aboutsummaryrefslogtreecommitdiffstats
path: root/demos/games
diff options
context:
space:
mode:
Diffstat (limited to 'demos/games')
-rw-r--r--demos/games/justget10/jg10.c54
-rw-r--r--demos/games/minesweeper/mines.c28
-rw-r--r--demos/games/minesweeper/resources/romfs/userfonts.h8
-rw-r--r--demos/games/tetris/Example_Makefiles/stm32f4/board_SSD1289.h12
-rw-r--r--demos/games/tetris/Example_Makefiles/stm32f4/ginput_lld_mouse_board.h8
-rw-r--r--demos/games/tetris/Example_Makefiles/stm32f4/gmouse_lld_ADS7843_board.h8
-rw-r--r--demos/games/tetris/Example_Makefiles/stm32f4/gmouse_lld_ADS7843_board.h.old8
-rw-r--r--demos/games/tetris/Example_Makefiles/stm32f4_chibios_3.x/board_SSD1289.h12
-rw-r--r--demos/games/tetris/Example_Makefiles/stm32f4_chibios_3.x/ginput_lld_mouse_board.h8
-rw-r--r--demos/games/tetris/Example_Makefiles/stm32f4_chibios_3.x/gmouse_lld_ADS7843_board.h8
-rw-r--r--demos/games/tetris/tetris.c24
11 files changed, 89 insertions, 89 deletions
diff --git a/demos/games/justget10/jg10.c b/demos/games/justget10/jg10.c
index d6ec0e2e..bcb58508 100644
--- a/demos/games/justget10/jg10.c
+++ b/demos/games/justget10/jg10.c
@@ -16,7 +16,7 @@ GHandle jg10SelectionWidgetGCreate(GDisplay* g, jg10WidgetObject* wo, GWidgetIni
typedef struct { // Node properties
- uint8_t num; // Node number
+ gU8 num; // Node number
gBool check; // Node needs to be checked or not
gBool sel; // Node selected or not
} nodeProps;
@@ -29,7 +29,7 @@ gdispImage jg10Image[JG10_MAX_COUNT];
#define JG10_ANIM_DELAY 60
const char *jg10GraphAnim[] = {"a1.bmp","a2.bmp","a3.bmp","a4.bmp","background.bmp"}; // 5 elements (0-4)
gdispImage jg10ImageAnim[JG10_ANIM_IMAGES];
-uint8_t jg10MaxVal=4; // Max value in field...
+gU8 jg10MaxVal=4; // Max value in field...
gFont font;
#if JG10_SHOW_SPLASH
GTimer jg10SplashBlink;
@@ -42,7 +42,7 @@ static void initRng(void) {
srand(gfxSystemTicks());
}
-static uint32_t randomInt(uint32_t max) {
+static gU32 randomInt(gU32 max) {
return rand() % max;
}
@@ -86,12 +86,12 @@ static int uitoa(unsigned int value, char * buf, int max) {
return n;
}
-static gBool inRange(int16_t x, int16_t y) {
+static gBool inRange(gI16 x, gI16 y) {
if ((x >= 0) && (x < JG10_FIELD_WIDTH) && (y >= 0) && (y < JG10_FIELD_HEIGHT)) return gTrue; else return gFalse;
}
static void clean_SelCheck(void) {
- uint16_t i ,j;
+ gU16 i ,j;
for (i = 0; i < JG10_FIELD_WIDTH; i++) {
for (j = 0; j < JG10_FIELD_HEIGHT; j++) {
jg10Field[i][j].check = gFalse;
@@ -101,7 +101,7 @@ static void clean_SelCheck(void) {
}
static void remove_Selected(void) {
- uint16_t i ,j, step;
+ gU16 i ,j, step;
gTicks delay_start = 0;
gTicks delay=0;
for (step = 0; step < JG10_ANIM_IMAGES; step++) {
@@ -129,12 +129,12 @@ static void remove_Selected(void) {
// gwinRedraw(mainWin);
}
-static uint8_t jg10_randomer(uint8_t max, uint8_t th) {
- uint32_t r = randomInt((1<<max)-1);
+static gU8 jg10_randomer(gU8 max, gU8 th) {
+ gU32 r = randomInt((1<<max)-1);
if (r != 0) {
- for (int8_t i = max; i >= 0; i--) {
- if (r >= (uint32_t)(1<<i)) {
+ for (gI8 i = max; i >= 0; i--) {
+ if (r >= (gU32)(1<<i)) {
if ((max-i) >= th) {
return randomInt(max-i)+1;
} else {
@@ -147,20 +147,20 @@ static uint8_t jg10_randomer(uint8_t max, uint8_t th) {
}
static void movePiecesDown(void) {
- uint8_t tmp = 0;
+ gU8 tmp = 0;
gBool needToCheck = gTrue;
while (needToCheck) {
needToCheck = gFalse;
- for (int8_t y = (JG10_FIELD_HEIGHT-1); y >= 0; y--) {
- for (uint8_t x = 0; x < JG10_FIELD_WIDTH; x++) {
+ for (gI8 y = (JG10_FIELD_HEIGHT-1); y >= 0; y--) {
+ for (gU8 x = 0; x < JG10_FIELD_WIDTH; x++) {
if (jg10Field[x][y].num == 0) {
// check if there is at least single none empty piece
tmp = 0;
- for (int8_t tmpy = y; tmpy >= 0; tmpy--) {
+ for (gI8 tmpy = y; tmpy >= 0; tmpy--) {
if (jg10Field[x][tmpy].num != 0) tmp++;
}
if (tmp != 0) {
- for (int8_t tmpy = y; tmpy > 0; tmpy--) {
+ for (gI8 tmpy = y; tmpy > 0; tmpy--) {
jg10Field[x][tmpy].num = jg10Field[x][tmpy-1].num;
}
jg10Field[x][0].num = 0;
@@ -175,10 +175,10 @@ static void movePiecesDown(void) {
needToCheck = gTrue;
while (needToCheck) {
needToCheck = gFalse;
- for (int8_t y = (JG10_FIELD_HEIGHT-1); y >= 0; y--) {
- for (uint8_t x = 0; x < JG10_FIELD_WIDTH; x++) {
+ for (gI8 y = (JG10_FIELD_HEIGHT-1); y >= 0; y--) {
+ for (gU8 x = 0; x < JG10_FIELD_WIDTH; x++) {
if (jg10Field[x][y].num == 0) {
- for (int8_t tmpy = y; tmpy > 0; tmpy--) {
+ for (gI8 tmpy = y; tmpy > 0; tmpy--) {
jg10Field[x][tmpy].num = jg10Field[x][tmpy-1].num;
}
jg10Field[x][0].num = jg10_randomer(jg10MaxVal, 3);
@@ -193,7 +193,7 @@ static void movePiecesDown(void) {
static gBool checkForPossibleMove(void) {
gBool canMove = gFalse;
- uint16_t i ,j;
+ gU16 i ,j;
for (i = 0; i < JG10_FIELD_WIDTH; i++) {
for (j = 0; j < JG10_FIELD_HEIGHT; j++) {
if ((inRange(i,j-1) && jg10Field[i][j-1].num == jg10Field[i][j].num) ||
@@ -225,7 +225,7 @@ static void printCongrats(void) {
static DECLARE_THREAD_FUNCTION(thdJg10, msg) {
(void)msg;
- uint16_t x,y;
+ gU16 x,y;
while (!jg10GameOver) {
srand(gfxSystemTicks());
ginputGetMouseStatus(0, &ev);
@@ -278,8 +278,8 @@ static DECLARE_THREAD_FUNCTION(thdJg10, msg) {
static void initField(void) {
jg10MaxVal = 4;
- for (uint8_t x = 0; x < JG10_FIELD_WIDTH; x++) {
- for (uint8_t y = 0; y < JG10_FIELD_HEIGHT; y++) {
+ for (gU8 x = 0; x < JG10_FIELD_WIDTH; x++) {
+ for (gU8 y = 0; y < JG10_FIELD_HEIGHT; y++) {
jg10Field[x][y].num = randomInt(jg10MaxVal)+1;
//jg10Field[x][y].num = 1; // good for animation testing
//jg10Field[x][y].num = x+x+5; // good to get high score fast
@@ -295,15 +295,15 @@ static void initField(void) {
static void mainWinDraw(GWidgetObject* gw, void* param) {
(void)param;
- for (uint8_t x = 0; x < JG10_FIELD_WIDTH; x++) {
- for (uint8_t y = 0; y < JG10_FIELD_HEIGHT; y++) {
+ for (gU8 x = 0; x < JG10_FIELD_WIDTH; x++) {
+ for (gU8 y = 0; y < JG10_FIELD_HEIGHT; y++) {
gdispGImageDraw(gw->g.display, &jg10Image[jg10Field[x][y].num], (x*JG10_CELL_HEIGHT)+1, (y*JG10_CELL_WIDTH)+1, JG10_CELL_WIDTH, JG10_CELL_HEIGHT, 0, 0);
}
}
}
static void jg10SelectionWidget_Draw(GWidgetObject* gw, void* param) {
- int16_t x, y;
+ gI16 x, y;
gBool needToCheck = gTrue;
(void)param;
@@ -468,11 +468,11 @@ void jg10Start(void) {
void jg10Init(void) {
initRng();
- for (uint8_t i = 0; i < JG10_MAX_COUNT; i++) {
+ for (gU8 i = 0; i < JG10_MAX_COUNT; i++) {
gdispImageOpenFile(&jg10Image[i], jg10Graph[i]);
gdispImageCache(&jg10Image[i]);
}
- for (uint8_t i = 0; i < JG10_ANIM_IMAGES; i++) {
+ for (gU8 i = 0; i < JG10_ANIM_IMAGES; i++) {
gdispImageOpenFile(&jg10ImageAnim[i], jg10GraphAnim[i]);
gdispImageCache(&jg10ImageAnim[i]);
}
diff --git a/demos/games/minesweeper/mines.c b/demos/games/minesweeper/mines.c
index 5a0b4c41..4ae8f361 100644
--- a/demos/games/minesweeper/mines.c
+++ b/demos/games/minesweeper/mines.c
@@ -3,25 +3,25 @@
#include "mines.h"
typedef struct { // Node properties
- uint8_t num; // Node number, how many mines around
+ gU8 num; // Node number, how many mines around
gBool open; // Node shown or hidden
gBool check; // Node needs to be checked or not, used for opening up empty nodes
gBool flag; // Node is marked with flag by player
- uint16_t fieldNum; // Node number, used to randomize gamestart "animation"
+ gU16 fieldNum; // Node number, used to randomize gamestart "animation"
} nodeProps;
static GEventMouse ev;
static nodeProps minesField[MINES_FIELD_WIDTH][MINES_FIELD_HEIGHT]; // Mines field array
static gBool minesGameOver = gFalse;
static gBool minesGameWinner = gFalse;
-static int16_t minesEmptyNodes; // Empty node counter
-static int16_t minesFlags; // Flag counter
-static int16_t minesTime; // Time counter
+static gI16 minesEmptyNodes; // Empty node counter
+static gI16 minesFlags; // Flag counter
+static gI16 minesTime; // Time counter
static GTimer minesTimeCounterTimer;
static const char* minesGraph[] = {"1.bmp","2.bmp","3.bmp","4.bmp","5.bmp","6.bmp","7.bmp","8.bmp", "closed.bmp", "empty.bmp", "explode.bmp", "flag.bmp", "mine.bmp", "wrong.bmp"}; // 14 elements (0-13)
static gdispImage minesImage;
-static uint8_t minesStatusIconWidth = 0;
-static uint8_t minesStatusIconHeight = 0;
+static gU8 minesStatusIconWidth = 0;
+static gU8 minesStatusIconHeight = 0;
static gBool minesFirstGame = gTrue; // Just don't clear field for the first time, as we have black screen already... :/
static gBool minesSplashTxtVisible = gFalse;
#if MINES_SHOW_SPLASH
@@ -84,7 +84,7 @@ static void initRng(void)
srand(gfxSystemTicks());
}
-static uint32_t randomInt(uint32_t max)
+static gU32 randomInt(gU32 max)
{
return rand() % max;
}
@@ -125,7 +125,7 @@ static void minesTimeCounter(void* arg)
minesUpdateTime();
}
-static gBool inRange(int16_t x, int16_t y)
+static gBool inRange(gI16 x, gI16 y)
{
if ((x >= 0) && (x < MINES_FIELD_WIDTH) && (y >= 0) && (y < MINES_FIELD_HEIGHT))
return gTrue;
@@ -133,7 +133,7 @@ static gBool inRange(int16_t x, int16_t y)
return gFalse;
}
-static void showOne(int16_t x, int16_t y)
+static void showOne(gI16 x, gI16 y)
{
minesField[x][y].open = gTrue;
if (minesField[x][y].flag) {
@@ -167,7 +167,7 @@ static void showOne(int16_t x, int16_t y)
static void openEmptyNodes(void)
{
- int16_t x, y, i, j;
+ gI16 x, y, i, j;
gBool needToCheck = gTrue;
while (needToCheck) {
@@ -195,7 +195,7 @@ static void openEmptyNodes(void)
static DECLARE_THREAD_FUNCTION(thdMines, msg)
{
(void)msg;
- uint16_t x,y, delay;
+ gU16 x,y, delay;
gBool delayed = gFalse;
while (!minesGameOver) {
if (minesEmptyNodes == 0) {
@@ -265,7 +265,7 @@ static void printGameOver(void)
static void initField(void)
{
- int16_t x, y, mines, i, j;
+ gI16 x, y, mines, i, j;
minesFlags = 0;
minesGameOver = gFalse;
@@ -374,7 +374,7 @@ static void initField(void)
void minesStart(void)
{
- int16_t x, y;
+ gI16 x, y;
#if MINES_SHOW_SPLASH
gtimerStop(&minesSplashBlink);
diff --git a/demos/games/minesweeper/resources/romfs/userfonts.h b/demos/games/minesweeper/resources/romfs/userfonts.h
index e775aec0..232c8452 100644
--- a/demos/games/minesweeper/resources/romfs/userfonts.h
+++ b/demos/games/minesweeper/resources/romfs/userfonts.h
@@ -11,25 +11,25 @@
#error The font file is not compatible with this version of mcufont.
#endif
-static const uint8_t mf_rlefont_digital_7__mono_20_dictionary_data[39] = {
+static const gU8 mf_rlefont_digital_7__mono_20_dictionary_data[39] = {
0x81, 0x05, 0x81, 0x05, 0x81, 0x05, 0x81, 0x05, 0x81, 0x06, 0x80, 0x01, 0x07, 0x80, 0x05, 0x85,
0x05, 0x80, 0x81, 0x03, 0x03, 0x85, 0x0f, 0x44, 0x84, 0x85, 0x86, 0x88, 0x44, 0x44, 0x44, 0x44,
0x24, 0x84, 0x44, 0x44, 0x18, 0xc4, 0x83,
};
-static const uint16_t mf_rlefont_digital_7__mono_20_dictionary_offsets[13] = {
+static const gU16 mf_rlefont_digital_7__mono_20_dictionary_offsets[13] = {
0x0000, 0x0009, 0x000c, 0x000f, 0x0010, 0x0012, 0x0013, 0x0014,
0x0016, 0x001c, 0x0020, 0x0024, 0x0027,
};
-static const uint8_t mf_rlefont_digital_7__mono_20_glyph_data_0[63] = {
+static const gU8 mf_rlefont_digital_7__mono_20_glyph_data_0[63] = {
0x09, 0x1b, 0x18, 0x1c, 0x1a, 0x18, 0x1b, 0x09, 0x21, 0x19, 0x22, 0x21, 0x09, 0x83, 0x44, 0x21,
0x83, 0x20, 0x1f, 0x10, 0x09, 0x83, 0x44, 0x21, 0x82, 0x44, 0x21, 0x83, 0x09, 0x84, 0x23, 0x20,
0xec, 0x44, 0x09, 0x43, 0x20, 0x1f, 0x20, 0xec, 0x83, 0x09, 0x43, 0x20, 0x1f, 0x23, 0x0f, 0x09,
0x1b, 0x18, 0x22, 0x21, 0x09, 0x1b, 0x23, 0x23, 0x0f, 0x09, 0x1b, 0x23, 0x20, 0xec, 0x83,
};
-static const uint16_t mf_rlefont_digital_7__mono_20_glyph_offsets_0[10] = {
+static const gU16 mf_rlefont_digital_7__mono_20_glyph_offsets_0[10] = {
0x0000, 0x0007, 0x000c, 0x0014, 0x001c, 0x0022, 0x0029, 0x002f,
0x0034, 0x0039,
};
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)) {