0
|
1 /*
|
17
|
2 * $Id$
|
0
|
3 */
|
|
4 #include "libps2.h"
|
|
5 #include "ps2util.h"
|
|
6 #include "title_scene.h"
|
|
7
|
|
8 typedef enum {
|
|
9 TITLE_INIT,
|
|
10 TITLE_MAIN,
|
|
11 TITLE_FINISH
|
|
12 } TITLE_STATE;
|
|
13
|
|
14
|
|
15 static ps2utilSprite title_sprite;
|
|
16
|
|
17 static TEXTURE *title_img;
|
|
18
|
|
19 #define TITLE_IMG_FILE "img/title.png"
|
|
20
|
|
21
|
|
22 static void
|
|
23 title_init()
|
|
24 {
|
|
25 /*
|
|
26 load texture
|
|
27 */
|
|
28 title_img = read_png_file( TITLE_IMG_FILE );
|
|
29 ps2util_tex_Set( title_img );
|
|
30
|
|
31 /*
|
|
32 create sprite object
|
|
33 */
|
|
34 ps2util_sprite_Create( &title_sprite, title_img );
|
|
35 ps2util_sprite_Set_basicAttribute( &title_sprite,
|
|
36 0, 0, 650, 500, 0, 0, 512, 256, SPRITE_PRIO_FOREGROUND );
|
|
37 ps2util_sprite_Use_alpha( &title_sprite );
|
|
38 ps2util_sprite_Request( &title_sprite );
|
|
39 }
|
|
40
|
|
41 void
|
|
42 title_init_call()
|
|
43 {
|
|
44 title_init();
|
|
45 }
|
|
46
|
|
47 static void
|
|
48 title_finish()
|
|
49 {
|
|
50 ps2util_sprite_Destroy( &title_sprite );
|
|
51 ps2util_tex_Exclude( title_img );
|
|
52 free_texture( title_img );
|
|
53 }
|
|
54
|
|
55 void
|
|
56 title_finish_call()
|
|
57 {
|
2
|
58 title_finish();
|
0
|
59 }
|
|
60
|
|
61 int
|
|
62 title_scene()
|
|
63 {
|
|
64 static TITLE_STATE state = TITLE_INIT;
|
|
65 int pad;
|
|
66
|
|
67 switch (state) {
|
|
68 case TITLE_INIT:
|
|
69 title_init();
|
|
70 state = TITLE_MAIN;
|
|
71 break;
|
|
72
|
|
73 case TITLE_MAIN:
|
|
74 pad = sjoy_get_ps2_button( JOYPAD_1 );
|
|
75 state = (pad & SJOY_PS2_START) ? TITLE_FINISH : TITLE_MAIN;
|
|
76 break;
|
|
77
|
|
78 case TITLE_FINISH:
|
|
79 title_finish();
|
|
80 return -1;
|
|
81
|
|
82 default:
|
|
83 break;
|
|
84 }
|
|
85 return 0;
|
|
86 }
|