PROGMEMed two sprite arrays
This commit is contained in:
parent
847648d5e6
commit
c64a587af4
|
@ -1,6 +1,8 @@
|
|||
#include <stdint.h>
|
||||
#include "../../compat/pgmspace.h"
|
||||
#include "invaders2.h"
|
||||
|
||||
unsigned char peter[8][11] =
|
||||
uint8_t const peter[8][11] PROGMEM =
|
||||
{
|
||||
{ 0, 0, P, 0, 0, 0, 0, 0, P, 0, 0 },
|
||||
{ 0, 0, 0, P, 0, 0, 0, P, 0, 0, 0 },
|
||||
|
@ -11,7 +13,7 @@ unsigned char peter[8][11] =
|
|||
{ P, 0, P, 0, 0, 0, 0, 0, P, 0, P },
|
||||
{ 0, 0, 0, P, P, 0, P, P, 0, 0, 0 } };
|
||||
|
||||
unsigned char hans[8][11] =
|
||||
uint8_t const hans[8][11] PROGMEM =
|
||||
{
|
||||
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
|
||||
{ 1, 2, 1, 1, 2, 2, 2, 1, 2, 2, 1 },
|
||||
|
@ -114,7 +116,7 @@ void initInvaders(Invaders * iv, unsigned char lv)
|
|||
{
|
||||
for (y = 0; y < 8; ++y)
|
||||
{
|
||||
if (hans[y][x] != 0)
|
||||
if (pgm_read_byte(&hans[y][x]) != 0)
|
||||
{
|
||||
iv->map[x][y] = 2;
|
||||
}
|
||||
|
@ -134,7 +136,7 @@ void initInvaders(Invaders * iv, unsigned char lv)
|
|||
{
|
||||
for (y = 0; y < 8; ++y)
|
||||
{
|
||||
if (peter[y][x] != 0)
|
||||
if (pgm_read_byte(&peter[y][x]) != 0)
|
||||
{
|
||||
iv->map[x][y] = 2;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#define INVADERS2_H
|
||||
/* TEST PARTS NEW API */
|
||||
|
||||
#include <stdint.h>
|
||||
#include "../../config.h"
|
||||
#include "../../pixel.h"
|
||||
|
||||
|
@ -50,8 +51,8 @@ typedef struct
|
|||
/* GLOBALE VAR */
|
||||
/****************************************************************/
|
||||
#define P 3
|
||||
extern unsigned char peter[8][11];
|
||||
extern unsigned char hans[8][11];
|
||||
extern uint8_t const peter[8][11];
|
||||
extern uint8_t const hans[8][11];
|
||||
|
||||
/****************************************************************/
|
||||
/* DEFINES */
|
||||
|
|
Loading…
Reference in New Issue