Mercurial > hg > old > magoroku_racing
comparison gSprite.cc @ 115:31dd5c07f7c1
class OBJECT:SceanGraph
author | e085768 |
---|---|
date | Wed, 15 Jun 2011 23:31:59 +0900 |
parents | e5f2eb98b575 |
children | ed702e49cc6c |
comparison
equal
deleted
inserted
replaced
113:8c96cadde050 | 115:31dd5c07f7c1 |
---|---|
13 static SpriteTable sptable[DEFOBJ]; | 13 static SpriteTable sptable[DEFOBJ]; |
14 static ps2utilSprite sp[DEFOBJ]; // 表示スプライト用スタック | 14 static ps2utilSprite sp[DEFOBJ]; // 表示スプライト用スタック |
15 static unsigned int sp_counter; | 15 static unsigned int sp_counter; |
16 static bool flag_spriteInited = false; // スプライトロードフラグ | 16 static bool flag_spriteInited = false; // スプライトロードフラグ |
17 | 17 |
18 static TEXTURE *sprite_tex; | 18 //static TEXTURE *sprite_tex; |
19 | 19 |
20 | 20 |
21 void | 21 void |
22 gSprite_DefSprite(int number, int tx, int ty, int tw, int th) | 22 gSprite_DefSprite(int number, int tx, int ty, int tw, int th) |
23 { | 23 { |
25 sptable[number].ty = ty; | 25 sptable[number].ty = ty; |
26 sptable[number].tw = tw; | 26 sptable[number].tw = tw; |
27 sptable[number].th = th; | 27 sptable[number].th = th; |
28 } | 28 } |
29 | 29 |
30 // DandyのPutSprite関数 | |
30 void | 31 void |
31 gSprite_PutSprite(int number, int x, int y) | 32 gSprite_PutSprite(int number, int x, int y) |
32 { | 33 { |
33 ps2utilSprite *p = &sp[sp_counter]; | 34 ps2utilSprite *p = &sp[sp_counter]; |
34 | 35 |
35 ps2util_sprite_Set_basicAttribute( | 36 // テクスチャの設定 |
36 p, | 37 ps2util_sprite_Set_basicAttribute( |
37 (unsigned short)x, (unsigned short)y, | 38 p, |
38 (unsigned short)sptable[number].tw*2, (unsigned short)sptable[number].th*2, | 39 (unsigned short)x, (unsigned short)y, |
39 (unsigned short)sptable[number].tx, (unsigned short)sptable[number].ty, | 40 (unsigned short)sptable[number].tw*2, (unsigned short)sptable[number].th*2, |
40 (unsigned short)sptable[number].tw, (unsigned short)sptable[number].th, | 41 (unsigned short)sptable[number].tx, (unsigned short)sptable[number].ty, |
41 SPRITE_PRIO_FOREGROUND); | 42 (unsigned short)sptable[number].tw, (unsigned short)sptable[number].th, |
43 SPRITE_PRIO_FOREGROUND); | |
42 | 44 |
43 ps2util_sprite_Request(p); | 45 // 表示 |
44 sp_counter++; | 46 ps2util_sprite_Request(p); |
47 sp_counter++; | |
45 } | 48 } |
46 | 49 |
47 void | 50 void |
48 gSprite_PutSpriteEx(int number, int x, int y, float w, float h) | 51 gSprite_PutSpriteEx(int number, int x, int y, float w, float h) |
49 { | 52 { |
50 ps2utilSprite *p = &sp[sp_counter]; | 53 ps2utilSprite *p = &sp[sp_counter]; |
51 | 54 |
52 ps2util_sprite_Set_basicAttribute( | 55 ps2util_sprite_Set_basicAttribute( |
53 p, | 56 p, |
54 (unsigned short)x, (unsigned short)y, | 57 (unsigned short)x, (unsigned short)y, |
55 (unsigned short)sptable[number].tw*w, (unsigned short)sptable[number].th*h, | 58 (unsigned short)sptable[number].tw*w, (unsigned short)sptable[number].th*h, |
56 (unsigned short)sptable[number].tx, (unsigned short)sptable[number].ty, | 59 (unsigned short)sptable[number].tx, (unsigned short)sptable[number].ty, |
57 (unsigned short)sptable[number].tw, (unsigned short)sptable[number].th, | 60 (unsigned short)sptable[number].tw, (unsigned short)sptable[number].th, |
58 SPRITE_PRIO_FOREGROUND); | 61 SPRITE_PRIO_FOREGROUND); |
59 | 62 |
60 ps2util_sprite_Request(p); | 63 ps2util_sprite_Request(p); |
61 sp_counter++; | 64 sp_counter++; |
62 } | 65 } |
63 | |
64 | 66 |
65 static void | 67 static void |
66 gSprite_Init_Png(const char *texname) | 68 gSprite_Init_Png(const char *texname) |
67 { | 69 { |
68 if (!(sprite_tex = read_png_file(texname))) { | 70 if (!(sprite_tex = read_png_file(texname))) { |
76 fprintf(stderr, | 78 fprintf(stderr, |
77 "cannot set texture - init_png().\n"); | 79 "cannot set texture - init_png().\n"); |
78 fflush(stderr); | 80 fflush(stderr); |
79 exit(EXIT_FAILURE); | 81 exit(EXIT_FAILURE); |
80 } | 82 } |
81 | |
82 } | 83 } |
83 | 84 |
84 static void | 85 static void |
85 gSprite_Create() | 86 gSprite_Create() |
86 { | 87 { |
137 sprite_disappear(&sp[i].attribute); | 138 sprite_disappear(&sp[i].attribute); |
138 } | 139 } |
139 sp_counter = 0; | 140 sp_counter = 0; |
140 } | 141 } |
141 | 142 |
142 | |
143 | |
144 void | 143 void |
145 gSprite_Draw_Reset() | 144 gSprite_Draw_Reset() |
146 { | 145 { |
147 if (flag_spriteInited == true) { | 146 if (flag_spriteInited == true) { |
148 gSprite_Clear(); | 147 gSprite_Clear(); |
149 } | 148 } |
150 } | 149 } |
151 | 150 |
152 | 151 |
153 | |
154 void | 152 void |
155 gSprite_PutSprite_Pause() | 153 gSprite_PutSprite_Pause() |
156 { | 154 { |
157 } | 155 } |