Add paladin game; fix NK bool

This commit is contained in:
John Alanbrook 2022-08-14 23:10:29 +00:00
parent 24ee74150a
commit 638e57e660
5 changed files with 28 additions and 10 deletions

View file

@ -55,7 +55,7 @@ edirs += ./source/engine/thirdparty/Chipmunk2D/include ./source/engine/thirdpart
includeflag != $(call prefix,$(edirs) $(eddirs),-I) includeflag != $(call prefix,$(edirs) $(eddirs),-I)
COMPINCLUDE = $(edirs) $(eddirs) 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 $@ COMPILER_FLAGS = $(includeflag) -I/usr/local/include -g -O0 -MD $(WARNING_FLAGS) -c $< -o $@
@ -102,6 +102,9 @@ bs: engine
pin: engine pin: engine
cp engine pinball cp engine pinball
pal: engine
cp engine paladin
$(ENGINE): $(eobjects) bin/libglfw3.a $(ENGINE): $(eobjects) bin/libglfw3.a
@echo Making library engine.a @echo Making library engine.a
@ar r $(ENGINE) $(eobjects) @ar r $(ENGINE) $(eobjects)

View file

@ -444,7 +444,7 @@ void editor_project_gui() {
nk_label(ctx, bbbuf, NK_TEXT_LEFT); nk_label(ctx, bbbuf, NK_TEXT_LEFT);
if (nk_menu_begin_label(ctx, "Windows", NK_TEXT_LEFT, nk_vec2(100, 200))) { 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, "Resources", &editor.showAssetMenu);
nk_checkbox_label(ctx, "Hierarchy", &editor.showHierarchy); nk_checkbox_label(ctx, "Hierarchy", &editor.showHierarchy);
@ -459,8 +459,8 @@ void editor_project_gui() {
nk_menu_end(ctx); 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")) { if (nk_button_label(ctx, "New")) {
new_level(); new_level();
current_level[0] = '\0'; current_level[0] = '\0';
@ -488,9 +488,9 @@ void editor_project_gui() {
} }
nk_end(ctx); nk_end(ctx);
if (editor.showExport && if (editor.showExport) {
nk_begin(ctx, "Export and Bake", nk_rect_std, nuk_std)) { 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, "Bake")) {
} }
if (nk_button_label(ctx, "Build")) { if (nk_button_label(ctx, "Build")) {
@ -500,6 +500,7 @@ void editor_project_gui() {
} }
// Shadow map vars // Shadow map vars
if (editor.showLighting) {
if (nk_begin(ctx, "Lighting options", nk_rect_std, nuk_std)) { if (nk_begin(ctx, "Lighting options", nk_rect_std, nuk_std)) {
nk_layout_row_dynamic(ctx, 25, 1); nk_layout_row_dynamic(ctx, 25, 1);
nk_label(ctx, "Directional shadow map", NK_TEXT_LEFT); 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_property_float(ctx, "Plane size", 0.f, &plane_size, 100.f, 1.f, 0.01f);
} }
nk_end(ctx); nk_end(ctx);
}
if (editor.showGameSettings) { if (editor.showGameSettings) {
nk_begin(ctx, "Game settings", nk_rect_std, nuk_std); 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, // nk_edit_string_zero_terminated(ctx, NK_EDIT_SIMPLE, cur_project->name,
// 126, nk_filter_default); // 126, nk_filter_default);
@ -542,6 +545,8 @@ void editor_project_gui() {
if (editor.showREPL) { if (editor.showREPL) {
nk_begin(ctx, "REPL", nk_rect_std, nuk_std); nk_begin(ctx, "REPL", nk_rect_std, nuk_std);
nk_layout_row_dynamic(ctx, 300, 1);
nk_flags active; nk_flags active;
static char buffer[512] = {'\0'}; static char buffer[512] = {'\0'};
@ -558,6 +563,8 @@ void editor_project_gui() {
if (editor.showViewmode) { if (editor.showViewmode) {
nk_begin(ctx, "View options", nk_rect_std, nuk_std); 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 FOV", 0.1f, &editorFOV, 90.f, 1.f, 0.1f);
nk_property_float(ctx, "Camera Near Plane", 0.1f, &editorClose, 5.f, 0.1f, nk_property_float(ctx, "Camera Near Plane", 0.1f, &editorClose, 5.f, 0.1f,
0.01f); 0.01f);
@ -597,7 +604,7 @@ void editor_project_gui() {
} }
if (editor.showHierarchy) { 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")) { if (nk_button_label(ctx, "New Object")) {
MakeGameobject(); MakeGameobject();
@ -610,6 +617,7 @@ void editor_project_gui() {
if (nk_begin(ctx, "Simulate", nk_rect_std, nuk_std)) { if (nk_begin(ctx, "Simulate", nk_rect_std, nuk_std)) {
nk_layout_row_dynamic(ctx, 25, 2);
if (physOn) { if (physOn) {
if (nk_button_label(ctx, "Pause")) if (nk_button_label(ctx, "Pause"))
game_pause(); game_pause();
@ -625,13 +633,15 @@ void editor_project_gui() {
} }
if (nk_begin(ctx, "Prefab Creator", nk_rect_std, nuk_std)) { 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); vec_walk(prefabs, (void (*)(void *)) & editor_prefab_btn);
nk_end(ctx); nk_end(ctx);
} }
if (editor.showAssetMenu) { if (editor.showAssetMenu) {
nk_begin(ctx, "Asset Menu", nk_rect_std, nuk_std); 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_string_zero_terminated(ctx,
NK_EDIT_BOX | NK_EDIT_NO_HORIZONTAL_SCROLL, NK_EDIT_BOX | NK_EDIT_NO_HORIZONTAL_SCROLL,
asset_search_buffer, 100, nk_filter_ascii); asset_search_buffer, 100, nk_filter_ascii);

View file

@ -5,6 +5,7 @@
#define NK_INCLUDE_VERTEX_BUFFER_OUTPUT #define NK_INCLUDE_VERTEX_BUFFER_OUTPUT
#define NK_INCLUDE_FONT_BAKING #define NK_INCLUDE_FONT_BAKING
#define NK_INCLUDE_DEFAULT_FONT #define NK_INCLUDE_DEFAULT_FONT
#define NK_INCLUDE_STANDARD_BOOL
#define NK_IMPLEMENTATION #define NK_IMPLEMENTATION
#define NK_GLFW_GL3_IMPLEMENTATION #define NK_GLFW_GL3_IMPLEMENTATION
#define NK_KEYSTATE_BASED_INPUT #define NK_KEYSTATE_BASED_INPUT

View file

@ -6,6 +6,8 @@
#include <stdio.h> #include <stdio.h>
#include <vec.h> #include <vec.h>
#include "input.h" #include "input.h"
#include "script.h"
#include "nuke.h"
struct mSDLWindow *mainwin; struct mSDLWindow *mainwin;

View file

@ -4,6 +4,8 @@
#include "engine.h" #include "engine.h"
#include "input.h" #include "input.h"
#include "openglrender.h" #include "openglrender.h"
#include "script.h"
#include "editor.h"
#include "string.h" #include "string.h"
@ -23,7 +25,7 @@ static int ed = 1;
int main(int argc, char **args) { int main(int argc, char **args) {
for (int i = 1; i < argc; i++) { for (int i = 1; i < argc; i++) {
if (args[i][0] == '-') { if (args[i][0] == '-') {
if (strncmp(args[i][1], "play", 4) == 0) { if (strncmp(&args[i][1], "play", 4) == 0) {
ed = 0; ed = 0;
} }
} }