add in start screen and come up with name

This commit is contained in:
t. boddy 2022-08-17 01:20:57 -04:00
parent cf71ad715a
commit 85e0aedff0
9 changed files with 89 additions and 7 deletions

View File

@ -1,3 +1,6 @@
CRYTPIC CAVES?
######### #########
# THEME # # THEME #
######### #########

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -1,4 +1,8 @@
IMAGE font "font.png" BEST NONE IMAGE font "font.png" BEST NONE
IMAGE startBg1 "start/bg1.png" FAST
IMAGE startLogo1 "start/logo1.png" FAST
IMAGE frame "chrome/frame.png" FAST IMAGE frame "chrome/frame.png" FAST
IMAGE wall1 "bg/wall1.png" FAST IMAGE wall1 "bg/wall1.png" FAST

BIN
res/start/bg1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

BIN
res/start/logo1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@ -10,11 +10,10 @@
static void drawBg(){ static void drawBg(){
for(u16 x = 0; x < BG_W; x++) for(u16 y = 0; y < BG_H; y++){ for(u16 x = 0; x < BG_W; x++) for(u16 y = 0; y < BG_H; y++){
if(x % 8 == 0 && y % 8 == 0){ if(x % 8 == 0 && y % 8 == 0)
VDP_drawImageEx(BG_A, &wall1, TILE_ATTR_FULL(PAL2, 0, 0, 0, BG_I), x, y, 0, DMA); VDP_drawImageEx(BG_A, &wall1, TILE_ATTR_FULL(PAL2, 0, 0, 0, BG_I), x, y, 0, DMA);
} }
} }
}
// update // update

View File

@ -16,7 +16,8 @@
#define COUNT_INT 8 #define COUNT_INT 8
#define INVINCIBLE_LIMIT 60 * 4 #define INVINCIBLE_LIMIT 60 * 4
bool killBullets; bool killBullets,
started;
s16 clock; s16 clock;
@ -26,4 +27,6 @@ u32 score,
s16 emptyI; // lmao s16 emptyI; // lmao
void EMPTY(s16 i){emptyI = i;} void EMPTY(s16 i){emptyI = i;}
void loadGame();
void collideObstacleWithPlayer(s16); void collideObstacleWithPlayer(s16);

View File

@ -6,6 +6,7 @@
#include "global.h" #include "global.h"
#include "structs.h" #include "structs.h"
#include "controls.h" #include "controls.h"
#include "start.h"
#include "background.h" #include "background.h"
#include "foreground.h" #include "foreground.h"
#include "bullets.h" #include "bullets.h"
@ -18,7 +19,6 @@ static void loadInternals(){
JOY_init(); JOY_init();
JOY_setEventHandler(&updateControls); JOY_setEventHandler(&updateControls);
SPR_init(127, 0, 0); SPR_init(127, 0, 0);
VDP_setScreenWidth256();
VDP_setPalette(PAL1, nitori.palette -> data); VDP_setPalette(PAL1, nitori.palette -> data);
VDP_setPalette(PAL2, wall1.palette -> data); VDP_setPalette(PAL2, wall1.palette -> data);
VDP_setPalette(PAL3, font.palette -> data); VDP_setPalette(PAL3, font.palette -> data);
@ -26,7 +26,8 @@ static void loadInternals(){
VDP_setTextPalette(3); VDP_setTextPalette(3);
} }
static void loadGame(){ void loadGame(){
started = TRUE;
loadBg(); loadBg();
loadChrome(); loadChrome();
loadFg(); loadFg();
@ -47,9 +48,10 @@ static void updateGame(){
int main(){ int main(){
loadInternals(); loadInternals();
loadGame(); // loadGame();
loadStart();
while(1){ while(1){
updateGame(); started ? updateGame() : updateStart();
SPR_update(); SPR_update();
SYS_doVBlankProcess(); SYS_doVBlankProcess();
} }

71
src/start.h Normal file
View File

@ -0,0 +1,71 @@
// start
bool selectingStartMenu, aboutShowing;
u8 currentStartMenu;
#define START_W 32
#define START_H 28
#define START_I 32
// events
static void loadGameFromStart(){
selectingStartMenu = FALSE;
aboutShowing = FALSE;
VDP_clearTileMapRect(BG_A, 0, 0, START_W, START_H);
VDP_clearTileMapRect(BG_B, 0, 0, START_W, START_H);
loadGame();
}
static void selectStartMenu(){
selectingStartMenu = TRUE;
switch(currentStartMenu){
case 0: loadGameFromStart(); break;
}
}
// draw
static void drawStartBg(){
VDP_fillTileMapRect(BG_B, TILE_ATTR_FULL(PAL2, 0, 0, 0, START_I), 0, 0, START_W, START_H);
}
#define LOGO_X 8
#define LOGO_Y 6
static void drawStartLogo(){
VDP_drawImageEx(BG_B, &startLogo1, TILE_ATTR_FULL(PAL1, 0, 0, 0, START_I + 32), LOGO_X, LOGO_Y, 0, DMA);
}
#define MENU_X 13
#define MENU_Y 14
#define ARROW_X 13
static void drawStartMenu(){
// VDP_drawText(">", ARROW_X, MENU_Y);
VDP_drawText("start?", MENU_X, MENU_Y);
VDP_drawText("HOW-TO", MENU_X, MENU_Y + 2);
VDP_drawText("ABOUT!", MENU_X, MENU_Y + 4);
}
// loop
void loadStart(){
VDP_setScreenWidth256();
currentStartMenu = 0;
VDP_loadTileSet(startBg1.tileset, START_I, DMA);
drawStartBg();
drawStartLogo();
drawStartMenu();
VDP_drawText("VER 0.1", 1, 26);
// loadGameFromStart();
}
void updateStart(){
if((ctrl.a || ctrl.start) && !aboutShowing && !selectingStartMenu) selectStartMenu();
}