commit fc5995cb69e6dd202d0fc87458c382c9d173696d Author: Slyvtt Date: Fri May 13 09:34:06 2022 +0200 Initial commit diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..620aebd --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,32 @@ +cmake_minimum_required(VERSION 3.15) +project(MyAddin) + +include(GenerateG3A) +include(Fxconv) +find_package(Gint 2.7.1 REQUIRED) +find_package(LibProf 2.4 REQUIRED) + +set(SOURCES + src/main.c + # ... +) +# Shared assets, fx-9860G-only assets and fx-CG-50-only assets +set(ASSETS + # ... +) + +set(ASSETS_cg + assets-cg/example.png + # ... +) + +fxconv_declare_assets(${ASSETS} ${ASSETS_cg} WITH_METADATA) + +add_executable(myaddin ${SOURCES} ${ASSETS} ${ASSETS_${FXSDK_PLATFORM}}) +target_compile_options(myaddin PRIVATE -Wall -Wextra -Os) +target_link_libraries(myaddin LibProf::LibProf Gint::Gint -lSDL_image_prizm -lcJPG -lcPNG -lczlib -lSDL_prizm) + +if("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50) + generate_g3a(TARGET myaddin OUTPUT "Lumines.g3a" + NAME "Lumines" ICONS assets-cg/icon-uns.png assets-cg/icon-sel.png) +endif() diff --git a/Lumines.g3a b/Lumines.g3a new file mode 100644 index 0000000..fdc534d Binary files /dev/null and b/Lumines.g3a differ diff --git a/Lumines.tar.gz b/Lumines.tar.gz new file mode 100644 index 0000000..53cf611 Binary files /dev/null and b/Lumines.tar.gz differ diff --git a/Lumines/Backgrounds/back001.jpg b/Lumines/Backgrounds/back001.jpg new file mode 100644 index 0000000..bc971cc Binary files /dev/null and b/Lumines/Backgrounds/back001.jpg differ diff --git a/Lumines/Backgrounds/back002.jpg b/Lumines/Backgrounds/back002.jpg new file mode 100644 index 0000000..20adaad Binary files /dev/null and b/Lumines/Backgrounds/back002.jpg differ diff --git a/Lumines/Backgrounds/back003.jpg b/Lumines/Backgrounds/back003.jpg new file mode 100644 index 0000000..3bb878d Binary files /dev/null and b/Lumines/Backgrounds/back003.jpg differ diff --git a/Lumines/Blocks/test.png b/Lumines/Blocks/test.png new file mode 100644 index 0000000..fae4818 Binary files /dev/null and b/Lumines/Blocks/test.png differ diff --git a/README.md b/README.md new file mode 100644 index 0000000..f09de02 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# WIP for creating a Lumines (to be pronounced Loo-Mi-Nes) for the Casio PRISM CG10/20/50 serie + +This port recreated from scratch is based on the "brand new" `SDL 1.2` library just ported to that plateform. + +This is a work in progress, some new should come very soon. + +So stay tuned ... diff --git a/SDL_Lumines.cbp b/SDL_Lumines.cbp new file mode 100644 index 0000000..47b94b5 --- /dev/null +++ b/SDL_Lumines.cbp @@ -0,0 +1,22 @@ + + + + + + diff --git a/assets-cg/example.png b/assets-cg/example.png new file mode 100644 index 0000000..8826800 Binary files /dev/null and b/assets-cg/example.png differ diff --git a/assets-cg/fxconv-metadata.txt b/assets-cg/fxconv-metadata.txt new file mode 100644 index 0000000..d435d5f --- /dev/null +++ b/assets-cg/fxconv-metadata.txt @@ -0,0 +1,3 @@ +example.png: + type: bopti-image + name: img_example diff --git a/assets-cg/icon-sel.png b/assets-cg/icon-sel.png new file mode 100644 index 0000000..6f28cf2 Binary files /dev/null and b/assets-cg/icon-sel.png differ diff --git a/assets-cg/icon-uns.png b/assets-cg/icon-uns.png new file mode 100644 index 0000000..b2627b2 Binary files /dev/null and b/assets-cg/icon-uns.png differ diff --git a/assets-fx/example.png b/assets-fx/example.png new file mode 100644 index 0000000..b26ba9a Binary files /dev/null and b/assets-fx/example.png differ diff --git a/assets-fx/fxconv-metadata.txt b/assets-fx/fxconv-metadata.txt new file mode 100644 index 0000000..d435d5f --- /dev/null +++ b/assets-fx/fxconv-metadata.txt @@ -0,0 +1,3 @@ +example.png: + type: bopti-image + name: img_example diff --git a/assets-fx/icon.png b/assets-fx/icon.png new file mode 100644 index 0000000..c92f12a Binary files /dev/null and b/assets-fx/icon.png differ diff --git a/build b/build new file mode 100755 index 0000000..1f9dd05 --- /dev/null +++ b/build @@ -0,0 +1,3 @@ +rm -r build-cg +rm *.g3a +fxsdk build-cg VERBOSE=1 diff --git a/capture b/capture new file mode 100755 index 0000000..08d0646 --- /dev/null +++ b/capture @@ -0,0 +1 @@ +fxlink -iw --quiet --fxlink-log=MyLogFile.log diff --git a/clean b/clean new file mode 100755 index 0000000..0c58279 --- /dev/null +++ b/clean @@ -0,0 +1,2 @@ +rm -r build-cg/ +rm *.g3a diff --git a/correct b/correct new file mode 100755 index 0000000..d3b1d35 --- /dev/null +++ b/correct @@ -0,0 +1 @@ +fxsdk build-cg VERBOSE=1 diff --git a/icon-sel.xcf b/icon-sel.xcf new file mode 100644 index 0000000..3576311 Binary files /dev/null and b/icon-sel.xcf differ diff --git a/send b/send new file mode 100755 index 0000000..16e4d29 --- /dev/null +++ b/send @@ -0,0 +1 @@ +fxlink -sw -u *.g3a diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..fa49245 --- /dev/null +++ b/src/main.c @@ -0,0 +1,300 @@ +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#define GRID_H 10 +#define GRID_W 16 +#define CELL_SIZE 15 + +#define SCREEN_W 396 +#define SCREEN_H 224 + +#define GRID_CENTER_X (SCREEN_W/2-40) +#define GRID_Y (SCREEN_H-14) + +SDL_Surface* screen = NULL; +SDL_Surface* background = NULL; +SDL_Surface* blocks = NULL; +cSDL_Font *font; + +typedef struct +{ + char color; + +} block; + +block GridBoard[GRID_W][GRID_H]; + + +uint32_t timerstart=0; +uint32_t currenttimer=0; +float currentX=0; + +uint32_t time_frame=0; + + +void drawGrid( SDL_Surface *surf ) +{ + for(int x=0; xGRID_W*CELL_SIZE) x=0; + + *currentpositionX=x; + + lineRGBA( surf, GRID_CENTER_X-GRID_W/2*CELL_SIZE+x-1, GRID_Y-GRID_H*CELL_SIZE-1, GRID_CENTER_X-GRID_W/2*CELL_SIZE+x-1, GRID_Y+1, 255, 0, 0, 255 ); + lineRGBA( surf, GRID_CENTER_X-GRID_W/2*CELL_SIZE+x, GRID_Y-GRID_H*CELL_SIZE-1, GRID_CENTER_X-GRID_W/2*CELL_SIZE+x, GRID_Y+1, 255, 0, 0, 255 ); + lineRGBA( surf, GRID_CENTER_X-GRID_W/2*CELL_SIZE+x+1, GRID_Y-GRID_H*CELL_SIZE-1, GRID_CENTER_X-GRID_W/2*CELL_SIZE+x+1, GRID_Y+1, 255, 0, 0, 255 ); +} + +void initBoard( void ) +{ + srand( 0 ); + + for(int x=0; x9) GridBoard[x][y].color=9; + } + } +} + +void drawBlockGrid( SDL_Surface *surf ) +{ + for(int x=0; xformat, SDL_SWSURFACE ); + //if (!background) return 1; + + blocks = SDL_ConvertSurface( (SDL_Surface*) gint_world_switch( GINT_CALL( IMG_Load, "./Lumines/Blocks/test.png" ) ), + screen->format, SDL_SWSURFACE ); + //if (!blocks) return 1; + + initBoard( ); + + timerstart=0; + + bool done = false; + while (!done) + { + perf = prof_make(); + prof_enter(perf); + + currenttimer=SDL_GetTicks(); + uint32_t deltatimer = currenttimer-timerstart; + timerstart=currenttimer; + + // message processing loop + SDL_Event event; + while (SDL_PollEvent(&event)) + { + // check for messages + switch (event.type) + { + // exit if the window is closed + case SDL_QUIT: + done = true; + break; + + // check for keypresses + case SDL_KEYDOWN: + { + // exit if ESCAPE is pressed + if (event.key.keysym.sym == SDLK_PRZ_KEY_EXIT) + done = true; + break; + } + } // end switch + } // end of message processing + + //SDL_FillRect(screen, 0, SDL_MapRGB(screen->format, 127, 127, 127)); + drawBackground( screen ); + + drawGrid( screen ); + +/* drawBlock( screen, 0, 0, 0 ); + drawBlock( screen, 0, 1, 1 ); + + drawBlock( screen, 2, 0, 2 ); + drawBlock( screen, 2, 1, 3 ); + + drawBlock( screen, 4, 0, 4 ); + drawBlock( screen, 4, 1, 5 ); + + drawBlock( screen, 6, 0, 6 ); + drawBlock( screen, 6, 1, 7 ); + + drawBlock( screen, 8, 0, 8 ); + drawBlock( screen, 8, 1, 9 ); +*/ + + drawBlockGrid( screen ); + + drawSweepLine( screen, deltatimer, 10, ¤tX ); + + cSDL_DrawString( screen, font, 10, 10, "Delta t: %d", time_frame/1000 ); + + cSDL_DrawString( screen, font, 10, 20, "Hello !!" ); + + SDL_Flip(screen); + + prof_leave(perf); + time_frame = prof_time(perf); + } // end main loop + + + SDL_FreeSurface( blocks ); + SDL_FreeSurface( background ); + cSDL_FreeFont( font ); + + SDL_Quit(); + + return 0; +}