diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8a62bd9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +obj/ +bin/BLOCKS.bin +bin/BLOCKS.map + +.vscode/ \ No newline at end of file diff --git a/bin/BLOCKS.8xp b/bin/BLOCKS.8xp index 62e1752..01f1f9e 100644 Binary files a/bin/BLOCKS.8xp and b/bin/BLOCKS.8xp differ diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..5ad5e7b Binary files /dev/null and b/icon.png differ diff --git a/readme.md b/readme.md index 41e7f29..8e4b9df 100644 --- a/readme.md +++ b/readme.md @@ -18,9 +18,9 @@ is an artifact of the emulator, and doesn't show up when running on real hardwar 2. Download the [CE C Standard Libraries](https://github.com/CE-Programming/libraries/releases/tag/v11.2). 3. Load both onto your calculator using the [TI Connectâ„¢ CE software](https://education.ti.com/en/products/computer-software/ti-connect-ce-sw). 4. Run the ASM program either with `Asm(prgmBLOCKS)` or your favorite graphical shell. -5. The world select menu should appear. Select an empty save slot and press enter to generate a new world. +5. The main menu should appear. Then press "Play!" and the world select menu will appear. Select an empty save slot and press enter to generate a new world. -**Warning:** This program takes up a lot of RAM on the calculator, and doesn't always do so gracefully. It doesn't happen very often, but in the case where you get it to crash **you will need to reset your calculator**, which will clear any unarchived data in RAM. It's best to just archive anything you wouldn't want to lose before running this. Not only does it protect that data from crashes, but it frees up more memory for the game. +**Warning:** This program takes up a lot of RAM on the calculator, and doesn't always do so gracefully. It doesn't happen very often, but in the case where you get it to crash **you will need to reset your calculator**, which will clear any unarchived data in RAM. It's best to just archive anything you wouldn't want to lose before running this. Not only does it protect that data from crashes, but it frees up more memory for the game. Archiving the program(prgmBLOCKS) as well may be necessary to run it. ## Controls diff --git a/src/main.cpp b/src/main.cpp index dee704d..813ff7c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -335,6 +335,79 @@ void world_select() { } } +void home_menu() { + uint8_t selection = 4; + + while(true) { + gfx_SetDrawScreen(); + + gfx_SetColor(4); + gfx_FillRectangle(UI_BORDER, UI_BORDER, LCD_WIDTH - 2 * UI_BORDER, LCD_HEIGHT - 2 * UI_BORDER); + + init_palette(); + + draw_block((int24_t) ( ( LCD_WIDTH - 2 * UI_BORDER ) / 2 ) + BLOCK_WIDTH / 2, (int24_t) ( LCD_HEIGHT - 2 * UI_BORDER ) / 3, (uint8_t*)textures[1]); + + init_ui_palette(); + + gfx_SetTextFGColor(0); + gfx_PrintStringXY("Isometric Block Game", ( ( LCD_WIDTH - 2 * UI_BORDER ) / 2 ) - 55, ( ( LCD_HEIGHT - 2 * UI_BORDER ) / 3 ) + BLOCK_HEIGHT + 8); + + gfx_SetTextFGColor(0); + gfx_PrintStringXY("Play!", ( LCD_WIDTH - 2 * UI_BORDER ) / 2, LCD_HEIGHT - UI_BORDER - 16 - 8 - 32); + + gfx_SetTextFGColor(0); + gfx_PrintStringXY("Quit", ( LCD_WIDTH - 2 * UI_BORDER ) / 2, LCD_HEIGHT - UI_BORDER - 16 - 8); + + + uint8_t selection_old = selection ^ 1; + + sk_key_t key; + + do + { + + if(selection != selection_old) { + gfx_SetColor(4); + gfx_Rectangle(UI_BORDER + 8, + UI_BORDER + 12 + selection_old * 32, + LCD_WIDTH - UI_BORDER - UI_BORDER - 8 - 8, 24); + + gfx_SetColor(3); + gfx_Rectangle(UI_BORDER + 8, + UI_BORDER + 12 + selection * 32, + LCD_WIDTH - UI_BORDER - UI_BORDER - 8 - 8, 24); + } + + selection_old = selection; + + key = os_GetCSC(); + + switch (key) + { + case sk_Down: + if(selection < SAVE_CNT) + selection++; + break; + case sk_Up: + if(selection > 4) + selection--; + break; + case sk_Enter: + // Break from the program when the last option (quit) is selected + if(selection == SAVE_CNT) return; + world_select(); + break; + + default: + break; + } + + // Exit the inner loop every time something gets selected + } while (key != sk_Enter && key != sk_Del); + } +} + void init () { // Set right face textures to always to be in shadow for(int i = 0; i < TEX_CNT; i++) { @@ -350,7 +423,8 @@ void init () { init_ui_palette(); - world_select(); + //world_select(); + home_menu(); } int main(void)