From 60699af63f92f43cc4b4b9e3050fcdd2a8468281 Mon Sep 17 00:00:00 2001 From: Andrew Opalach Date: Wed, 10 Apr 2019 15:14:00 -0400 Subject: add opengl fronend, remove sdl frontend, refactor build system --- .../CEdev/examples/gfx_template/iconc.png | Bin 0 -> 910 bytes .../CEdev/examples/gfx_template/makefile | 15 +++++ .../CEdev/examples/gfx_template/readme.md | 12 ++++ .../CEdev/examples/gfx_template/src/main.c | 64 +++++++++++++++++++++ 4 files changed, 91 insertions(+) create mode 100644 frontends/calculator/CEdev/examples/gfx_template/iconc.png create mode 100644 frontends/calculator/CEdev/examples/gfx_template/makefile create mode 100644 frontends/calculator/CEdev/examples/gfx_template/readme.md create mode 100644 frontends/calculator/CEdev/examples/gfx_template/src/main.c (limited to 'frontends/calculator/CEdev/examples/gfx_template') diff --git a/frontends/calculator/CEdev/examples/gfx_template/iconc.png b/frontends/calculator/CEdev/examples/gfx_template/iconc.png new file mode 100644 index 0000000..125ca62 Binary files /dev/null and b/frontends/calculator/CEdev/examples/gfx_template/iconc.png differ diff --git a/frontends/calculator/CEdev/examples/gfx_template/makefile b/frontends/calculator/CEdev/examples/gfx_template/makefile new file mode 100644 index 0000000..1f1b36b --- /dev/null +++ b/frontends/calculator/CEdev/examples/gfx_template/makefile @@ -0,0 +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 diff --git a/frontends/calculator/CEdev/examples/gfx_template/readme.md b/frontends/calculator/CEdev/examples/gfx_template/readme.md new file mode 100644 index 0000000..9d807e1 --- /dev/null +++ b/frontends/calculator/CEdev/examples/gfx_template/readme.md @@ -0,0 +1,12 @@ +### GraphX Template + +You can clone this directory for your own GraphX-based projects. + +To add code, fill in the begin, end, step, and draw functions in main.c. You can also create your own .c and .h files and add them to the directory; the Makefile included in this template will automatically find and compile the new .c files. + +In addition, you can also add your own .asm files, which will be detected and +added appropriately to the proper segment. + +--- + +This template is a part of the C SDK Toolchain for use on the CE. diff --git a/frontends/calculator/CEdev/examples/gfx_template/src/main.c b/frontends/calculator/CEdev/examples/gfx_template/src/main.c new file mode 100644 index 0000000..2904b0a --- /dev/null +++ b/frontends/calculator/CEdev/examples/gfx_template/src/main.c @@ -0,0 +1,64 @@ +/* + *-------------------------------------- + * Program Name: + * Author: + * License: + * Description: + *-------------------------------------- +*/ + +/* Keep these headers */ +#include +#include +#include +#include + +/* Standard headers (recommended) */ +#include +#include +#include +#include + +#include + +/* Put your function prototypes here */ +void begin(); +void end(); +bool step(); +void draw(); + +/* Put all your globals here */ +bool partial_redraw; + +void main() { + begin(); // No rendering allowed! + gfx_Begin(); + gfx_SetDrawBuffer(); // Draw to the buffer to avoid rendering artifats + + while (step()) { // No rendering allowed in step! + if (partial_redraw) // Only want to redraw part of the previous frame? + gfx_BlitScreen(); // Copy previous frame as a base for this frame + draw(); // As little non-rendering logic as possible + gfx_SwapDraw(); // Queue the buffered frame to be displayed + } + + gfx_End(); + end(); +} + +/* Put other functions here */ +void begin() { + /* Implement me! */ +} + +void end() { + /* Implement me! */ +} + +bool step() { + /* Implement me! */ +} + +void draw() { + /* Implement me! */ +} -- cgit v1.2.3-101-g0448