2023-11-20 09:43:12 -05:00
|
|
|
/*
|
|
|
|
Copyright (c) 2023 : Ognjen 'xolatile' Milan Robovic
|
|
|
|
|
|
|
|
Xhartae is free software! You will redistribute it or modify it under the terms of the GNU General Public License by Free Software Foundation.
|
|
|
|
And when you do redistribute it or modify it, it will use either version 3 of the License, or (at yours truly opinion) any later version.
|
|
|
|
It is distributed in the hope that it will be useful or harmful, it really depends... But no warranty what so ever, seriously. See GNU/GPLv3.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CHAPTER_5_SOURCE
|
|
|
|
#define CHAPTER_5_SOURCE
|
|
|
|
|
|
|
|
#include "chapter_5.h"
|
2023-11-20 10:24:58 -05:00
|
|
|
/*
|
2023-11-20 09:43:12 -05:00
|
|
|
static void (* game_action [GAME_ACTION_COUNT]) (game_t * game, player_t * player);
|
2023-11-20 10:24:58 -05:00
|
|
|
*/
|
|
|
|
static number_t game_is_active (game_t * game) { return (game->active = curses_active); }/*
|
2023-11-20 09:43:12 -05:00
|
|
|
static number_t game_get_screen_width (game_t * game) { return (game->screen_width); }
|
|
|
|
static number_t game_get_screen_height (game_t * game) { return (game->screen_height); }
|
|
|
|
static number_t game_set_screen_width (game_t * game, number_t width) { return (game->screen_width = width); }
|
|
|
|
static number_t game_set_screen_height (game_t * game, number_t height) { return (game->screen_height = height); }*/
|
|
|
|
|
|
|
|
static void game_configure (game_t * game, player_t * player) {
|
|
|
|
curses_configure ();
|
|
|
|
|
2023-11-20 10:24:58 -05:00
|
|
|
game->active = curses_active;
|
2023-11-20 09:43:12 -05:00
|
|
|
game->screen_width = curses_screen_width;
|
|
|
|
game->screen_height = curses_screen_height;
|
|
|
|
|
|
|
|
player->x = 0;
|
|
|
|
player->y = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void game_synchronize (game_t * game, player_t * player) {
|
|
|
|
(void) game;
|
|
|
|
|
|
|
|
curses_render_background (' ', COLOUR_WHITE, EFFECT_NORMAL);
|
|
|
|
|
|
|
|
curses_render_character ('@', COLOUR_CYAN, EFFECT_BOLD, player->x, player->y);
|
|
|
|
|
|
|
|
curses_synchronize ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void play_game (void) {
|
|
|
|
game_t game;
|
|
|
|
player_t player;
|
|
|
|
|
|
|
|
game_configure (& game, & player);
|
|
|
|
|
|
|
|
while (game_is_active (& game) && curses_active) {
|
|
|
|
game_synchronize (& game, & player);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|