A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd

Invadrox - some bitmap related changes in preparation of porting it to more screen resolutions, should not be visible to the user: (1) Use single bitmaps (or strips where possible) instead of one big bitmap each, so instructions and defines how to take the bitmap apart aren't needed. It's more flexible and makes it possible to (2) get some width/height variables directly from the bitmaps. (3) Use background images for static items. Both reduces the number of hardcoded values noticeably. (4) Make the 'fire_sprite' an external bitmap too - with help of Jens -. (5) Rename 'TINY_GRAPHICS' to 'SMALL_GRAPHICS' to have this name available for even smaller images (which is planned).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20646 a1c6a512-1295-4272-9138-f99709370657

+127 -196
+9
apps/plugins/bitmaps/mono/SOURCES
··· 37 37 #endif 38 38 #endif 39 39 40 + /* Invadrox, not on monochrome targets yet */ 41 + #if LCD_DEPTH > 1 42 + #if LCD_WIDTH >= 220 43 + invadrox_fire.8x8x1.bmp 44 + #elif LCD_WIDTH >= 160 45 + invadrox_fire.6x6x1.bmp 46 + #endif 47 + #endif 48 + 40 49 #if CONFIG_CODEC == SWCODEC 41 50 /* MPEGplayer */ 42 51 mpegplayer_status_icons_8x8x1.bmp
apps/plugins/bitmaps/mono/invadrox_fire.6x6x1.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/mono/invadrox_fire.8x8x1.bmp

This is a binary file and will not be displayed.

+44 -23
apps/plugins/bitmaps/native/SOURCES
··· 256 256 #endif 257 257 258 258 /* Invadrox */ 259 - #if (LCD_WIDTH == 320) && (LCD_HEIGHT == 240) 260 - invadrox.320x240x16.bmp 261 - invadrox_left.320x240x16.bmp 262 - invadrox_right.320x240x16.bmp 263 - #elif (LCD_WIDTH == 220) && (LCD_HEIGHT == 176) 264 - /* Use iPod Video character bitmap */ 265 - invadrox.320x240x16.bmp 266 - #elif (LCD_WIDTH == 240) && (LCD_HEIGHT == 320) 267 - /* Use iPod Video character bitmap */ 268 - invadrox.320x240x16.bmp 269 - invadrox_logo.240x320x16.bmp 270 - #elif (LCD_WIDTH == 176) && (LCD_HEIGHT == 132) 271 - invadrox.176x132x16.bmp 272 - #elif (LCD_WIDTH == 160) && (LCD_HEIGHT == 128) && (LCD_DEPTH >= 8) 273 - /* Use iPod Nano character bitmap */ 274 - invadrox.176x132x16.bmp 275 - #elif (LCD_WIDTH == 160) && (LCD_HEIGHT == 128) && (LCD_DEPTH == 2) 276 - /* Grayscale */ 277 - invadrox.160x128x2.bmp 278 - #elif (LCD_WIDTH == 176) && (LCD_HEIGHT == 220) 279 - /* Use iPod Nano character bitmap */ 280 - invadrox.176x132x16.bmp 281 - invadrox_logo.176x220x16.bmp 259 + #if defined HAVE_LCD_COLOR 260 + #if LCD_WIDTH >= 220 261 + invadrox_aliens.24x24x16.bmp 262 + invadrox_alien_explode.13x7x16.bmp 263 + invadrox_ships.16x24x16.bmp 264 + invadrox_bombs.9x42x16.bmp 265 + invadrox_shield.22x16x16.bmp 266 + invadrox_ufo.16x7x16.bmp 267 + invadrox_ufo_explode.21x8x16.bmp 268 + invadrox_numbers.50x7x16.bmp 269 + #if LCD_WIDTH == 320 270 + invadrox_background.320x240x16.bmp 271 + #elif LCD_WIDTH == 240 272 + invadrox_background.240x320x16.bmp 273 + #elif LCD_WIDTH == 220 274 + invadrox_background.220x176x16.bmp 275 + #endif 276 + #elif LCD_WIDTH >= 160 277 + invadrox_aliens.16x15x16.bmp 278 + invadrox_alien_explode.10x5x16.bmp 279 + invadrox_ships.10x15x16.bmp 280 + invadrox_bombs.9x30x16.bmp 281 + invadrox_shield.15x10x16.bmp 282 + invadrox_ufo.11x5x16.bmp 283 + invadrox_ufo_explode.14x5x16.bmp 284 + invadrox_numbers.40x5x16.bmp 285 + #if LCD_WIDTH == 176 && LCD_HEIGHT == 220 286 + invadrox_background.176x220x16.bmp 287 + #elif LCD_WIDTH == 176 && LCD_HEIGHT == 132 288 + invadrox_background.176x132x16.bmp 289 + #elif LCD_WIDTH == 160 && LCD_HEIGHT == 128 290 + invadrox_background.160x128x16.bmp 282 291 #endif 292 + #endif /* LCD_WIDTH */ 293 + #elif LCD_DEPTH == 2 /* Greyscale */ 294 + invadrox_aliens.16x15x16.bmp 295 + invadrox_alien_explode.10x5x16.bmp 296 + invadrox_ships.10x15x2.bmp 297 + invadrox_bombs.9x30x16.bmp 298 + invadrox_shield.15x10x2.bmp 299 + invadrox_ufo.11x5x2.bmp 300 + invadrox_ufo_explode.14x5x2.bmp 301 + invadrox_numbers.40x5x16.bmp 302 + invadrox_background.160x128x16.bmp 303 + #endif /* colour depth */ 283 304 284 305 /* Jewels */ 285 306 #if (LCD_WIDTH == 112) && (LCD_HEIGHT == 64)
apps/plugins/bitmaps/native/invadrox.160x128x2.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/native/invadrox.176x132x16.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/native/invadrox.320x240x16.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/native/invadrox_alien_explode.10x5x16.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/native/invadrox_alien_explode.13x7x16.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/native/invadrox_aliens.16x15x16.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/native/invadrox_aliens.24x24x16.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/native/invadrox_background.160x128x16.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/native/invadrox_background.176x132x16.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/native/invadrox_background.176x220x16.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/native/invadrox_background.220x176x16.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/native/invadrox_background.240x320x16.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/native/invadrox_background.320x240x16.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/native/invadrox_bombs.9x30x16.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/native/invadrox_bombs.9x42x16.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/native/invadrox_left.320x240x16.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/native/invadrox_logo.176x220x16.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/native/invadrox_logo.240x320x16.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/native/invadrox_numbers.40x5x16.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/native/invadrox_numbers.50x7x16.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/native/invadrox_right.320x240x16.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/native/invadrox_shield.15x10x16.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/native/invadrox_shield.15x10x2.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/native/invadrox_shield.22x16x16.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/native/invadrox_ships.10x15x16.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/native/invadrox_ships.10x15x2.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/native/invadrox_ships.16x24x16.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/native/invadrox_ufo.11x5x16.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/native/invadrox_ufo.11x5x2.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/native/invadrox_ufo.16x7x16.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/native/invadrox_ufo_explode.14x5x16.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/native/invadrox_ufo_explode.14x5x2.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/native/invadrox_ufo_explode.21x8x16.bmp

