annotate title_scene.c @ 66:4af6c92304bb

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