startpage.c
2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
* This is the handler for the start page. It takes controller input
* and provides Sprites as output and also a return value which says
* what the next page should be.
*/
#include <ultra64.h>
#include "uimain.h"
#include "font.h"
/*
* XXX A simple sprite for testing
*/
#include "sp_ball.h"
/*
* XXX Some test stuff
*/
static int xpos = 100;
static int ypos = 100;
#define NUM_BMS (24*40)
static Bitmap textBoxBmp[NUM_BMS];
static Gfx textBoxDl[NUM_DL(NUM_BMS)];
extern Font tvfont;
static Sprite textBox = {
0,0, /* Position: x,y */
0,0, /* Sprite size in texels (x,y) */
1.0,1.0, /* Sprite Scale: x,y */
0,0, /* Explosion (x,y) */
SP_TRANSPARENT, /* Sprite Attributes */
0x1234, /* Sprite Depth: Z */
255,255,255,255, /* Sprite Coloration: RGBA */
0,0,NULL, /* Color LookUp Table: start_index, length, address */
0,1, /* Sprite Bitmap index: start index, step increment */
NUM_BMS, /* Number of bitmaps */
NUM_DL(NUM_BMS), /* Number of display list locations allocated */
15, 128, /* Sprite Bitmap Height: Used_height, physical height */
G_IM_FMT_I, /* Sprite Bitmap Format */
G_IM_SIZ_4b, /* Sprite Bitmap Texel Size */
textBoxBmp, /* Pointer to bitmaps */
textBoxDl, /* Display list memory */
NULL, /* HACK: dynamic_dl pointer */
};
static int fontColor = 255;
int startInit()
{
if (drawString("Press Start", &tvfont, 11, 1, &textBox) == 0) {
return 0;
}
return -1;
}
int startPage(u16 cntrl, Sprite **sp)
{
if (cntrl != 0) {
if (cntrl & CONT_A) {
xpos += 10;
ypos += 10;
}
if (cntrl & CONT_B) {
xpos -= 10;
ypos -= 10;
}
}
/*
* Just write some letters
*/
fontColor = (fontColor+10) & 0xff;
spMove(&textBox, xpos, ypos);
if (fontColor > 128) {
spScale(&textBox, 1.2, 1.2);
} else {
spScale(&textBox, 1.0, 1.0);
}
spColor (&textBox, 255, fontColor, 255, 255);
sp[0] = &textBox;
sp[1] = &ball_sprite;
sp[2] = 0;
if (cntrl & CONT_START) {
return 1;
} else {
/*
* Come back to current page
*/
return 0;
}
}