diff options
Diffstat (limited to 'demos/games')
13 files changed, 135 insertions, 135 deletions
diff --git a/demos/games/justget10/jg10.c b/demos/games/justget10/jg10.c index f9974fe1..7d5f8a46 100644 --- a/demos/games/justget10/jg10.c +++ b/demos/games/justget10/jg10.c @@ -17,12 +17,12 @@ GHandle jg10SelectionWidgetGCreate(GDisplay* g, jg10WidgetObject* wo, GWidgetIni typedef struct { // Node properties uint8_t num; // Node number - bool_t check; // Node needs to be checked or not - bool_t sel; // Node selected or not + gBool check; // Node needs to be checked or not + gBool sel; // Node selected or not } nodeProps; nodeProps jg10Field[JG10_FIELD_WIDTH][JG10_FIELD_HEIGHT]; // jg10 field array -bool_t jg10GameOver = FALSE; +gBool jg10GameOver = gFalse; const char *jg10Graph[] = {"background.bmp", "1.bmp","2.bmp","3.bmp","4.bmp","5.bmp","6.bmp","7.bmp","8.bmp", "9.bmp", "10.bmp", "11.bmp", "12.bmp", "13.bmp", "14.bmp", "15.bmp", "16.bmp", "17.bmp", "18.bmp", "19.bmp", "20.bmp"}; // 21 elements (0-20) gdispImage jg10Image[JG10_MAX_COUNT]; #define JG10_ANIM_IMAGES 5 @@ -33,7 +33,7 @@ uint8_t jg10MaxVal=4; // Max v font_t font; #if JG10_SHOW_SPLASH GTimer jg10SplashBlink; -bool_t jg10SplashTxtVisible = FALSE; +gBool jg10SplashTxtVisible = gFalse; gdispImage jg10SplashImage; #endif @@ -86,16 +86,16 @@ static int uitoa(unsigned int value, char * buf, int max) { return n; } -static bool_t inRange(int16_t x, int16_t y) { - if ((x >= 0) && (x < JG10_FIELD_WIDTH) && (y >= 0) && (y < JG10_FIELD_HEIGHT)) return TRUE; else return FALSE; +static gBool inRange(int16_t x, int16_t 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; for (i = 0; i < JG10_FIELD_WIDTH; i++) { for (j = 0; j < JG10_FIELD_HEIGHT; j++) { - jg10Field[i][j].check = FALSE; - jg10Field[i][j].sel = FALSE; + jg10Field[i][j].check = gFalse; + jg10Field[i][j].sel = gFalse; } } } @@ -121,7 +121,7 @@ static void remove_Selected(void) { for (i = 0; i < JG10_FIELD_WIDTH; i++) { for (j = 0; j < JG10_FIELD_HEIGHT; j++) { if (jg10Field[i][j].sel) { - jg10Field[i][j].sel = FALSE; + jg10Field[i][j].sel = gFalse; jg10Field[i][j].num = 0; } } @@ -148,9 +148,9 @@ static uint8_t jg10_randomer(uint8_t max, uint8_t th) { static void movePiecesDown(void) { uint8_t tmp = 0; - bool_t needToCheck = TRUE; + gBool needToCheck = gTrue; while (needToCheck) { - needToCheck = FALSE; + needToCheck = gFalse; for (int8_t y = (JG10_FIELD_HEIGHT-1); y >= 0; y--) { for (uint8_t x = 0; x < JG10_FIELD_WIDTH; x++) { if (jg10Field[x][y].num == 0) { @@ -164,7 +164,7 @@ static void movePiecesDown(void) { jg10Field[x][tmpy].num = jg10Field[x][tmpy-1].num; } jg10Field[x][0].num = 0; - needToCheck = TRUE; + needToCheck = gTrue; } } } @@ -172,9 +172,9 @@ static void movePiecesDown(void) { } gwinRedraw(mainWin); // Add new pieces - needToCheck = TRUE; + needToCheck = gTrue; while (needToCheck) { - needToCheck = FALSE; + needToCheck = gFalse; for (int8_t y = (JG10_FIELD_HEIGHT-1); y >= 0; y--) { for (uint8_t x = 0; x < JG10_FIELD_WIDTH; x++) { if (jg10Field[x][y].num == 0) { @@ -182,7 +182,7 @@ static void movePiecesDown(void) { jg10Field[x][tmpy].num = jg10Field[x][tmpy-1].num; } jg10Field[x][0].num = jg10_randomer(jg10MaxVal, 3); - needToCheck = TRUE; + needToCheck = gTrue; } } } @@ -191,8 +191,8 @@ static void movePiecesDown(void) { } } -static bool_t checkForPossibleMove(void) { - bool_t canMove = FALSE; +static gBool checkForPossibleMove(void) { + gBool canMove = gFalse; uint16_t i ,j; for (i = 0; i < JG10_FIELD_WIDTH; i++) { for (j = 0; j < JG10_FIELD_HEIGHT; j++) { @@ -200,7 +200,7 @@ static bool_t checkForPossibleMove(void) { (inRange(i-1,j) && jg10Field[i-1][j].num == jg10Field[i][j].num) || (inRange(i,j+1) && jg10Field[i][j+1].num == jg10Field[i][j].num) || (inRange(i+1,j) && jg10Field[i+1][j].num == jg10Field[i][j].num)) { - canMove = TRUE; + canMove = gTrue; return canMove; } } @@ -242,10 +242,10 @@ static DECLARE_THREAD_FUNCTION(thdJg10, msg) { (inRange(x-1,y) && jg10Field[x-1][y].num == jg10Field[x][y].num) || (inRange(x,y+1) && jg10Field[x][y+1].num == jg10Field[x][y].num) || (inRange(x+1,y) && jg10Field[x+1][y].num == jg10Field[x][y].num)) { - gwinSetVisible(Jg10SelectWidget, FALSE); + gwinSetVisible(Jg10SelectWidget, gFalse); clean_SelCheck(); - jg10Field[x][y].check = TRUE; - gwinSetVisible(Jg10SelectWidget, TRUE); + jg10Field[x][y].check = gTrue; + gwinSetVisible(Jg10SelectWidget, gTrue); } } else { // already selected section clicked... @@ -254,19 +254,19 @@ static DECLARE_THREAD_FUNCTION(thdJg10, msg) { jg10MaxVal = jg10Field[x][y].num; if (jg10MaxVal >= 10) printCongrats(); if (jg10MaxVal == 20) { // Just in case someone got so far :D I cannot imaginge though - jg10GameOver = TRUE; + jg10GameOver = gTrue; printGameOver(); } } - jg10Field[x][y].sel = FALSE; - gwinSetVisible(Jg10SelectWidget, FALSE); + jg10Field[x][y].sel = gFalse; + gwinSetVisible(Jg10SelectWidget, gFalse); remove_Selected(); movePiecesDown(); if (checkForPossibleMove()) { clean_SelCheck(); //gwinRedraw(mainWin); } else { - jg10GameOver = TRUE; + jg10GameOver = gTrue; printGameOver(); } } @@ -284,11 +284,11 @@ static void initField(void) { //jg10Field[x][y].num = 1; // good for animation testing //jg10Field[x][y].num = x+x+5; // good to get high score fast //jg10Field[x][y].num = x+y+5; // good demo to check out pieces :D - jg10Field[x][y].check = FALSE; - jg10Field[x][y].sel = FALSE; + jg10Field[x][y].check = gFalse; + jg10Field[x][y].sel = gFalse; } } - jg10GameOver = FALSE; + jg10GameOver = gFalse; printGameOver(); } @@ -304,21 +304,21 @@ static void mainWinDraw(GWidgetObject* gw, void* param) { static void jg10SelectionWidget_Draw(GWidgetObject* gw, void* param) { int16_t x, y; - bool_t needToCheck = TRUE; + gBool needToCheck = gTrue; (void)param; while (needToCheck) { - needToCheck = FALSE; + needToCheck = gFalse; for (x = 0; x < JG10_FIELD_WIDTH; x++) { for (y = 0; y < JG10_FIELD_HEIGHT; y++) { if (jg10Field[x][y].check && !jg10Field[x][y].sel) { - jg10Field[x][y].sel = TRUE; - jg10Field[x][y].check = FALSE; + jg10Field[x][y].sel = gTrue; + jg10Field[x][y].check = gFalse; // Up if (inRange(x, y-1) && !jg10Field[x][y-1].sel && (jg10Field[x][y-1].num == jg10Field[x][y].num)) { - jg10Field[x][y-1].check = TRUE; - needToCheck = TRUE; + jg10Field[x][y-1].check = gTrue; + needToCheck = gTrue; } else if (!inRange(x, y-1) || (inRange(x, y-1) && !jg10Field[x][y-1].sel)) { // We need longer line if this is wide corner inside shape if (inRange(x+1, y) && inRange(x+1, y-1) && (jg10Field[x][y].num == jg10Field[x+1][y].num) && (jg10Field[x][y].num == jg10Field[x+1][y-1].num)) { @@ -329,8 +329,8 @@ static void jg10SelectionWidget_Draw(GWidgetObject* gw, void* param) { } // Down if (inRange(x, y+1) && !jg10Field[x][y+1].sel && (jg10Field[x][y+1].num == jg10Field[x][y].num)) { - jg10Field[x][y+1].check = TRUE; - needToCheck = TRUE; + jg10Field[x][y+1].check = gTrue; + needToCheck = gTrue; } else if (!inRange(x, y+1) || (inRange(x, y+1) && !jg10Field[x][y+1].sel)) { // We need longer line if this is wide corner inside shape if (inRange(x-1, y) && inRange(x-1, y+1) && (jg10Field[x][y].num == jg10Field[x-1][y].num) && (jg10Field[x][y].num == jg10Field[x-1][y+1].num)) { @@ -341,8 +341,8 @@ static void jg10SelectionWidget_Draw(GWidgetObject* gw, void* param) { } // Left if (inRange(x-1, y) && !jg10Field[x-1][y].sel && (jg10Field[x-1][y].num == jg10Field[x][y].num)) { - jg10Field[x-1][y].check = TRUE; - needToCheck = TRUE; + jg10Field[x-1][y].check = gTrue; + needToCheck = gTrue; } else if (!inRange(x-1, y) || (inRange(x-1, y) && !jg10Field[x-1][y].sel)) { // We need longer line if this is wide corner inside shape if (inRange(x, y-1) && inRange(x-1, y-1) && (jg10Field[x][y].num == jg10Field[x][y-1].num) && (jg10Field[x][y].num == jg10Field[x-1][y-1].num)) { @@ -353,8 +353,8 @@ static void jg10SelectionWidget_Draw(GWidgetObject* gw, void* param) { } // Right if (inRange(x+1, y) && !jg10Field[x+1][y].sel && (jg10Field[x+1][y].num == jg10Field[x][y].num)) { - jg10Field[x+1][y].check = TRUE; - needToCheck = TRUE; + jg10Field[x+1][y].check = gTrue; + needToCheck = gTrue; } else if (!inRange(x+1, y) || (inRange(x+1, y) && !jg10Field[x+1][y].sel)) { // We need longer line if this is wide corner inside shape if (inRange(x, y+1) && inRange(x+1, y+1) && (jg10Field[x][y].num == jg10Field[x][y+1].num) && (jg10Field[x][y].num == jg10Field[x+1][y+1].num)) { @@ -422,7 +422,7 @@ static void createMainWin(void) { GWidgetInit wi; gwinWidgetClearInit(&wi); // Container - mainWin - wi.g.show = FALSE; + wi.g.show = gFalse; wi.g.x = 0; wi.g.y = 0; wi.g.width = gdispGetWidth(); @@ -435,7 +435,7 @@ static void createMainWin(void) { mainWin = gwinContainerCreate(0, &wi, 0); // create selection widget - wi.g.show = FALSE; + wi.g.show = gFalse; wi.g.x = 0; wi.g.y = 0; wi.g.width = 272; @@ -496,6 +496,6 @@ void jg10ShowSplash(void) { gdispImageOpenFile(&jg10SplashImage, "splash.bmp"); gdispImageDraw(&jg10SplashImage, (gdispGetWidth()/2)-150, (gdispGetHeight()/2)-100, 300, 200, 0, 0); gdispImageClose(&jg10SplashImage); - gtimerStart(&jg10SplashBlink, jg10SplashBlinker, 0, TRUE, 400); + gtimerStart(&jg10SplashBlink, jg10SplashBlinker, 0, gTrue, 400); } #endif
\ No newline at end of file diff --git a/demos/games/justget10/main.c b/demos/games/justget10/main.c index 29749686..d4238fed 100644 --- a/demos/games/justget10/main.c +++ b/demos/games/justget10/main.c @@ -21,7 +21,7 @@ int main(void) gdispCloseFont(font); #endif - while (TRUE) { + while (1) { ginputGetMouseStatus(0, &ev); if (ev.buttons & GINPUT_MOUSE_BTN_LEFT) { while (ev.buttons & GINPUT_MOUSE_BTN_LEFT) { // Wait until release diff --git a/demos/games/minesweeper/main.c b/demos/games/minesweeper/main.c index e7a105bf..54b79743 100644 --- a/demos/games/minesweeper/main.c +++ b/demos/games/minesweeper/main.c @@ -55,7 +55,7 @@ int main(void) gdispCloseFont(font); #endif - while (TRUE) { + while (1) { ginputGetMouseStatus(0, &ev); if (ev.buttons & GINPUT_MOUSE_BTN_LEFT) { while (ev.buttons & GINPUT_MOUSE_BTN_LEFT) { // Wait until release diff --git a/demos/games/minesweeper/mines.c b/demos/games/minesweeper/mines.c index 8b0cd292..1b58fc6b 100644 --- a/demos/games/minesweeper/mines.c +++ b/demos/games/minesweeper/mines.c @@ -4,16 +4,16 @@ typedef struct { // Node properties uint8_t num; // Node number, how many mines around - bool_t open; // Node shown or hidden - bool_t check; // Node needs to be checked or not, used for opening up empty nodes - bool_t flag; // Node is marked with flag by player + 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" } nodeProps; static GEventMouse ev; static nodeProps minesField[MINES_FIELD_WIDTH][MINES_FIELD_HEIGHT]; // Mines field array -static bool_t minesGameOver = FALSE; -static bool_t minesGameWinner = FALSE; +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 @@ -22,8 +22,8 @@ static const char* minesGraph[] = {"1.bmp","2.bmp","3.bmp","4.bmp","5.bmp","6.bm static gdispImage minesImage; static uint8_t minesStatusIconWidth = 0; static uint8_t minesStatusIconHeight = 0; -static bool_t minesFirstGame = TRUE; // Just don't clear field for the first time, as we have black screen already... :/ -static bool_t minesSplashTxtVisible = FALSE; +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 static GTimer minesSplashBlink; #endif @@ -125,19 +125,19 @@ static void minesTimeCounter(void* arg) minesUpdateTime(); } -static bool_t inRange(int16_t x, int16_t y) +static gBool inRange(int16_t x, int16_t y) { if ((x >= 0) && (x < MINES_FIELD_WIDTH) && (y >= 0) && (y < MINES_FIELD_HEIGHT)) - return TRUE; + return gTrue; else - return FALSE; + return gFalse; } static void showOne(int16_t x, int16_t y) { - minesField[x][y].open = TRUE; + minesField[x][y].open = gTrue; if (minesField[x][y].flag) { - minesField[x][y].flag = FALSE; + minesField[x][y].flag = gFalse; minesFlags--; } @@ -149,8 +149,8 @@ static void showOne(int16_t x, int16_t y) gdispImageClose(&minesImage); minesEmptyNodes--; } else if (minesField[x][y].num == 9) { - minesGameOver = TRUE; - minesGameWinner = FALSE; + minesGameOver = gTrue; + minesGameWinner = gFalse; gdispImageOpenFile(&minesImage, minesGraph[10]); gdispImageDraw(&minesImage, (x*MINES_CELL_HEIGHT)+1, (y*MINES_CELL_WIDTH)+1, MINES_CELL_WIDTH, MINES_CELL_HEIGHT, 0, 0); gdispImageClose(&minesImage); @@ -160,7 +160,7 @@ static void showOne(int16_t x, int16_t y) gdispImageOpenFile(&minesImage, minesGraph[9]); gdispImageDraw(&minesImage, (x*MINES_CELL_HEIGHT)+1, (y*MINES_CELL_WIDTH)+1, MINES_CELL_WIDTH, MINES_CELL_HEIGHT, 0, 0); gdispImageClose(&minesImage); - minesField[x][y].check = TRUE; + minesField[x][y].check = gTrue; minesEmptyNodes--; } } @@ -168,10 +168,10 @@ static void showOne(int16_t x, int16_t y) static void openEmptyNodes(void) { int16_t x, y, i, j; - bool_t needToCheck = TRUE; + gBool needToCheck = gTrue; while (needToCheck) { - needToCheck = FALSE; + needToCheck = gFalse; for (x = 0; x < MINES_FIELD_WIDTH; x++) { for (y = 0; y < MINES_FIELD_HEIGHT; y++) { if (minesField[x][y].check) { @@ -180,12 +180,12 @@ static void openEmptyNodes(void) if ((i != 0) || (j != 0)) { // We don't need to check middle node as it is the one we are checking right now! :D if (inRange(x+i,y+j)) { if (!minesField[x+i][y+j].open) showOne(x+i,y+j); - if (minesField[x+i][y+j].check) needToCheck = TRUE; + if (minesField[x+i][y+j].check) needToCheck = gTrue; } } } } - minesField[x][y].check = FALSE; + minesField[x][y].check = gFalse; } } } @@ -196,15 +196,15 @@ static DECLARE_THREAD_FUNCTION(thdMines, msg) { (void)msg; uint16_t x,y, delay; - bool_t delayed = FALSE; + gBool delayed = gFalse; while (!minesGameOver) { if (minesEmptyNodes == 0) { - minesGameOver = TRUE; - minesGameWinner = TRUE; + minesGameOver = gTrue; + minesGameWinner = gTrue; } initRng(); ginputGetMouseStatus(0, &ev); - delayed = FALSE; + delayed = gFalse; if (ev.buttons & GINPUT_MOUSE_BTN_LEFT) { x = ev.x/MINES_CELL_WIDTH; y = ev.y/MINES_CELL_WIDTH; @@ -220,18 +220,18 @@ static DECLARE_THREAD_FUNCTION(thdMines, msg) gdispImageOpenFile(&minesImage, minesGraph[8]); gdispImageDraw(&minesImage, (x*MINES_CELL_HEIGHT)+1, (y*MINES_CELL_WIDTH)+1, MINES_CELL_WIDTH-1, MINES_CELL_HEIGHT-1, 0, 0); gdispImageClose(&minesImage); - minesField[x][y].flag = FALSE; + minesField[x][y].flag = gFalse; minesFlags--; printStats(); } else { gdispImageOpenFile(&minesImage, minesGraph[11]); gdispImageDraw(&minesImage, (x*MINES_CELL_HEIGHT)+1, (y*MINES_CELL_WIDTH)+1, MINES_CELL_WIDTH, MINES_CELL_HEIGHT, 0, 0); gdispImageClose(&minesImage); - minesField[x][y].flag = TRUE; + minesField[x][y].flag = gTrue; minesFlags++; printStats(); } - delayed = TRUE; + delayed = gTrue; } } } @@ -268,7 +268,7 @@ static void initField(void) int16_t x, y, mines, i, j; minesFlags = 0; - minesGameOver = FALSE; + minesGameOver = gFalse; printGameOver(); font_t font = gdispOpenFont("fixed_5x8"); @@ -291,9 +291,9 @@ static void initField(void) for (x = 0; x < MINES_FIELD_WIDTH; x++) { for (y = 0; y < MINES_FIELD_HEIGHT; y++) { minesField[x][y].num = 0; - minesField[x][y].open = FALSE; - minesField[x][y].check = FALSE; - minesField[x][y].flag = FALSE; + minesField[x][y].open = gFalse; + minesField[x][y].check = gFalse; + minesField[x][y].flag = gFalse; minesField[x][y].fieldNum = i; i++; } @@ -322,7 +322,7 @@ static void initField(void) } } } else { - minesFirstGame = FALSE; + minesFirstGame = gFalse; } // Drawing closed nodes randomly @@ -369,7 +369,7 @@ static void initField(void) minesTime = 0; minesUpdateTime(); - gtimerStart(&minesTimeCounterTimer, minesTimeCounter, 0, TRUE, 1000); + gtimerStart(&minesTimeCounterTimer, minesTimeCounter, 0, gTrue, 1000); } void minesStart(void) @@ -434,7 +434,7 @@ void minesStart(void) gdispImageDraw(&minesImage, (gdispGetWidth()/2)-150, (gdispGetHeight()/2)-100, 300, 200, 0, 0); gdispImageClose(&minesImage); - gtimerStart(&minesSplashBlink, minesSplashBlinker, 0, TRUE, 400); + gtimerStart(&minesSplashBlink, minesSplashBlinker, 0, gTrue, 400); } #endif diff --git a/demos/games/tetris/Example_Makefiles/stm32f4/board_SSD1289.h b/demos/games/tetris/Example_Makefiles/stm32f4/board_SSD1289.h index 833ebdb4..dc3580e6 100644 --- a/demos/games/tetris/Example_Makefiles/stm32f4/board_SSD1289.h +++ b/demos/games/tetris/Example_Makefiles/stm32f4/board_SSD1289.h @@ -111,7 +111,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } 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 39538747..0568d4e5 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 @@ -26,7 +26,7 @@ static GFXINLINE void init_board(void) spiStart(&SPID1, &spicfg); } -static GFXINLINE bool_t getpin_pressed(void) +static GFXINLINE gBool getpin_pressed(void) { return (!palReadPad(GPIOC, 4)); } 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 dc8e979e..1af92bb2 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 @@ -45,12 +45,12 @@ static const SPIConfig spicfg = { // How much extra data to allocate at the end of the GMouse structure for the board's use #define GMOUSE_ADS7843_BOARD_DATA_SIZE 0 -static bool_t init_board(GMouse* m, unsigned driverinstance) { +static gBool init_board(GMouse* m, unsigned driverinstance) { (void)m; // Only one touch interface on this board if (driverinstance) - return FALSE; + return gFalse; // Set the GPIO modes palSetPadMode(GPIOC, 6, PAL_MODE_OUTPUT_PUSHPULL); @@ -62,10 +62,10 @@ static bool_t init_board(GMouse* m, unsigned driverinstance) { // Start the SPI peripheral spiStart(&SPID1, &spicfg); - return TRUE; + return gTrue; } -static GFXINLINE bool_t getpin_pressed(GMouse* m) { +static GFXINLINE gBool getpin_pressed(GMouse* m) { (void) m; return (!palReadPad(GPIOC, 4)); 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 77d82bf8..70a22ee3 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 @@ -22,13 +22,13 @@ static const SPIConfig spicfg = { /* SPI_CR1_BR_2 |*/ SPI_CR1_BR_1 | SPI_CR1_BR_0, }; -static bool_t init_board(GMouse* m, unsigned driverinstance) +static gBool init_board(GMouse* m, unsigned driverinstance) { (void)m; // Only one touch interface on this board if (driverinstance) - return FALSE; + return gFalse; // Set the GPIO modes palSetPadMode(GPIOC, 6, PAL_MODE_OUTPUT_PUSHPULL); @@ -40,10 +40,10 @@ static bool_t init_board(GMouse* m, unsigned driverinstance) // Start the SPI peripheral spiStart(&SPID1, &spicfg); - return TRUE; + return gTrue; } -GFXINLINE bool_t getpin_pressed(void) { +GFXINLINE gBool getpin_pressed(void) { return (!palReadPad(GPIOC, 4)); } 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 a74507e5..7e2bb05d 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 @@ -109,7 +109,7 @@ static GFXINLINE void post_init_board(GDisplay *g) { (void) g; } -static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { +static GFXINLINE void setpin_reset(GDisplay *g, gBool state) { (void) g; (void) state; } 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 39538747..0568d4e5 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 @@ -26,7 +26,7 @@ static GFXINLINE void init_board(void) spiStart(&SPID1, &spicfg); } -static GFXINLINE bool_t getpin_pressed(void) +static GFXINLINE gBool getpin_pressed(void) { return (!palReadPad(GPIOC, 4)); } 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 77d82bf8..70a22ee3 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 @@ -22,13 +22,13 @@ static const SPIConfig spicfg = { /* SPI_CR1_BR_2 |*/ SPI_CR1_BR_1 | SPI_CR1_BR_0, }; -static bool_t init_board(GMouse* m, unsigned driverinstance) +static gBool init_board(GMouse* m, unsigned driverinstance) { (void)m; // Only one touch interface on this board if (driverinstance) - return FALSE; + return gFalse; // Set the GPIO modes palSetPadMode(GPIOC, 6, PAL_MODE_OUTPUT_PUSHPULL); @@ -40,10 +40,10 @@ static bool_t init_board(GMouse* m, unsigned driverinstance) // Start the SPI peripheral spiStart(&SPID1, &spicfg); - return TRUE; + return gTrue; } -GFXINLINE bool_t getpin_pressed(void) { +GFXINLINE gBool getpin_pressed(void) { return (!palReadPad(GPIOC, 4)); } diff --git a/demos/games/tetris/main.c b/demos/games/tetris/main.c index ffbccf6c..705813ab 100644 --- a/demos/games/tetris/main.c +++ b/demos/games/tetris/main.c @@ -43,7 +43,7 @@ int main(void) tetrisInit(); - while (TRUE) { + while (1) { // Start a new game // Will return when game is over tetrisStart(); diff --git a/demos/games/tetris/tetris.c b/demos/games/tetris/tetris.c index ed924781..cf73c978 100644 --- a/demos/games/tetris/tetris.c +++ b/demos/games/tetris/tetris.c @@ -86,9 +86,9 @@ int tetrisOldShape[4][2]; int tetrisNextShapeNum, tetrisOldShapeNum; unsigned long tetrisLines = 0; unsigned long tetrisScore = 0; -bool_t tetrisKeysPressed[5] = {FALSE, FALSE, FALSE, FALSE, FALSE}; // left/down/right/up/pause -bool_t tetrisPaused = FALSE; -bool_t tetrisGameOver = FALSE; +gBool tetrisKeysPressed[5] = {gFalse, gFalse, gFalse, gFalse, gFalse}; // left/down/right/up/pause +gBool tetrisPaused = gFalse; +gBool tetrisGameOver = gFalse; font_t font16; font_t font12; @@ -274,34 +274,34 @@ static void printTouchAreas(void) { gdispDrawLine(gdispGetWidth()-(gdispGetWidth()/4), gdispGetHeight()-gdispGetHeight()/4, gdispGetWidth()-(gdispGetWidth()/4), gdispGetHeight()-1, GFX_GRAY); } -static bool_t stay(bool_t down) { +static gBool stay(gBool down) { int sk, k; - bool_t stay; - if (down == TRUE) sk = 1; else sk = 0; - stay = FALSE; + gBool stay; + if (down) sk = 1; else sk = 0; + stay = gFalse; for (k = 0; k <= 3; k++) { if (tetrisCurrentShape[k][1] == 0) { - return TRUE; + return gTrue; } } for (k = 0; k <= 3; k++) { - if ((tetrisCurrentShape[k][0] < 0) || (tetrisCurrentShape[k][0] > 9)) return TRUE; + if ((tetrisCurrentShape[k][0] < 0) || (tetrisCurrentShape[k][0] > 9)) return gTrue; if (tetrisCurrentShape[k][1] <= 16) - if (tetrisField[tetrisCurrentShape[k][1]-sk][tetrisCurrentShape[k][0]] != 0) return TRUE; + if (tetrisField[tetrisCurrentShape[k][1]-sk][tetrisCurrentShape[k][0]] != 0) return gTrue; } return stay; } static void clearCompleteLines(void) { - bool_t t; + gBool t; uint8_t reiz = 0; int l,k,j; l = 0; while (l <= 16) { - t = TRUE; + t = gTrue; for (j = 0; j <= 9; j++) - if (tetrisField[l][j] == 0) t = FALSE; - if (t == TRUE) { + if (tetrisField[l][j] == 0) t = gFalse; + if (t) { for (j = 4; j >= 0; j--) { // cheap & dirty line removal animation :D drawCell(j,l, 0); drawCell(9-j,l, 0); @@ -331,7 +331,7 @@ static void clearCompleteLines(void) { static void goDown(void) { int i; - if (stay(TRUE) == FALSE) { + if (!stay(gTrue)) { drawShape(0); for (i = 0; i <= 3; i++) { tetrisCurrentShape[i][1]--; @@ -340,7 +340,7 @@ static void goDown(void) { } else { for (i = 0; i <= 3; i++) { if (tetrisCurrentShape[i][1] >=17) { - tetrisGameOver = TRUE; + tetrisGameOver = gTrue; return; } else { tetrisField[tetrisCurrentShape[i][1]][tetrisCurrentShape[i][0]] = tetrisOldShapeNum+1; @@ -348,8 +348,8 @@ static void goDown(void) { } clearCompleteLines(); createShape(); - if (stay(FALSE) == TRUE) { - tetrisGameOver = TRUE; + if (stay(gFalse)) { + tetrisGameOver = gTrue; return; } drawShape(tetrisOldShapeNum+1); @@ -383,7 +383,7 @@ static void rotateShape(void) { tetrisCurrentShape[i][0] = ox+(round((tx-ox)*cos(90*(3.14/180))-(ty-oy)*sin(90*(3.14/180)))); tetrisCurrentShape[i][1] = oy+(round((tx-ox)*sin(90*(3.14/180))+(ty-oy)*cos(90*(3.14/180)))); } - if (stay(FALSE) == FALSE) { + if (!stay(gFalse)) { memcpy(tetrisNextShape, tetrisCurrentShape, sizeof(tetrisNextShape)); // tetrisNextShape = tetrisCurrentShape; memcpy(tetrisCurrentShape, tetrisOldShape, sizeof(tetrisCurrentShape)); // tetrisCurrentShape = tetrisOldShape; drawShape(0); @@ -394,20 +394,20 @@ static void rotateShape(void) { } } -static bool_t checkSides(bool_t left) { +static gBool checkSides(gBool left) { int sk,k; - if (left == TRUE) sk = 1; else sk = -1; + if (left) sk = 1; else sk = -1; for (k = 0; k <= 3; k++) { - if ((tetrisCurrentShape[k][0]+sk < 0) || (tetrisCurrentShape[k][0]+sk > 9)) return TRUE; + if ((tetrisCurrentShape[k][0]+sk < 0) || (tetrisCurrentShape[k][0]+sk > 9)) return gTrue; if (tetrisCurrentShape[k][1] <= 16) - if (tetrisField[tetrisCurrentShape[k][1]][tetrisCurrentShape[k][0]+sk] != 0) return TRUE; + if (tetrisField[tetrisCurrentShape[k][1]][tetrisCurrentShape[k][0]+sk] != 0) return gTrue; } - return FALSE; + return gFalse; } static void goRight(void) { int i; - if (checkSides(TRUE) == FALSE) { + if (!checkSides(gTrue)) { drawShape(0); for (i = 0; i <= 3; i++) { tetrisCurrentShape[i][0]++; @@ -418,7 +418,7 @@ static void goRight(void) { static void goLeft(void) { int i; - if (checkSides(FALSE) == FALSE) { + if (!checkSides(gFalse)) { drawShape(0); for (i = 0; i <= 3; i++) { tetrisCurrentShape[i][0]--; @@ -434,8 +434,8 @@ static DECLARE_THREAD_FUNCTION(thdTetris, arg) { // key handling if (gfxSystemTicks() - tetrisPreviousKeyTime >= gfxMillisecondsToTicks(tetrisKeySpeed) || gfxSystemTicks() <= gfxMillisecondsToTicks(tetrisKeySpeed)) { for (i = 0; i < sizeof(tetrisKeysPressed); i++) { - if (tetrisKeysPressed[i] == TRUE) { - tetrisKeysPressed[i] = FALSE; + if (tetrisKeysPressed[i]) { + tetrisKeysPressed[i] = gFalse; } } tetrisPreviousKeyTime = gfxSystemTicks(); @@ -447,28 +447,28 @@ static DECLARE_THREAD_FUNCTION(thdTetris, arg) { tetrisPreviousGameTime = gfxSystemTicks(); } if (!(ev.buttons & GINPUT_MOUSE_BTN_LEFT)) continue; - if (ev.x <= gdispGetWidth()/4 && ev.y >= gdispGetHeight()-(gdispGetHeight()/4) && tetrisKeysPressed[0] == FALSE && !tetrisPaused) { + if (ev.x <= gdispGetWidth()/4 && ev.y >= gdispGetHeight()-(gdispGetHeight()/4) && !tetrisKeysPressed[0] && !tetrisPaused) { goLeft(); - tetrisKeysPressed[0] = TRUE; + tetrisKeysPressed[0] = gTrue; tetrisPreviousKeyTime = gfxSystemTicks(); } - if (ev.x > gdispGetWidth()-(gdispGetWidth()/4) && ev.y >= gdispGetHeight()-(gdispGetHeight()/4) && tetrisKeysPressed[2] == FALSE && !tetrisPaused) { + if (ev.x > gdispGetWidth()-(gdispGetWidth()/4) && ev.y >= gdispGetHeight()-(gdispGetHeight()/4) && !tetrisKeysPressed[2] && !tetrisPaused) { goRight(); - tetrisKeysPressed[2] = TRUE; + tetrisKeysPressed[2] = gTrue; tetrisPreviousKeyTime = gfxSystemTicks(); } - if (ev.y > gdispGetHeight()/4 && ev.y < gdispGetHeight()-(gdispGetHeight()/4) && tetrisKeysPressed[3] == FALSE && !tetrisPaused) { + if (ev.y > gdispGetHeight()/4 && ev.y < gdispGetHeight()-(gdispGetHeight()/4) && !tetrisKeysPressed[3] && !tetrisPaused) { rotateShape(); - tetrisKeysPressed[3] = TRUE; + tetrisKeysPressed[3] = gTrue; tetrisPreviousKeyTime = gfxSystemTicks(); } - if (ev.x > gdispGetWidth()/4 && ev.x <= gdispGetWidth()-(gdispGetWidth()/4) && ev.y >= gdispGetHeight()-(gdispGetHeight()/4) && tetrisKeysPressed[1] == FALSE && !tetrisPaused) { + if (ev.x > gdispGetWidth()/4 && ev.x <= gdispGetWidth()-(gdispGetWidth()/4) && ev.y >= gdispGetHeight()-(gdispGetHeight()/4) && !tetrisKeysPressed[1] && !tetrisPaused) { goDown(); - tetrisKeysPressed[1] = TRUE; + tetrisKeysPressed[1] = gTrue; tetrisPreviousKeyTime = gfxSystemTicks(); } - if (ev.y <= gdispGetHeight()/4 && tetrisKeysPressed[4] == FALSE) { - tetrisKeysPressed[4] = TRUE; + if (ev.y <= gdispGetHeight()/4 && !tetrisKeysPressed[4]) { + tetrisKeysPressed[4] = gTrue; tetrisPaused = !tetrisPaused; printPaused(); tetrisPreviousKeyTime = gfxSystemTicks(); @@ -495,8 +495,8 @@ void tetrisStart(void) { // Away we go initField(); - tetrisGameOver = FALSE; - printGameOver(); // removes "Game Over!" if tetrisGameOver == FALSE + tetrisGameOver = gFalse; + printGameOver(); // removes "Game Over!" if tetrisGameOver == gFalse tetrisPreviousGameTime = gfxSystemTicks(); gfxThreadCreate(0, 1024, NORMAL_PRIORITY, thdTetris, 0); while (!tetrisGameOver) { |