add in start screen and come up with name
This commit is contained in:
parent
cf71ad715a
commit
85e0aedff0
BIN
res/font.png
BIN
res/font.png
Binary file not shown.
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.7 KiB |
|
@ -1,4 +1,8 @@
|
|||
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 wall1 "bg/wall1.png" FAST
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 4.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.8 KiB |
|
@ -10,11 +10,10 @@
|
|||
|
||||
static void drawBg(){
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// update
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
#define COUNT_INT 8
|
||||
#define INVINCIBLE_LIMIT 60 * 4
|
||||
|
||||
bool killBullets;
|
||||
bool killBullets,
|
||||
started;
|
||||
|
||||
s16 clock;
|
||||
|
||||
|
@ -26,4 +27,6 @@ u32 score,
|
|||
s16 emptyI; // lmao
|
||||
void EMPTY(s16 i){emptyI = i;}
|
||||
|
||||
void loadGame();
|
||||
|
||||
void collideObstacleWithPlayer(s16);
|
||||
|
|
10
src/main.c
10
src/main.c
|
@ -6,6 +6,7 @@
|
|||
#include "global.h"
|
||||
#include "structs.h"
|
||||
#include "controls.h"
|
||||
#include "start.h"
|
||||
#include "background.h"
|
||||
#include "foreground.h"
|
||||
#include "bullets.h"
|
||||
|
@ -18,7 +19,6 @@ static void loadInternals(){
|
|||
JOY_init();
|
||||
JOY_setEventHandler(&updateControls);
|
||||
SPR_init(127, 0, 0);
|
||||
VDP_setScreenWidth256();
|
||||
VDP_setPalette(PAL1, nitori.palette -> data);
|
||||
VDP_setPalette(PAL2, wall1.palette -> data);
|
||||
VDP_setPalette(PAL3, font.palette -> data);
|
||||
|
@ -26,7 +26,8 @@ static void loadInternals(){
|
|||
VDP_setTextPalette(3);
|
||||
}
|
||||
|
||||
static void loadGame(){
|
||||
void loadGame(){
|
||||
started = TRUE;
|
||||
loadBg();
|
||||
loadChrome();
|
||||
loadFg();
|
||||
|
@ -47,9 +48,10 @@ static void updateGame(){
|
|||
|
||||
int main(){
|
||||
loadInternals();
|
||||
loadGame();
|
||||
// loadGame();
|
||||
loadStart();
|
||||
while(1){
|
||||
updateGame();
|
||||
started ? updateGame() : updateStart();
|
||||
SPR_update();
|
||||
SYS_doVBlankProcess();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
Reference in New Issue