Back to shtanton's homepage
summaryrefslogtreecommitdiff
path: root/src/all.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/all.c')
-rw-r--r--src/all.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/all.c b/src/all.c
index ea76f8f..340b500 100644
--- a/src/all.c
+++ b/src/all.c
@@ -325,7 +325,6 @@ static DrawList *render(State *state, UI *ui, Arena *a) {
for (int y = 0; y < 2; y++) {
drawList->els[drawList->len++] = (DrawElement) {
.x = BUTTON_SIZE / 2 + x * (BUTTON_SIZE / 2),
- // .y = (BUTTON_SIZE / 2 + y * (BUTTON_SIZE / 2) + BUTTON_SPACING * (cellCount % 2 + 1)) * (cellCount + 1), // TODO - padding
.y = BUTTON_SIZE / 2 + i * (BUTTON_SIZE + BUTTON_SPACING) + y * (BUTTON_SIZE / 2),
.w = BUTTON_SIZE / 2,
.h = BUTTON_SIZE / 2,
@@ -344,12 +343,11 @@ static void restart_level(Game* game) {
xmemcpy(&game->state.grid, &levels[level].grid, sizeof(game->state.grid));
game->state.goalx = levels[level].goalx;
game->state.goaly = levels[level].goaly;
- game->state.playing = 0;
+ game->state.playing = 1;
xmemcpy(&game->state.placeableCells, &levels[level].placeableCells, sizeof(game->state.placeableCells));
}
static void update(Game *game, uint64_t now, Arena a) {
- // TODO - offset some more because of right black bar, dependent on ui size and window size?
const int offset_width = game->ui.width - GRID_OFFSET_X;
switch (game->input) {
@@ -399,9 +397,12 @@ static void update(Game *game, uint64_t now, Arena a) {
restart_level(game);
break;
case BUTTON_CONTINUE:
- // TODO - get size of levels array
- if (!game->state.levelComplete || game->state.currentLevel + 1 >= 2)
+ if (
+ !game->state.levelComplete ||
+ game->state.currentLevel + 1 >= sizeof(levels) / sizeof(levels[0])
+ ) {
break;
+ }
game->state.levelComplete = 0;
game->state.currentLevel++;
restart_level(game);
@@ -466,7 +467,7 @@ int main(int argc, char **argv) {
};
Game *game = new(&a, 1, Game);
- game->state.currentLevel = 0;
+ game->state.currentLevel = 5;
restart_level(game);
game->ui = (UI) {
.width = 640,