Change new colors to GFX_RED instead of GFXRED. Use the new color defs
parent
f265924396
commit
94f1cc2f0a
|
@ -17,12 +17,12 @@ void setup() {
|
|||
height = gdispGetHeight();
|
||||
|
||||
// Code Here
|
||||
gdispDrawBox(10, 10, width / 2, height / 2, Yellow);
|
||||
gdispFillArea(width / 2, height / 2, width / 2 - 10, height / 2 - 10, Blue);
|
||||
gdispDrawLine(5, 30, width - 50, height - 40, Red);
|
||||
gdispDrawBox(10, 10, width / 2, height / 2, GFX_YELLOW);
|
||||
gdispFillArea(width / 2, height / 2, width / 2 - 10, height / 2 - 10, GFX_BLUE);
|
||||
gdispDrawLine(5, 30, width - 50, height - 40, GFX_RED);
|
||||
|
||||
for (i = 5, j = 0; i < width && j < height; i += 7, j += i / 20)
|
||||
gdispDrawPixel(i, j, White);
|
||||
gdispDrawPixel(i, j, GFX_WHITE);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -9,9 +9,11 @@
|
|||
#define _GDISP_LLD_BOARD_H
|
||||
|
||||
// Avoid naming collisions with CubeHAL
|
||||
#undef Red
|
||||
#undef Green
|
||||
#undef Blue
|
||||
#if GFX_COMPAT_V2 && GFX_COMPAT_OLDCOLORS
|
||||
#undef Red
|
||||
#undef Green
|
||||
#undef Blue
|
||||
#endif
|
||||
|
||||
// Include CubeHAL
|
||||
#include "stm32f4xx_hal.h"
|
||||
|
|
|
@ -15,9 +15,11 @@
|
|||
#define _GINPUT_LLD_MOUSE_BOARD_H
|
||||
|
||||
// Avoid naming collisions with CubeHAL
|
||||
#undef Red
|
||||
#undef Green
|
||||
#undef Blue
|
||||
#if GFX_COMPAT_V2 && GFX_COMPAT_OLDCOLORS
|
||||
#undef Red
|
||||
#undef Green
|
||||
#undef Blue
|
||||
#endif
|
||||
|
||||
// Include CubeHAL
|
||||
#include "stm32f4xx_hal.h"
|
||||
|
|
|
@ -78,9 +78,11 @@
|
|||
------------------------------------------------------------------------------*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#undef Red
|
||||
#undef Green
|
||||
#undef Blue
|
||||
#if GFX_COMPAT_V2 && GFX_COMPAT_OLDCOLORS
|
||||
#undef Red
|
||||
#undef Green
|
||||
#undef Blue
|
||||
#endif
|
||||
#include "stm324x9i_eval_sdram.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
|
|
|
@ -40,9 +40,11 @@
|
|||
#ifndef __STM324x9I_EVAL_SDRAM_H
|
||||
#define __STM324x9I_EVAL_SDRAM_H
|
||||
|
||||
#undef Red
|
||||
#undef Green
|
||||
#undef Blue
|
||||
#if GFX_COMPAT_V2 && GFX_COMPAT_OLDCOLORS
|
||||
#undef Red
|
||||
#undef Green
|
||||
#undef Blue
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
@ -38,9 +38,11 @@
|
|||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#undef Red
|
||||
#undef Green
|
||||
#undef Blue
|
||||
#if GFX_COMPAT_V2 && GFX_COMPAT_OLDCOLORS
|
||||
#undef Red
|
||||
#undef Green
|
||||
#undef Blue
|
||||
#endif
|
||||
#include "stm32f4xx_hal_conf.h"
|
||||
#include "stm32f4xx_hal.h"
|
||||
|
||||
|
|
|
@ -62,9 +62,11 @@
|
|||
/** @addtogroup STM32F4xx_System_Private_Includes
|
||||
* @{
|
||||
*/
|
||||
#undef Red
|
||||
#undef Green
|
||||
#undef Blue
|
||||
#if GFX_COMPAT_V2 && GFX_COMPAT_OLDCOLORS
|
||||
#undef Red
|
||||
#undef Green
|
||||
#undef Blue
|
||||
#endif
|
||||
|
||||
#include "stm32f4xx.h"
|
||||
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
#include "../../../gfx.h"
|
||||
|
||||
#undef Red
|
||||
#undef Green
|
||||
#undef Blue
|
||||
#if GFX_COMPAT_V2 && GFX_COMPAT_OLDCOLORS
|
||||
#undef Red
|
||||
#undef Green
|
||||
#undef Blue
|
||||
#endif
|
||||
|
||||
#include "stm32f4xx_hal.h"
|
||||
|
||||
|
|
|
@ -9,9 +9,11 @@
|
|||
#define _GDISP_LLD_BOARD_H
|
||||
|
||||
/* Avoid naming collisions with CubeHAL. */
|
||||
#undef Red
|
||||
#undef Green
|
||||
#undef Blue
|
||||
#if GFX_COMPAT_V2 && GFX_COMPAT_OLDCOLORS
|
||||
#undef Red
|
||||
#undef Green
|
||||
#undef Blue
|
||||
#endif
|
||||
|
||||
/* HAL drivers needed for configuration. */
|
||||
#include "stm32f4xx_hal.h"
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
#include "../../../gfx.h"
|
||||
#undef Red
|
||||
#undef Green
|
||||
#undef Blue
|
||||
#if GFX_COMPAT_V2 && GFX_COMPAT_OLDCOLORS
|
||||
#undef Red
|
||||
#undef Green
|
||||
#undef Blue
|
||||
#endif
|
||||
#include "stm32f4xx.h"
|
||||
#include "stm32f4xx_hal.h"
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
#include "../../../gfx.h"
|
||||
#undef Red
|
||||
#undef Green
|
||||
#undef Blue
|
||||
#if GFX_COMPAT_V2 && GFX_COMPAT_OLDCOLORS
|
||||
#undef Red
|
||||
#undef Green
|
||||
#undef Blue
|
||||
#endif
|
||||
#include "stm32f746g_discovery_sdram.h"
|
||||
#include "stm32f7xx_hal_rcc.h"
|
||||
#include "stm32f7xx_hal_dma.h"
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
#include "../../../gfx.h"
|
||||
#undef Red
|
||||
#undef Green
|
||||
#undef Blue
|
||||
#if GFX_COMPAT_V2 && GFX_COMPAT_OLDCOLORS
|
||||
#undef Red
|
||||
#undef Green
|
||||
#undef Blue
|
||||
#endif
|
||||
#include "stm32f7xx_hal.h"
|
||||
|
||||
#if GFX_USE_OS_CHIBIOS
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
#include "gfx.h"
|
||||
#undef Red
|
||||
#undef Green
|
||||
#undef Blue
|
||||
#if GFX_COMPAT_V2 && GFX_COMPAT_OLDCOLORS
|
||||
#undef Red
|
||||
#undef Green
|
||||
#undef Blue
|
||||
#endif
|
||||
#include "stm32f7_i2c.h"
|
||||
|
||||
/*
|
||||
|
|
|
@ -13,7 +13,7 @@ FIX: Fixed drawing of 3x3 pixel boxes
|
|||
FIX: Fixed issue in RTX5/CMSIS2 port which resulted in hanging delays/threads
|
||||
FEATURE: Added GFX_COMPAT_V2 to maintain source compatibility with V2.x programs. It is turned on by default.
|
||||
FEATURE: Added GFX_COMPAT_OLDCOLORS to allow V2.x Red, Green, Blue color names. It is turned on by default.
|
||||
CHANGE: Added GFXRED, GFXBLUE, GFXGREEN etc to replace V2.x Red, Gree, Blue color names
|
||||
CHANGE: Added GFX_RED, GFX_BLUE, GFX_GREEN etc to replace V2.x Red, Gree, Blue color names
|
||||
CHANGE: Added GFXON/GFXOFF to replace V2.x TRUE/FALSE for configuration options.
|
||||
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
const NColorScheme schemeDefault = {
|
||||
.titleBarColor = HTML2COLOR(0x3064D8),
|
||||
.titleTextColor = White,
|
||||
.titleTextColor = GFX_WHITE,
|
||||
|
||||
.winBgColor = HTML2COLOR(0xFFECB0),
|
||||
.drawingWinBorder = HTML2COLOR(0xCEBA77),
|
||||
|
@ -53,7 +53,7 @@ const NColorScheme schemeDefault = {
|
|||
|
||||
const NColorScheme schemeDefault2 = {
|
||||
.titleBarColor = HTML2COLOR(0x3064D8),
|
||||
.titleTextColor = White,
|
||||
.titleTextColor = GFX_WHITE,
|
||||
|
||||
.winBgColor = HTML2COLOR(0xC8D8F8),
|
||||
.drawingWinBorder = HTML2COLOR(0x8098E0),
|
||||
|
@ -91,9 +91,9 @@ int main(void) {
|
|||
gfxThreadWait(nLaunchNotepadApp());
|
||||
|
||||
gdispSetClip(0, 0, gdispGetWidth(), gdispGetHeight());
|
||||
gdispClear(Black);
|
||||
gdispDrawString(3, 3, "Notepad Terminated.", font, White);
|
||||
gdispDrawString(3, 20, "Relaunching Notepad App...", font, White);
|
||||
gdispClear(GFX_BLACK);
|
||||
gdispDrawString(3, 3, "Notepad Terminated.", font, GFX_WHITE);
|
||||
gdispDrawString(3, 20, "Relaunching Notepad App...", font, GFX_WHITE);
|
||||
|
||||
gfxSleepMilliseconds(1000);
|
||||
}
|
||||
|
|
|
@ -63,9 +63,9 @@ static GButtonObject btnClose;
|
|||
// Image object
|
||||
static gdispImage toolbarImageFilmstrip;
|
||||
|
||||
static color_t myColors[] = { Black, Red, Green, Blue, Cyan, Magenta, Yellow, White };
|
||||
static color_t myColors[] = { GFX_BLACK, GFX_RED, GFX_GREEN, GFX_BLUE, GFX_CYAN, GFX_MAGENTA, GFX_YELLOW, GFX_WHITE };
|
||||
|
||||
static color_t selColor = Black;
|
||||
static color_t selColor = GFX_BLACK;
|
||||
static int selColorIndex = 0, selPenWidth = 1, tbMode = 1;
|
||||
|
||||
static NColorScheme nCurColorScheme;
|
||||
|
@ -383,13 +383,13 @@ static DECLARE_THREAD_FUNCTION(notepadThread, param) {
|
|||
0);
|
||||
|
||||
gwinSetBgColor(ghc, nCurColorScheme.winBgColor);
|
||||
gwinSetColor(ghc, Black);
|
||||
gwinSetColor(ghc, GFX_BLACK);
|
||||
|
||||
gstatusConsole = ghc;
|
||||
|
||||
/* draw the buttons */
|
||||
gwinSetColor(nDrawingArea, Black);
|
||||
gwinSetBgColor(nDrawingArea, White);
|
||||
gwinSetColor(nDrawingArea, GFX_BLACK);
|
||||
gwinSetBgColor(nDrawingArea, GFX_WHITE);
|
||||
|
||||
gwinClear(nDrawingArea);
|
||||
gwinClear(ghc);
|
||||
|
@ -414,8 +414,8 @@ static DECLARE_THREAD_FUNCTION(notepadThread, param) {
|
|||
selPenWidth = 0;
|
||||
ncoreSetMode(NCORE_MODE_DRAW);
|
||||
|
||||
gwinSetColor(nDrawingArea, Black);
|
||||
gwinSetBgColor(nDrawingArea, White);
|
||||
gwinSetColor(nDrawingArea, GFX_BLACK);
|
||||
gwinSetBgColor(nDrawingArea, GFX_WHITE);
|
||||
|
||||
// Refresh the buttons
|
||||
drawButtons();
|
||||
|
|
|
@ -55,8 +55,8 @@ static gfxThreadHandle thread;
|
|||
* #define GMISC_INVSQRT_REAL_SLOW GFXON
|
||||
* in your gfxconf.h file. This should always work although it will probably be slow.
|
||||
*/
|
||||
#define BALLCOLOR1 Red
|
||||
#define BALLCOLOR2 Yellow
|
||||
#define BALLCOLOR1 GFX_RED
|
||||
#define BALLCOLOR2 GFX_YELLOW
|
||||
#define WALLCOLOR HTML2COLOR(0x303030)
|
||||
#define BACKCOLOR HTML2COLOR(0xC0C0C0)
|
||||
#define FLOORCOLOR HTML2COLOR(0x606060)
|
||||
|
@ -117,7 +117,7 @@ static DECLARE_THREAD_FUNCTION(task, param) {
|
|||
|
||||
// The ball shadow is darker
|
||||
if (g*(g+.4)+h*(h+.1) < 1)
|
||||
colour = gdispBlendColor(colour, Black, SHADOWALPHA);
|
||||
colour = gdispBlendColor(colour, GFX_BLACK, SHADOWALPHA);
|
||||
}
|
||||
gdispStreamColor(colour); /* pixel to the LCD */
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
/* Our custom yellow style */
|
||||
static const GWidgetStyle YellowWidgetStyle = {
|
||||
Yellow, // window background
|
||||
GFX_YELLOW, // window background
|
||||
HTML2COLOR(0x800000), // focus - for text edit.
|
||||
|
||||
// enabled color set
|
||||
|
@ -168,7 +168,7 @@ static void createWidgets(void) {
|
|||
wi.g.x = pagewidth;
|
||||
wi.g.width = pagewidth;
|
||||
ghConsole = gwinConsoleCreate(0, &wi.g);
|
||||
gwinSetColor(ghConsole, Black);
|
||||
gwinSetColor(ghConsole, GFX_BLACK);
|
||||
gwinSetBgColor(ghConsole, HTML2COLOR(0xF0F0F0));
|
||||
|
||||
// Buttons
|
||||
|
@ -405,7 +405,7 @@ int main(void) {
|
|||
font = gdispOpenFont("*"); // Get the first defined font.
|
||||
gwinSetDefaultFont(font);
|
||||
gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE);
|
||||
gdispClear(White);
|
||||
gdispClear(GFX_WHITE);
|
||||
|
||||
// Create the gwin windows/widgets
|
||||
createWidgets();
|
||||
|
|
|
@ -49,23 +49,23 @@ void drawScreen(void) {
|
|||
font1 = gdispOpenFont("DejaVuSans24*");
|
||||
font2 = gdispOpenFont("DejaVuSans12*");
|
||||
|
||||
gdispClear(White);
|
||||
gdispDrawString(gdispGetWidth()-gdispGetStringWidth(msg, font1)-3, 3, msg, font1, Black);
|
||||
gdispClear(GFX_WHITE);
|
||||
gdispDrawString(gdispGetWidth()-gdispGetStringWidth(msg, font1)-3, 3, msg, font1, GFX_BLACK);
|
||||
|
||||
/* colors */
|
||||
gdispFillArea(0 * COLOR_SIZE + 3, 3, COLOR_SIZE, COLOR_SIZE, Black); /* Black */
|
||||
gdispFillArea(1 * COLOR_SIZE + 3, 3, COLOR_SIZE, COLOR_SIZE, Red); /* Red */
|
||||
gdispFillArea(2 * COLOR_SIZE + 3, 3, COLOR_SIZE, COLOR_SIZE, Yellow); /* Yellow */
|
||||
gdispFillArea(3 * COLOR_SIZE + 3, 3, COLOR_SIZE, COLOR_SIZE, Green); /* Green */
|
||||
gdispFillArea(4 * COLOR_SIZE + 3, 3, COLOR_SIZE, COLOR_SIZE, Blue); /* Blue */
|
||||
gdispDrawBox (5 * COLOR_SIZE + 3, 3, COLOR_SIZE, COLOR_SIZE, Black); /* White */
|
||||
gdispFillArea(0 * COLOR_SIZE + 3, 3, COLOR_SIZE, COLOR_SIZE, GFX_BLACK); /* Black */
|
||||
gdispFillArea(1 * COLOR_SIZE + 3, 3, COLOR_SIZE, COLOR_SIZE, GFX_RED); /* Red */
|
||||
gdispFillArea(2 * COLOR_SIZE + 3, 3, COLOR_SIZE, COLOR_SIZE, GFX_YELLOW); /* Yellow */
|
||||
gdispFillArea(3 * COLOR_SIZE + 3, 3, COLOR_SIZE, COLOR_SIZE, GFX_GREEN); /* Green */
|
||||
gdispFillArea(4 * COLOR_SIZE + 3, 3, COLOR_SIZE, COLOR_SIZE, GFX_BLUE); /* Blue */
|
||||
gdispDrawBox (5 * COLOR_SIZE + 3, 3, COLOR_SIZE, COLOR_SIZE, GFX_WHITE); /* White */
|
||||
|
||||
/* pens */
|
||||
gdispFillStringBox(OFFSET * 2, DRAW_PEN(1), PEN_SIZE, PEN_SIZE, "1", font2, White, Black, justifyCenter);
|
||||
gdispFillStringBox(OFFSET * 2, DRAW_PEN(2), PEN_SIZE, PEN_SIZE, "2", font2, White, Black, justifyCenter);
|
||||
gdispFillStringBox(OFFSET * 2, DRAW_PEN(3), PEN_SIZE, PEN_SIZE, "3", font2, White, Black, justifyCenter);
|
||||
gdispFillStringBox(OFFSET * 2, DRAW_PEN(4), PEN_SIZE, PEN_SIZE, "4", font2, White, Black, justifyCenter);
|
||||
gdispFillStringBox(OFFSET * 2, DRAW_PEN(5), PEN_SIZE, PEN_SIZE, "5", font2, White, Black, justifyCenter);
|
||||
gdispFillStringBox(OFFSET * 2, DRAW_PEN(1), PEN_SIZE, PEN_SIZE, "1", font2, GFX_WHITE, GFX_BLACK, justifyCenter);
|
||||
gdispFillStringBox(OFFSET * 2, DRAW_PEN(2), PEN_SIZE, PEN_SIZE, "2", font2, GFX_WHITE, GFX_BLACK, justifyCenter);
|
||||
gdispFillStringBox(OFFSET * 2, DRAW_PEN(3), PEN_SIZE, PEN_SIZE, "3", font2, GFX_WHITE, GFX_BLACK, justifyCenter);
|
||||
gdispFillStringBox(OFFSET * 2, DRAW_PEN(4), PEN_SIZE, PEN_SIZE, "4", font2, GFX_WHITE, GFX_BLACK, justifyCenter);
|
||||
gdispFillStringBox(OFFSET * 2, DRAW_PEN(5), PEN_SIZE, PEN_SIZE, "5", font2, GFX_WHITE, GFX_BLACK, justifyCenter);
|
||||
|
||||
gdispCloseFont(font1);
|
||||
gdispCloseFont(font2);
|
||||
|
@ -74,7 +74,7 @@ void drawScreen(void) {
|
|||
GEventMouse ev;
|
||||
|
||||
int main(void) {
|
||||
color_t color = Black;
|
||||
color_t color = GFX_BLACK;
|
||||
uint16_t pen = 0;
|
||||
|
||||
gfxInit();
|
||||
|
@ -89,12 +89,12 @@ int main(void) {
|
|||
|
||||
/* inside color box ? */
|
||||
if(ev.y >= OFFSET && ev.y <= COLOR_SIZE) {
|
||||
if(GET_COLOR(0)) color = Black;
|
||||
else if(GET_COLOR(1)) color = Red;
|
||||
else if(GET_COLOR(2)) color = Yellow;
|
||||
else if(GET_COLOR(3)) color = Green;
|
||||
else if(GET_COLOR(4)) color = Blue;
|
||||
else if(GET_COLOR(5)) color = White;
|
||||
if(GET_COLOR(0)) color = GFX_BLACK;
|
||||
else if(GET_COLOR(1)) color = GFX_RED;
|
||||
else if(GET_COLOR(2)) color = GFX_YELLOW;
|
||||
else if(GET_COLOR(3)) color = GFX_GREEN;
|
||||
else if(GET_COLOR(4)) color = GFX_BLUE;
|
||||
else if(GET_COLOR(5)) color = GFX_WHITE;
|
||||
|
||||
/* inside pen box ? */
|
||||
} else if(ev.x >= OFFSET && ev.x <= PEN_SIZE) {
|
||||
|
|
|
@ -98,10 +98,10 @@ void benchmark(void) {
|
|||
height = gdispGetHeight();
|
||||
font = gdispOpenFont("UI2 Double");
|
||||
|
||||
gdispDrawStringBox(0, 0, width, 30, "ChibiOS/GFX - Benchmark", font, White, justifyCenter);
|
||||
gdispDrawStringBox(0, 0, width, 30, "ChibiOS/GFX - Benchmark", font, GFX_WHITE, justifyCenter);
|
||||
|
||||
font = gdispOpenFont("UI2");
|
||||
gdispDrawStringBox(0, height/2, width, 30, "5000 random rectangles", font, White, justifyCenter);
|
||||
gdispDrawStringBox(0, height/2, width, 30, "5000 random rectangles", font, GFX_WHITE, justifyCenter);
|
||||
|
||||
gfxSleepMilliseconds(3000);
|
||||
|
||||
|
@ -130,10 +130,10 @@ void benchmark(void) {
|
|||
strcat(pps_str, " Pixels/s");
|
||||
|
||||
font = gdispOpenFont("UI2 Double");
|
||||
gdispClear(Black);
|
||||
gdispDrawStringBox(0, 0, width, 30, "ChibiOS/GFX - Benchmark", font, White, justifyCenter);
|
||||
gdispDrawStringBox(0, height/2, width, 30, pps_str, font, White, justifyCenter);
|
||||
//gdispDrawString(20, height/2, pps_str, font, White);
|
||||
gdispClear(GFX_BLACK);
|
||||
gdispDrawStringBox(0, 0, width, 30, "ChibiOS/GFX - Benchmark", font, GFX_WHITE, justifyCenter);
|
||||
gdispDrawStringBox(0, height/2, width, 30, pps_str, font, GFX_WHITE, justifyCenter);
|
||||
//gdispDrawString(20, height/2, pps_str, font, GFX_WHITE);
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -160,8 +160,8 @@ int main(void) {
|
|||
wi.height = sheight;
|
||||
ghText = gwinConsoleCreate(&gTextWindow, &wi);
|
||||
}
|
||||
gwinSetBgColor(ghText, Black);
|
||||
gwinSetColor(ghText, Yellow);
|
||||
gwinSetBgColor(ghText, GFX_BLACK);
|
||||
gwinSetColor(ghText, GFX_YELLOW);
|
||||
gwinClear(ghText);
|
||||
|
||||
/* Start our timer for reading the dial */
|
||||
|
@ -195,8 +195,8 @@ int main(void) {
|
|||
wi.height = SCOPE_CY;
|
||||
ghScope = gwinScopeCreate(&gScopeWindow, &wi, MY_MIC_DEVICE, MY_MIC_FREQUENCY);
|
||||
}
|
||||
gwinSetBgColor(ghScope, White);
|
||||
gwinSetColor(ghScope, Red);
|
||||
gwinSetBgColor(ghScope, GFX_WHITE);
|
||||
gwinSetColor(ghScope, GFX_RED);
|
||||
gwinClear(ghScope);
|
||||
|
||||
/* Just keep displaying the scope traces */
|
||||
|
|
|
@ -79,8 +79,8 @@ int main(void) {
|
|||
wi.width = swidth; wi.height = sheight;
|
||||
ghScope = gwinScopeCreate(&gScopeWindow, &wi, MY_AUDIO_CHANNEL, MY_AUDIO_FREQUENCY, MY_AUDIO_FORMAT);
|
||||
}
|
||||
gwinSetBgColor(ghScope, White);
|
||||
gwinSetColor(ghScope, Red);
|
||||
gwinSetBgColor(ghScope, GFX_WHITE);
|
||||
gwinSetColor(ghScope, GFX_RED);
|
||||
gwinClear(ghScope);
|
||||
|
||||
/* Just keep displaying the scope traces */
|
||||
|
|
|
@ -79,7 +79,7 @@ repeatplay:
|
|||
}
|
||||
|
||||
// Play the file
|
||||
gdispDrawString(0, gdispGetHeight()/2, "Playing...", font, Yellow);
|
||||
gdispDrawString(0, gdispGetHeight()/2, "Playing...", font, GFX_YELLOW);
|
||||
toplay = gfileGetSize(f);
|
||||
while(toplay) {
|
||||
// Get a buffer to put the data into
|
||||
|
@ -102,17 +102,17 @@ repeatplay:
|
|||
|
||||
// Wait for the play to finish
|
||||
gaudioPlayWait(TIME_INFINITE);
|
||||
gdispDrawString(0, gdispGetHeight()/2+10, "Done", font, Green);
|
||||
gdispDrawString(0, gdispGetHeight()/2+10, "Done", font, GFX_GREEN);
|
||||
|
||||
// Repeat the whole thing
|
||||
gfxSleepMilliseconds(1500);
|
||||
gdispClear(Black);
|
||||
gdispClear(GFX_BLACK);
|
||||
goto repeatplay;
|
||||
|
||||
// The end
|
||||
theend:
|
||||
if (errmsg)
|
||||
gdispDrawString(0, gdispGetHeight()/2, errmsg, font, Red);
|
||||
gdispDrawString(0, gdispGetHeight()/2, errmsg, font, GFX_RED);
|
||||
|
||||
while(TRUE)
|
||||
gfxSleepMilliseconds(1000);
|
||||
|
|
|
@ -162,7 +162,7 @@ repeatplay:
|
|||
}
|
||||
|
||||
// Play the file
|
||||
gdispDrawString(0, gdispGetHeight()/2, "Playing...", font, Yellow);
|
||||
gdispDrawString(0, gdispGetHeight()/2, "Playing...", font, GFX_YELLOW);
|
||||
while(toplay) {
|
||||
// Get a buffer to put the data into
|
||||
pd = gfxBufferGet(TIME_INFINITE); // This should never fail as we are waiting forever
|
||||
|
@ -184,17 +184,17 @@ repeatplay:
|
|||
|
||||
// Wait for the play to finish
|
||||
gaudioPlayWait(TIME_INFINITE);
|
||||
gdispDrawString(0, gdispGetHeight()/2+10, "Done", font, Green);
|
||||
gdispDrawString(0, gdispGetHeight()/2+10, "Done", font, GFX_GREEN);
|
||||
|
||||
// Repeat the whole thing
|
||||
gfxSleepMilliseconds(1500);
|
||||
gdispClear(Black);
|
||||
gdispClear(GFX_BLACK);
|
||||
goto repeatplay;
|
||||
|
||||
// The end
|
||||
theend:
|
||||
if (errmsg)
|
||||
gdispDrawString(0, gdispGetHeight()/2, errmsg, font, Red);
|
||||
gdispDrawString(0, gdispGetHeight()/2, errmsg, font, GFX_RED);
|
||||
|
||||
while(TRUE)
|
||||
gfxSleepMilliseconds(1000);
|
||||
|
|
|
@ -49,9 +49,9 @@ int main(void) {
|
|||
|
||||
while(1) {
|
||||
// Draw the arc sectors
|
||||
gdispClear(White);
|
||||
gdispDrawArcSectors(cx, cy, r1, sectors, Blue);
|
||||
gdispFillArcSectors(cx, cy, r2, sectors, Red);
|
||||
gdispClear(GFX_WHITE);
|
||||
gdispDrawArcSectors(cx, cy, r1, sectors, GFX_BLUE);
|
||||
gdispFillArcSectors(cx, cy, r2, sectors, GFX_RED);
|
||||
|
||||
// Increase the sectors counter
|
||||
sectors++;
|
||||
|
|
|
@ -41,12 +41,12 @@ int main(void) {
|
|||
height = gdispGetHeight();
|
||||
|
||||
// Code Here
|
||||
gdispDrawBox(10, 10, width/2, height/2, Yellow);
|
||||
gdispFillArea(width/2, height/2, width/2-10, height/2-10, Blue);
|
||||
gdispDrawLine(5, 30, width-50, height-40, Red);
|
||||
gdispDrawBox(10, 10, width/2, height/2, GFX_YELLOW);
|
||||
gdispFillArea(width/2, height/2, width/2-10, height/2-10, GFX_BLUE);
|
||||
gdispDrawLine(5, 30, width-50, height-40, GFX_RED);
|
||||
|
||||
for(i = 5, j = 0; i < width && j < height; i += 7, j += i/20)
|
||||
gdispDrawPixel(i, j, White);
|
||||
gdispDrawPixel(i, j, GFX_WHITE);
|
||||
|
||||
while(TRUE) {
|
||||
gfxSleepMilliseconds(500);
|
||||
|
|
|
@ -40,12 +40,12 @@ int main(void) {
|
|||
height = gdispGetHeight();
|
||||
|
||||
// Code Here
|
||||
gdispFillArc(width/2, height/2, width/4, -10, -45, White);
|
||||
gdispDrawCircle(width/2+width/8, height/2-height/8, 13, Green);
|
||||
gdispFillCircle (width/2+width/8, height/2-height/8, 10, Red);
|
||||
gdispDrawArc(width/2+width/8, height/2-height/8, 20, 25, 115, Gray);
|
||||
gdispFillEllipse (width-width/6, height-height/6, width/8, height/16, Blue);
|
||||
gdispDrawEllipse (width-width/6, height-height/6, width/16, height/8, Yellow);
|
||||
gdispFillArc(width/2, height/2, width/4, -10, -45, GFX_WHITE);
|
||||
gdispDrawCircle(width/2+width/8, height/2-height/8, 13, GFX_GREEN);
|
||||
gdispFillCircle (width/2+width/8, height/2-height/8, 10, GFX_RED);
|
||||
gdispDrawArc(width/2+width/8, height/2-height/8, 20, 25, 115, GFX_GRAY);
|
||||
gdispFillEllipse (width-width/6, height-height/6, width/8, height/16, GFX_BLUE);
|
||||
gdispDrawEllipse (width-width/6, height-height/6, width/16, height/8, GFX_YELLOW);
|
||||
|
||||
while(TRUE) {
|
||||
gfxSleepMilliseconds(500);
|
||||
|
|
|
@ -60,21 +60,21 @@ int main(void) {
|
|||
line2 = "0123456789~!@#$%^&*_-+=(){}[]<>|/\\:;,.?'\"`";
|
||||
|
||||
// Font 1
|
||||
gdispFillStringBox(0, y, width, fheight1, line1, font1, Black, White, justifyCenter);
|
||||
gdispFillStringBox(0, y, width, fheight1, line1, font1, GFX_BLACK, GFX_WHITE, justifyCenter);
|
||||
y += fheight1+1;
|
||||
gdispFillStringBox(0, y, width, fheight1, line2, font1, Black, White, justifyCenter);
|
||||
gdispFillStringBox(0, y, width, fheight1, line2, font1, GFX_BLACK, GFX_WHITE, justifyCenter);
|
||||
y += fheight1+1;
|
||||
|
||||
// Font 2
|
||||
gdispFillStringBox(0, y, width, fheight2, line1, font2, Black, White, justifyCenter);
|
||||
gdispFillStringBox(0, y, width, fheight2, line1, font2, GFX_BLACK, GFX_WHITE, justifyCenter);
|
||||
y += fheight2+1;
|
||||
gdispFillStringBox(0, y, width, fheight2, line2, font2, Black, White, justifyCenter);
|
||||
gdispFillStringBox(0, y, width, fheight2, line2, font2, GFX_BLACK, GFX_WHITE, justifyCenter);
|
||||
y += fheight2+1;
|
||||
|
||||
// Font 1 drawing White on the (black) background
|
||||
gdispDrawStringBox(0, y, width, fheight1, line1, font1, White, justifyCenter);
|
||||
gdispDrawStringBox(0, y, width, fheight1, line1, font1, GFX_WHITE, justifyCenter);
|
||||
y += fheight1+1;
|
||||
gdispDrawStringBox(0, y, width, fheight1, line2, font1, White, justifyCenter);
|
||||
gdispDrawStringBox(0, y, width, fheight1, line2, font1, GFX_WHITE, justifyCenter);
|
||||
y += fheight1+1;
|
||||
|
||||
// Show Sizes
|
||||
|
@ -85,7 +85,7 @@ int main(void) {
|
|||
buf[4] = (fheight2-2)/10 + '0';
|
||||
buf[5] = (fheight2-2)%10 + '0';
|
||||
buf[6] = 0;
|
||||
gdispFillStringBox(0, y, width, fheight1, buf, font1, Red, White, justifyCenter);
|
||||
gdispFillStringBox(0, y, width, fheight1, buf, font1, GFX_RED, GFX_WHITE, justifyCenter);
|
||||
|
||||
// Wait forever
|
||||
while(TRUE) {
|
||||
|
|
|
@ -39,7 +39,7 @@ int main(void) {
|
|||
font1 = gdispOpenFont("Archangelsk Regular 12");
|
||||
|
||||
// Demonstrate our other fonts
|
||||
gdispDrawString(10, 10, "привет мир", font1, Yellow);
|
||||
gdispDrawString(10, 10, "привет мир", font1, GFX_YELLOW);
|
||||
|
||||
// Wait forever
|
||||
while(TRUE) {
|
||||
|
|
|
@ -85,21 +85,21 @@ int main(void) {
|
|||
gdispImageCache(&myImage);
|
||||
#endif
|
||||
if (gdispImageDraw(&myImage, 0, 0, myImage.width, myImage.height, 0, 0) != GDISP_IMAGE_ERR_OK) {
|
||||
SHOW_ERROR(Orange);
|
||||
SHOW_ERROR(GFX_ORANGE);
|
||||
break;
|
||||
}
|
||||
delay = gdispImageNext(&myImage);
|
||||
if (delay == TIME_INFINITE) {
|
||||
SHOW_ERROR(Green);
|
||||
SHOW_ERROR(GFX_GREEN);
|
||||
break;
|
||||
}
|
||||
SHOW_ERROR(Yellow);
|
||||
SHOW_ERROR(GFX_YELLOW);
|
||||
if (delay != TIME_IMMEDIATE)
|
||||
gfxSleepMilliseconds(delay);
|
||||
}
|
||||
gdispImageClose(&myImage);
|
||||
} else
|
||||
SHOW_ERROR(Red);
|
||||
SHOW_ERROR(GFX_RED);
|
||||
|
||||
while(1) {
|
||||
gfxSleepMilliseconds(1000);
|
||||
|
|
|
@ -48,7 +48,7 @@ int main(void)
|
|||
|
||||
// Initialize everything
|
||||
gfxInit();
|
||||
gdispClear(Silver);
|
||||
gdispClear(GFX_SILVER);
|
||||
|
||||
// Open the image file
|
||||
gdispImageOpenFile(&_imgHome, "icon_home.bmp");
|
||||
|
@ -56,7 +56,7 @@ int main(void)
|
|||
// Retrieve the color palette size and dump it - just for fun.
|
||||
paletteSize = gdispImageGetPaletteSize(&_imgHome);
|
||||
if (paletteSize != 2) { // With this image we expect the palette to have only two entries!
|
||||
gdispClear(Red);
|
||||
gdispClear(GFX_RED);
|
||||
while (1);
|
||||
}
|
||||
|
||||
|
@ -64,33 +64,33 @@ int main(void)
|
|||
gdispImageDraw(&_imgHome, 10, 10, gdispGetWidth(), gdispGetHeight(), 0, 0);
|
||||
|
||||
// Modify the palette & redraw at a different location
|
||||
gdispImageAdjustPalette(&_imgHome, 0, Blue);
|
||||
gdispImageAdjustPalette(&_imgHome, 1, Red);
|
||||
gdispImageAdjustPalette(&_imgHome, 0, GFX_BLUE);
|
||||
gdispImageAdjustPalette(&_imgHome, 1, GFX_RED);
|
||||
gdispImageDraw(&_imgHome, 10, 60, gdispGetWidth(), gdispGetHeight(), 0, 0);
|
||||
|
||||
// Modify the palette & redraw at a different location
|
||||
gdispImageAdjustPalette(&_imgHome, 0, White);
|
||||
gdispImageAdjustPalette(&_imgHome, 1, Black);
|
||||
gdispImageAdjustPalette(&_imgHome, 0, GFX_WHITE);
|
||||
gdispImageAdjustPalette(&_imgHome, 1, GFX_BLACK);
|
||||
gdispImageDraw(&_imgHome, 10, 110, gdispGetWidth(), gdispGetHeight(), 0, 0);
|
||||
|
||||
// Modify the palette & redraw at a different location
|
||||
gdispImageAdjustPalette(&_imgHome, 0, Lime);
|
||||
gdispImageAdjustPalette(&_imgHome, 1, Navy);
|
||||
gdispImageAdjustPalette(&_imgHome, 0, GFX_LIME);
|
||||
gdispImageAdjustPalette(&_imgHome, 1, GFX_NAVY);
|
||||
gdispImageDraw(&_imgHome, 10, 160, gdispGetWidth(), gdispGetHeight(), 0, 0);
|
||||
|
||||
// Modify the palette & redraw at a different location
|
||||
gdispImageAdjustPalette(&_imgHome, 0, Gray);
|
||||
gdispImageAdjustPalette(&_imgHome, 1, Yellow);
|
||||
gdispImageAdjustPalette(&_imgHome, 0, GFX_GRAY);
|
||||
gdispImageAdjustPalette(&_imgHome, 1, GFX_YELLOW);
|
||||
gdispImageDraw(&_imgHome, 60, 60, gdispGetWidth(), gdispGetHeight(), 0, 0);
|
||||
|
||||
// Modify the palette & redraw at a different location
|
||||
gdispImageAdjustPalette(&_imgHome, 0, Green);
|
||||
gdispImageAdjustPalette(&_imgHome, 1, Black);
|
||||
gdispImageAdjustPalette(&_imgHome, 0, GFX_GREEN);
|
||||
gdispImageAdjustPalette(&_imgHome, 1, GFX_BLACK);
|
||||
gdispImageDraw(&_imgHome, 60, 110, gdispGetWidth(), gdispGetHeight(), 0, 0);
|
||||
|
||||
// Modify the palette & redraw at a different location
|
||||
gdispImageAdjustPalette(&_imgHome, 0, Lime);
|
||||
gdispImageAdjustPalette(&_imgHome, 1, Teal);
|
||||
gdispImageAdjustPalette(&_imgHome, 0, GFX_LIME);
|
||||
gdispImageAdjustPalette(&_imgHome, 1, GFX_TEAL);
|
||||
gdispImageDraw(&_imgHome, 60, 160, gdispGetWidth(), gdispGetHeight(), 0, 0);
|
||||
|
||||
// We're done. Clean up.
|
||||
|
|
|
@ -71,16 +71,16 @@
|
|||
/* Draw draw draw */
|
||||
sprintg(buf, "Display %u", display);
|
||||
if (width < 128) {
|
||||
gdispGDrawBox(g, 0, 0, width/2, height/2, Yellow);
|
||||
gdispGFillStringBox(g, 0, height/2, width, height/2, buf, f, Black, Blue, justifyCenter);
|
||||
gdispGDrawBox(g, 0, 0, width/2, height/2, GFX_YELLOW);
|
||||
gdispGFillStringBox(g, 0, height/2, width, height/2, buf, f, GFX_BLACK, GFX_BLUE, justifyCenter);
|
||||
} else {
|
||||
gdispGDrawBox(g, 10, 10, width/2, height/2, Yellow);
|
||||
gdispGFillStringBox(g, width/2, height/2, width/2-10, height/2-10, buf, f, White, Blue, justifyCenter);
|
||||
gdispGDrawBox(g, 10, 10, width/2, height/2, GFX_YELLOW);
|
||||
gdispGFillStringBox(g, width/2, height/2, width/2-10, height/2-10, buf, f, GFX_WHITE, GFX_BLUE, justifyCenter);
|
||||
}
|
||||
gdispGDrawLine(g, 5, 30, width-50, height-40, Red);
|
||||
gdispGDrawLine(g, 5, 30, width-50, height-40, GFX_RED);
|
||||
|
||||
for(i = 5, j = 0; i < width && j < height; i += 7, j += i/20)
|
||||
gdispGDrawPixel(g, i, j, White);
|
||||
gdispGDrawPixel(g, i, j, GFX_WHITE);
|
||||
}
|
||||
|
||||
while(TRUE) {
|
||||
|
@ -114,16 +114,16 @@
|
|||
/* Draw draw draw */
|
||||
sprintg(buf, "Display %u", display);
|
||||
if (width < 128) {
|
||||
gdispDrawBox(0, 0, width/2, height/2, Yellow);
|
||||
gdispFillStringBox(0, height/2, width, height/2, buf, f, Black, Blue, justifyCenter);
|
||||
gdispDrawBox(0, 0, width/2, height/2, GFX_YELLOW);
|
||||
gdispFillStringBox(0, height/2, width, height/2, buf, f, GFX_BLACK, GFX_BLUE, justifyCenter);
|
||||
} else {
|
||||
gdispDrawBox(10, 10, width/2, height/2, Yellow);
|
||||
gdispFillStringBox(width/2, height/2, width/2-10, height/2-10, buf, f, White, Blue, justifyCenter);
|
||||
gdispDrawBox(10, 10, width/2, height/2, GFX_YELLOW);
|
||||
gdispFillStringBox(width/2, height/2, width/2-10, height/2-10, buf, f, GFX_WHITE, GFX_BLUE, justifyCenter);
|
||||
}
|
||||
gdispDrawLine(5, 30, width-50, height-40, Red);
|
||||
gdispDrawLine(5, 30, width-50, height-40, GFX_RED);
|
||||
|
||||
for(i = 5, j = 0; i < width && j < height; i += 7, j += i/20)
|
||||
gdispDrawPixel(i, j, White);
|
||||
gdispDrawPixel(i, j, GFX_WHITE);
|
||||
}
|
||||
|
||||
while(TRUE) {
|
||||
|
|
|
@ -59,12 +59,12 @@ int main(void) {
|
|||
surface[j*PIXMAP_WIDTH + i] = RGB2COLOR(0, 255-i*(256/PIXMAP_WIDTH), j*(256/PIXMAP_HEIGHT));
|
||||
|
||||
// Secondly, show drawing a line on it like a virtual display
|
||||
gdispGDrawLine(pixmap, 0, 0, gdispGGetWidth(pixmap)-1, gdispGGetHeight(pixmap)-1, White);
|
||||
gdispGDrawLine(pixmap, 0, 0, gdispGGetWidth(pixmap)-1, gdispGGetHeight(pixmap)-1, GFX_WHITE);
|
||||
|
||||
i = j = 0;
|
||||