@@ -27,8 +27,8 @@ void Draw::BlitSquare(SDL_Texture * texture, int x, int y, int dx, int dy) {
2727 y *= BLOCK_SIZE ;
2828 dx *= BLOCK_SIZE ;
2929 dy *= BLOCK_SIZE ;
30- SDL_Rect sr={x,y, BLOCK_SIZE , BLOCK_SIZE };
31- SDL_Rect dr={dx,dy, BLOCK_SIZE , BLOCK_SIZE };
30+ SDL_Rect sr={x, y, BLOCK_SIZE , BLOCK_SIZE };
31+ SDL_Rect dr={dx + OFFSET_X , dy + OFFSET_Y , BLOCK_SIZE , BLOCK_SIZE };
3232 SDL_RenderCopy (renderer, texture, &sr, &dr);
3333}
3434
@@ -40,26 +40,26 @@ void Draw::BlitWater(SDL_Texture * texture, int rotation, int dx, int dy) {
4040 rotation = rotation % BLOCK_SIZE ;
4141 dx *= BLOCK_SIZE ;
4242 dy *= BLOCK_SIZE ;
43- SDL_Rect dr={dx + rotation, dy, BLOCK_SIZE - rotation, BLOCK_SIZE };
43+ SDL_Rect dr={dx + rotation + OFFSET_X , dy + OFFSET_Y , BLOCK_SIZE - rotation, BLOCK_SIZE };
4444 SDL_Rect sr={0 , 0 , BLOCK_SIZE - rotation, BLOCK_SIZE };
4545 SDL_RenderCopy (renderer, texture, &sr, &dr);
4646 if (rotation > 0 ) {
47- SDL_Rect dr2={dx, dy, rotation, BLOCK_SIZE };
47+ SDL_Rect dr2={dx + OFFSET_X , dy + OFFSET_Y , rotation, BLOCK_SIZE };
4848 SDL_Rect sr2={BLOCK_SIZE - rotation, 0 , rotation, BLOCK_SIZE };
4949 SDL_RenderCopy (renderer, texture, &sr2, &dr2);
5050 }
5151}
5252
5353void Draw::BlitOther (SDL_Texture * texture, int x, int y, int dx, int dy, int w, int h) {
54- SDL_Rect sr={x,y,w, h};
55- SDL_Rect dr={dx,dy, w, h};
54+ SDL_Rect sr={x, y, w, h};
55+ SDL_Rect dr={dx + OFFSET_X , dy + OFFSET_Y , w, h};
5656 SDL_RenderCopy (renderer, texture, &sr, &dr);
5757}
5858
5959void Draw::BlackSquare (int x, int y) {
6060 x *= BLOCK_SIZE ;
6161 y *= BLOCK_SIZE ;
62- SDL_Rect r={x,y, BLOCK_SIZE ,BLOCK_SIZE };
62+ SDL_Rect r={x + OFFSET_X , y + OFFSET_Y , BLOCK_SIZE , BLOCK_SIZE };
6363 SDL_SetRenderDrawColor (renderer, 0 , 0 , 0 , 255 );
6464 SDL_RenderFillRect (renderer, &r);
6565}
@@ -70,26 +70,26 @@ void Draw::BlitBeam(int rotation, int x, int y) {
7070 SDL_Rect r={0 , 0 , 0 , 0 };
7171 switch (rotation) {
7272 case 0 :
73- r.x = x;
74- r.y = y + (BLOCK_SIZE / 2 ) - 1 ;
75- r.w = BLOCK_SIZE / 2 ;
73+ r.x = x + OFFSET_X ;
74+ r.y = y + (BLOCK_SIZE / 2 ) - 1 + OFFSET_Y ;
75+ r.w = BLOCK_SIZE / 2 ;
7676 r.h = 2 ;
7777 break ;
7878 case 1 :
79- r.x = x + (BLOCK_SIZE / 2 ) - 1 ;
80- r.y = y;
79+ r.x = x + (BLOCK_SIZE / 2 ) - 1 + OFFSET_X ;
80+ r.y = y + OFFSET_Y ;
8181 r.w = 2 ;
8282 r.h = BLOCK_SIZE / 2 ;
8383 break ;
8484 case 2 :
85- r.x = x + BLOCK_SIZE / 2 ;
86- r.y = y + (BLOCK_SIZE / 2 ) - 1 ;
85+ r.x = x + BLOCK_SIZE / 2 + OFFSET_X ;
86+ r.y = y + (BLOCK_SIZE / 2 ) - 1 + OFFSET_Y ;
8787 r.w = BLOCK_SIZE / 2 ;
8888 r.h = 2 ;
8989 break ;
9090 case 3 :
91- r.x = x + (BLOCK_SIZE / 2 ) - 1 ;
92- r.y = y + (BLOCK_SIZE / 2 );
91+ r.x = x + (BLOCK_SIZE / 2 ) - 1 + OFFSET_X ;
92+ r.y = y + (BLOCK_SIZE / 2 ) + OFFSET_Y ;
9393 r.w = 2 ;
9494 r.h = BLOCK_SIZE ;
9595 break ;
@@ -140,7 +140,7 @@ void Draw::BlitMessage(const char *title, const char **lines, int line_count) {
140140 }
141141
142142 // Draw outside box
143- SDL_Rect box = {(COLUMNS * BLOCK_SIZE / 2 ) - ((widest_line + 20 ) / 2 ), (ROWS * BLOCK_SIZE / 2 ) - ((text_height + 20 ) / 2 ), widest_line + 20 , text_height + 20 };
143+ SDL_Rect box = {(WINDOW_WIDTH / 2 ) - ((widest_line + 20 ) / 2 ), (WINDOW_HEIGHT / 2 ) - ((text_height + 20 ) / 2 ), widest_line + 20 , text_height + 20 };
144144 BlitMessageBox (&box);
145145
146146 // Draw text
@@ -219,7 +219,7 @@ void Draw::BlitMessageBox(SDL_Rect *box) {
219219
220220void Draw::BlitLevelInfo (int level, char *description, char *author) {
221221 // Draw outside box
222- SDL_Rect box = {(COLUMNS * BLOCK_SIZE / 2 ) - 153 , (ROWS * BLOCK_SIZE / 2 ) - 73 , 306 , 146 };
222+ SDL_Rect box = {(WINDOW_WIDTH / 2 ) - 153 , (WINDOW_HEIGHT / 2 ) - 73 , 306 , 146 };
223223 BlitMessageBox (&box);
224224
225225 // Generate level text
@@ -272,7 +272,6 @@ void Draw::BlitLevelInfo(int level, char *description, char *author) {
272272 SDL_RenderDrawLine (renderer, description_background.x , description_background.y + description_background.h , description_background.x + description_background.w , description_background.y + description_background.h );
273273 SDL_RenderDrawLine (renderer, description_background.x + description_background.w , description_background.y , description_background.x + description_background.w , description_background.y + description_background.h );
274274
275-
276275 SDL_Rect author_background = {box.x + 52 , box.y + 98 , box.w - (52 * 2 ), 20 };
277276 SDL_SetRenderDrawColor (renderer, 0 , 0 , 0 , 255 );
278277 SDL_RenderFillRect (renderer, &author_background);
@@ -287,13 +286,13 @@ void Draw::BlitLevelInfo(int level, char *description, char *author) {
287286
288287
289288 // Draw info from level file
290- SDL_Rect description_rect = {(COLUMNS * BLOCK_SIZE / 2 ), (ROWS * BLOCK_SIZE / 2 ) - 21 , 0 , 0 };
289+ SDL_Rect description_rect = {(WINDOW_WIDTH / 2 ), (WINDOW_HEIGHT / 2 ) - 21 , 0 , 0 };
291290 SDL_QueryTexture (description_text, NULL , NULL , &description_rect.w , &description_rect.h );
292291 description_rect.x -= description_rect.w /2 ;
293292 description_rect.y -= description_rect.h /2 ;
294293 SDL_RenderCopy (renderer, description_text, NULL , &description_rect);
295294
296- SDL_Rect author_info_rect = {(COLUMNS * BLOCK_SIZE / 2 ), (ROWS * BLOCK_SIZE / 2 ) + 34 , 0 , 0 };
295+ SDL_Rect author_info_rect = {(WINDOW_WIDTH / 2 ), (WINDOW_HEIGHT / 2 ) + 34 , 0 , 0 };
297296 SDL_QueryTexture (author_info_text, NULL , NULL , &author_info_rect.w , &author_info_rect.h );
298297 author_info_rect.x -= author_info_rect.w /2 ;
299298 author_info_rect.y -= author_info_rect.h /2 ;
@@ -314,10 +313,30 @@ void Draw::BlitText(char * text, TTF_Font * font, int x, int y, SDL_Color color)
314313
315314void Draw::Flip () {
316315 SDL_RenderPresent (renderer);
317- SDL_SetRenderDrawColor (renderer, 0 , 0 , 0 , 255 );
316+ #ifdef __PSP__
317+ SDL_SetRenderDrawColor (renderer, 3 , 103 , 107 , 255 );
318+ #else
319+ SDL_SetRenderDrawColor (renderer, 0 , 0 , 0 , 255 );
320+ #endif
318321 SDL_RenderClear (renderer);
319322}
320323
324+ #if __PSP__
325+ void Draw::BlitFrame (SDL_Texture * logoSprite) {
326+ SDL_SetRenderDrawColor (renderer, 2 , 59 , 60 , 255 );
327+ SDL_RenderDrawLine (renderer, OFFSET_X - 1 , OFFSET_Y - 1 , COLUMNS * BLOCK_SIZE + OFFSET_X , OFFSET_Y - 1 );
328+ SDL_RenderDrawLine (renderer, OFFSET_X - 1 , OFFSET_Y , OFFSET_X - 1 , ROWS * BLOCK_SIZE + OFFSET_Y );
329+
330+ SDL_SetRenderDrawColor (renderer, 87 , 247 , 249 , 255 );
331+ SDL_RenderDrawLine (renderer, COLUMNS * BLOCK_SIZE + OFFSET_X , OFFSET_Y , COLUMNS * BLOCK_SIZE + OFFSET_X , ROWS * BLOCK_SIZE + OFFSET_Y );
332+
333+ SDL_Rect logo_rect = {COLUMNS * BLOCK_SIZE + OFFSET_X , 5 , 0 , 0 };
334+ SDL_QueryTexture (logoSprite, NULL , NULL , &logo_rect.w , &logo_rect.h );
335+ logo_rect.x -= logo_rect.w ;
336+ SDL_RenderCopy (renderer, logoSprite, NULL , &logo_rect);
337+ }
338+ #endif
339+
321340SDL_Texture * Draw::stringToTexture (SDL_Renderer * renderer, char * text, TTF_Font * font, SDL_Color color) {
322341 SDL_Surface * surface = TTF_RenderText_Solid (font, text, color);
323342 if (surface == NULL ) {
0 commit comments