Moved menus into game, since it is specific...
This commit is contained in:
parent
f7eda61e32
commit
756b6d1047
16
compile.sh
16
compile.sh
@ -2,30 +2,16 @@
|
||||
|
||||
set -xe
|
||||
|
||||
#~clang -g -ansi -Weverything -Werror -Ofast -c -o ./source/engine.o ./source/engine.c
|
||||
#~clang -g -ansi -Weverything -Werror -Ofast -c -o ./source/render.o ./source/render.c
|
||||
#~clang -g -ansi -Weverything -Werror -Ofast -c -o ./source/game.o ./source/game.c
|
||||
#~clang -g -ansi -Weverything -Werror -Ofast -c -o ./source/menu.o ./source/menu.c
|
||||
#~clang -g -ansi -Weverything -Werror -Ofast -c -o ./source/main.o ./source/main.c
|
||||
|
||||
#~gcc -g -ansi -Wall -Wextra -Wpedantic -Werror -Ofast -c -o ./source/engine.o ./source/engine.c
|
||||
#~gcc -g -ansi -Wall -Wextra -Wpedantic -Werror -Ofast -c -o ./source/render.o ./source/render.c
|
||||
#~gcc -g -ansi -Wall -Wextra -Wpedantic -Werror -Ofast -c -o ./source/game.o ./source/game.c
|
||||
#~gcc -g -ansi -Wall -Wextra -Wpedantic -Werror -Ofast -c -o ./source/menu.o ./source/menu.c
|
||||
#~gcc -g -ansi -Wall -Wextra -Wpedantic -Werror -Ofast -c -o ./source/main.o ./source/main.c
|
||||
|
||||
clang -g -ansi -Weverything -Werror -c -o ./source/engine.o ./source/engine.c
|
||||
clang -g -ansi -Weverything -Werror -c -o ./source/render.o ./source/render.c
|
||||
clang -g -ansi -Weverything -Werror -c -o ./source/game.o ./source/game.c
|
||||
clang -g -ansi -Weverything -Werror -c -o ./source/menu.o ./source/menu.c
|
||||
clang -g -ansi -Weverything -Werror -c -o ./source/main.o ./source/main.c
|
||||
|
||||
gcc -g -ansi -Wall -Wextra -Wpedantic -Werror -c -o ./source/engine.o ./source/engine.c
|
||||
gcc -g -ansi -Wall -Wextra -Wpedantic -Werror -c -o ./source/render.o ./source/render.c
|
||||
gcc -g -ansi -Wall -Wextra -Wpedantic -Werror -c -o ./source/game.o ./source/game.c
|
||||
gcc -g -ansi -Wall -Wextra -Wpedantic -Werror -c -o ./source/menu.o ./source/menu.c
|
||||
gcc -g -ansi -Wall -Wextra -Wpedantic -Werror -c -o ./source/main.o ./source/main.c
|
||||
|
||||
gcc -o umorna ./source/main.o ./source/game.o ./source/engine.o ./source/menu.o ./source/render.o -lraylib -lpng
|
||||
gcc -o umorna ./source/main.o ./source/game.o ./source/engine.o ./source/render.o -lraylib -lpng
|
||||
|
||||
exit
|
||||
|
@ -2,7 +2,6 @@
|
||||
#define UMORNA_ENGINE
|
||||
|
||||
#include "game.h"
|
||||
#include "menu.h"
|
||||
#include "render.h"
|
||||
|
||||
extern int camera_x;
|
||||
|
@ -2,7 +2,33 @@
|
||||
|
||||
#include <xolatile/chads.c>
|
||||
|
||||
static void define_minimenu (int menu, char * text, int icon, void (* action) (void)) {
|
||||
menu_text [menu] [menu_items [menu]] = text;
|
||||
menu_icon [menu] [menu_items [menu]] = icon;
|
||||
menu_action [menu] [menu_items [menu]] = action;
|
||||
|
||||
menu_items [menu]++;
|
||||
}
|
||||
|
||||
static void define_menu (int show) {
|
||||
menu_items [menu_count] = 0;
|
||||
menu_show [menu_count] = show;
|
||||
|
||||
menu_count++;
|
||||
}
|
||||
|
||||
int menu_count = 0;
|
||||
|
||||
int menu_items [menu_limit];
|
||||
int menu_show [menu_limit];
|
||||
|
||||
char * menu_text [menu_limit] [menu_item_limit];
|
||||
int menu_icon [menu_limit] [menu_item_limit];
|
||||
void (* menu_action [menu_limit] [menu_item_limit]) (void);
|
||||
|
||||
void game_configure (void) {
|
||||
int index;
|
||||
|
||||
define_trait ("Strength", 1, 1, 10);
|
||||
define_trait ("Dexterity", 1, 1, 10);
|
||||
define_trait ("Wisdom", 1, 1, 10);
|
||||
@ -232,4 +258,28 @@ void game_configure (void) {
|
||||
define_player ("Ognjen", player_human, 30, 30);
|
||||
|
||||
configure ();
|
||||
|
||||
define_menu (0);
|
||||
define_menu (0);
|
||||
define_menu (1);
|
||||
define_menu (0);
|
||||
|
||||
for (index = 0; index < trait_count; ++index) {
|
||||
define_minimenu (menu_traits, trait_name [index], index, 0);
|
||||
}
|
||||
|
||||
for (index = 0; index < skill_count; ++index) {
|
||||
define_minimenu (menu_skills, skill_name [index], 3 + index, 0);
|
||||
}
|
||||
|
||||
for (index = 0; index < value_count; ++index) {
|
||||
define_minimenu (menu_values, value_name [index], 27 + index, 0);
|
||||
}
|
||||
|
||||
define_minimenu (menu_resources, "This is some simple neon menu...", 1, 0);
|
||||
define_minimenu (menu_resources, "And to test dimension computation...", 1, 0);
|
||||
define_minimenu (menu_resources, "We have different line lengths.", 1, 0);
|
||||
define_minimenu (menu_resources, "I really don't know what else to write here.", 1, 0);
|
||||
define_minimenu (menu_resources, "Important thing is how it looks when done.", 1, 0);
|
||||
define_minimenu (menu_resources, "And I want HoM&M4 look and feel.", 1, 0);
|
||||
}
|
||||
|
@ -23,6 +23,9 @@
|
||||
|
||||
#define player_limit (8)
|
||||
|
||||
#define menu_limit (24)
|
||||
#define menu_item_limit (24)
|
||||
|
||||
#include <xolatile/chads.h>
|
||||
|
||||
enum {
|
||||
@ -70,6 +73,19 @@ enum {
|
||||
sacrificer, elk_rider, warmaster, coal_golem, iron_golem, sage
|
||||
};
|
||||
|
||||
enum {
|
||||
menu_traits, menu_skills, menu_values, menu_resources
|
||||
};
|
||||
|
||||
extern int menu_count;
|
||||
|
||||
extern int menu_items [menu_limit];
|
||||
extern int menu_show [menu_limit];
|
||||
|
||||
extern char * menu_text [menu_limit] [menu_item_limit];
|
||||
extern int menu_icon [menu_limit] [menu_item_limit];
|
||||
extern void (* menu_action [menu_limit] [menu_item_limit]) (void);
|
||||
|
||||
extern void game_configure (void);
|
||||
|
||||
#endif
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "game.h"
|
||||
#include "render.h"
|
||||
#include "engine.h"
|
||||
#include "menu.h"
|
||||
|
||||
#include <raylib.h>
|
||||
|
||||
@ -10,8 +9,6 @@ int main (void) {
|
||||
|
||||
render_configure ();
|
||||
|
||||
menu_configure ();
|
||||
|
||||
while (render_active != 0) {
|
||||
render_synchronize ();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user