diff options
author | inmarket <andrewh@inmarket.com.au> | 2018-11-03 10:51:23 +1000 |
---|---|---|
committer | inmarket <andrewh@inmarket.com.au> | 2018-11-03 10:51:23 +1000 |
commit | 7c5a6c928fa7129cf754c9c73c5c7ae39372ba9d (patch) | |
tree | 95cf152ef65ff19c7b2515b427bbe86b92b611d0 /demos/games/tetris | |
parent | 8bd70d953bcd3e32ceb4e45a4e561c973726280a (diff) | |
download | uGFX-7c5a6c928fa7129cf754c9c73c5c7ae39372ba9d.tar.gz uGFX-7c5a6c928fa7129cf754c9c73c5c7ae39372ba9d.tar.bz2 uGFX-7c5a6c928fa7129cf754c9c73c5c7ae39372ba9d.zip |
For all source files update integer types to the new gI8 etc type names
Diffstat (limited to 'demos/games/tetris')
8 files changed, 44 insertions, 44 deletions
diff --git a/demos/games/tetris/Example_Makefiles/stm32f4/board_SSD1289.h b/demos/games/tetris/Example_Makefiles/stm32f4/board_SSD1289.h index 35ef653d..e14def7d 100644 --- a/demos/games/tetris/Example_Makefiles/stm32f4/board_SSD1289.h +++ b/demos/games/tetris/Example_Makefiles/stm32f4/board_SSD1289.h @@ -18,8 +18,8 @@ // For a multiple display configuration we would put all this in a structure and then // set g->board to that structure. -#define GDISP_REG ((volatile uint16_t *) 0x60000000)[0] /* RS = 0 */ -#define GDISP_RAM ((volatile uint16_t *) 0x60020000)[0] /* RS = 1 */ +#define GDISP_REG ((volatile gU16 *) 0x60000000)[0] /* RS = 0 */ +#define GDISP_RAM ((volatile gU16 *) 0x60020000)[0] /* RS = 1 */ #define GDISP_DMA_STREAM STM32_DMA2_STREAM6 #define FSMC_BANK 0 @@ -116,7 +116,7 @@ static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) state; } -static GFXINLINE void set_backlight(GDisplay *g, uint8_t percent) { +static GFXINLINE void set_backlight(GDisplay *g, gU8 percent) { (void) g; pwmEnableChannel(&PWMD3, 2, percent); } @@ -129,12 +129,12 @@ static GFXINLINE void release_bus(GDisplay *g) { (void) g; } -static GFXINLINE void write_index(GDisplay *g, uint16_t index) { +static GFXINLINE void write_index(GDisplay *g, gU16 index) { (void) g; GDISP_REG = index; } -static GFXINLINE void write_data(GDisplay *g, uint16_t data) { +static GFXINLINE void write_data(GDisplay *g, gU16 data) { (void) g; GDISP_RAM = data; } @@ -149,7 +149,7 @@ static GFXINLINE void setwritemode(GDisplay *g) { FSMC_Bank1->BTCR[FSMC_BANK+1] = FSMC_BTR1_ADDSET_0 | FSMC_BTR1_DATAST_2 | FSMC_BTR1_BUSTURN_0; /* FSMC timing */ } -static GFXINLINE uint16_t read_data(GDisplay *g) { +static GFXINLINE gU16 read_data(GDisplay *g) { (void) g; return GDISP_RAM; } diff --git a/demos/games/tetris/Example_Makefiles/stm32f4/ginput_lld_mouse_board.h b/demos/games/tetris/Example_Makefiles/stm32f4/ginput_lld_mouse_board.h index 4ba46339..6b599207 100644 --- a/demos/games/tetris/Example_Makefiles/stm32f4/ginput_lld_mouse_board.h +++ b/demos/games/tetris/Example_Makefiles/stm32f4/ginput_lld_mouse_board.h @@ -43,11 +43,11 @@ static GFXINLINE void release_bus(void) spiReleaseBus(&SPID1); } -static GFXINLINE uint16_t read_value(uint16_t port) +static GFXINLINE gU16 read_value(gU16 port) { - static uint8_t txbuf[3] = {0}; - static uint8_t rxbuf[3] = {0}; - uint16_t ret; + static gU8 txbuf[3] = {0}; + static gU8 rxbuf[3] = {0}; + gU16 ret; txbuf[0] = port; diff --git a/demos/games/tetris/Example_Makefiles/stm32f4/gmouse_lld_ADS7843_board.h b/demos/games/tetris/Example_Makefiles/stm32f4/gmouse_lld_ADS7843_board.h index eef222fa..1114853c 100644 --- a/demos/games/tetris/Example_Makefiles/stm32f4/gmouse_lld_ADS7843_board.h +++ b/demos/games/tetris/Example_Makefiles/stm32f4/gmouse_lld_ADS7843_board.h @@ -85,15 +85,15 @@ static GFXINLINE void release_bus(GMouse* m) { spiReleaseBus(&SPID1); } -static GFXINLINE uint16_t read_value(GMouse* m, uint16_t port) { - static uint8_t txbuf[3] = {0}; - static uint8_t rxbuf[3] = {0}; +static GFXINLINE gU16 read_value(GMouse* m, gU16 port) { + static gU8 txbuf[3] = {0}; + static gU8 rxbuf[3] = {0}; (void) m; txbuf[0] = port; spiExchange(&SPID1, 3, txbuf, rxbuf); - return ((uint16_t)rxbuf[1] << 5) | (rxbuf[2] >> 3); + return ((gU16)rxbuf[1] << 5) | (rxbuf[2] >> 3); } #endif /* _GINPUT_LLD_MOUSE_BOARD_H */ diff --git a/demos/games/tetris/Example_Makefiles/stm32f4/gmouse_lld_ADS7843_board.h.old b/demos/games/tetris/Example_Makefiles/stm32f4/gmouse_lld_ADS7843_board.h.old index f5f39c63..5b520a3d 100644 --- a/demos/games/tetris/Example_Makefiles/stm32f4/gmouse_lld_ADS7843_board.h.old +++ b/demos/games/tetris/Example_Makefiles/stm32f4/gmouse_lld_ADS7843_board.h.old @@ -57,10 +57,10 @@ static GFXINLINE void release_bus(void) { spiReleaseBus(&SPID1); } -static GFXINLINE uint16_t read_value(uint16_t port) { - static uint8_t txbuf[3] = {0}; - static uint8_t rxbuf[3] = {0}; - uint16_t ret; +static GFXINLINE gU16 read_value(gU16 port) { + static gU8 txbuf[3] = {0}; + static gU8 rxbuf[3] = {0}; + gU16 ret; txbuf[0] = port; diff --git a/demos/games/tetris/Example_Makefiles/stm32f4_chibios_3.x/board_SSD1289.h b/demos/games/tetris/Example_Makefiles/stm32f4_chibios_3.x/board_SSD1289.h index 9ad3edd5..41d0ea8f 100644 --- a/demos/games/tetris/Example_Makefiles/stm32f4_chibios_3.x/board_SSD1289.h +++ b/demos/games/tetris/Example_Makefiles/stm32f4_chibios_3.x/board_SSD1289.h @@ -18,8 +18,8 @@ // For a multiple display configuration we would put all this in a structure and then // set g->board to that structure. -#define GDISP_REG ((volatile uint16_t *) 0x60000000)[0] /* RS = 0 */ -#define GDISP_RAM ((volatile uint16_t *) 0x60020000)[0] /* RS = 1 */ +#define GDISP_REG ((volatile gU16 *) 0x60000000)[0] /* RS = 0 */ +#define GDISP_RAM ((volatile gU16 *) 0x60020000)[0] /* RS = 1 */ #define GDISP_DMA_STREAM STM32_DMA2_STREAM6 #define FSMC_BANK 0 @@ -114,7 +114,7 @@ static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) state; } -static GFXINLINE void set_backlight(GDisplay *g, uint8_t percent) { +static GFXINLINE void set_backlight(GDisplay *g, gU8 percent) { (void) g; pwmEnableChannel(&PWMD3, 2, percent); } @@ -127,12 +127,12 @@ static GFXINLINE void release_bus(GDisplay *g) { (void) g; } -static GFXINLINE void write_index(GDisplay *g, uint16_t index) { +static GFXINLINE void write_index(GDisplay *g, gU16 index) { (void) g; GDISP_REG = index; } -static GFXINLINE void write_data(GDisplay *g, uint16_t data) { +static GFXINLINE void write_data(GDisplay *g, gU16 data) { (void) g; GDISP_RAM = data; } @@ -147,7 +147,7 @@ static GFXINLINE void setwritemode(GDisplay *g) { FSMC_Bank1->BTCR[FSMC_BANK+1] = FSMC_BTR1_ADDSET_0 | FSMC_BTR1_DATAST_2 | FSMC_BTR1_BUSTURN_0; /* FSMC timing */ } -static GFXINLINE uint16_t read_data(GDisplay *g) { +static GFXINLINE gU16 read_data(GDisplay *g) { (void) g; return GDISP_RAM; } diff --git a/demos/games/tetris/Example_Makefiles/stm32f4_chibios_3.x/ginput_lld_mouse_board.h b/demos/games/tetris/Example_Makefiles/stm32f4_chibios_3.x/ginput_lld_mouse_board.h index 4ba46339..6b599207 100644 --- a/demos/games/tetris/Example_Makefiles/stm32f4_chibios_3.x/ginput_lld_mouse_board.h +++ b/demos/games/tetris/Example_Makefiles/stm32f4_chibios_3.x/ginput_lld_mouse_board.h @@ -43,11 +43,11 @@ static GFXINLINE void release_bus(void) spiReleaseBus(&SPID1); } -static GFXINLINE uint16_t read_value(uint16_t port) +static GFXINLINE gU16 read_value(gU16 port) { - static uint8_t txbuf[3] = {0}; - static uint8_t rxbuf[3] = {0}; - uint16_t ret; + static gU8 txbuf[3] = {0}; + static gU8 rxbuf[3] = {0}; + gU16 ret; txbuf[0] = port; diff --git a/demos/games/tetris/Example_Makefiles/stm32f4_chibios_3.x/gmouse_lld_ADS7843_board.h b/demos/games/tetris/Example_Makefiles/stm32f4_chibios_3.x/gmouse_lld_ADS7843_board.h index f5f39c63..5b520a3d 100644 --- a/demos/games/tetris/Example_Makefiles/stm32f4_chibios_3.x/gmouse_lld_ADS7843_board.h +++ b/demos/games/tetris/Example_Makefiles/stm32f4_chibios_3.x/gmouse_lld_ADS7843_board.h @@ -57,10 +57,10 @@ static GFXINLINE void release_bus(void) { spiReleaseBus(&SPID1); } -static GFXINLINE uint16_t read_value(uint16_t port) { - static uint8_t txbuf[3] = {0}; - static uint8_t rxbuf[3] = {0}; - uint16_t ret; +static GFXINLINE gU16 read_value(gU16 port) { + static gU8 txbuf[3] = {0}; + static gU8 rxbuf[3] = {0}; + gU16 ret; txbuf[0] = port; diff --git a/demos/games/tetris/tetris.c b/demos/games/tetris/tetris.c index cd4cc315..c0bbe3b0 100644 --- a/demos/games/tetris/tetris.c +++ b/demos/games/tetris/tetris.c @@ -62,7 +62,7 @@ F B E C D */ -const uint8_t sevenSegNumbers[10] = {0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x6F}; // 0,1,2,3,4,5,6,7,8,9 +const gU8 sevenSegNumbers[10] = {0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x6F}; // 0,1,2,3,4,5,6,7,8,9 const gColor tetrisShapeColors[9] = {GFX_BLACK, HTML2COLOR(0x009000), GFX_RED, GFX_BLUE, GFX_MAGENTA, GFX_SKYBLUE, GFX_ORANGE, HTML2COLOR(0xBBBB00), GFX_WHITE}; // shape colors // default tetris shapes const int tetrisShapes[TETRIS_SHAPE_COUNT][4][2] = { @@ -143,7 +143,7 @@ static int uitoa(unsigned int value, char * buf, int max) { return n; } -static void sevenSegDraw(int x, int y, uint8_t number, gColor color) { +static void sevenSegDraw(int x, int y, gU8 number, gColor color) { if (number & 0x01) gdispFillArea(x+SEVEN_SEG_HEIGHT+SEVEN_SEG_SIZE, y, SEVEN_SEG_WIDTH, SEVEN_SEG_HEIGHT, color); // A if (number & 0x02) gdispFillArea(x+SEVEN_SEG_HEIGHT+(SEVEN_SEG_SIZE*2)+SEVEN_SEG_WIDTH, y+SEVEN_SEG_HEIGHT+SEVEN_SEG_SIZE, SEVEN_SEG_HEIGHT, SEVEN_SEG_WIDTH, color); // B if (number & 0x04) gdispFillArea(x+SEVEN_SEG_HEIGHT+(SEVEN_SEG_SIZE*2)+SEVEN_SEG_WIDTH, y+(SEVEN_SEG_HEIGHT*2)+SEVEN_SEG_WIDTH+(SEVEN_SEG_SIZE*3), SEVEN_SEG_HEIGHT, SEVEN_SEG_WIDTH, color); // C @@ -153,7 +153,7 @@ static void sevenSegDraw(int x, int y, uint8_t number, gColor color) { if (number & 0x40) gdispFillArea(x+SEVEN_SEG_HEIGHT+SEVEN_SEG_SIZE, y+SEVEN_SEG_HEIGHT+SEVEN_SEG_WIDTH+(SEVEN_SEG_SIZE*2), SEVEN_SEG_WIDTH, SEVEN_SEG_HEIGHT, color); // G } -static void drawShape(uint8_t color) { +static void drawShape(gU8 color) { int i; for (i = 0; i <= 3; i++) { if (tetrisCurrentShape[i][1] <= 16 || tetrisCurrentShape[i][1] >= 19) { @@ -167,14 +167,14 @@ static void drawShape(uint8_t color) { } } -// static uint32_t randomInt(uint32_t max) { //getting random number from STM32 hardware RNG -// static uint32_t new_value=0; +// static gU32 randomInt(gU32 max) { //getting random number from STM32 hardware RNG +// static gU32 new_value=0; // while ((RNG->SR & RNG_SR_DRDY) == 0) { } // new_value=RNG->DR % max; // return new_value; // } -static uint32_t randomInt(uint32_t max) { +static gU32 randomInt(gU32 max) { return rand() % max; } @@ -200,9 +200,9 @@ static void createShape(void) { memcpy(tetrisCurrentShape, tetrisOldShape, sizeof(tetrisCurrentShape)); // tetrisCurrentShape = tetrisOldShape; } -static void tellScore(uint8_t color) { +static void tellScore(gU8 color) { char pps_str[12]; - uint8_t i; + gU8 i; uitoa(tetrisLines, pps_str, sizeof(pps_str)); gdispFillArea((TETRIS_FIELD_WIDTH*TETRIS_CELL_WIDTH)+5, gdispGetHeight()-50, gdispGetStringWidth(pps_str, font16)+4, gdispGetCharWidth('A', font16)+2, tetrisShapeColors[0]); gdispDrawString((TETRIS_FIELD_WIDTH*TETRIS_CELL_WIDTH)+5, gdispGetHeight()-50, pps_str, font16, tetrisShapeColors[color]); @@ -237,7 +237,7 @@ static void initField(void) { tellScore(8); } -static void drawCell(int x, int y, uint8_t color) { +static void drawCell(int x, int y, gU8 color) { gdispFillArea((x*TETRIS_CELL_WIDTH)+2, gdispGetHeight()-TETRIS_CELL_HEIGHT-(y*TETRIS_CELL_HEIGHT)-3, TETRIS_CELL_WIDTH-2, TETRIS_CELL_HEIGHT-2, tetrisShapeColors[color]); if (color != 0) { gdispDrawBox((x*TETRIS_CELL_WIDTH)+2, gdispGetHeight()-TETRIS_CELL_HEIGHT-(y*TETRIS_CELL_HEIGHT)-3, TETRIS_CELL_WIDTH-1, TETRIS_CELL_HEIGHT-1, tetrisShapeColors[8]); @@ -246,7 +246,7 @@ static void drawCell(int x, int y, uint8_t color) { } } -static void printText(uint8_t color) { +static void printText(gU8 color) { gdispDrawString((TETRIS_FIELD_WIDTH*TETRIS_CELL_WIDTH)+TETRIS_CELL_WIDTH, gdispGetHeight()-(TETRIS_FIELD_HEIGHT*TETRIS_CELL_HEIGHT), "Next", font16, tetrisShapeColors[color]); gdispDrawString((TETRIS_FIELD_WIDTH*TETRIS_CELL_WIDTH)+5, gdispGetHeight()-70, "Lines", font16, tetrisShapeColors[color]); } @@ -294,7 +294,7 @@ static gBool stay(gBool down) { static void clearCompleteLines(void) { gBool t; - uint8_t reiz = 0; + gU8 reiz = 0; int l,k,j; l = 0; while (l <= 16) { @@ -429,7 +429,7 @@ static void goLeft(void) { static DECLARE_THREAD_FUNCTION(thdTetris, arg) { (void)arg; - uint8_t i; + gU8 i; while (!tetrisGameOver) { // key handling if (gfxSystemTicks() - tetrisPreviousKeyTime >= gfxMillisecondsToTicks(tetrisKeySpeed) || gfxSystemTicks() <= gfxMillisecondsToTicks(tetrisKeySpeed)) { |