From 638e57e6607daebc11809444095994c5db15bbc4 Mon Sep 17 00:00:00 2001 From: John Alanbrook Date: Sun, 14 Aug 2022 23:10:29 +0000 Subject: [PATCH] Add paladin game; fix NK bool --- Makefile | 5 ++++- source/engine/editor.c | 26 ++++++++++++++++++-------- source/engine/nuke.c | 1 + source/engine/window.c | 2 ++ source/engine/yugine.c | 4 +++- 5 files changed, 28 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index c99756f..c96c658 100755 --- a/Makefile +++ b/Makefile @@ -55,7 +55,7 @@ edirs += ./source/engine/thirdparty/Chipmunk2D/include ./source/engine/thirdpart includeflag != $(call prefix,$(edirs) $(eddirs),-I) COMPINCLUDE = $(edirs) $(eddirs) -WARNING_FLAGS = -Wno-everything #-Wall -Wwrite-strings -Wunsupported -Wall -Wextra -Wwrite-strings -Wno-unused-parameter -Wno-unused-function -Wno-missing-braces -Wno-incompatible-function-pointer-types -Wno-gnu-statement-expression -Wno-complex-component-init -pedantic +WARNING_FLAGS = -Wno-incompatible-function-pointer-types #-Wall -Wwrite-strings -Wunsupported -Wall -Wextra -Wwrite-strings -Wno-unused-parameter -Wno-unused-function -Wno-missing-braces -Wno-incompatible-function-pointer-types -Wno-gnu-statement-expression -Wno-complex-component-init -pedantic COMPILER_FLAGS = $(includeflag) -I/usr/local/include -g -O0 -MD $(WARNING_FLAGS) -c $< -o $@ @@ -102,6 +102,9 @@ bs: engine pin: engine cp engine pinball +pal: engine + cp engine paladin + $(ENGINE): $(eobjects) bin/libglfw3.a @echo Making library engine.a @ar r $(ENGINE) $(eobjects) diff --git a/source/engine/editor.c b/source/engine/editor.c index d6603e2..6eb0d43 100644 --- a/source/engine/editor.c +++ b/source/engine/editor.c @@ -444,7 +444,7 @@ void editor_project_gui() { nk_label(ctx, bbbuf, NK_TEXT_LEFT); if (nk_menu_begin_label(ctx, "Windows", NK_TEXT_LEFT, nk_vec2(100, 200))) { - nk_layout_row_dynamic(ctx, 30, 1); + nk_layout_row_dynamic(ctx, 25, 1); nk_checkbox_label(ctx, "Resources", &editor.showAssetMenu); nk_checkbox_label(ctx, "Hierarchy", &editor.showHierarchy); @@ -459,8 +459,8 @@ void editor_project_gui() { nk_menu_end(ctx); } - if (nk_menu_begin_text(ctx, "Levels", 100, 0, nk_vec2(100, 50))) { - + if (nk_menu_begin_label(ctx, "Levels", NK_TEXT_LEFT, nk_vec2(100, 50))) { + nk_layout_row_dynamic(ctx,25,3); if (nk_button_label(ctx, "New")) { new_level(); current_level[0] = '\0'; @@ -488,9 +488,9 @@ void editor_project_gui() { } nk_end(ctx); - if (editor.showExport && - nk_begin(ctx, "Export and Bake", nk_rect_std, nuk_std)) { - + if (editor.showExport) { + nk_begin(ctx, "Export and Bake", nk_rect_std, nuk_std); + nk_layout_row_dynamic(ctx, 25,2); if (nk_button_label(ctx, "Bake")) { } if (nk_button_label(ctx, "Build")) { @@ -500,6 +500,7 @@ void editor_project_gui() { } // Shadow map vars + if (editor.showLighting) { if (nk_begin(ctx, "Lighting options", nk_rect_std, nuk_std)) { nk_layout_row_dynamic(ctx, 25, 1); nk_label(ctx, "Directional shadow map", NK_TEXT_LEFT); @@ -512,9 +513,11 @@ void editor_project_gui() { nk_property_float(ctx, "Plane size", 0.f, &plane_size, 100.f, 1.f, 0.01f); } nk_end(ctx); + } if (editor.showGameSettings) { nk_begin(ctx, "Game settings", nk_rect_std, nuk_std); + nk_layout_row_dynamic(ctx,25,1); // nk_edit_string_zero_terminated(ctx, NK_EDIT_SIMPLE, cur_project->name, // 126, nk_filter_default); @@ -542,6 +545,8 @@ void editor_project_gui() { if (editor.showREPL) { nk_begin(ctx, "REPL", nk_rect_std, nuk_std); + nk_layout_row_dynamic(ctx, 300, 1); + nk_flags active; static char buffer[512] = {'\0'}; @@ -558,6 +563,8 @@ void editor_project_gui() { if (editor.showViewmode) { nk_begin(ctx, "View options", nk_rect_std, nuk_std); + nk_layout_row_dynamic(ctx, 25, 1); + nk_property_float(ctx, "Camera FOV", 0.1f, &editorFOV, 90.f, 1.f, 0.1f); nk_property_float(ctx, "Camera Near Plane", 0.1f, &editorClose, 5.f, 0.1f, 0.01f); @@ -597,7 +604,7 @@ void editor_project_gui() { } if (editor.showHierarchy) { - editor.showHierarchy = nk_begin(ctx, "Objects", nk_rect_std, nuk_std); + nk_begin(ctx, "Objects", nk_rect_std, nuk_std); if (nk_button_label(ctx, "New Object")) { MakeGameobject(); @@ -610,6 +617,7 @@ void editor_project_gui() { if (nk_begin(ctx, "Simulate", nk_rect_std, nuk_std)) { + nk_layout_row_dynamic(ctx, 25, 2); if (physOn) { if (nk_button_label(ctx, "Pause")) game_pause(); @@ -625,13 +633,15 @@ void editor_project_gui() { } if (nk_begin(ctx, "Prefab Creator", nk_rect_std, nuk_std)) { + nk_layout_row_dynamic(ctx, 25, 1); + vec_walk(prefabs, (void (*)(void *)) & editor_prefab_btn); nk_end(ctx); } if (editor.showAssetMenu) { nk_begin(ctx, "Asset Menu", nk_rect_std, nuk_std); - + nk_layout_row_dynamic(ctx,25,1); nk_edit_string_zero_terminated(ctx, NK_EDIT_BOX | NK_EDIT_NO_HORIZONTAL_SCROLL, asset_search_buffer, 100, nk_filter_ascii); diff --git a/source/engine/nuke.c b/source/engine/nuke.c index dd9027e..a5b294e 100644 --- a/source/engine/nuke.c +++ b/source/engine/nuke.c @@ -5,6 +5,7 @@ #define NK_INCLUDE_VERTEX_BUFFER_OUTPUT #define NK_INCLUDE_FONT_BAKING #define NK_INCLUDE_DEFAULT_FONT +#define NK_INCLUDE_STANDARD_BOOL #define NK_IMPLEMENTATION #define NK_GLFW_GL3_IMPLEMENTATION #define NK_KEYSTATE_BASED_INPUT diff --git a/source/engine/window.c b/source/engine/window.c index 4f61b32..9b492fe 100644 --- a/source/engine/window.c +++ b/source/engine/window.c @@ -6,6 +6,8 @@ #include #include #include "input.h" +#include "script.h" +#include "nuke.h" struct mSDLWindow *mainwin; diff --git a/source/engine/yugine.c b/source/engine/yugine.c index fcc63d2..dc68b30 100644 --- a/source/engine/yugine.c +++ b/source/engine/yugine.c @@ -4,6 +4,8 @@ #include "engine.h" #include "input.h" #include "openglrender.h" +#include "script.h" +#include "editor.h" #include "string.h" @@ -23,7 +25,7 @@ static int ed = 1; int main(int argc, char **args) { for (int i = 1; i < argc; i++) { if (args[i][0] == '-') { - if (strncmp(args[i][1], "play", 4) == 0) { + if (strncmp(&args[i][1], "play", 4) == 0) { ed = 0; } }