This is a binary file and will not be displayed.

+74 -173
apps/plugins/invadrox.c
··· 166 166 #define UFO_Y (SCORENUM_Y + FONT_HEIGHT + ALIEN_HEIGHT) 167 167 #define PLAYFIELD_Y (LCD_HEIGHT - SHIP_HEIGHT - 2) 168 168 #define PLAYFIELD_WIDTH (LCD_WIDTH - 2 * PLAYFIELD_X) 169 - #define LEVEL_X (LCD_WIDTH - PLAYFIELD_X - LIVES_X - LEVEL_WIDTH - 2 * NUMBERS_WIDTH - 3 * NUM_SPACING) 169 + #define LEVEL_X (LCD_WIDTH - PLAYFIELD_X - LIVES_X - 2 * NUMBERS_WIDTH - 3 * NUM_SPACING) 170 170 #define SHIP_MIN_X (PLAYFIELD_X + PLAYFIELD_WIDTH / 5 - SHIELD_WIDTH / 2 - SHIP_WIDTH) 171 171 #define SHIP_MAX_X (PLAYFIELD_X + 4 * PLAYFIELD_WIDTH / 5 + SHIELD_WIDTH / 2) 172 172 /* SCORE_Y = 0 for most targets. Gigabeat redefines it later. */ ··· 211 211 #define ALIEN_START_Y (UFO_Y + 3 * ALIEN_HEIGHT) 212 212 #define SCORENUM_X (PLAYFIELD_X + NUMBERS_WIDTH) 213 213 #define SCORENUM_Y SCORE_Y + (2 * (FONT_HEIGHT + 1) + 1) 214 - #define HISCORE_X (LCD_WIDTH - PLAYFIELD_X - HISCORE_WIDTH) 215 214 #define HISCORENUM_X (LCD_WIDTH - PLAYFIELD_X - 1 - 6 * NUMBERS_WIDTH - 5 * NUM_SPACING) 216 215 #define SHIELD_Y (PLAYFIELD_Y - 6 * SHIP_HEIGHT) 217 216 #define LIVES_X 10 ··· 248 247 * Lives and Level goes inside bottom border 249 248 */ 250 249 251 - #define TINY_GRAPHICS 250 + #define SMALL_GRAPHICS 252 251 #define PLAYFIELD_X 0 253 252 #define SHIP_Y (PLAYFIELD_Y - 2 * SHIP_HEIGHT) 254 253 #define SHIELD_Y (SHIP_Y - SHIP_HEIGHT - SHIELD_HEIGHT) ··· 258 257 #define SCORE_Y 70 259 258 #define SCORENUM_X (PLAYFIELD_X + NUMBERS_WIDTH) 260 259 #define SCORENUM_Y (SCORE_Y + 2 * FONT_HEIGHT) 261 - #define HISCORE_X (LCD_WIDTH - PLAYFIELD_X - HISCORE_WIDTH) 262 260 #define HISCORENUM_X (LCD_WIDTH - PLAYFIELD_X - 1 - 6 * NUMBERS_WIDTH - 5 * NUM_SPACING) 263 261 #define LIVES_X 8 264 262 #define MAX_X 75 ··· 306 304 * Lives and Level goes inside bottom border 307 305 */ 308 306 309 - #define TINY_GRAPHICS 307 + #define SMALL_GRAPHICS 310 308 #define PLAYFIELD_X 0 311 309 #define SHIP_Y (PLAYFIELD_Y - 2 * SHIP_HEIGHT) 312 310 #define ALIEN_START_Y (UFO_Y + 12) 313 - #define SCORENUM_X (PLAYFIELD_X + SCORE_WIDTH + NUMBERS_WIDTH + NUM_SPACING) 311 + #define SCORENUM_X (PLAYFIELD_X + 6 * NUMBERS_WIDTH + 5 * NUM_SPACING) 314 312 #define SCORENUM_Y SCORE_Y 315 313 #define HISCORENUM_X (LCD_WIDTH - PLAYFIELD_X - 4 * NUMBERS_WIDTH - 3 * NUM_SPACING) 316 - #define HISCORE_X (HISCORENUM_X - NUMBERS_WIDTH - NUM_SPACING - HISCORE_WIDTH) 317 314 #define SHIELD_Y (SHIP_Y - SHIP_HEIGHT - SHIELD_HEIGHT) 318 315 #define LIVES_X 8 319 316 #define MAX_X 75 ··· 321 318 322 319 #elif (LCD_WIDTH == 160) && (LCD_HEIGHT == 128) 323 320 324 - /* iAudio X5, iRiver H10 20Gb, iPod 3g/4g: 160x128x16 325 - * ====================================== 321 + /* iAudio X5, iRiver H10 20Gb, iPod 3g/4g, H100, M5: 160x128 322 + * ========================================================= 326 323 * X: No padding. No border -> 160p playfield. 327 324 * 328 325 * LIVES_X 0 ··· 360 357 * Lives and Level goes inside bottom border 361 358 */ 362 359 363 - #define TINY_GRAPHICS 360 + #define SMALL_GRAPHICS 364 361 #define PLAYFIELD_X 0 365 362 #define SHIP_Y (PLAYFIELD_Y - 2 * SHIP_HEIGHT) 366 363 #define ALIEN_START_Y (UFO_Y + 10) 367 - #define SCORENUM_X (PLAYFIELD_X + SCORE_WIDTH + NUMBERS_WIDTH + NUM_SPACING) 364 + #define SCORENUM_X (PLAYFIELD_X + 6 * NUMBERS_WIDTH + 5 * NUM_SPACING) 368 365 #define SCORENUM_Y SCORE_Y 369 366 #define HISCORENUM_X (LCD_WIDTH - PLAYFIELD_X - 4 * NUMBERS_WIDTH - 3 * NUM_SPACING) 370 - #define HISCORE_X (HISCORENUM_X - NUMBERS_WIDTH - NUM_SPACING - HISCORE_WIDTH) 371 367 #define SHIELD_Y (SHIP_Y - SHIP_HEIGHT - SHIELD_HEIGHT) 372 368 #define LIVES_X 0 373 369 #define MAX_X 75 ··· 410 406 #define SCORE_Y 80 411 407 #define SCORENUM_X (PLAYFIELD_X + NUMBERS_WIDTH) 412 408 #define SCORENUM_Y SCORE_Y + (2 * (FONT_HEIGHT + 1) + 1) 413 - #define HISCORE_X (LCD_WIDTH - PLAYFIELD_X - HISCORE_WIDTH) 414 409 #define HISCORENUM_X (LCD_WIDTH - PLAYFIELD_X - 1 - 6 * NUMBERS_WIDTH - 5 * NUM_SPACING) 415 410 #define SHIELD_Y (PLAYFIELD_Y - 6 * SHIP_HEIGHT) 416 411 #define LIVES_X 10 ··· 447 442 #define SHIP_Y (PLAYFIELD_Y - 2 * SHIP_HEIGHT) 448 443 #define ALIEN_START_Y (UFO_Y + 10) 449 444 #define SCORENUM_Y SCORE_Y 450 - #define SCORENUM_X (PLAYFIELD_X + SCORE_WIDTH + NUMBERS_WIDTH + NUM_SPACING) 445 + #define SCORENUM_X (PLAYFIELD_X + 6 * NUMBERS_WIDTH + 6 * NUM_SPACING) 451 446 #define HISCORENUM_X (LCD_WIDTH - PLAYFIELD_X - 4 * NUMBERS_WIDTH - 3 * NUM_SPACING) 452 - #define HISCORE_X (HISCORENUM_X - NUMBERS_WIDTH - NUM_SPACING - HISCORE_WIDTH) 453 447 #define SHIELD_Y (PLAYFIELD_Y - 5 * SHIP_HEIGHT) 454 448 #define LIVES_X 8 455 449 #define MAX_X 95 456 450 #define MAX_Y 15 457 451 452 + 458 453 #else 459 454 #error INVADROX: Unsupported LCD type 460 455 #endif 461 456 457 + /* bitmaps */ 458 + #include "pluginbitmaps/invadrox_background.h" 459 + 460 + /* get dimensions for later use from the bitmaps */ 461 + #include "pluginbitmaps/invadrox_aliens.h" 462 + #include "pluginbitmaps/invadrox_ships.h" 463 + #include "pluginbitmaps/invadrox_bombs.h" 464 + #include "pluginbitmaps/invadrox_alien_explode.h" 465 + #include "pluginbitmaps/invadrox_shield.h" 466 + #include "pluginbitmaps/invadrox_ufo.h" 467 + #include "pluginbitmaps/invadrox_ufo_explode.h" 468 + #include "pluginbitmaps/invadrox_numbers.h" 469 + #include "pluginbitmaps/invadrox_fire.h" 470 + #define ALIEN_WIDTH (BMPWIDTH_invadrox_aliens/2) 471 + #define ALIEN_HEIGHT (BMPHEIGHT_invadrox_aliens/3) 472 + #define SHIP_WIDTH BMPWIDTH_invadrox_ships 473 + #define SHIP_HEIGHT (BMPHEIGHT_invadrox_ships/3) 474 + #define BOMB_WIDTH (BMPWIDTH_invadrox_bombs/3) 475 + #define BOMB_HEIGHT (BMPHEIGHT_invadrox_bombs/6) 476 + #define ALIEN_EXPLODE_WIDTH BMPWIDTH_invadrox_alien_explode 477 + #define ALIEN_EXPLODE_HEIGHT BMPHEIGHT_invadrox_alien_explode 478 + #define SHIELD_WIDTH BMPWIDTH_invadrox_shield 479 + #define SHIELD_HEIGHT BMPHEIGHT_invadrox_shield 480 + #define UFO_WIDTH BMPWIDTH_invadrox_ufo 481 + #define UFO_HEIGHT BMPHEIGHT_invadrox_ufo 482 + #define UFO_EXPLODE_WIDTH BMPWIDTH_invadrox_ufo_explode 483 + #define UFO_EXPLODE_HEIGHT BMPHEIGHT_invadrox_ufo_explode 484 + #define NUMBERS_WIDTH (BMPWIDTH_invadrox_numbers/10) 485 + #define FONT_HEIGHT BMPHEIGHT_invadrox_numbers 486 + #define FIRE_WIDTH BMPWIDTH_invadrox_fire 487 + #define FIRE_HEIGHT BMPHEIGHT_invadrox_fire 462 488 463 489 /* Defines common to each "graphic type" */ 464 490 #ifdef ARCADISH_GRAPHICS 465 491 466 - #define STRIDE 71 467 - #define SHIP_SRC_X 24 468 - #define SHIP_WIDTH 16 469 - #define SHIP_HEIGHT 8 470 492 #define SHOT_HEIGHT 5 471 - #define ALIEN_WIDTH 12 472 - #define ALIEN_EXPLODE_SRC_X 52 473 - #define ALIEN_EXPLODE_SRC_Y 39 474 - #define ALIEN_EXPLODE_WIDTH 13 475 - #define ALIEN_EXPLODE_HEIGHT 7 476 - #define ALIEN_HEIGHT 8 477 493 #define ALIEN_SPACING 4 478 494 #define ALIEN_SPEED 2 479 - #define UFO_SRC_X 40 480 - #define UFO_WIDTH 16 481 - #define UFO_HEIGHT 7 482 - #define UFO_EXPLODE_WIDTH 21 483 - #define UFO_EXPLODE_HEIGHT 8 484 495 #define UFO_SPEED 1 485 - #define FONT_HEIGHT 7 486 - #define LEVEL_SRC_Y 24 487 - #define LEVEL_WIDTH 37 488 - #define SCORE_SRC_X 24 489 - #define SCORE_SRC_Y 31 490 - #define SCORE_WIDTH 37 491 - #define HISCORE_WIDTH 61 492 496 #define NUM_SPACING 3 493 - #define NUMBERS_SRC_Y 38 494 - #define NUMBERS_WIDTH 5 495 - #define SHIELD_SRC_X 40 496 - #define SHIELD_SRC_Y 15 497 - #define SHIELD_WIDTH 22 498 - #define SHIELD_HEIGHT 16 499 - #define FIRE_WIDTH 8 500 - #define FIRE_HEIGHT 8 501 497 #define FIRE_SPEED 8 502 - #define BOMB_SRC_X 62 503 - #define BOMB_WIDTH 3 504 - #define BOMB_HEIGHT 7 505 498 #define BOMB_SPEED 3 506 499 #define ALIENS 11 507 - unsigned char fire_sprite[FIRE_HEIGHT] = { 508 - (1 << 7) | (0 << 6) | (0 << 5) | (0 << 4) | (1 << 3) | (0 << 2) | (0 << 1) | 1, 509 - (0 << 7) | (0 << 6) | (1 << 5) | (0 << 4) | (0 << 3) | (0 << 2) | (1 << 1) | 0, 510 - (0 << 7) | (1 << 6) | (1 << 5) | (1 << 4) | (1 << 3) | (1 << 2) | (1 << 1) | 0, 511 - (1 << 7) | (1 << 6) | (1 << 5) | (1 << 4) | (1 << 3) | (1 << 2) | (1 << 1) | 1, 512 - (0 << 7) | (1 << 6) | (1 << 5) | (1 << 4) | (1 << 3) | (1 << 2) | (1 << 1) | 1, 513 - (0 << 7) | (1 << 6) | (1 << 5) | (1 << 4) | (1 << 3) | (1 << 2) | (1 << 1) | 0, 514 - (0 << 7) | (0 << 6) | (1 << 5) | (0 << 4) | (0 << 3) | (1 << 2) | (0 << 1) | 0, 515 - (1 << 7) | (0 << 6) | (0 << 5) | (1 << 4) | (0 << 3) | (0 << 2) | (0 << 1) | 1 516 - }; 517 500 518 - #elif defined TINY_GRAPHICS 501 + #elif defined SMALL_GRAPHICS 519 502 520 - #define STRIDE 53 521 - #define SHIP_SRC_X 16 522 - #define SHIP_WIDTH 10 523 - #define SHIP_HEIGHT 5 524 503 #define SHOT_HEIGHT 4 525 - #define ALIEN_WIDTH 8 526 - #define ALIEN_HEIGHT 5 527 - #define ALIEN_EXPLODE_SRC_X 40 528 - #define ALIEN_EXPLODE_SRC_Y 26 529 - #define ALIEN_EXPLODE_WIDTH 10 530 - #define ALIEN_EXPLODE_HEIGHT 5 531 504 #define ALIEN_SPACING 3 532 505 #define ALIEN_SPEED 2 533 - #define UFO_SRC_X 26 534 - #define UFO_WIDTH 11 535 - #define UFO_HEIGHT 5 536 - #define UFO_EXPLODE_WIDTH 14 537 - #define UFO_EXPLODE_HEIGHT 5 538 506 #define UFO_SPEED 1 539 - #define FONT_HEIGHT 5 540 - #define LEVEL_SRC_Y 15 541 - #define LEVEL_WIDTH 29 542 - #define NUMBERS_WIDTH 4 543 507 #define NUM_SPACING 2 544 - #define SCORE_SRC_X 17 545 - #define SCORE_SRC_Y 20 546 - #define SCORE_WIDTH 28 547 - #define HISCORE_WIDTH 45 548 - #define NUMBERS_SRC_Y 25 549 - #define SHIELD_SRC_X 29 550 - #define SHIELD_SRC_Y 10 551 - #define SHIELD_WIDTH 15 552 - #define SHIELD_HEIGHT 10 553 - #define FIRE_WIDTH 6 554 - #define FIRE_HEIGHT 6 555 508 #define FIRE_SPEED 6 556 - #define BOMB_SRC_X 44 557 - #define BOMB_WIDTH 3 558 - #define BOMB_HEIGHT 5 559 509 #define BOMB_SPEED 2 560 510 #define ALIENS 11 561 - unsigned char fire_sprite[FIRE_HEIGHT] = { 562 - (1 << 5) | (0 << 4) | (0 << 3) | (1 << 2) | (0 << 1) | 1, 563 - (0 << 5) | (1 << 4) | (0 << 3) | (0 << 2) | (0 << 1) | 0, 564 - (0 << 5) | (1 << 4) | (1 << 3) | (1 << 2) | (1 << 1) | 0, 565 - (0 << 5) | (1 << 4) | (1 << 3) | (1 << 2) | (1 << 1) | 1, 566 - (0 << 5) | (1 << 4) | (0 << 3) | (0 << 2) | (1 << 1) | 0, 567 - (1 << 5) | (0 << 4) | (1 << 3) | (0 << 2) | (0 << 1) | 1 568 - }; 569 511 570 512 #else 571 513 #error Graphic type not defined ··· 642 584 643 585 /* For optimization, precalculate startoffset of each scanline */ 644 586 unsigned int ytab[LCD_HEIGHT]; 645 - 646 - /* external bitmaps */ 647 - extern const fb_data invadrox[]; 648 - #if (LCD_WIDTH == 320) && (LCD_HEIGHT == 240) 649 - /* iPod Video only */ 650 - extern const fb_data invadrox_left[]; 651 - extern const fb_data invadrox_right[]; 652 - #endif 653 - #if ((LCD_WIDTH == 240) && (LCD_HEIGHT == 320)) || ((LCD_WIDTH == 176) && (LCD_HEIGHT == 220)) 654 - /* Gigabeat F, Sansa e200 */ 655 - extern const fb_data invadrox_logo[]; 656 - #endif 657 - 658 587 659 588 int lives = 2; 660 589 int score = 0; ··· 716 645 for (i = digits - 1; i >= 0; i--) { 717 646 d = num % 10; 718 647 num = num / 10; 719 - rb->lcd_bitmap_part(invadrox, d * NUMBERS_WIDTH, NUMBERS_SRC_Y, 720 - STRIDE, x + i * (NUMBERS_WIDTH + NUM_SPACING), y, 648 + rb->lcd_bitmap_part(invadrox_numbers, d * NUMBERS_WIDTH, 0, 649 + BMPWIDTH_invadrox_numbers, 650 + x + i * (NUMBERS_WIDTH + NUM_SPACING), y, 721 651 NUMBERS_WIDTH, FONT_HEIGHT); 722 652 } 723 653 /* Update lcd */ ··· 737 667 738 668 void draw_level(void) 739 669 { 740 - rb->lcd_bitmap_part(invadrox, 0, LEVEL_SRC_Y, 741 - STRIDE, LEVEL_X, PLAYFIELD_Y + 2, 742 - LEVEL_WIDTH, FONT_HEIGHT); 743 - draw_number(LEVEL_X + LEVEL_WIDTH + 2 * NUM_SPACING, PLAYFIELD_Y + 2, level, 2); 670 + draw_number(LEVEL_X + 2 * NUM_SPACING, PLAYFIELD_Y + 2, level, 2); 744 671 } 745 672 746 673 ··· 748 675 { 749 676 int i; 750 677 /* Lives num */ 751 - rb->lcd_bitmap_part(invadrox, lives * NUMBERS_WIDTH, NUMBERS_SRC_Y, 752 - STRIDE, PLAYFIELD_X + LIVES_X, PLAYFIELD_Y + 2, 678 + rb->lcd_bitmap_part(invadrox_numbers, lives * NUMBERS_WIDTH, 0, 679 + BMPWIDTH_invadrox_numbers, PLAYFIELD_X + LIVES_X, PLAYFIELD_Y + 2, 753 680 NUMBERS_WIDTH, FONT_HEIGHT); 754 681 755 682 /* Ships */ 756 683 for (i = 0; i < (lives - 1); i++) { 757 - rb->lcd_bitmap_part(invadrox, SHIP_SRC_X, 0, STRIDE, 684 + rb->lcd_bitmap_part(invadrox_ships, 0, 0, BMPWIDTH_invadrox_ships, 758 685 PLAYFIELD_X + LIVES_X + SHIP_WIDTH + i * (SHIP_WIDTH + NUM_SPACING), 759 686 PLAYFIELD_Y + 1, SHIP_WIDTH, SHIP_HEIGHT); 760 687 } 761 688 762 - /* Erase ship to the righ (if less than MAX_LIVES) */ 689 + /* Erase ship to the right (if less than MAX_LIVES) */ 763 690 if (lives < MAX_LIVES) { 764 691 rb->lcd_fillrect(PLAYFIELD_X + LIVES_X + SHIP_WIDTH + i * (SHIP_WIDTH + NUM_SPACING), 765 692 PLAYFIELD_Y + 1, SHIP_WIDTH, SHIP_HEIGHT); ··· 775 702 int i; 776 703 777 704 for (i = 0; i < 5 * ALIENS; i++) { 778 - rb->lcd_bitmap_part(invadrox, aliens[i].x & 1 ? ALIEN_WIDTH : 0, aliens[i].type * ALIEN_HEIGHT, 779 - STRIDE, PLAYFIELD_X + LIVES_X + aliens[i].x * ALIEN_SPEED, 705 + rb->lcd_bitmap_part(invadrox_aliens, aliens[i].x & 1 ? ALIEN_WIDTH : 0, aliens[i].type * ALIEN_HEIGHT, 706 + BMPWIDTH_invadrox_aliens, PLAYFIELD_X + LIVES_X + aliens[i].x * ALIEN_SPEED, 780 707 ALIEN_START_Y + aliens[i].y * ALIEN_HEIGHT, 781 708 ALIEN_WIDTH, ALIEN_HEIGHT); 782 709 } ··· 912 839 /* Draw alien at new pos */ 913 840 x = PLAYFIELD_X + LIVES_X + aliens[curr_alien].x * ALIEN_SPEED; 914 841 y = ALIEN_START_Y + aliens[curr_alien].y * ALIEN_HEIGHT; 915 - rb->lcd_bitmap_part(invadrox, 842 + rb->lcd_bitmap_part(invadrox_aliens, 916 843 aliens[curr_alien].x & 1 ? ALIEN_WIDTH : 0, aliens[curr_alien].type * ALIEN_HEIGHT, 917 - STRIDE, x, y, ALIEN_WIDTH, ALIEN_HEIGHT); 844 + BMPWIDTH_invadrox_aliens, x, y, ALIEN_WIDTH, ALIEN_HEIGHT); 918 845 919 846 if (!next_alien()) { 920 847 /* Round finished. Set curr_alien to first alive from bottom. */ ··· 941 868 } 942 869 943 870 /* Draw ship */ 944 - rb->lcd_bitmap_part(invadrox, SHIP_SRC_X, ship_frame * SHIP_HEIGHT, 945 - STRIDE, ship_x, SHIP_Y, SHIP_WIDTH, SHIP_HEIGHT); 871 + rb->lcd_bitmap_part(invadrox_ships, 0, ship_frame * SHIP_HEIGHT, 872 + BMPWIDTH_invadrox_ships, ship_x, SHIP_Y, SHIP_WIDTH, SHIP_HEIGHT); 946 873 if (ship_hit) { 947 874 /* Alternate between frame 1 and 2 during hit */ 948 875 ship_frame_counter++; ··· 962 889 963 890 inline void fire_alpha(int xc, int yc, fb_data color) 964 891 { 965 - int x, y; 966 - unsigned char mask; 892 + int oldmode = rb->lcd_get_drawmode(); 967 893 968 894 rb->lcd_set_foreground(color); 969 - 970 - for (y = 0; y < FIRE_HEIGHT; y++) { 971 - mask = 1 << (FIRE_WIDTH - 1); 972 - for (x = -(FIRE_WIDTH / 2); x < (FIRE_WIDTH / 2); x++) { 973 - if (fire_sprite[y] & mask) { 974 - rb->lcd_drawpixel(xc + x, yc + y); 975 - } 976 - mask >>= 1; 977 - } 978 - } 895 + rb->lcd_set_drawmode(DRMODE_FG); 896 + 897 + rb->lcd_mono_bitmap(invadrox_fire, xc - (FIRE_WIDTH/2), yc, FIRE_WIDTH, FIRE_HEIGHT); 979 898 980 899 rb->lcd_set_foreground(LCD_BLACK); 900 + rb->lcd_set_drawmode(oldmode); 981 901 } 982 902 983 903 ··· 1041 961 fire_target = TARGET_UFO; 1042 962 /* Center explosion */ 1043 963 ufo_x -= (UFO_EXPLODE_WIDTH - UFO_WIDTH) / 2; 1044 - rb->lcd_bitmap_part(invadrox, UFO_SRC_X, UFO_HEIGHT, 1045 - STRIDE, ufo_x, UFO_Y - 1, UFO_EXPLODE_WIDTH, UFO_EXPLODE_HEIGHT); 964 + rb->lcd_bitmap(invadrox_ufo_explode, ufo_x, UFO_Y - 1, 965 + UFO_EXPLODE_WIDTH, UFO_EXPLODE_HEIGHT); 1046 966 return; 1047 967 } 1048 968 } ··· 1125 1045 1126 1046 /* Paralyze aliens S_EXPLODE frames */ 1127 1047 aliens_paralyzed = S_EXPLODE; 1128 - rb->lcd_bitmap_part(invadrox, ALIEN_EXPLODE_SRC_X, ALIEN_EXPLODE_SRC_Y, 1129 - STRIDE, PLAYFIELD_X + LIVES_X + aliens[i].x * ALIEN_SPEED, 1048 + rb->lcd_bitmap(invadrox_alien_explode, 1049 + PLAYFIELD_X + LIVES_X + aliens[i].x * ALIEN_SPEED, 1130 1050 ALIEN_START_Y + aliens[i].y * ALIEN_HEIGHT, 1131 1051 ALIEN_EXPLODE_WIDTH, ALIEN_EXPLODE_HEIGHT); 1132 1052 /* Since alien is 1 pixel taller than explosion sprite, erase bottom line */ ··· 1187 1107 1188 1108 inline void draw_bomb(int i) 1189 1109 { 1190 - rb->lcd_bitmap_part(invadrox, BOMB_SRC_X + bombs[i].type * BOMB_WIDTH, 1191 - bombs[i].frame * (BOMB_HEIGHT + 1), 1192 - STRIDE, bombs[i].x, bombs[i].y, 1110 + rb->lcd_bitmap_part(invadrox_bombs, bombs[i].type * BOMB_WIDTH, 1111 + bombs[i].frame * BOMB_HEIGHT, 1112 + BMPWIDTH_invadrox_bombs, bombs[i].x, bombs[i].y, 1193 1113 BOMB_WIDTH, BOMB_HEIGHT); 1194 1114 /* Advance frame */ 1195 1115 bombs[i].frame++; ··· 1288 1208 ship_frame_counter = 0; 1289 1209 bombs[i].state = S_EXPLODE * 4; 1290 1210 bombs[i].target = TARGET_SHIP; 1291 - rb->lcd_bitmap_part(invadrox, SHIP_SRC_X, 1 * SHIP_HEIGHT, STRIDE, 1292 - ship_x, SHIP_Y, SHIP_WIDTH, SHIP_HEIGHT); 1211 + rb->lcd_bitmap_part(invadrox_ships, 0, 1 * SHIP_HEIGHT, 1212 + BMPWIDTH_invadrox_ships, ship_x, SHIP_Y, 1213 + SHIP_WIDTH, SHIP_HEIGHT); 1293 1214 break; 1294 1215 } 1295 1216 /* Shield hit */ ··· 1399 1320 break; 1400 1321 } 1401 1322 /* Draw new pos */ 1402 - rb->lcd_bitmap_part(invadrox, UFO_SRC_X, 0, 1403 - STRIDE, ufo_x, UFO_Y, UFO_WIDTH, UFO_HEIGHT); 1323 + rb->lcd_bitmap(invadrox_ufo, ufo_x, UFO_Y, UFO_WIDTH, UFO_HEIGHT); 1404 1324 break; 1405 1325 1406 1326 case S_SHOWSCORE: ··· 1438 1358 void draw_background(void) 1439 1359 { 1440 1360 1441 - #if (LCD_WIDTH == 320) && (LCD_HEIGHT == 240) 1442 - /* Erase background to black */ 1443 - rb->lcd_fillrect(PLAYFIELD_X, 0, PLAYFIELD_WIDTH, LCD_HEIGHT); 1444 - /* Left and right bitmaps */ 1445 - rb->lcd_bitmap(invadrox_left, 0, 0, PLAYFIELD_X, LCD_HEIGHT); 1446 - rb->lcd_bitmap(invadrox_right, LCD_WIDTH - PLAYFIELD_X, 0, PLAYFIELD_X, LCD_HEIGHT); 1447 - #else 1448 - rb->lcd_fillrect(0, 0, LCD_WIDTH, LCD_HEIGHT); 1449 - #endif 1450 - 1451 - #if ((LCD_WIDTH == 240) && (LCD_HEIGHT == 320)) || ((LCD_WIDTH == 176) && (LCD_HEIGHT == 220)) 1452 - rb->lcd_bitmap(invadrox_logo, 0, 0, LCD_WIDTH, SCORE_Y); 1453 - #endif 1454 - 1361 + rb->lcd_bitmap(invadrox_background, 0, 0, LCD_WIDTH, LCD_HEIGHT); 1455 1362 rb->lcd_update(); 1456 1363 } 1457 1364 ··· 1468 1375 draw_lives(); 1469 1376 1470 1377 /* Score */ 1471 - rb->lcd_bitmap_part(invadrox, SCORE_SRC_X, SCORE_SRC_Y, 1472 - STRIDE, PLAYFIELD_X, SCORE_Y, SCORE_WIDTH, FONT_HEIGHT); 1473 - /* Hi-score */ 1474 - rb->lcd_bitmap_part(invadrox, 0, SCORE_SRC_Y, 1475 - STRIDE, HISCORE_X, SCORE_Y, 1476 - HISCORE_WIDTH, FONT_HEIGHT); 1477 1378 draw_score(); 1478 1379 draw_number(HISCORENUM_X, SCORENUM_Y, hiscore.score, 4); 1479 1380 ··· 1539 1440 1540 1441 /* 4 shields */ 1541 1442 for (i = 1; i <= 4; i++) { 1542 - rb->lcd_bitmap_part(invadrox, SHIELD_SRC_X, SHIELD_SRC_Y, STRIDE, 1443 + rb->lcd_bitmap(invadrox_shield, 1543 1444 PLAYFIELD_X + i * PLAYFIELD_WIDTH / 5 - SHIELD_WIDTH / 2, 1544 1445 SHIELD_Y, SHIELD_WIDTH, SHIELD_HEIGHT); 1545 1446 }