diff options
| author | 2019-04-14 20:10:23 -0400 | |
|---|---|---|
| committer | 2019-04-14 20:10:23 -0400 | |
| commit | 4477c1db42b579a441bf0a62bed2f627176f1c76 (patch) | |
| tree | e6960d29717ddecd45c88fa7ec510e644eecfda8 /frontends | |
| parent | 2e59a5b0a8e8b70f30d44de7d14e53c800e19914 (diff) | |
| download | cetris-4477c1db42b579a441bf0a62bed2f627176f1c76.tar.gz cetris-4477c1db42b579a441bf0a62bed2f627176f1c76.tar.bz2 cetris-4477c1db42b579a441bf0a62bed2f627176f1c76.zip | |
add next piece delay for when a line is cleared + cleanup
Diffstat (limited to 'frontends')
38 files changed, 1150 insertions, 4 deletions
diff --git a/frontends/calculator/Makefile b/frontends/calculator/Makefile new file mode 100644 index 0000000..505d4bf --- /dev/null +++ b/frontends/calculator/Makefile @@ -0,0 +1,8 @@ +NAME ?= Cetris +COMPRESSED ?= NO +ICON ?= iconc.png +DESCRIPTION ?= "Cetris for calculator" + +# ---------------------------- + +include $(CEDEV)/include/.makefile diff --git a/frontends/calculator/obj/gfx/block_1.src b/frontends/calculator/obj/gfx/block_1.src new file mode 100644 index 0000000..19a50e7 --- /dev/null +++ b/frontends/calculator/obj/gfx/block_1.src @@ -0,0 +1,98 @@ +; Zilog eZ80 ANSI C Compiler Release 3.4
+; -optsize -noreduceopt -nomodsect -peephole -globalopt
+; -localcse -const=ROM
+ FILE "SRC\GFX\BLOCK_1.C"
+ .assume ADL=1
+ SEGMENT DATA
+_block_1_data:
+ DB 9
+ DB 9
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 0
+ DB 5
+ DB 5
+ DB 5
+ DB 5
+ DB 5
+ DB 5
+ DB 2
+ DB 2
+ DB 5
+ DB 0
+ DB 0
+ DB 5
+ DB 5
+ DB 5
+ DB 5
+ DB 2
+ DB 2
+ DB 5
+ DB 0
+ DB 5
+ DB 5
+ DB 5
+ DB 5
+ DB 5
+ DB 2
+ DB 2
+ DB 5
+ DB 5
+ DB 5
+ DB 5
+ DB 5
+ DB 5
+ DB 5
+ DB 2
+ DB 2
+ DB 5
+ DB 5
+ DB 5
+ DB 5
+ DB 5
+ DB 5
+ DB 5
+ DB 2
+ DB 2
+ DB 5
+ DB 5
+ DB 5
+ DB 5
+ DB 5
+ DB 5
+ DB 5
+ DB 2
+ DB 2
+ DB 5
+ DB 5
+ DB 5
+ DB 5
+ DB 5
+ DB 5
+ DB 5
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ XDEF _block_1_data
+; 1 // convpng v7.0
+; 2 #include <stdint.h>
+; 3 #include "logo_gfx.h"
+; 4
+; 5 // 8 bpp image
+; 6 uint8_t block_1_data[83] = {
+ END
diff --git a/frontends/calculator/obj/gfx/block_2.src b/frontends/calculator/obj/gfx/block_2.src new file mode 100644 index 0000000..200b19f --- /dev/null +++ b/frontends/calculator/obj/gfx/block_2.src @@ -0,0 +1,98 @@ +; Zilog eZ80 ANSI C Compiler Release 3.4
+; -optsize -noreduceopt -nomodsect -peephole -globalopt
+; -localcse -const=ROM
+ FILE "SRC\GFX\BLOCK_2.C"
+ .assume ADL=1
+ SEGMENT DATA
+_block_2_data:
+ DB 9
+ DB 9
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 0
+ DB 7
+ DB 7
+ DB 7
+ DB 7
+ DB 7
+ DB 7
+ DB 2
+ DB 2
+ DB 7
+ DB 0
+ DB 0
+ DB 7
+ DB 7
+ DB 7
+ DB 7
+ DB 2
+ DB 2
+ DB 7
+ DB 0
+ DB 7
+ DB 7
+ DB 7
+ DB 7
+ DB 7
+ DB 2
+ DB 2
+ DB 7
+ DB 7
+ DB 7
+ DB 7
+ DB 7
+ DB 7
+ DB 7
+ DB 2
+ DB 2
+ DB 7
+ DB 7
+ DB 7
+ DB 7
+ DB 7
+ DB 7
+ DB 7
+ DB 2
+ DB 2
+ DB 7
+ DB 7
+ DB 7
+ DB 7
+ DB 7
+ DB 7
+ DB 7
+ DB 2
+ DB 2
+ DB 7
+ DB 7
+ DB 7
+ DB 7
+ DB 7
+ DB 7
+ DB 7
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ XDEF _block_2_data
+; 1 // convpng v7.0
+; 2 #include <stdint.h>
+; 3 #include "logo_gfx.h"
+; 4
+; 5 // 8 bpp image
+; 6 uint8_t block_2_data[83] = {
+ END
diff --git a/frontends/calculator/obj/gfx/block_3.src b/frontends/calculator/obj/gfx/block_3.src new file mode 100644 index 0000000..5126067 --- /dev/null +++ b/frontends/calculator/obj/gfx/block_3.src @@ -0,0 +1,98 @@ +; Zilog eZ80 ANSI C Compiler Release 3.4
+; -optsize -noreduceopt -nomodsect -peephole -globalopt
+; -localcse -const=ROM
+ FILE "SRC\GFX\BLOCK_3.C"
+ .assume ADL=1
+ SEGMENT DATA
+_block_3_data:
+ DB 9
+ DB 9
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 0
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 2
+ DB 2
+ DB 6
+ DB 0
+ DB 0
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 2
+ DB 2
+ DB 6
+ DB 0
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 2
+ DB 2
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 2
+ DB 2
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 2
+ DB 2
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 2
+ DB 2
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ XDEF _block_3_data
+; 1 // convpng v7.0
+; 2 #include <stdint.h>
+; 3 #include "logo_gfx.h"
+; 4
+; 5 // 8 bpp image
+; 6 uint8_t block_3_data[83] = {
+ END
diff --git a/frontends/calculator/obj/gfx/block_4.src b/frontends/calculator/obj/gfx/block_4.src new file mode 100644 index 0000000..bc9ad7d --- /dev/null +++ b/frontends/calculator/obj/gfx/block_4.src @@ -0,0 +1,98 @@ +; Zilog eZ80 ANSI C Compiler Release 3.4
+; -optsize -noreduceopt -nomodsect -peephole -globalopt
+; -localcse -const=ROM
+ FILE "SRC\GFX\BLOCK_4.C"
+ .assume ADL=1
+ SEGMENT DATA
+_block_4_data:
+ DB 9
+ DB 9
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 0
+ DB 3
+ DB 3
+ DB 3
+ DB 3
+ DB 3
+ DB 3
+ DB 2
+ DB 2
+ DB 3
+ DB 0
+ DB 0
+ DB 3
+ DB 3
+ DB 3
+ DB 3
+ DB 2
+ DB 2
+ DB 3
+ DB 0
+ DB 3
+ DB 3
+ DB 3
+ DB 3
+ DB 3
+ DB 2
+ DB 2
+ DB 3
+ DB 3
+ DB 3
+ DB 3
+ DB 3
+ DB 3
+ DB 3
+ DB 2
+ DB 2
+ DB 3
+ DB 3
+ DB 3
+ DB 3
+ DB 3
+ DB 3
+ DB 3
+ DB 2
+ DB 2
+ DB 3
+ DB 3
+ DB 3
+ DB 3
+ DB 3
+ DB 3
+ DB 3
+ DB 2
+ DB 2
+ DB 3
+ DB 3
+ DB 3
+ DB 3
+ DB 3
+ DB 3
+ DB 3
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ XDEF _block_4_data
+; 1 // convpng v7.0
+; 2 #include <stdint.h>
+; 3 #include "logo_gfx.h"
+; 4
+; 5 // 8 bpp image
+; 6 uint8_t block_4_data[83] = {
+ END
diff --git a/frontends/calculator/obj/gfx/block_5.src b/frontends/calculator/obj/gfx/block_5.src new file mode 100644 index 0000000..ec02546 --- /dev/null +++ b/frontends/calculator/obj/gfx/block_5.src @@ -0,0 +1,98 @@ +; Zilog eZ80 ANSI C Compiler Release 3.4
+; -optsize -noreduceopt -nomodsect -peephole -globalopt
+; -localcse -const=ROM
+ FILE "SRC\GFX\BLOCK_5.C"
+ .assume ADL=1
+ SEGMENT DATA
+_block_5_data:
+ DB 9
+ DB 9
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 0
+ DB 4
+ DB 4
+ DB 4
+ DB 4
+ DB 4
+ DB 4
+ DB 2
+ DB 2
+ DB 4
+ DB 0
+ DB 0
+ DB 4
+ DB 4
+ DB 4
+ DB 4
+ DB 2
+ DB 2
+ DB 4
+ DB 0
+ DB 4
+ DB 4
+ DB 4
+ DB 4
+ DB 4
+ DB 2
+ DB 2
+ DB 4
+ DB 4
+ DB 4
+ DB 4
+ DB 4
+ DB 4
+ DB 4
+ DB 2
+ DB 2
+ DB 4
+ DB 4
+ DB 4
+ DB 4
+ DB 4
+ DB 4
+ DB 4
+ DB 2
+ DB 2
+ DB 4
+ DB 4
+ DB 4
+ DB 4
+ DB 4
+ DB 4
+ DB 4
+ DB 2
+ DB 2
+ DB 4
+ DB 4
+ DB 4
+ DB 4
+ DB 4
+ DB 4
+ DB 4
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ XDEF _block_5_data
+; 1 // convpng v7.0
+; 2 #include <stdint.h>
+; 3 #include "logo_gfx.h"
+; 4
+; 5 // 8 bpp image
+; 6 uint8_t block_5_data[83] = {
+ END
diff --git a/frontends/calculator/obj/gfx/block_6.src b/frontends/calculator/obj/gfx/block_6.src new file mode 100644 index 0000000..7ae3009 --- /dev/null +++ b/frontends/calculator/obj/gfx/block_6.src @@ -0,0 +1,98 @@ +; Zilog eZ80 ANSI C Compiler Release 3.4
+; -optsize -noreduceopt -nomodsect -peephole -globalopt
+; -localcse -const=ROM
+ FILE "SRC\GFX\BLOCK_6.C"
+ .assume ADL=1
+ SEGMENT DATA
+_block_6_data:
+ DB 9
+ DB 9
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 0
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 2
+ DB 2
+ DB 6
+ DB 0
+ DB 0
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 2
+ DB 2
+ DB 6
+ DB 0
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 2
+ DB 2
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 2
+ DB 2
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 2
+ DB 2
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 2
+ DB 2
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 6
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ XDEF _block_6_data
+; 1 // convpng v7.0
+; 2 #include <stdint.h>
+; 3 #include "logo_gfx.h"
+; 4
+; 5 // 8 bpp image
+; 6 uint8_t block_6_data[83] = {
+ END
diff --git a/frontends/calculator/obj/gfx/block_7.src b/frontends/calculator/obj/gfx/block_7.src new file mode 100644 index 0000000..fc945cd --- /dev/null +++ b/frontends/calculator/obj/gfx/block_7.src @@ -0,0 +1,98 @@ +; Zilog eZ80 ANSI C Compiler Release 3.4
+; -optsize -noreduceopt -nomodsect -peephole -globalopt
+; -localcse -const=ROM
+ FILE "SRC\GFX\BLOCK_7.C"
+ .assume ADL=1
+ SEGMENT DATA
+_block_7_data:
+ DB 9
+ DB 9
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 0
+ DB 1
+ DB 1
+ DB 1
+ DB 1
+ DB 1
+ DB 1
+ DB 2
+ DB 2
+ DB 1
+ DB 0
+ DB 0
+ DB 1
+ DB 1
+ DB 1
+ DB 1
+ DB 2
+ DB 2
+ DB 1
+ DB 0
+ DB 1
+ DB 1
+ DB 1
+ DB 1
+ DB 1
+ DB 2
+ DB 2
+ DB 1
+ DB 1
+ DB 1
+ DB 1
+ DB 1
+ DB 1
+ DB 1
+ DB 2
+ DB 2
+ DB 1
+ DB 1
+ DB 1
+ DB 1
+ DB 1
+ DB 1
+ DB 1
+ DB 2
+ DB 2
+ DB 1
+ DB 1
+ DB 1
+ DB 1
+ DB 1
+ DB 1
+ DB 1
+ DB 2
+ DB 2
+ DB 1
+ DB 1
+ DB 1
+ DB 1
+ DB 1
+ DB 1
+ DB 1
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ DB 2
+ XDEF _block_7_data
+; 1 // convpng v7.0
+; 2 #include <stdint.h>
+; 3 #include "logo_gfx.h"
+; 4
+; 5 // 8 bpp image
+; 6 uint8_t block_7_data[83] = {
+ END
diff --git a/frontends/calculator/obj/gfx/logo_gfx.src b/frontends/calculator/obj/gfx/logo_gfx.src new file mode 100644 index 0000000..673beca --- /dev/null +++ b/frontends/calculator/obj/gfx/logo_gfx.src @@ -0,0 +1,22 @@ +; Zilog eZ80 ANSI C Compiler Release 3.4
+; -optsize -noreduceopt -nomodsect -peephole -globalopt
+; -localcse -const=ROM
+ FILE "SRC\GFX\LOGO_GFX.C"
+ .assume ADL=1
+ SEGMENT DATA
+_logo_gfx_pal:
+ DW 65535
+ DW 62052
+ DW 0
+ DW 52356
+ DW 14527
+ DW 8479
+ DW 41840
+ DW 22671
+ XDEF _logo_gfx_pal
+; 1 // convpng v7.0
+; 2 #include <stdint.h>
+; 3 #include "logo_gfx.h"
+; 4
+; 5 uint16_t logo_gfx_pal[8] = {
+ END
diff --git a/frontends/calculator/obj/main.src b/frontends/calculator/obj/main.src new file mode 100644 index 0000000..8897b9b --- /dev/null +++ b/frontends/calculator/obj/main.src @@ -0,0 +1,172 @@ +; Zilog eZ80 ANSI C Compiler Release 3.4
+; -optsize -noreduceopt -nomodsect -peephole -globalopt
+; -localcse -const=ROM
+ FILE "SRC\MAIN.C"
+ .assume ADL=1
+ SEGMENT CODE
+; 1 #include <stdbool.h>
+; 2 #include <stddef.h>
+; 3 #include <stdint.h>
+; 4 #include <tice.h>
+; 5
+; 6 #include <math.h>
+; 7 #include <stdio.h>
+; 8 #include <stdlib.h>
+; 9 #include <string.h>
+; 10
+; 11 #include <graphx.h>
+; 12
+; 13 #include "cetris.h"
+; 14
+; 15 /* Include the sprite data */
+; 16 #include "gfx/logo_gfx.h"
+; 17
+; 18 void main(void) {
+_main:
+; 19 /* Initialize the 8bpp graphics */
+; 20 gfx_Begin();
+ CALL _gfx_Begin
+; 21
+; 22 /* Set up the palette for our sprites */
+; 23 gfx_SetPalette(logo_gfx_pal, sizeof_logo_gfx_pal, 0);
+ LD BC,0
+ PUSH BC
+ LD BC,16
+ PUSH BC
+ LD BC,_logo_gfx_pal
+ PUSH BC
+ CALL _gfx_SetPalette
+ POP BC
+ POP BC
+ POP BC
+; 24
+; 25 /* Fill the screen with color index 0 */
+; 26 gfx_FillScreen(0);
+ LD BC,0
+ PUSH BC
+ CALL _gfx_FillScreen
+ POP BC
+; 27
+; 28 /* Draw a bunch of different styled sprites on the screen */
+; 29 gfx_Sprite(block_1, 0, 0);
+ LD BC,0
+ PUSH BC
+ PUSH BC
+ LD BC,_block_1_data
+ PUSH BC
+ CALL _gfx_Sprite
+ POP BC
+ POP BC
+ POP BC
+; 30 gfx_Sprite_NoClip(block_1, 32, 32);
+ LD BC,32
+ PUSH BC
+ PUSH BC
+ LD BC,_block_1_data
+ PUSH BC
+ CALL _gfx_Sprite_NoClip
+ POP BC
+ POP BC
+ POP BC
+; 31 gfx_TransparentSprite(block_1, 64, 64);
+ LD BC,64
+ PUSH BC
+ PUSH BC
+ LD BC,_block_1_data
+ PUSH BC
+ CALL _gfx_TransparentSprite
+ POP BC
+ POP BC
+ POP BC
+; 32 gfx_TransparentSprite_NoClip(block_1, 96, 96);
+ LD BC,96
+ PUSH BC
+ PUSH BC
+ LD BC,_block_1_data
+ PUSH BC
+ CALL _gfx_TransparentSprite_NoClip
+ POP BC
+ POP BC
+ POP BC
+; 33 gfx_ScaledSprite_NoClip(block_1, 128, 128, 2, 2);
+ LD BC,2
+ PUSH BC
+ PUSH BC
+ LD BC,128
+ PUSH BC
+ PUSH BC
+ LD BC,_block_1_data
+ PUSH BC
+ CALL _gfx_ScaledSprite_NoClip
+ POP BC
+ POP BC
+ POP BC
+ POP BC
+ POP BC
+; 34 gfx_ScaledTransparentSprite_NoClip(block_1, 128, 0, 3, 3);
+ LD BC,3
+ PUSH BC
+ PUSH BC
+ LD BC,0
+ PUSH BC
+ LD BC,128
+ PUSH BC
+ LD BC,_block_1_data
+ PUSH BC
+ CALL _gfx_ScaledTransparentSprite_NoClip
+ POP BC
+ POP BC
+ POP BC
+ POP BC
+ POP BC
+; 35
+; 36 /* Wait for a key to be pressed */
+; 37 while (!os_GetCSC());
+L_1:
+ CALL _os_GetCSC
+ OR A,A
+ JR Z,L_1
+; 38
+; 39 /* Close the graphics */
+; 40 gfx_End();
+ CALL _gfx_End
+; 41 }
+ RET
+
+
+;**************************** _main ***************************
+;Name Addr/Register Size Type
+;_gfx_End IMPORT ----- function
+;_os_GetCSC IMPORT ----- function
+;_gfx_ScaledTransparentSprite_NoClip IMPORT ----- function
+;_gfx_ScaledSprite_NoClip IMPORT ----- function
+;_gfx_TransparentSprite_NoClip IMPORT ----- function
+;_gfx_TransparentSprite IMPORT ----- function
+;_gfx_Sprite_NoClip IMPORT ----- function
+;_block_1_data IMPORT 83 variable
+;_gfx_Sprite IMPORT ----- function
+;_gfx_FillScreen IMPORT ----- function
+;_logo_gfx_pal IMPORT 16 variable
+;_gfx_SetPalette IMPORT ----- function
+;_gfx_Begin IMPORT ----- function
+
+
+; Stack Frame Size: 6 (bytes)
+; Spill Code: 0 (instruction)
+
+
+ XREF _logo_gfx_pal:ROM
+ XREF _block_1_data:ROM
+ XREF _gfx_ScaledTransparentSprite_NoClip:ROM
+ XREF _gfx_ScaledSprite_NoClip:ROM
+ XREF _gfx_TransparentSprite_NoClip:ROM
+ XREF _gfx_TransparentSprite:ROM
+ XREF _gfx_Sprite_NoClip:ROM
+ XREF _gfx_Sprite:ROM
+ XREF _gfx_FillScreen:ROM
+ XREF _gfx_SetPalette:ROM
+ XREF _gfx_End:ROM
+ XREF _gfx_Begin:ROM
+ XREF _os_GetCSC:ROM
+ XDEF _main
+ END
diff --git a/frontends/calculator/src/cetris.c b/frontends/calculator/src/cetris.c new file mode 120000 index 0000000..ecbdb48 --- /dev/null +++ b/frontends/calculator/src/cetris.c @@ -0,0 +1 @@ +../../../core/src/cetris.c
\ No newline at end of file diff --git a/frontends/calculator/src/cetris.h b/frontends/calculator/src/cetris.h new file mode 120000 index 0000000..37329b2 --- /dev/null +++ b/frontends/calculator/src/cetris.h @@ -0,0 +1 @@ +../../../core/include/cetris.h
\ No newline at end of file diff --git a/frontends/calculator/src/gfx/block_1.c b/frontends/calculator/src/gfx/block_1.c new file mode 100644 index 0000000..58d58d3 --- /dev/null +++ b/frontends/calculator/src/gfx/block_1.c @@ -0,0 +1,17 @@ +// convpng v7.0 +#include <stdint.h> +#include "logo_gfx.h" + +// 8 bpp image +uint8_t block_1_data[83] = { + 9,9, // width,height + 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, + 0x02,0x00,0x05,0x05,0x05,0x05,0x05,0x05,0x02, + 0x02,0x05,0x00,0x00,0x05,0x05,0x05,0x05,0x02, + 0x02,0x05,0x00,0x05,0x05,0x05,0x05,0x05,0x02, + 0x02,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x02, + 0x02,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x02, + 0x02,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x02, + 0x02,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x02, + 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +}; diff --git a/frontends/calculator/src/gfx/block_1.png b/frontends/calculator/src/gfx/block_1.png Binary files differnew file mode 100644 index 0000000..295821e --- /dev/null +++ b/frontends/calculator/src/gfx/block_1.png diff --git a/frontends/calculator/src/gfx/block_2.c b/frontends/calculator/src/gfx/block_2.c new file mode 100644 index 0000000..47c16cb --- /dev/null +++ b/frontends/calculator/src/gfx/block_2.c @@ -0,0 +1,17 @@ +// convpng v7.0 +#include <stdint.h> +#include "logo_gfx.h" + +// 8 bpp image +uint8_t block_2_data[83] = { + 9,9, // width,height + 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, + 0x02,0x00,0x07,0x07,0x07,0x07,0x07,0x07,0x02, + 0x02,0x07,0x00,0x00,0x07,0x07,0x07,0x07,0x02, + 0x02,0x07,0x00,0x07,0x07,0x07,0x07,0x07,0x02, + 0x02,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x02, + 0x02,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x02, + 0x02,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x02, + 0x02,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x02, + 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +}; diff --git a/frontends/calculator/src/gfx/block_2.png b/frontends/calculator/src/gfx/block_2.png Binary files differnew file mode 100644 index 0000000..29443db --- /dev/null +++ b/frontends/calculator/src/gfx/block_2.png diff --git a/frontends/calculator/src/gfx/block_3.c b/frontends/calculator/src/gfx/block_3.c new file mode 100644 index 0000000..798215c --- /dev/null +++ b/frontends/calculator/src/gfx/block_3.c @@ -0,0 +1,17 @@ +// convpng v7.0 +#include <stdint.h> +#include "logo_gfx.h" + +// 8 bpp image +uint8_t block_3_data[83] = { + 9,9, // width,height + 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, + 0x02,0x00,0x06,0x06,0x06,0x06,0x06,0x06,0x02, + 0x02,0x06,0x00,0x00,0x06,0x06,0x06,0x06,0x02, + 0x02,0x06,0x00,0x06,0x06,0x06,0x06,0x06,0x02, + 0x02,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x02, + 0x02,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x02, + 0x02,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x02, + 0x02,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x02, + 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +}; diff --git a/frontends/calculator/src/gfx/block_3.png b/frontends/calculator/src/gfx/block_3.png Binary files differnew file mode 100644 index 0000000..a4b6dfd --- /dev/null +++ b/frontends/calculator/src/gfx/block_3.png diff --git a/frontends/calculator/src/gfx/block_4.c b/frontends/calculator/src/gfx/block_4.c new file mode 100644 index 0000000..517aff2 --- /dev/null +++ b/frontends/calculator/src/gfx/block_4.c @@ -0,0 +1,17 @@ +// convpng v7.0 +#include <stdint.h> +#include "logo_gfx.h" + +// 8 bpp image +uint8_t block_4_data[83] = { + 9,9, // width,height + 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, + 0x02,0x00,0x03,0x03,0x03,0x03,0x03,0x03,0x02, + 0x02,0x03,0x00,0x00,0x03,0x03,0x03,0x03,0x02, + 0x02,0x03,0x00,0x03,0x03,0x03,0x03,0x03,0x02, + 0x02,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x02, + 0x02,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x02, + 0x02,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x02, + 0x02,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x02, + 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +}; diff --git a/frontends/calculator/src/gfx/block_4.png b/frontends/calculator/src/gfx/block_4.png Binary files differnew file mode 100644 index 0000000..e5b977e --- /dev/null +++ b/frontends/calculator/src/gfx/block_4.png diff --git a/frontends/calculator/src/gfx/block_5.c b/frontends/calculator/src/gfx/block_5.c new file mode 100644 index 0000000..073b138 --- /dev/null +++ b/frontends/calculator/src/gfx/block_5.c @@ -0,0 +1,17 @@ +// convpng v7.0 +#include <stdint.h> +#include "logo_gfx.h" + +// 8 bpp image +uint8_t block_5_data[83] = { + 9,9, // width,height + 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, + 0x02,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x02, + 0x02,0x04,0x00,0x00,0x04,0x04,0x04,0x04,0x02, + 0x02,0x04,0x00,0x04,0x04,0x04,0x04,0x04,0x02, + 0x02,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x02, + 0x02,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x02, + 0x02,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x02, + 0x02,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x02, + 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +}; diff --git a/frontends/calculator/src/gfx/block_5.png b/frontends/calculator/src/gfx/block_5.png Binary files differnew file mode 100644 index 0000000..a63802c --- /dev/null +++ b/frontends/calculator/src/gfx/block_5.png diff --git a/frontends/calculator/src/gfx/block_6.c b/frontends/calculator/src/gfx/block_6.c new file mode 100644 index 0000000..4decd9b --- /dev/null +++ b/frontends/calculator/src/gfx/block_6.c @@ -0,0 +1,17 @@ +// convpng v7.0 +#include <stdint.h> +#include "logo_gfx.h" + +// 8 bpp image +uint8_t block_6_data[83] = { + 9,9, // width,height + 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, + 0x02,0x00,0x06,0x06,0x06,0x06,0x06,0x06,0x02, + 0x02,0x06,0x00,0x00,0x06,0x06,0x06,0x06,0x02, + 0x02,0x06,0x00,0x06,0x06,0x06,0x06,0x06,0x02, + 0x02,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x02, + 0x02,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x02, + 0x02,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x02, + 0x02,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x02, + 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +}; diff --git a/frontends/calculator/src/gfx/block_6.png b/frontends/calculator/src/gfx/block_6.png Binary files differnew file mode 100644 index 0000000..a4b6dfd --- /dev/null +++ b/frontends/calculator/src/gfx/block_6.png diff --git a/frontends/calculator/src/gfx/block_7.c b/frontends/calculator/src/gfx/block_7.c new file mode 100644 index 0000000..67122d1 --- /dev/null +++ b/frontends/calculator/src/gfx/block_7.c @@ -0,0 +1,17 @@ +// convpng v7.0 +#include <stdint.h> +#include "logo_gfx.h" + +// 8 bpp image +uint8_t block_7_data[83] = { + 9,9, // width,height + 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, + 0x02,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x02, + 0x02,0x01,0x00,0x00,0x01,0x01,0x01,0x01,0x02, + 0x02,0x01,0x00,0x01,0x01,0x01,0x01,0x01,0x02, + 0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02, + 0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02, + 0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02, + 0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02, + 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +}; diff --git a/frontends/calculator/src/gfx/block_7.png b/frontends/calculator/src/gfx/block_7.png Binary files differnew file mode 100644 index 0000000..8cb6da8 --- /dev/null +++ b/frontends/calculator/src/gfx/block_7.png diff --git a/frontends/calculator/src/gfx/convpng.ini b/frontends/calculator/src/gfx/convpng.ini new file mode 100644 index 0000000..fcf7193 --- /dev/null +++ b/frontends/calculator/src/gfx/convpng.ini @@ -0,0 +1,10 @@ +#GroupC : logo_gfx +#TransparentColor : 255,255,255 +#PNGImages : + block_1 + block_2 + block_3 + block_4 + block_5 + block_6 + block_7 diff --git a/frontends/calculator/src/gfx/convpng.log b/frontends/calculator/src/gfx/convpng.log new file mode 100644 index 0000000..538c0d0 --- /dev/null +++ b/frontends/calculator/src/gfx/convpng.log @@ -0,0 +1,20 @@ +opened convpng.ini + +--- logo_gfx (C) --- +building palette with [256] available indices ... +built palette with [8] indices. +palette quality : 100.00% +transparent color index : 0 +transparent color : 0xFFFF +7: + block_1 : 100.00% + block_2 : 100.00% + block_3 : 100.00% + block_4 : 100.00% + block_5 : 100.00% + block_6 : 100.00% + block_7 : 100.00% + +converted in 0 s + +finished! diff --git a/frontends/calculator/src/gfx/logo_gfx.c b/frontends/calculator/src/gfx/logo_gfx.c new file mode 100644 index 0000000..3509c0e --- /dev/null +++ b/frontends/calculator/src/gfx/logo_gfx.c @@ -0,0 +1,14 @@ +// convpng v7.0 +#include <stdint.h> +#include "logo_gfx.h" + +uint16_t logo_gfx_pal[8] = { + 0xFFFF, // 00 :: rgb(255,255,255) + 0xF264, // 01 :: rgb(231,156,33) + 0x0000, // 02 :: rgb(0,0,0) + 0xCC84, // 03 :: rgb(160,35,30) + 0x38BF, // 04 :: rgb(115,41,255) + 0x211F, // 05 :: rgb(66,66,255) + 0xA370, // 06 :: rgb(66,222,132) + 0x588F, // 07 :: rgb(181,33,123) +};
\ No newline at end of file diff --git a/frontends/calculator/src/gfx/logo_gfx.h b/frontends/calculator/src/gfx/logo_gfx.h new file mode 100644 index 0000000..02714e5 --- /dev/null +++ b/frontends/calculator/src/gfx/logo_gfx.h @@ -0,0 +1,47 @@ +// convpng v7.0 +// this file contains all the graphics sources for easy inclusion in a project +#ifndef __logo_gfx__ +#define __logo_gfx__ +#include <stdint.h> + +#define logo_gfx_transparent_color_index 0 + +#define block_1_width 9 +#define block_1_height 9 +#define block_1_size 83 +extern uint8_t block_1_data[83]; +#define block_1 ((gfx_sprite_t*)block_1_data) +#define block_2_width 9 +#define block_2_height 9 +#define block_2_size 83 +extern uint8_t block_2_data[83]; +#define block_2 ((gfx_sprite_t*)block_2_data) +#define block_3_width 9 +#define block_3_height 9 +#define block_3_size 83 +extern uint8_t block_3_data[83]; +#define block_3 ((gfx_sprite_t*)block_3_data) +#define block_4_width 9 +#define block_4_height 9 +#define block_4_size 83 +extern uint8_t block_4_data[83]; +#define block_4 ((gfx_sprite_t*)block_4_data) +#define block_5_width 9 +#define block_5_height 9 +#define block_5_size 83 +extern uint8_t block_5_data[83]; +#define block_5 ((gfx_sprite_t*)block_5_data) +#define block_6_width 9 +#define block_6_height 9 +#define block_6_size 83 +extern uint8_t block_6_data[83]; +#define block_6 ((gfx_sprite_t*)block_6_data) +#define block_7_width 9 +#define block_7_height 9 +#define block_7_size 83 +extern uint8_t block_7_data[83]; +#define block_7 ((gfx_sprite_t*)block_7_data) +#define sizeof_logo_gfx_pal 16 +extern uint16_t logo_gfx_pal[8]; + +#endif diff --git a/frontends/calculator/src/input.c b/frontends/calculator/src/input.c new file mode 120000 index 0000000..5b377ca --- /dev/null +++ b/frontends/calculator/src/input.c @@ -0,0 +1 @@ +../../../core/src/input.c
\ No newline at end of file diff --git a/frontends/calculator/src/input.h b/frontends/calculator/src/input.h new file mode 120000 index 0000000..d569ad2 --- /dev/null +++ b/frontends/calculator/src/input.h @@ -0,0 +1 @@ +../../../core/include/input.h
\ No newline at end of file diff --git a/frontends/calculator/src/main.c b/frontends/calculator/src/main.c new file mode 100644 index 0000000..535f431 --- /dev/null +++ b/frontends/calculator/src/main.c @@ -0,0 +1,41 @@ +#include <stdbool.h> +#include <stddef.h> +#include <stdint.h> +#include <tice.h> + +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include <graphx.h> + +#include "cetris.h" + +/* Include the sprite data */ +#include "gfx/logo_gfx.h" + +void main(void) { + /* Initialize the 8bpp graphics */ + gfx_Begin(); + + /* Set up the palette for our sprites */ + gfx_SetPalette(logo_gfx_pal, sizeof_logo_gfx_pal, 0); + + /* Fill the screen with color index 0 */ + gfx_FillScreen(0); + + /* Draw a bunch of different styled sprites on the screen */ + gfx_Sprite(block_1, 0, 0); + gfx_Sprite_NoClip(block_1, 32, 32); + gfx_TransparentSprite(block_1, 64, 64); + gfx_TransparentSprite_NoClip(block_1, 96, 96); + gfx_ScaledSprite_NoClip(block_1, 128, 128, 2, 2); + gfx_ScaledTransparentSprite_NoClip(block_1, 128, 0, 3, 3); + + /* Wait for a key to be pressed */ + while (!os_GetCSC()); + + /* Close the graphics */ + gfx_End(); +} diff --git a/frontends/calculator/src/matrix.c b/frontends/calculator/src/matrix.c new file mode 120000 index 0000000..9a72a36 --- /dev/null +++ b/frontends/calculator/src/matrix.c @@ -0,0 +1 @@ +../../../core/src/matrix.c
\ No newline at end of file diff --git a/frontends/calculator/src/matrix.h b/frontends/calculator/src/matrix.h new file mode 120000 index 0000000..0b441d9 --- /dev/null +++ b/frontends/calculator/src/matrix.h @@ -0,0 +1 @@ +../../../core/include/matrix.h
\ No newline at end of file diff --git a/frontends/calculator/src/types.h b/frontends/calculator/src/types.h new file mode 120000 index 0000000..65216e0 --- /dev/null +++ b/frontends/calculator/src/types.h @@ -0,0 +1 @@ +../../../core/include/types.h
\ No newline at end of file diff --git a/frontends/curses/curses_ui.c b/frontends/curses/curses_ui.c index 1f1440c..5557ed9 100644 --- a/frontends/curses/curses_ui.c +++ b/frontends/curses/curses_ui.c @@ -66,7 +66,7 @@ #define X_OFFSET 8
#define Y_OFFSET 0
-struct cetris_game game;
+cetris_game game;
void curses_init() {
setlocale(LC_CTYPE, "");
@@ -119,7 +119,7 @@ void draw_board() { }
if (game.board[x][y].occupied) {
attron(COLOR_PAIR(game.board[x][y].c) | A_BOLD);
- if (game.board[0][y].remove_tick > 0) {
+ if (game.board[0][y].remove_tick) {
if (game.tick % 2 == 0) {
mvaddstr((y) + 1, x * 2 + X_OFFSET, BLOCK);
}
@@ -148,7 +148,7 @@ void draw_board() { attron(A_BOLD);
char score[50];
- sprintf(score, "%li", game.score);
+ sprintf(score, "%i", game.score);
mvaddstr(1, (39 + X_OFFSET) - strlen(score), score);
char level[20];
diff --git a/frontends/gl/main.c b/frontends/gl/main.c index a105290..1cab197 100644 --- a/frontends/gl/main.c +++ b/frontends/gl/main.c @@ -188,7 +188,7 @@ int main(void) { struct block_drawable block;
create_block(&block);
- struct cetris_game cetris;
+ cetris_game cetris;
init_game(&cetris);
double prev_time = glfwGetTime();
|