diff options
Diffstat (limited to 'demos/games')
-rw-r--r-- | demos/games/justget10/demo.mk | 2 | ||||
-rw-r--r-- | demos/games/justget10/gfxconf.h | 82 | ||||
-rw-r--r-- | demos/games/justget10/jg10.c | 12 | ||||
-rw-r--r-- | demos/games/justget10/jg10.h | 2 | ||||
-rw-r--r-- | demos/games/justget10/main.c | 4 | ||||
-rw-r--r-- | demos/games/minesweeper/demo.mk | 2 | ||||
-rw-r--r-- | demos/games/minesweeper/gfxconf.h | 45 | ||||
-rw-r--r-- | demos/games/minesweeper/main.c | 2 | ||||
-rw-r--r-- | demos/games/minesweeper/mines.c | 26 | ||||
-rw-r--r-- | demos/games/minesweeper/readme.txt | 2 | ||||
-rw-r--r-- | demos/games/tetris/Example_Makefiles/stm32f4/Makefile | 2 | ||||
-rw-r--r-- | demos/games/tetris/gfxconf.h | 40 | ||||
-rw-r--r-- | demos/games/tetris/tetris.c | 48 |
13 files changed, 134 insertions, 135 deletions
diff --git a/demos/games/justget10/demo.mk b/demos/games/justget10/demo.mk index 1487808b..9e58121c 100644 --- a/demos/games/justget10/demo.mk +++ b/demos/games/justget10/demo.mk @@ -6,4 +6,4 @@ GFXINC += $(DEMODIR) \ GFXSRC += $(DEMODIR)/main.c \ $(DEMODIR)/jg10.c -DEFS += -DJG10_SHOW_SPLASH=TRUE +DEFS += -DJG10_SHOW_SPLASH=GFXON diff --git a/demos/games/justget10/gfxconf.h b/demos/games/justget10/gfxconf.h index 9cfb3859..834b4a9d 100644 --- a/demos/games/justget10/gfxconf.h +++ b/demos/games/justget10/gfxconf.h @@ -31,65 +31,65 @@ #define _GFXCONF_H /* GFX sub-systems to turn on */ -#define GFX_USE_GDISP TRUE -#define GFX_USE_GEVENT TRUE -#define GFX_USE_GTIMER TRUE -#define GFX_USE_GINPUT TRUE +#define GFX_USE_GDISP GFXON +#define GFX_USE_GEVENT GFXON +#define GFX_USE_GTIMER GFXON +#define GFX_USE_GINPUT GFXON -#define GFX_USE_GFILE TRUE -#define GFILE_NEED_ROMFS TRUE +#define GFX_USE_GFILE GFXON +#define GFILE_NEED_ROMFS GFXON #define GFILE_MAX_GFILES 24 /* Features for the GDISP sub-system. */ -#define GDISP_NEED_CONTROL TRUE -#define GDISP_NEED_VALIDATION TRUE -#define GDISP_NEED_CLIP TRUE -#define GDISP_NEED_TEXT TRUE -#define GDISP_NEED_MULTITHREAD TRUE -#define GDISP_NEED_IMAGE TRUE -#define GDISP_NEED_IMAGE_BMP TRUE -#define GDISP_NEED_CIRCLE TRUE -#define GDISP_NEED_ELLIPSE TRUE -#define GDISP_NEED_ARC TRUE -#define GDISP_NEED_STARTUP_LOGO FALSE +#define GDISP_NEED_CONTROL GFXON +#define GDISP_NEED_VALIDATION GFXON +#define GDISP_NEED_CLIP GFXON +#define GDISP_NEED_TEXT GFXON +#define GDISP_NEED_MULTITHREAD GFXON +#define GDISP_NEED_IMAGE GFXON +#define GDISP_NEED_IMAGE_BMP GFXON +#define GDISP_NEED_CIRCLE GFXON +#define GDISP_NEED_ELLIPSE GFXON +#define GDISP_NEED_ARC GFXON +#define GDISP_NEED_STARTUP_LOGO GFXOFF ////////////////// -#define GFX_USE_GWIN TRUE +#define GFX_USE_GWIN GFXON -#define GWIN_NEED_WINDOWMANAGER TRUE -#define GQUEUE_NEED_ASYNC TRUE -#define GFX_USE_GQUEUE TRUE -#define GWIN_REDRAW_IMMEDIATE TRUE -#define GWIN_REDRAW_SINGLEOP TRUE +#define GWIN_NEED_WINDOWMANAGER GFXON +#define GQUEUE_NEED_ASYNC GFXON +#define GFX_USE_GQUEUE GFXON +#define GWIN_REDRAW_IMMEDIATE GFXON +#define GWIN_REDRAW_SINGLEOP GFXON -#define GWIN_NEED_WIDGET TRUE -#define GWIN_NEED_BUTTON TRUE -#define GWIN_BUTTON_LAZY_RELEASE FALSE -#define GWIN_NEED_SLIDER TRUE -#define GWIN_FLAT_STYLING FALSE +#define GWIN_NEED_WIDGET GFXON +#define GWIN_NEED_BUTTON GFXON +#define GWIN_BUTTON_LAZY_RELEASE GFXOFF +#define GWIN_NEED_SLIDER GFXON +#define GWIN_FLAT_STYLING GFXOFF -#define GWIN_NEED_CONTAINERS TRUE -#define GWIN_NEED_CONTAINER TRUE -#define GWIN_NEED_FRAME FALSE -#define GWIN_NEED_TABSET FALSE +#define GWIN_NEED_CONTAINERS GFXON +#define GWIN_NEED_CONTAINER GFXON +#define GWIN_NEED_FRAME GFXOFF +#define GWIN_NEED_TABSET GFXOFF -#define GWIN_NEED_CONSOLE TRUE - #define GWIN_CONSOLE_USE_HISTORY TRUE - #define GWIN_CONSOLE_HISTORY_AVERAGING TRUE - #define GWIN_CONSOLE_HISTORY_ATCREATE TRUE - #define GWIN_CONSOLE_ESCSEQ TRUE - #define GWIN_CONSOLE_USE_BASESTREAM TRUE -#define GWIN_NEED_GRAPH TRUE +#define GWIN_NEED_CONSOLE GFXON + #define GWIN_CONSOLE_USE_HISTORY GFXON + #define GWIN_CONSOLE_HISTORY_AVERAGING GFXON + #define GWIN_CONSOLE_HISTORY_ATCREATE GFXON + #define GWIN_CONSOLE_ESCSEQ GFXON + #define GWIN_CONSOLE_USE_BASESTREAM GFXON +#define GWIN_NEED_GRAPH GFXON /* Builtin Fonts */ -#define GDISP_INCLUDE_FONT_DEJAVUSANS16 TRUE +#define GDISP_INCLUDE_FONT_DEJAVUSANS16 GFXON /* Features for the GINPUT sub-system. */ -#define GINPUT_NEED_MOUSE TRUE +#define GINPUT_NEED_MOUSE GFXON #endif /* _GFXCONF_H */ diff --git a/demos/games/justget10/jg10.c b/demos/games/justget10/jg10.c index 6ea4e951..f9974fe1 100644 --- a/demos/games/justget10/jg10.c +++ b/demos/games/justget10/jg10.c @@ -209,18 +209,18 @@ static bool_t checkForPossibleMove(void) { } static void printGameOver(void) { - gdispFillArea(JG10_TOTAL_FIELD_WIDTH, (gdispGetHeight()/2)-10, gdispGetWidth()-JG10_TOTAL_FIELD_WIDTH, 80, Black); + gdispFillArea(JG10_TOTAL_FIELD_WIDTH, (gdispGetHeight()/2)-10, gdispGetWidth()-JG10_TOTAL_FIELD_WIDTH, 80, GFX_BLACK); if (jg10GameOver) { - gdispDrawString(JG10_TOTAL_FIELD_WIDTH+((gdispGetWidth()-JG10_TOTAL_FIELD_WIDTH)/2)-(gdispGetStringWidth("Game Over", font)/2), gdispGetHeight()/2, "Game Over", font, White); + gdispDrawString(JG10_TOTAL_FIELD_WIDTH+((gdispGetWidth()-JG10_TOTAL_FIELD_WIDTH)/2)-(gdispGetStringWidth("Game Over", font)/2), gdispGetHeight()/2, "Game Over", font, GFX_WHITE); } } static void printCongrats(void) { char pps_str[3]; - gdispFillArea(JG10_TOTAL_FIELD_WIDTH, (gdispGetHeight()/2)-10, gdispGetWidth()-JG10_TOTAL_FIELD_WIDTH, 80, Black); - gdispDrawString(JG10_TOTAL_FIELD_WIDTH+((gdispGetWidth()-JG10_TOTAL_FIELD_WIDTH)/2)-(gdispGetStringWidth("Congrats, now try to get", font)/2), gdispGetHeight()/2, "Congrats, now try to get", font, White); + gdispFillArea(JG10_TOTAL_FIELD_WIDTH, (gdispGetHeight()/2)-10, gdispGetWidth()-JG10_TOTAL_FIELD_WIDTH, 80, GFX_BLACK); + gdispDrawString(JG10_TOTAL_FIELD_WIDTH+((gdispGetWidth()-JG10_TOTAL_FIELD_WIDTH)/2)-(gdispGetStringWidth("Congrats, now try to get", font)/2), gdispGetHeight()/2, "Congrats, now try to get", font, GFX_WHITE); uitoa(jg10MaxVal+1, pps_str, sizeof(pps_str)); - gdispDrawString(JG10_TOTAL_FIELD_WIDTH+((gdispGetWidth()-JG10_TOTAL_FIELD_WIDTH)/2)-(gdispGetStringWidth(pps_str, font)/2), (gdispGetHeight()/2)+20, pps_str, font, Red); + gdispDrawString(JG10_TOTAL_FIELD_WIDTH+((gdispGetWidth()-JG10_TOTAL_FIELD_WIDTH)/2)-(gdispGetStringWidth(pps_str, font)/2), (gdispGetHeight()/2)+20, pps_str, font, GFX_RED); } static DECLARE_THREAD_FUNCTION(thdJg10, msg) { @@ -456,7 +456,7 @@ void guiCreate(void) { void jg10Start(void) { #if JG10_SHOW_SPLASH gtimerStop(&jg10SplashBlink); - gdispClear(Black); + gdispClear(GFX_BLACK); #endif initField(); guiCreate(); diff --git a/demos/games/justget10/jg10.h b/demos/games/justget10/jg10.h index 58e76570..7ee5ea37 100644 --- a/demos/games/justget10/jg10.h +++ b/demos/games/justget10/jg10.h @@ -7,7 +7,7 @@ #define JG10_FIELD_HEIGHT 5 #define JG10_TOTAL_FIELD_WIDTH (JG10_FIELD_WIDTH*JG10_CELL_WIDTH) #define JG10_TOTAL_FIELD_HEIGHT (JG10_FIELD_HEIGHT*JG10_CELL_HEIGHT) -#define JG10_SEL_COLOR Yellow +#define JG10_SEL_COLOR GFX_YELLOW #define JG10_MAX_COUNT 21 // Max number you can get +1, so if max number would be 20, then this number should be 21 (+ background) void jg10Init(void); diff --git a/demos/games/justget10/main.c b/demos/games/justget10/main.c index 11ee13c7..29749686 100644 --- a/demos/games/justget10/main.c +++ b/demos/games/justget10/main.c @@ -17,7 +17,7 @@ int main(void) jg10ShowSplash(); #else font = gdispOpenFont("DejaVuSans16_aa"); - gdispDrawString((gdispGetWidth()/2)-(gdispGetStringWidth("Touch to start!", font)/2), gdispGetHeight()/2, "Touch to start!", font, White); + gdispDrawString((gdispGetWidth()/2)-(gdispGetStringWidth("Touch to start!", font)/2), gdispGetHeight()/2, "Touch to start!", font, GFX_WHITE); gdispCloseFont(font); #endif @@ -30,7 +30,7 @@ int main(void) #if !JG10_SHOW_SPLASH font = gdispOpenFont("DejaVuSans16"); - gdispFillArea((gdispGetWidth()/2)-(gdispGetStringWidth("Touch to start!", font)/2), gdispGetHeight()/2, gdispGetWidth()/2, 17, Black); + gdispFillArea((gdispGetWidth()/2)-(gdispGetStringWidth("Touch to start!", font)/2), gdispGetHeight()/2, gdispGetWidth()/2, 17, GFX_BLACK); gdispCloseFont(font); #endif diff --git a/demos/games/minesweeper/demo.mk b/demos/games/minesweeper/demo.mk index 43869d7e..41b18106 100644 --- a/demos/games/minesweeper/demo.mk +++ b/demos/games/minesweeper/demo.mk @@ -6,4 +6,4 @@ GFXINC += $(DEMODIR) \ GFXSRC += $(DEMODIR)/main.c \ $(DEMODIR)/mines.c -DEFS += -DMINES_SHOW_SPLASH=TRUE +DEFS += -DMINES_SHOW_SPLASH=GFXON diff --git a/demos/games/minesweeper/gfxconf.h b/demos/games/minesweeper/gfxconf.h index 468b32e2..c0961839 100644 --- a/demos/games/minesweeper/gfxconf.h +++ b/demos/games/minesweeper/gfxconf.h @@ -31,35 +31,34 @@ #define _GFXCONF_H /* GFX sub-systems to turn on */ -#define GFX_USE_GDISP TRUE -#define GFX_USE_GWIN TRUE -#define GFX_USE_GEVENT TRUE -#define GFX_USE_GTIMER TRUE -#define GFX_USE_GINPUT TRUE +#define GFX_USE_GDISP GFXON +#define GFX_USE_GWIN GFXON +#define GFX_USE_GEVENT GFXON +#define GFX_USE_GTIMER GFXON +#define GFX_USE_GINPUT GFXON -#define GFX_USE_GFILE TRUE -#define GFILE_NEED_ROMFS TRUE +#define GFX_USE_GFILE GFXON +#define GFILE_NEED_ROMFS GFXON /* Features for the GDISP sub-system. */ -#define GDISP_NEED_CONTROL TRUE -#define GDISP_NEED_VALIDATION TRUE -#define GDISP_NEED_CLIP TRUE -#define GDISP_NEED_TEXT TRUE -#define GDISP_NEED_MULTITHREAD TRUE -#define GDISP_NEED_IMAGE TRUE -#define GDISP_NEED_IMAGE_BMP TRUE -#define GDISP_NEED_CIRCLE TRUE -#define GDISP_NEED_ELLIPSE TRUE -#define GDISP_NEED_ARC TRUE -#define GDISP_NEED_STARTUP_LOGO FALSE +#define GDISP_NEED_CONTROL GFXON +#define GDISP_NEED_VALIDATION GFXON +#define GDISP_NEED_CLIP GFXON +#define GDISP_NEED_TEXT GFXON +#define GDISP_NEED_MULTITHREAD GFXON +#define GDISP_NEED_IMAGE GFXON +#define GDISP_NEED_IMAGE_BMP GFXON +#define GDISP_NEED_CIRCLE GFXON +#define GDISP_NEED_ELLIPSE GFXON +#define GDISP_NEED_ARC GFXON /* Builtin Fonts */ -#define GDISP_INCLUDE_USER_FONTS TRUE -#define GDISP_INCLUDE_FONT_DEJAVUSANS16 TRUE -#define GDISP_INCLUDE_FONT_FIXED_10X20 TRUE -#define GDISP_INCLUDE_FONT_FIXED_5X8 TRUE +#define GDISP_INCLUDE_USER_FONTS GFXON +#define GDISP_INCLUDE_FONT_DEJAVUSANS16 GFXON +#define GDISP_INCLUDE_FONT_FIXED_10X20 GFXON +#define GDISP_INCLUDE_FONT_FIXED_5X8 GFXON /* Features for the GINPUT sub-system. */ -#define GINPUT_NEED_MOUSE TRUE +#define GINPUT_NEED_MOUSE GFXON #endif /* _GFXCONF_H */ diff --git a/demos/games/minesweeper/main.c b/demos/games/minesweeper/main.c index 84943922..e7a105bf 100644 --- a/demos/games/minesweeper/main.c +++ b/demos/games/minesweeper/main.c @@ -51,7 +51,7 @@ int main(void) minesShowSplash(); #else font = gdispOpenFont("DejaVuSans16"); - gdispDrawString((gdispGetWidth()-gdispGetStringWidth("Touch to start!", font))/2, gdispGetHeight()-25, "Touch to start!", font, White); + gdispDrawString((gdispGetWidth()-gdispGetStringWidth("Touch to start!", font))/2, gdispGetHeight()-25, "Touch to start!", font, GFX_WHITE); gdispCloseFont(font); #endif diff --git a/demos/games/minesweeper/mines.c b/demos/games/minesweeper/mines.c index 55d70984..8b0cd292 100644 --- a/demos/games/minesweeper/mines.c +++ b/demos/games/minesweeper/mines.c @@ -95,11 +95,11 @@ static void printStats(void) font_t font = gdispOpenFont("fixed_5x8"); uitoa(MINES_MINE_COUNT, pps_str, sizeof(pps_str)); - gdispFillString(minesStatusIconWidth+8, gdispGetHeight()-11, " ", font, Black, Black); - gdispDrawString(minesStatusIconWidth+8, gdispGetHeight()-11, pps_str, font, White); + gdispFillString(minesStatusIconWidth+8, gdispGetHeight()-11, " ", font, GFX_BLACK, GFX_BLACK); + gdispDrawString(minesStatusIconWidth+8, gdispGetHeight()-11, pps_str, font, GFX_WHITE); uitoa(minesFlags, pps_str, sizeof(pps_str)); - gdispFillString(8+(minesStatusIconWidth*2)+gdispGetStringWidth("99999", font), gdispGetHeight()-11, " ", font, Black, Black); - gdispDrawString(8+(minesStatusIconWidth*2)+gdispGetStringWidth("99999", font), gdispGetHeight()-11, pps_str, font, White); + gdispFillString(8+(minesStatusIconWidth*2)+gdispGetStringWidth("99999", font), gdispGetHeight()-11, " ", font, GFX_BLACK, GFX_BLACK); + gdispDrawString(8+(minesStatusIconWidth*2)+gdispGetStringWidth("99999", font), gdispGetHeight()-11, pps_str, font, GFX_WHITE); gdispCloseFont(font); } @@ -112,8 +112,8 @@ static void minesUpdateTime(void) font_t font = gdispOpenFont("digital_7__mono_20"); uitoa(minesTime, pps_str, sizeof(pps_str)); - gdispFillArea((MINES_FIELD_WIDTH*MINES_CELL_WIDTH)-gdispGetStringWidth("9999", font), gdispGetHeight()-15, gdispGetWidth(), 15, Black); - gdispDrawString((MINES_FIELD_WIDTH*MINES_CELL_WIDTH)-gdispGetStringWidth(pps_str, font), gdispGetHeight()-15, pps_str, font, Lime); + gdispFillArea((MINES_FIELD_WIDTH*MINES_CELL_WIDTH)-gdispGetStringWidth("9999", font), gdispGetHeight()-15, gdispGetWidth(), 15, GFX_BLACK); + gdispDrawString((MINES_FIELD_WIDTH*MINES_CELL_WIDTH)-gdispGetStringWidth(pps_str, font), gdispGetHeight()-15, pps_str, font, GFX_LIME); gdispCloseFont(font); } @@ -141,7 +141,7 @@ static void showOne(int16_t x, int16_t y) minesFlags--; } - gdispFillArea((x*MINES_CELL_WIDTH)+1, (y*MINES_CELL_HEIGHT)+1, MINES_CELL_WIDTH-1, MINES_CELL_HEIGHT-1, Black); + gdispFillArea((x*MINES_CELL_WIDTH)+1, (y*MINES_CELL_HEIGHT)+1, MINES_CELL_WIDTH-1, MINES_CELL_HEIGHT-1, GFX_BLACK); if ((minesField[x][y].num > 0) && (minesField[x][y].num < 9)) { gdispImageOpenFile(&minesImage, minesGraph[minesField[x][y].num-1]); @@ -253,13 +253,13 @@ static void printGameOver(void) if (minesGameOver) { font_t font = gdispOpenFont("DejaVuSans16"); if (minesGameWinner) { - gdispDrawString((gdispGetWidth()-gdispGetStringWidth("You LIVE!", font))/2, gdispGetHeight()-15, "You LIVE!", font, White); + gdispDrawString((gdispGetWidth()-gdispGetStringWidth("You LIVE!", font))/2, gdispGetHeight()-15, "You LIVE!", font, GFX_WHITE); } else { - gdispDrawString((gdispGetWidth()-gdispGetStringWidth("You DIED!", font))/2, gdispGetHeight()-15, "You DIED!", font, White); + gdispDrawString((gdispGetWidth()-gdispGetStringWidth("You DIED!", font))/2, gdispGetHeight()-15, "You DIED!", font, GFX_WHITE); } gdispCloseFont(font); } else { - gdispFillArea(0, gdispGetHeight()-25, gdispGetWidth(), 25, Black); + gdispFillArea(0, gdispGetHeight()-25, gdispGetWidth(), 25, GFX_BLACK); } } @@ -317,7 +317,7 @@ static void initField(void) for (y = 0; y < MINES_FIELD_HEIGHT; y++) { i = minesField[x][y].fieldNum/MINES_FIELD_HEIGHT; j = minesField[x][y].fieldNum-(i*MINES_FIELD_HEIGHT); - gdispFillArea((i*MINES_CELL_WIDTH)+1, (j*MINES_CELL_HEIGHT)+1, MINES_CELL_WIDTH, MINES_CELL_HEIGHT, Black); + gdispFillArea((i*MINES_CELL_WIDTH)+1, (j*MINES_CELL_HEIGHT)+1, MINES_CELL_WIDTH, MINES_CELL_HEIGHT, GFX_BLACK); gfxSleepMilliseconds(2); } } @@ -378,7 +378,7 @@ void minesStart(void) #if MINES_SHOW_SPLASH gtimerStop(&minesSplashBlink); - gdispClear(Black); + gdispClear(GFX_BLACK); #endif initField(); @@ -442,5 +442,5 @@ void minesInit(void) { initRng(); - gdispClear(Black); + gdispClear(GFX_BLACK); } diff --git a/demos/games/minesweeper/readme.txt b/demos/games/minesweeper/readme.txt index e820fe63..f207da09 100644 --- a/demos/games/minesweeper/readme.txt +++ b/demos/games/minesweeper/readme.txt @@ -1,6 +1,6 @@ A demo Minesweeper game using. Various configuration options can be found in mines.h -NOTE: You can save FLASH space by disabling the splash-screen, to do that set MINES_SHOW_SPLASH to FALSE. +NOTE: You can save FLASH space by disabling the splash-screen, to do that set MINES_SHOW_SPLASH to GFXOFF. Credits: Code: Fleck diff --git a/demos/games/tetris/Example_Makefiles/stm32f4/Makefile b/demos/games/tetris/Example_Makefiles/stm32f4/Makefile index b1f8a710..9fa2eca9 100644 --- a/demos/games/tetris/Example_Makefiles/stm32f4/Makefile +++ b/demos/games/tetris/Example_Makefiles/stm32f4/Makefile @@ -176,7 +176,7 @@ CPPWARN = -Wall -Wextra # # List all default C defines here, like -D_DEBUG=1 -DDEFS = -DGFX_USE_OS_CHIBIOS=TRUE +DDEFS = -DGFX_USE_OS_CHIBIOS=GFXON # List all default ASM defines here, like -D_DEBUG=1 DADEFS = diff --git a/demos/games/tetris/gfxconf.h b/demos/games/tetris/gfxconf.h index 08997b10..72df36c7 100644 --- a/demos/games/tetris/gfxconf.h +++ b/demos/games/tetris/gfxconf.h @@ -31,38 +31,38 @@ #define _GFXCONF_H /* The operating system to use. One of these must be defined - preferably in your Makefile */ -//#define GFX_USE_OS_CHIBIOS FALSE -//#define GFX_USE_OS_WIN32 FALSE -//#define GFX_USE_OS_LINUX FALSE -//#define GFX_USE_OS_OSX FALSE +//#define GFX_USE_OS_CHIBIOS GFXOFF +//#define GFX_USE_OS_WIN32 GFXOFF +//#define GFX_USE_OS_LINUX GFXOFF +//#define GFX_USE_OS_OSX GFXOFF /* GFX sub-systems to turn on */ -#define GFX_USE_GDISP TRUE -#define GFX_USE_GEVENT TRUE -#define GFX_USE_GTIMER TRUE -#define GFX_USE_GINPUT TRUE +#define GFX_USE_GDISP GFXON +#define GFX_USE_GEVENT GFXON +#define GFX_USE_GTIMER GFXON +#define GFX_USE_GINPUT GFXON /* Features for the GDISP sub-system. */ -#define GDISP_USE_DMA TRUE -#define GDISP_NEED_CONTROL TRUE -#define GDISP_NEED_VALIDATION TRUE -#define GDISP_NEED_CLIP TRUE -#define GDISP_NEED_TEXT TRUE -#define GDISP_NEED_CIRCLE TRUE -#define GDISP_NEED_MULTITHREAD TRUE +#define GDISP_USE_DMA GFXON +#define GDISP_NEED_CONTROL GFXON +#define GDISP_NEED_VALIDATION GFXON +#define GDISP_NEED_CLIP GFXON +#define GDISP_NEED_TEXT GFXON +#define GDISP_NEED_CIRCLE GFXON +#define GDISP_NEED_MULTITHREAD GFXON /* Comment these out if it conflicts with your hardware */ -#define GDISP_NEED_CONTROL TRUE +#define GDISP_NEED_CONTROL GFXON #define GDISP_DEFAULT_ORIENTATION GDISP_ROTATE_PORTRAIT #define GDISP_SCREEN_WIDTH 240 #define GDISP_SCREEN_HEIGHT 320 /* Builtin Fonts */ -#define GDISP_INCLUDE_FONT_DEJAVUSANS12 TRUE -#define GDISP_INCLUDE_FONT_DEJAVUSANS16 TRUE -#define GDISP_NEED_ANTIALIAS FALSE +#define GDISP_INCLUDE_FONT_DEJAVUSANS12 GFXON +#define GDISP_INCLUDE_FONT_DEJAVUSANS16 GFXON +#define GDISP_NEED_ANTIALIAS GFXOFF /* Features for the GINPUT sub-system. */ -#define GINPUT_NEED_MOUSE TRUE +#define GINPUT_NEED_MOUSE GFXON #endif /* _GFXCONF_H */ diff --git a/demos/games/tetris/tetris.c b/demos/games/tetris/tetris.c index 4e5c87c3..ed924781 100644 --- a/demos/games/tetris/tetris.c +++ b/demos/games/tetris/tetris.c @@ -63,7 +63,7 @@ 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 color_t tetrisShapeColors[9] = {Black, HTML2COLOR(0x009000), Red, Blue, Magenta, SkyBlue, Orange, HTML2COLOR(0xBBBB00), White}; // shape colors +const color_t 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] = { {{4, 17},{4, 16},{5, 16},{4, 15}}, @@ -209,16 +209,16 @@ static void tellScore(uint8_t color) { uitoa(tetrisScore, pps_str, sizeof(pps_str)); gdispFillArea(0, 0, gdispGetWidth(), gdispGetHeight()-(TETRIS_FIELD_HEIGHT*TETRIS_CELL_HEIGHT)-6, tetrisShapeColors[0]); for (i = 0; i < strlen(pps_str); i++) { - if (pps_str[i] == '0') sevenSegDraw(TETRIS_SEVEN_SEG_SCORE_X, gdispGetHeight()-(TETRIS_FIELD_HEIGHT*TETRIS_CELL_HEIGHT)-SEVEN_SEG_CHAR_HEIGHT-7, sevenSegNumbers[0], Lime); - if (pps_str[i] == '1') sevenSegDraw(TETRIS_SEVEN_SEG_SCORE_X, gdispGetHeight()-(TETRIS_FIELD_HEIGHT*TETRIS_CELL_HEIGHT)-SEVEN_SEG_CHAR_HEIGHT-7, sevenSegNumbers[1], Lime); - if (pps_str[i] == '2') sevenSegDraw(TETRIS_SEVEN_SEG_SCORE_X, gdispGetHeight()-(TETRIS_FIELD_HEIGHT*TETRIS_CELL_HEIGHT)-SEVEN_SEG_CHAR_HEIGHT-7, sevenSegNumbers[2], Lime); - if (pps_str[i] == '3') sevenSegDraw(TETRIS_SEVEN_SEG_SCORE_X, gdispGetHeight()-(TETRIS_FIELD_HEIGHT*TETRIS_CELL_HEIGHT)-SEVEN_SEG_CHAR_HEIGHT-7, sevenSegNumbers[3], Lime); - if (pps_str[i] == '4') sevenSegDraw(TETRIS_SEVEN_SEG_SCORE_X, gdispGetHeight()-(TETRIS_FIELD_HEIGHT*TETRIS_CELL_HEIGHT)-SEVEN_SEG_CHAR_HEIGHT-7, sevenSegNumbers[4], Lime); - if (pps_str[i] == '5') sevenSegDraw(TETRIS_SEVEN_SEG_SCORE_X, gdispGetHeight()-(TETRIS_FIELD_HEIGHT*TETRIS_CELL_HEIGHT)-SEVEN_SEG_CHAR_HEIGHT-7, sevenSegNumbers[5], Lime); - if (pps_str[i] == '6') sevenSegDraw(TETRIS_SEVEN_SEG_SCORE_X, gdispGetHeight()-(TETRIS_FIELD_HEIGHT*TETRIS_CELL_HEIGHT)-SEVEN_SEG_CHAR_HEIGHT-7, sevenSegNumbers[6], Lime); - if (pps_str[i] == '7') sevenSegDraw(TETRIS_SEVEN_SEG_SCORE_X, gdispGetHeight()-(TETRIS_FIELD_HEIGHT*TETRIS_CELL_HEIGHT)-SEVEN_SEG_CHAR_HEIGHT-7, sevenSegNumbers[7], Lime); - if (pps_str[i] == '8') sevenSegDraw(TETRIS_SEVEN_SEG_SCORE_X, gdispGetHeight()-(TETRIS_FIELD_HEIGHT*TETRIS_CELL_HEIGHT)-SEVEN_SEG_CHAR_HEIGHT-7, sevenSegNumbers[8], Lime); - if (pps_str[i] == '9') sevenSegDraw(TETRIS_SEVEN_SEG_SCORE_X, gdispGetHeight()-(TETRIS_FIELD_HEIGHT*TETRIS_CELL_HEIGHT)-SEVEN_SEG_CHAR_HEIGHT-7, sevenSegNumbers[9], Lime); + if (pps_str[i] == '0') sevenSegDraw(TETRIS_SEVEN_SEG_SCORE_X, gdispGetHeight()-(TETRIS_FIELD_HEIGHT*TETRIS_CELL_HEIGHT)-SEVEN_SEG_CHAR_HEIGHT-7, sevenSegNumbers[0], GFX_LIME); + if (pps_str[i] == '1') sevenSegDraw(TETRIS_SEVEN_SEG_SCORE_X, gdispGetHeight()-(TETRIS_FIELD_HEIGHT*TETRIS_CELL_HEIGHT)-SEVEN_SEG_CHAR_HEIGHT-7, sevenSegNumbers[1], GFX_LIME); + if (pps_str[i] == '2') sevenSegDraw(TETRIS_SEVEN_SEG_SCORE_X, gdispGetHeight()-(TETRIS_FIELD_HEIGHT*TETRIS_CELL_HEIGHT)-SEVEN_SEG_CHAR_HEIGHT-7, sevenSegNumbers[2], GFX_LIME); + if (pps_str[i] == '3') sevenSegDraw(TETRIS_SEVEN_SEG_SCORE_X, gdispGetHeight()-(TETRIS_FIELD_HEIGHT*TETRIS_CELL_HEIGHT)-SEVEN_SEG_CHAR_HEIGHT-7, sevenSegNumbers[3], GFX_LIME); + if (pps_str[i] == '4') sevenSegDraw(TETRIS_SEVEN_SEG_SCORE_X, gdispGetHeight()-(TETRIS_FIELD_HEIGHT*TETRIS_CELL_HEIGHT)-SEVEN_SEG_CHAR_HEIGHT-7, sevenSegNumbers[4], GFX_LIME); + if (pps_str[i] == '5') sevenSegDraw(TETRIS_SEVEN_SEG_SCORE_X, gdispGetHeight()-(TETRIS_FIELD_HEIGHT*TETRIS_CELL_HEIGHT)-SEVEN_SEG_CHAR_HEIGHT-7, sevenSegNumbers[5], GFX_LIME); + if (pps_str[i] == '6') sevenSegDraw(TETRIS_SEVEN_SEG_SCORE_X, gdispGetHeight()-(TETRIS_FIELD_HEIGHT*TETRIS_CELL_HEIGHT)-SEVEN_SEG_CHAR_HEIGHT-7, sevenSegNumbers[6], GFX_LIME); + if (pps_str[i] == '7') sevenSegDraw(TETRIS_SEVEN_SEG_SCORE_X, gdispGetHeight()-(TETRIS_FIELD_HEIGHT*TETRIS_CELL_HEIGHT)-SEVEN_SEG_CHAR_HEIGHT-7, sevenSegNumbers[7], GFX_LIME); + if (pps_str[i] == '8') sevenSegDraw(TETRIS_SEVEN_SEG_SCORE_X, gdispGetHeight()-(TETRIS_FIELD_HEIGHT*TETRIS_CELL_HEIGHT)-SEVEN_SEG_CHAR_HEIGHT-7, sevenSegNumbers[8], GFX_LIME); + if (pps_str[i] == '9') sevenSegDraw(TETRIS_SEVEN_SEG_SCORE_X, gdispGetHeight()-(TETRIS_FIELD_HEIGHT*TETRIS_CELL_HEIGHT)-SEVEN_SEG_CHAR_HEIGHT-7, sevenSegNumbers[9], GFX_LIME); } } @@ -262,16 +262,16 @@ static void printGameOver(void) { } static void printTouchAreas(void) { - gdispDrawStringBox(0, 0, gdispGetWidth(), gdispGetFontMetric(font16, fontHeight), "Touch Area's", font16, White, justifyCenter); - gdispDrawStringBox(0, 0, gdispGetWidth(), gdispGetHeight()/4, "Pause", font16, Grey, justifyCenter); - gdispDrawStringBox(0, gdispGetHeight()/4, gdispGetWidth(), gdispGetHeight()/2, "Rotate", font16, Grey, justifyCenter); - gdispDrawStringBox(0, gdispGetHeight()-(gdispGetHeight()/4), gdispGetWidth()/4, gdispGetHeight()/4, "Left", font16, Grey, justifyCenter); - gdispDrawStringBox(gdispGetWidth()/4, gdispGetHeight()-(gdispGetHeight()/4), gdispGetWidth()/2, gdispGetHeight()/4, "Down", font16, Grey, justifyCenter); - gdispDrawStringBox(gdispGetWidth()-(gdispGetWidth()/4), gdispGetHeight()-(gdispGetHeight()/4), gdispGetWidth()/4, gdispGetHeight()/4, "Right", font16, Grey, justifyCenter); - gdispDrawLine(0, gdispGetHeight()/4, gdispGetWidth()-1, gdispGetHeight()/4, Grey); - gdispDrawLine(0, gdispGetHeight()-gdispGetHeight()/4, gdispGetWidth()-1, gdispGetHeight()-gdispGetHeight()/4, Grey); - gdispDrawLine(gdispGetWidth()/4, gdispGetHeight()-gdispGetHeight()/4, gdispGetWidth()/4, gdispGetHeight()-1, Grey); - gdispDrawLine(gdispGetWidth()-(gdispGetWidth()/4), gdispGetHeight()-gdispGetHeight()/4, gdispGetWidth()-(gdispGetWidth()/4), gdispGetHeight()-1, Grey); + gdispDrawStringBox(0, 0, gdispGetWidth(), gdispGetFontMetric(font16, fontHeight), "Touch Area's", font16, GFX_WHITE, justifyCenter); + gdispDrawStringBox(0, 0, gdispGetWidth(), gdispGetHeight()/4, "Pause", font16, GFX_GRAY, justifyCenter); + gdispDrawStringBox(0, gdispGetHeight()/4, gdispGetWidth(), gdispGetHeight()/2, "Rotate", font16, GFX_GRAY, justifyCenter); + gdispDrawStringBox(0, gdispGetHeight()-(gdispGetHeight()/4), gdispGetWidth()/4, gdispGetHeight()/4, "Left", font16, GFX_GRAY, justifyCenter); + gdispDrawStringBox(gdispGetWidth()/4, gdispGetHeight()-(gdispGetHeight()/4), gdispGetWidth()/2, gdispGetHeight()/4, "Down", font16, GFX_GRAY, justifyCenter); + gdispDrawStringBox(gdispGetWidth()-(gdispGetWidth()/4), gdispGetHeight()-(gdispGetHeight()/4), gdispGetWidth()/4, gdispGetHeight()/4, "Right", font16, GFX_GRAY, justifyCenter); + gdispDrawLine(0, gdispGetHeight()/4, gdispGetWidth()-1, gdispGetHeight()/4, GFX_GRAY); + gdispDrawLine(0, gdispGetHeight()-gdispGetHeight()/4, gdispGetWidth()-1, gdispGetHeight()-gdispGetHeight()/4, GFX_GRAY); + gdispDrawLine(gdispGetWidth()/4, gdispGetHeight()-gdispGetHeight()/4, gdispGetWidth()/4, gdispGetHeight()-1, GFX_GRAY); + gdispDrawLine(gdispGetWidth()-(gdispGetWidth()/4), gdispGetHeight()-gdispGetHeight()/4, gdispGetWidth()-(gdispGetWidth()/4), gdispGetHeight()-1, GFX_GRAY); } static bool_t stay(bool_t down) { @@ -484,13 +484,13 @@ static void tetrisDeinit(void) { void tetrisStart(void) { // Show the help first - gdispClear(Black); + gdispClear(GFX_BLACK); printTouchAreas(); gfxSleepMilliseconds(3000); // Draw the board - gdispClear(Black); - gdispDrawBox(0, gdispGetHeight()-(TETRIS_FIELD_HEIGHT*TETRIS_CELL_HEIGHT)-5, (TETRIS_FIELD_WIDTH*TETRIS_CELL_WIDTH)+3, (TETRIS_FIELD_HEIGHT*TETRIS_CELL_HEIGHT)+3, White); + gdispClear(GFX_BLACK); + gdispDrawBox(0, gdispGetHeight()-(TETRIS_FIELD_HEIGHT*TETRIS_CELL_HEIGHT)-5, (TETRIS_FIELD_WIDTH*TETRIS_CELL_WIDTH)+3, (TETRIS_FIELD_HEIGHT*TETRIS_CELL_HEIGHT)+3, GFX_WHITE); printText(8); // Away we go |