Browse Source

Add boilerplate for level code

master
Forest Belton 3 years ago
parent
commit
6423e39262
4 changed files with 21 additions and 1 deletions
  1. +5
    -0
      src/game.h
  2. +12
    -0
      src/level.c
  3. +4
    -0
      src/main.c
  4. +0
    -1
      src/title.c

+ 5
- 0
src/game.h View File

@ -34,6 +34,11 @@ extern game_state_t game_state;
*/
void title(void);
/**
* @brief Render the current game level.
*/
void level(void);
/**
* @brief Enable interrupts.
*/

+ 12
- 0
src/level.c View File

@ -0,0 +1,12 @@
#include "game.h"
#include "sdk/hardware.h"
#include "sdk/joypad.h"
void level(void) {
while (1) {
joypad_update();
HALT();
rIF = 0;
}
}

+ 4
- 0
src/main.c View File

@ -29,6 +29,10 @@ void main() {
case GAME_STATE_TITLE:
title();
break;
case GAME_STATE_LEVEL:
level();
break;
}
}
}

+ 0
- 1
src/title.c View File

@ -16,7 +16,6 @@ void title(void) {
// Copy title screen to VRAM
memcpy((uint8_t *)_VRAM, &bg_tiles[0], bg_tiles_end - bg_tiles);
// vram_memcpy(_VRAM, &bg_tiles[0], bg_tiles_end - bg_tiles);
uint8_t *vram_ptr = (uint8_t *)_SCRN0;
const uint8_t *map_ptr = &bg_map[0];

Loading…
Cancel
Save