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 --- .../examples/gfx_buffered_cube/autotester.json | 80 ++++---- .../CEdev/examples/gfx_buffered_cube/makefile | 30 +-- .../CEdev/examples/gfx_buffered_cube/readme.md | 20 +- .../CEdev/examples/gfx_buffered_cube/src/main.c | 226 ++++++++++----------- 4 files changed, 178 insertions(+), 178 deletions(-) (limited to 'frontends/calculator/CEdev/examples/gfx_buffered_cube') diff --git a/frontends/calculator/CEdev/examples/gfx_buffered_cube/autotester.json b/frontends/calculator/CEdev/examples/gfx_buffered_cube/autotester.json index 6d4c32f..8fef238 100644 --- a/frontends/calculator/CEdev/examples/gfx_buffered_cube/autotester.json +++ b/frontends/calculator/CEdev/examples/gfx_buffered_cube/autotester.json @@ -1,40 +1,40 @@ -{ - "rom": "84pce_515.rom", - "transfer_files": [ - "bin/DEMO.8xp" - ], - "target": { - "name": "DEMO", - "isASM": true - }, - "sequence": [ - "action|launch", - "delay|300", - "hash|1", - "hash|2", - "key|enter", - "delay|300", - "hashWait|3" - ], - "hashes": { - "1": { - "description": "The background will be white (check a part before the cube)", - "start": "vram_start", - "size": "0x500", - "expected_CRCs": [ "5DAA1FBD" ] - }, - "2": { - "description": "The background will be white (check a part after the cube)", - "start": "0xD52700", - "size": "0x500", - "expected_CRCs": [ "5DAA1FBD" ] - }, - "3": { - "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", + "hash|2", + "key|enter", + "delay|300", + "hashWait|3" + ], + "hashes": { + "1": { + "description": "The background will be white (check a part before the cube)", + "start": "vram_start", + "size": "0x500", + "expected_CRCs": [ "5DAA1FBD" ] + }, + "2": { + "description": "The background will be white (check a part after the cube)", + "start": "0xD52700", + "size": "0x500", + "expected_CRCs": [ "5DAA1FBD" ] + }, + "3": { + "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_buffered_cube/makefile b/frontends/calculator/CEdev/examples/gfx_buffered_cube/makefile index 1f1b36b..d3deba8 100644 --- a/frontends/calculator/CEdev/examples/gfx_buffered_cube/makefile +++ b/frontends/calculator/CEdev/examples/gfx_buffered_cube/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_buffered_cube/readme.md b/frontends/calculator/CEdev/examples/gfx_buffered_cube/readme.md index 413aa36..c7cf3f4 100644 --- a/frontends/calculator/CEdev/examples/gfx_buffered_cube/readme.md +++ b/frontends/calculator/CEdev/examples/gfx_buffered_cube/readme.md @@ -1,10 +1,10 @@ -### GraphX Cube Buffer Demo - -Draws a rotating cube which demonstartes the line and double buffering routines - -![Screenshot](screenshot.gif) - ---- - -This demo is a part of the C SDK Toolchain for use on the CE. - +### GraphX Cube Buffer Demo + +Draws a rotating cube which demonstartes the line and double buffering routines + +![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_buffered_cube/src/main.c b/frontends/calculator/CEdev/examples/gfx_buffered_cube/src/main.c index 422e96c..3843d96 100644 --- a/frontends/calculator/CEdev/examples/gfx_buffered_cube/src/main.c +++ b/frontends/calculator/CEdev/examples/gfx_buffered_cube/src/main.c @@ -1,113 +1,113 @@ -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -/* Function prototypes */ -void rotate(void); - -/* Globals */ -#define ORG (-50) -#define DEG (6.0) -#define ANG (DEG * M_PI / 180.0) - -/* define the verticies for the two rectangles */ -float face1[4][2] = { - { 140, 45 }, - { 240, 45 }, - { 240, 145 }, - { 140, 145 }, -}; - -float face2[4][2] = { - { 140 + ORG, 45 - ORG }, - { 240 + ORG, 45 - ORG }, - { 240 + ORG, 145 - ORG }, - { 140 + ORG, 145 - ORG }, -}; - -/* declare some globals */ -float sin_angle, - cos_angle; - -float midx1, - midy1, - midx2, - midy2; - -/* Place main code in main */ -void main(void) { - uint8_t loop = 0; - - /* Seed the random numbers */ - srand(rtc_Time()); - - /* Get some main variables set up */ - sin_angle = sin(ANG); - cos_angle = cos(ANG); - midx1 = (face1[0][0] + face1[1][0]) / 2.0; - midy1 = (face1[1][1] + face1[2][1]) / 2.0; - midx2 = (face2[0][0] + face2[1][0]) / 2.0; - midy2 = (face2[1][1] + face2[2][1]) / 2.0; - - /* Start the graphics routines */ - gfx_Begin(); - gfx_SetDrawBuffer(); - - /* Loop until a key is pressed */ - while (!os_GetCSC()) { - - /* Change the color of the cube depending on loop (mod 16) */ - if (!((loop++) & 0xf)) { - gfx_SetColor(rand()); - } - - /* Call the rotation code */ - rotate(); - - /* Swap the buffer with the screen */ - gfx_SwapDraw(); - } - - /* End the graphics */ - gfx_End(); -} - -/* Rotation code */ -void rotate(void) { - uint8_t i, j; - float tmp1, tmp2; - - /* Compute the new vertex coordinates */ - for (i=0; i<4; i++) { - tmp1 = face1[i][0] - midx1; - tmp2 = face1[i][1] - midy1; - - face1[i][0] = midx1 + (tmp1 * cos_angle) - (tmp2 * sin_angle); - face1[i][1] = midy1 + (tmp1 * sin_angle) + (tmp2 * cos_angle); - - tmp1 = face2[i][0] - midx2; - tmp2 = face2[i][1] - midy2; - - face2[i][0] = midx2 + (tmp1 * cos_angle) - (tmp2 * sin_angle); - face2[i][1] = midy2 + (tmp1 * sin_angle) + (tmp2 * cos_angle); - } - - /* Clear the drawing buffer */ - gfx_FillScreen(gfx_white); - - /* Draw the cube */ - for (i=0; i<4; i++) { - j = i + 1 & 3; - gfx_Line(face1[i][0], face1[i][1], face1[j][0], face1[j][1]); - gfx_Line(face2[i][0], face2[i][1], face2[j][0], face2[j][1]); - gfx_Line(face1[i][0], face1[i][1], face2[i][0], face2[i][1]); - } -} +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +/* Function prototypes */ +void rotate(void); + +/* Globals */ +#define ORG (-50) +#define DEG (6.0) +#define ANG (DEG * M_PI / 180.0) + +/* define the verticies for the two rectangles */ +float face1[4][2] = { + { 140, 45 }, + { 240, 45 }, + { 240, 145 }, + { 140, 145 }, +}; + +float face2[4][2] = { + { 140 + ORG, 45 - ORG }, + { 240 + ORG, 45 - ORG }, + { 240 + ORG, 145 - ORG }, + { 140 + ORG, 145 - ORG }, +}; + +/* declare some globals */ +float sin_angle, + cos_angle; + +float midx1, + midy1, + midx2, + midy2; + +/* Place main code in main */ +void main(void) { + uint8_t loop = 0; + + /* Seed the random numbers */ + srand(rtc_Time()); + + /* Get some main variables set up */ + sin_angle = sin(ANG); + cos_angle = cos(ANG); + midx1 = (face1[0][0] + face1[1][0]) / 2.0; + midy1 = (face1[1][1] + face1[2][1]) / 2.0; + midx2 = (face2[0][0] + face2[1][0]) / 2.0; + midy2 = (face2[1][1] + face2[2][1]) / 2.0; + + /* Start the graphics routines */ + gfx_Begin(); + gfx_SetDrawBuffer(); + + /* Loop until a key is pressed */ + while (!os_GetCSC()) { + + /* Change the color of the cube depending on loop (mod 16) */ + if (!((loop++) & 0xf)) { + gfx_SetColor(rand()); + } + + /* Call the rotation code */ + rotate(); + + /* Swap the buffer with the screen */ + gfx_SwapDraw(); + } + + /* End the graphics */ + gfx_End(); +} + +/* Rotation code */ +void rotate(void) { + uint8_t i, j; + float tmp1, tmp2; + + /* Compute the new vertex coordinates */ + for (i=0; i<4; i++) { + tmp1 = face1[i][0] - midx1; + tmp2 = face1[i][1] - midy1; + + face1[i][0] = midx1 + (tmp1 * cos_angle) - (tmp2 * sin_angle); + face1[i][1] = midy1 + (tmp1 * sin_angle) + (tmp2 * cos_angle); + + tmp1 = face2[i][0] - midx2; + tmp2 = face2[i][1] - midy2; + + face2[i][0] = midx2 + (tmp1 * cos_angle) - (tmp2 * sin_angle); + face2[i][1] = midy2 + (tmp1 * sin_angle) + (tmp2 * cos_angle); + } + + /* Clear the drawing buffer */ + gfx_FillScreen(gfx_white); + + /* Draw the cube */ + for (i=0; i<4; i++) { + j = i + 1 & 3; + gfx_Line(face1[i][0], face1[i][1], face1[j][0], face1[j][1]); + gfx_Line(face2[i][0], face2[i][1], face2[j][0], face2[j][1]); + gfx_Line(face1[i][0], face1[i][1], face2[i][0], face2[i][1]); + } +} -- cgit v1.2.3-101-g0448