menu.c
2.1 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo.
$RCSfile: menu.c,v $
$Revision: 1.1.1.1 $
$Date: 2002/05/02 03:27:21 $
*---------------------------------------------------------------------*/
/*
this file written in sjis code.
*/
/* pre-process */
#include "hmenu.h"
#include "hsb.h"
/* declarerations */
#define MENU_NUM 2
#define ITEM_H 20
#define BTILE_NUM 2
static s32 _selected = 0;
static TStringBar _menu[MENU_NUM];
static TStringBar _label[1];
static TBackTile _btile[BTILE_NUM];
static TMessage4dd _ddmsg = {0};
/* functions */
s32 _menuInit(void);
extern void _writeonly_automode(void);
/* implementation */
void dd_ready_for_reinit(void);
void
scr_menu(void)
{
static s32 _first = 1;
s32 i;
if (_first)
{
_menuInit();
_first = 0;
}
/* printing */
_btile[1].y = _menu[_selected].y + BD_Y;
for(i=0;i< BTILE_NUM ;i++) btile_show(&_btile[i]);
sbar_show(&_label[0]);
for(i=0;i< MENU_NUM ;i++) sbar_show(&_menu[i]);
/* key proc */
switch(_trig)
{
case B_BUTTON:
main_setScreen( SCREEN_TOPGUN );
return;
case U_JPAD: _selected = sb_clip(--_selected,0,MENU_NUM-1);break;
case D_JPAD: _selected = sb_clip(++_selected,0,MENU_NUM-1);break;
}
if( _trig == A_BUTTON )
switch( _selected )
{
case 0:
main_setScreen( SCREEN_SUMMON );
break;
case 1:
main_setScreen( SCREEN_TOPGUN );
break;
default:
break;
}
}
s32
_menuInit(void)
{
s32 xpos,ypos;
xpos = 50;
ypos = 50;
sbar_create(&_label[0],"onetriの再立ち上げを行います" ,xpos,ypos );
sbar_moveCenter(&_label[0],0,SCREEN_WD);
xpos = _label[0].x + 10;
sbar_create(&_menu[0],"O.K." ,xpos,(ypos += ITEM_H) );
sbar_create(&_menu[1],"Cancel" ,xpos,(ypos += ITEM_H) );
btile_create(&_btile[0] , _label[0].x + BD_X ,_label[0].y + BD_Y
,sbar_getWidth(&_label[0]) + 15 , ITEM_H * 3 ,RGBA_BLUEALPHA );
btile_create(&_btile[1] , _label[0].x + BD_X ,_label[0].y + BD_Y
,_btile[0].w , ITEM_H , RGBA_SKYBLUEALPHA );
_ddmsg.retQ = &myQ;
return -1;
}