Skip to content

Commit ed75888

Browse files
Added some more graphx demos and updated AutoTester files
1 parent 65b9c97 commit ed75888

36 files changed

+4503
-4924
lines changed
Binary file not shown.

CEdev/examples/library_examples/graphics/demo_0/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@ void main(void) {
4545

4646
/* Prints a screen centered string */
4747
void print_string_centered(const char *str) {
48-
gfx_PrintStringXY(str, (gfx_lcdWidth-gfx_GetStringWidth(str)) / 2, (gfx_lcdHeight-gfx_FontHeight()) / 2);
48+
gfx_PrintStringXY(str, (LCD_WIDTH-gfx_GetStringWidth(str)) / 2, (LCD_HEIGHT-gfx_FontHeight()) / 2);
4949
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"rom": "84pce_515.rom",
3+
"transfer_files": [
4+
"bin/GRAPHX10.8xp"
5+
],
6+
"target": {
7+
"name": "GRAPHX10",
8+
"isASM": true
9+
},
10+
"sequence": [
11+
"action|launch",
12+
"delay|300",
13+
"hash|1",
14+
"key|enter",
15+
"delay|300",
16+
"hash|2"
17+
],
18+
"hashes": {
19+
"1": {
20+
"description": "Test flipped text",
21+
"start": "vram_start",
22+
"size": "vram_8_size",
23+
"expected_CRCs": [ "198A8841" ]
24+
},
25+
"2": {
26+
"description": "Back to the home screen (exit check)",
27+
"start": "vram_start",
28+
"size": "vram_16_size",
29+
"expected_CRCs": [ "FFAF89BA", "101734A5", "9DA19F44" ]
30+
}
31+
}
32+
}
Binary file not shown.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#----------------------------
2+
3+
#Change TARGET to specify the output program name
4+
#Change DEBUGMODE to "DEBUG" in order to compile debug.h functions in, and "NDEBUG" to not compile debugging functions
5+
#Change ARCHIVED to "YES" to mark the output as archived, and "NO" to not
6+
#Change APPVAR to "YES" to create the file as an AppVar, otherwise "NO" for programs
7+
#Change ICONPNG to change the name of the png file that should be made into the icon
8+
#Change DESCRIPTION to modify what is displayed within a compatible shell (Not compiled in if icon is not present)
9+
10+
#----------------------------
11+
TARGET ?= GRAPHX10
12+
DEBUGMODE ?= NDEBUG
13+
ARCHIVED ?= NO
14+
APPVAR ?= NO
15+
#----------------------------
16+
ICONPNG ?= iconc.png
17+
DESCRIPTION ?= "C Graphics Demo 10"
18+
#----------------------------
19+
20+
#Add shared library names to the L varible, for instance:
21+
# L := graphx fileioc keypadc
22+
L := graphx
23+
24+
#These directories specify where source and output should go
25+
26+
#----------------------------
27+
SRCDIR := src
28+
OBJDIR := obj
29+
BINDIR := bin
30+
GFXDIR := src/gfx
31+
#----------------------------
32+
33+
#This changes the location of compiled output (Advanced)
34+
35+
#----------------------------
36+
BSSHEAP_LOW := D031F6
37+
BSSHEAP_HIGH := D13FD6
38+
STACK_HIGH := D1A87E
39+
INIT_LOC := D1A87F
40+
#----------------------------
41+
42+
#Use the (slower) OS embedded functions (Advanced)
43+
44+
#----------------------------
45+
USE_FLASH_FUNCTIONS ?= YES
46+
#----------------------------
47+
48+
include $(CEDEV)/bin/main_makefile
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Demo 10
2+
3+
A simple demo showing an upside down string
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/* Keep these headers */
2+
#include <stdbool.h>
3+
#include <stddef.h>
4+
#include <stdint.h>
5+
#include <tice.h>
6+
7+
/* Standard headers - it's recommended to leave them included */
8+
#include <math.h>
9+
#include <stdio.h>
10+
#include <stdlib.h>
11+
#include <string.h>
12+
13+
/* Shared libraries */
14+
#include <lib/ce/graphx.h>
15+
16+
/* Use some random color as the transparent one */
17+
#define TRANSPARENT_COLOR 10
18+
#define FONT_WIDTH 8
19+
20+
/* Put function prototypes here */
21+
22+
void printu(char *str, int x, int y);
23+
24+
const char *my_str = "!!DEPPILF si txet sihT";
25+
26+
/* Put all your code here */
27+
void main(void) {
28+
/* Initialize the 8bpp graphics */
29+
gfx_Begin( gfx_8bpp );
30+
gfx_FillScreen( gfx_black );
31+
32+
/* Setup the colors */
33+
gfx_SetTextFGColor( gfx_white );
34+
35+
/* Set the transparent text background color */
36+
gfx_SetTextBGColor( TRANSPARENT_COLOR );
37+
gfx_SetTextTransparentColor( TRANSPARENT_COLOR );
38+
gfx_SetMonospaceFont( FONT_WIDTH );
39+
40+
/* Print some upside down text */
41+
printu(my_str, (LCD_WIDTH - gfx_GetStringWidth(my_str)) / 2, (LCD_HEIGHT - gfx_FontHeight()) / 2);
42+
43+
/* Wait for key */
44+
while(!os_GetCSC());
45+
46+
/* Usual cleanup */
47+
gfx_End();
48+
prgm_CleanUp();
49+
}
50+
51+
void printu(char *str, int x, int y) {
52+
gfx_TempSprite( my_char, 8, 8 );
53+
54+
while(*str) {
55+
gfx_TransparentSprite( gfx_RotateSpriteHalf( gfx_GetSpriteChar(*str), my_char), x, y);
56+
x += gfx_GetCharWidth(*str++);
57+
}
58+
}

CEdev/examples/library_examples/graphics/demo_2/GRAPHX2_test.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"description": "Make sure the rotated sprites are displayed properly",
2121
"start": "vram_start",
2222
"size": "vram_8_size",
23-
"expected_CRCs": [ "30ABE132" ]
23+
"expected_CRCs": [ "40F05140" ]
2424
},
2525
"2": {
2626
"description": "Back to the home screen (exit check)",
Binary file not shown.
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
#GroupC : logo_gfx
2-
#Compression : none
3-
#Palette : xlibc
4-
#Sprites :
2+
#PNGImages :
53
ubuntu.png

0 commit comments

Comments
 (0)