From 55bfff7cf6541caac172b43186cf14405185b14d Mon Sep 17 00:00:00 2001 From: Andrew Opalach Date: Sat, 13 Apr 2019 12:40:52 -0400 Subject: fix curses on linux --- .../CEdev/examples/gfx_clipping/autotester.json | 104 ++++++------- .../CEdev/examples/gfx_clipping/makefile | 30 ++-- .../CEdev/examples/gfx_clipping/readme.md | 20 +-- .../CEdev/examples/gfx_clipping/src/main.c | 170 ++++++++++----------- 4 files changed, 162 insertions(+), 162 deletions(-) (limited to 'frontends/calculator/CEdev/examples/gfx_clipping') diff --git a/frontends/calculator/CEdev/examples/gfx_clipping/autotester.json b/frontends/calculator/CEdev/examples/gfx_clipping/autotester.json index 13f45cb..a43dad7 100644 --- a/frontends/calculator/CEdev/examples/gfx_clipping/autotester.json +++ b/frontends/calculator/CEdev/examples/gfx_clipping/autotester.json @@ -1,52 +1,52 @@ -{ - "rom": "84pce_515.rom", - "transfer_files": [ - "bin/DEMO.8xp" - ], - "target": { - "name": "DEMO", - "isASM": true - }, - "sequence": [ - "action|launch", - "delay|300", - "hash|1", - "key|enter", - "delay|300", - "hash|2", - "key|right", - "key|left", - "delay|300", - "hash|3", - "key|enter", - "delay|300", - "hashWait|4" - ], - "hashes": { - "1": { - "description": "Check text scaling", - "start": "vram_start", - "size": "vram_8_size", - "expected_CRCs": [ "BCD2C22B" ] - }, - "2": { - "description": "Check text clipping", - "start": "vram_start", - "size": "vram_8_size", - "expected_CRCs": [ "BCD2C22B" ] - }, - "3": { - "description": "Check clipped region movement and text clipping", - "start": "vram_start", - "size": "vram_8_size", - "expected_CRCs": [ "BE2F6B1A" ] - }, - "4": { - "description": "Back to the home screen (exit check)", - "start": "vram_start", - "size": "vram_16_size", - "expected_CRCs": [ "FFAF89BA", "101734A5", "9DA19F44" ] - } - } -} - +{ + "rom": "84pce_515.rom", + "transfer_files": [ + "bin/DEMO.8xp" + ], + "target": { + "name": "DEMO", + "isASM": true + }, + "sequence": [ + "action|launch", + "delay|300", + "hash|1", + "key|enter", + "delay|300", + "hash|2", + "key|right", + "key|left", + "delay|300", + "hash|3", + "key|enter", + "delay|300", + "hashWait|4" + ], + "hashes": { + "1": { + "description": "Check text scaling", + "start": "vram_start", + "size": "vram_8_size", + "expected_CRCs": [ "BCD2C22B" ] + }, + "2": { + "description": "Check text clipping", + "start": "vram_start", + "size": "vram_8_size", + "expected_CRCs": [ "BCD2C22B" ] + }, + "3": { + "description": "Check clipped region movement and text clipping", + "start": "vram_start", + "size": "vram_8_size", + "expected_CRCs": [ "BE2F6B1A" ] + }, + "4": { + "description": "Back to the home screen (exit check)", + "start": "vram_start", + "size": "vram_16_size", + "expected_CRCs": [ "FFAF89BA", "101734A5", "9DA19F44" ] + } + } +} + diff --git a/frontends/calculator/CEdev/examples/gfx_clipping/makefile b/frontends/calculator/CEdev/examples/gfx_clipping/makefile index 1f1b36b..d3deba8 100644 --- a/frontends/calculator/CEdev/examples/gfx_clipping/makefile +++ b/frontends/calculator/CEdev/examples/gfx_clipping/makefile @@ -1,15 +1,15 @@ -# ---------------------------- -# Set NAME to the program name -# Set ICON to the png icon file name -# Set DESCRIPTION to display within a compatible shell -# Set COMPRESSED to "YES" to create a compressed program -# ---------------------------- - -NAME ?= DEMO -COMPRESSED ?= NO -ICON ?= iconc.png -DESCRIPTION ?= "C SDK Demo" - -# ---------------------------- - -include $(CEDEV)/include/.makefile +# ---------------------------- +# Set NAME to the program name +# Set ICON to the png icon file name +# Set DESCRIPTION to display within a compatible shell +# Set COMPRESSED to "YES" to create a compressed program +# ---------------------------- + +NAME ?= DEMO +COMPRESSED ?= NO +ICON ?= iconc.png +DESCRIPTION ?= "C SDK Demo" + +# ---------------------------- + +include $(CEDEV)/include/.makefile diff --git a/frontends/calculator/CEdev/examples/gfx_clipping/readme.md b/frontends/calculator/CEdev/examples/gfx_clipping/readme.md index c0f0dbb..819dd6d 100644 --- a/frontends/calculator/CEdev/examples/gfx_clipping/readme.md +++ b/frontends/calculator/CEdev/examples/gfx_clipping/readme.md @@ -1,10 +1,10 @@ -### GraphX Clipping Demo - -This example demonstrates alternating the clipping region and using clipped text properly. - -![Screenshot](screenshot.gif) - ---- - -This demo is a part of the C SDK Toolchain for use on the CE. - +### GraphX Clipping Demo + +This example demonstrates alternating the clipping region and using clipped text properly. + +![Screenshot](screenshot.gif) + +--- + +This demo is a part of the C SDK Toolchain for use on the CE. + diff --git a/frontends/calculator/CEdev/examples/gfx_clipping/src/main.c b/frontends/calculator/CEdev/examples/gfx_clipping/src/main.c index 97f30eb..69308b1 100644 --- a/frontends/calculator/CEdev/examples/gfx_clipping/src/main.c +++ b/frontends/calculator/CEdev/examples/gfx_clipping/src/main.c @@ -1,85 +1,85 @@ -#include -#include -#include -#include - -#include -#include -#include - -#include - -/* Use some random color as the transparent one */ -#define TRANSPARENT_COLOR 10 -#define FONT_WIDTH 8 -#define FONT_HEIGHT 8 - -void main(void) { - uint8_t key = 24; - - /* Starting text posistion */ - int x = (LCD_WIDTH / 2) - 20; - int y = (LCD_HEIGHT / 2) - 5; - - int box_stride = 1; - int box_scale = 20; - - /* Initialize the 8bpp graphics */ - gfx_Begin(); - gfx_FillScreen(gfx_black); - - /* Setup the colors */ - gfx_SetColor(gfx_white); - gfx_SetTextFGColor(gfx_red); - - /* Set the transparent text background color */ - gfx_SetTextBGColor(TRANSPARENT_COLOR); - gfx_SetTextTransparentColor(TRANSPARENT_COLOR); - - /* Print some scaled font */ - gfx_SetTextScale(2, 2); - gfx_PrintStringXY("This text is SCALED!!", 15, 10); - - /* Wait for a key before continuing */ - while (!os_GetCSC()); - - /* Configure the font to normal size, clipped, and monospaced */ - gfx_SetTextScale(1, 1); - gfx_SetTextConfig(gfx_text_clip); - gfx_SetMonospaceFont(FONT_WIDTH); - - /* Graphics routines draw to the back buffer */ - gfx_SetDrawBuffer(); - - /* Run until the [ENTER] key is pressed */ - do { - /* Check if any keys are pressed */ - if (key == sk_Left) { x--; } - if (key == sk_Right) { x++; } - if (key == sk_Down) { y++; } - if (key == sk_Up) { y--; } - if (key) { - gfx_SetClipRegion((LCD_WIDTH/2) - box_scale, (LCD_HEIGHT/2) - box_scale, (LCD_WIDTH/2) + box_scale, (LCD_HEIGHT/2) + box_scale); - - gfx_FillScreen(gfx_black); - gfx_PrintStringXY("FUN WITH CLIPPING", x, y); - - /* Draw a rectangle on the edges of the clipping region so we can see it */ - gfx_Rectangle_NoClip((LCD_WIDTH/2) - box_scale, (LCD_HEIGHT/2) - box_scale, box_scale * 2, box_scale * 2); - - /* Change the clipping region */ - box_scale += box_stride; - - /* Check if we should increase or decrease the clip region */ - if (box_scale > 100 || box_scale < 10) { - box_stride = -box_stride; - } - - /* Move the graphics so the user can see it */ - gfx_SwapDraw(); - } - } while ((key = os_GetCSC()) != sk_Enter); - - /* Usual cleanup */ - gfx_End(); -} +#include +#include +#include +#include + +#include +#include +#include + +#include + +/* Use some random color as the transparent one */ +#define TRANSPARENT_COLOR 10 +#define FONT_WIDTH 8 +#define FONT_HEIGHT 8 + +void main(void) { + uint8_t key = 24; + + /* Starting text posistion */ + int x = (LCD_WIDTH / 2) - 20; + int y = (LCD_HEIGHT / 2) - 5; + + int box_stride = 1; + int box_scale = 20; + + /* Initialize the 8bpp graphics */ + gfx_Begin(); + gfx_FillScreen(gfx_black); + + /* Setup the colors */ + gfx_SetColor(gfx_white); + gfx_SetTextFGColor(gfx_red); + + /* Set the transparent text background color */ + gfx_SetTextBGColor(TRANSPARENT_COLOR); + gfx_SetTextTransparentColor(TRANSPARENT_COLOR); + + /* Print some scaled font */ + gfx_SetTextScale(2, 2); + gfx_PrintStringXY("This text is SCALED!!", 15, 10); + + /* Wait for a key before continuing */ + while (!os_GetCSC()); + + /* Configure the font to normal size, clipped, and monospaced */ + gfx_SetTextScale(1, 1); + gfx_SetTextConfig(gfx_text_clip); + gfx_SetMonospaceFont(FONT_WIDTH); + + /* Graphics routines draw to the back buffer */ + gfx_SetDrawBuffer(); + + /* Run until the [ENTER] key is pressed */ + do { + /* Check if any keys are pressed */ + if (key == sk_Left) { x--; } + if (key == sk_Right) { x++; } + if (key == sk_Down) { y++; } + if (key == sk_Up) { y--; } + if (key) { + gfx_SetClipRegion((LCD_WIDTH/2) - box_scale, (LCD_HEIGHT/2) - box_scale, (LCD_WIDTH/2) + box_scale, (LCD_HEIGHT/2) + box_scale); + + gfx_FillScreen(gfx_black); + gfx_PrintStringXY("FUN WITH CLIPPING", x, y); + + /* Draw a rectangle on the edges of the clipping region so we can see it */ + gfx_Rectangle_NoClip((LCD_WIDTH/2) - box_scale, (LCD_HEIGHT/2) - box_scale, box_scale * 2, box_scale * 2); + + /* Change the clipping region */ + box_scale += box_stride; + + /* Check if we should increase or decrease the clip region */ + if (box_scale > 100 || box_scale < 10) { + box_stride = -box_stride; + } + + /* Move the graphics so the user can see it */ + gfx_SwapDraw(); + } + } while ((key = os_GetCSC()) != sk_Enter); + + /* Usual cleanup */ + gfx_End(); +} -- cgit v1.2.3-101-g0448