mirror of
https://github.com/zoriya/ForecastingVillage.git
synced 2026-05-28 08:57:52 +00:00
Adding components of the My3D for isometry editing
This commit is contained in:
@@ -272,6 +272,9 @@ add_executable(my_rpg
|
||||
src/components/dialog_holder.c
|
||||
include/components/dialog_holder.h
|
||||
src/systems/dialog_manager.c
|
||||
src/map_editor/map_interactions.c
|
||||
src/map_editor/brush_component.c
|
||||
include/map_editor.h
|
||||
)
|
||||
|
||||
add_compile_options(-W -Wall -Wextra -Wshadow)
|
||||
|
||||
@@ -18,7 +18,10 @@ SRC = src/main.c \
|
||||
src/components/dialog_holder.c \
|
||||
src/systems/map_movement_system.c \
|
||||
src/systems/dialog_manager.c \
|
||||
src/systems/controllers/keyboard_controller_system.c
|
||||
src/systems/controllers/keyboard_controller_system.c \
|
||||
src/map_editor/map_interactions.c \
|
||||
src/map_editor/tile_collision_manager.c \
|
||||
src/map_editor/brush_component.c
|
||||
|
||||
OBJ = $(SRC:%.c=%.o)
|
||||
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
#define ERROR 84
|
||||
#include "scene.h"
|
||||
|
||||
int start_game(void);
|
||||
int start_game(bool map_editor);
|
||||
|
||||
bool start_button(gc_engine *engine, gc_entity *entity, gc_vector2 _, \
|
||||
enum gc_mousekeys __);
|
||||
|
||||
+8
-5
@@ -18,6 +18,7 @@
|
||||
#include "callbacks.h"
|
||||
#include "components/game_manager.h"
|
||||
#include "my.h"
|
||||
#include "map_editor.h"
|
||||
|
||||
const struct callback callbacks[] = {
|
||||
{"start_button", &start_button},
|
||||
@@ -35,7 +36,7 @@ const struct callback callbacks[] = {
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
int register_customcmps(gc_engine *engine)
|
||||
int register_customcmps(gc_engine *engine, bool map_editor)
|
||||
{
|
||||
engine->add_component(engine, &controllable_component);
|
||||
engine->add_component(engine, &keyboard_controller);
|
||||
@@ -50,14 +51,16 @@ int register_customcmps(gc_engine *engine)
|
||||
for (int i = 0; callbacks[i].func; i++)
|
||||
engine->add_callback(engine, my_strdup(callbacks[i].name), \
|
||||
callbacks[i].func);
|
||||
if (map_editor)
|
||||
engine->add_callback(engine, my_strdup("map_manage_click"), &map_onclick);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int create_game_scene(gc_engine *engine)
|
||||
int create_game_scene(gc_engine *engine, bool map_editor)
|
||||
{
|
||||
gc_scene *scene;
|
||||
|
||||
register_customcmps(engine);
|
||||
register_customcmps(engine, map_editor);
|
||||
scene = scene_create(engine, "prefabs/mainmenu.gcprefab");
|
||||
if (!scene)
|
||||
return (-1);
|
||||
@@ -65,14 +68,14 @@ int create_game_scene(gc_engine *engine)
|
||||
return (0);
|
||||
}
|
||||
|
||||
int start_game(void)
|
||||
int start_game(bool map_editor)
|
||||
{
|
||||
gc_engine *engine = engine_create();
|
||||
sfClock *clock = sfClock_create();
|
||||
|
||||
if (!engine || engine_use_sfml(engine, "Forecasting village", 60) < 0)
|
||||
return (ERROR);
|
||||
if (create_game_scene(engine) < 0)
|
||||
if (create_game_scene(engine, map_editor) < 0)
|
||||
return (ERROR);
|
||||
while (engine->is_open(engine))
|
||||
engine->game_loop(engine, sfTime_asSeconds(sfClock_restart(clock)));
|
||||
|
||||
+5
-1
@@ -15,7 +15,11 @@ int usage(char *bin)
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
bool map_editor = false;
|
||||
|
||||
if (argc != 1 && !my_strcmp(argv[1], "-h"))
|
||||
return (usage(argv[0]));
|
||||
return (start_game());
|
||||
if (argc > 1 && (!my_strcmp(argv[1], "-e") || !my_strcmp(argv[1], "--editor")))
|
||||
map_editor = true;
|
||||
return (start_game(map_editor));
|
||||
}
|
||||
Reference in New Issue
Block a user