diff options
author | Joel Bodenmann <joel@seriouslyembedded.com> | 2016-02-07 22:59:35 +0100 |
---|---|---|
committer | Joel Bodenmann <joel@seriouslyembedded.com> | 2016-02-07 22:59:35 +0100 |
commit | 7b6000346133a34600058931c7dbe2cfbbe1559d (patch) | |
tree | 84c5b4d2d2b078c6b1309bb8be7631dcfbb55089 /demos/modules/gtrans/basic | |
parent | 6b07b2af74b25f75e6006c13da4826568d0ea3c1 (diff) | |
download | uGFX-7b6000346133a34600058931c7dbe2cfbbe1559d.tar.gz uGFX-7b6000346133a34600058931c7dbe2cfbbe1559d.tar.bz2 uGFX-7b6000346133a34600058931c7dbe2cfbbe1559d.zip |
Preliminary version of GTRANS
Diffstat (limited to 'demos/modules/gtrans/basic')
-rw-r--r-- | demos/modules/gtrans/basic/gfxconf.h | 2 | ||||
-rw-r--r-- | demos/modules/gtrans/basic/main.c | 39 |
2 files changed, 39 insertions, 2 deletions
diff --git a/demos/modules/gtrans/basic/gfxconf.h b/demos/modules/gtrans/basic/gfxconf.h index a5a0fbef..09e6bbea 100644 --- a/demos/modules/gtrans/basic/gfxconf.h +++ b/demos/modules/gtrans/basic/gfxconf.h @@ -42,7 +42,7 @@ #define GDISP_NEED_VALIDATION TRUE #define GDISP_NEED_CLIP TRUE #define GDISP_NEED_TEXT TRUE -#define GDISP_NEED_ANTIALIAS TRUE +#define GDISP_NEED_ANTIALIAS FALSE #define GDISP_INCLUDE_USER_FONTS FALSE #define GDISP_INCLUDE_FONT_UI1 FALSE diff --git a/demos/modules/gtrans/basic/main.c b/demos/modules/gtrans/basic/main.c index 38d163cd..63310be7 100644 --- a/demos/modules/gtrans/basic/main.c +++ b/demos/modules/gtrans/basic/main.c @@ -28,10 +28,47 @@ */ #include "gfx.h" - + +static const char* EnglishStrings[] = { + "Welcome", + "The number %s has the value %d", + "Goodbye" +}; +static const transTable EnglishTranslation = { sizeof(EnglishStrings)/sizeof(EnglishStrings[0]), EnglishStrings }; + +static const char* GermanStrings[] = { + "Herzlich Willkommen", + "Die Zahl %s hat den Wert %d", + "Auf Wiedersehen" +}; +static const transTable GermanTranslation = { sizeof(GermanStrings)/sizeof(GermanStrings[0]), GermanStrings }; + int main(void) { + size_t i, j; + font_t font; + gfxInit(); + gdispClear(Silver); + + font = gdispOpenFont("*"); + + gtransSetBaseLanguage(&EnglishTranslation); + gtransSetLanguage(&GermanTranslation); + + gtransSetLanguage(&EnglishTranslation); + i = 0; + for (j = 0; j < EnglishTranslation.numEntries; j++) { + gdispFillStringBox(20+300*i, 35*j, 300, 35, gtransIndex(j), font, Black, Silver, justifyLeft); + } + + gtransSetLanguage(&GermanTranslation); + i = 1; + for (j = 0; j < EnglishTranslation.numEntries; j++) { + gdispFillStringBox(20+300*i, 35*j, 300, 35, gtransIndex(j), font, Black, Silver, justifyLeft); + } + + gdispFillStringBox(20, 300, 300, 25, gtransString("Welcome"), font, Black, Silver, justifyLeft); while (TRUE) { gfxSleepMilliseconds(500); |