Work on getting the gui to compile.

This commit is contained in:
Relintai 2024-09-13 22:27:49 +02:00
parent 7da5493aeb
commit 7dc5bd88a9
3 changed files with 38 additions and 9 deletions

View File

@ -96,6 +96,8 @@ ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_objects/sprite.cpp -o sfw/r
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_objects/tile_map.cpp -o sfw/render_objects/tile_map.o
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_objects/text_2d.cpp -o sfw/render_objects/text_2d.o
#ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/render_gui/gui.cpp -o sfw/render_gui/gui.o
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/game_scene.cpp -o sfw/game_scene.o
ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/main.cpp -o sfw/main.o
@ -139,3 +141,5 @@ ccache g++ -Wall -D_REENTRANT -g sfw/core/aabb.o sfw/core/basis.o sfw/core/color
sfw/game_scene.o sfw/main.o \
-lX11 \
-o game
#sfw/render_gui/gui.o \

View File

@ -11,7 +11,9 @@
// - simplified file<->media_group concept
// - minor cosmetics
#ifdef _WIN32
#include <cstring>
#if defined(_WIN64) || defined(_WIN32)
#include <direct.h> // _getcwd()
#else
#include <unistd.h> // getcwd()
@ -20,9 +22,15 @@
#define _pclose pclose
#endif
const char** old_file_list(const char *cwd, const char *masks) {
ASSERT(strend(cwd, "/"), "Error: dirs like '%s' must end with slash", cwd);
bool strend(const char *cwd, const char *masks) {
//TODO REMOVE
return true;
}
const char** old_file_list(const char *cwd, const char *masks) {
//ASSERT(strend(cwd, "/"), "Error: dirs like '%s' must end with slash", cwd);
/*
static __thread array(char*) list = 0;
const char *arg0 = cwd; // app_path();
int larg0 = strlen(arg0);
@ -34,7 +42,7 @@ const char** old_file_list(const char *cwd, const char *masks) {
for each_substring(masks,";",it) {
int recurse = !!strstr(it, "**");
#if is(win32)
#if defined(_WIN64) || defined(_WIN32)
char *glob = va("dir %s/b/o:n \"%s\\%s\" 2> NUL", recurse ? "/s":"", cwd, it);
#else // linux, osx
char *glob = va("find %s %s -name \"%s\" | sort", cwd, !recurse ? "-maxdepth 1":"-type f", it);
@ -52,7 +60,7 @@ const char** old_file_list(const char *cwd, const char *masks) {
if( line[0] == '.' ) if( !strcmp(line,".git") || !strcmp(line,".vs") || !strcmp(line,".") || !strcmp(line,"..") ) continue;
if( strstr(line, "/.") ) continue;
// insert copy
#if is(win32)
#if defined(_WIN64) || defined(_WIN32)
char *copy = STRDUP(line); // full path already provided
#else
// while(line[0] == '/') ++line;
@ -64,6 +72,8 @@ const char** old_file_list(const char *cwd, const char *masks) {
}
array_push(list, 0); // terminator
return (const char**)list;
*/
return NULL;
}
#if 1

View File

@ -1,8 +1,23 @@
#define NK_GLFW_GL3_IMPLEMENTATION // nuklear
#define NK_IMPLEMENTATION // nuklear
#define NK_INCLUDE_DEFAULT_ALLOCATOR // nuklear
#define NK_INCLUDE_DEFAULT_FONT // nuklear
#define NK_INCLUDE_FIXED_TYPES // nuklear
#define NK_INCLUDE_FONT_BAKING // nuklear
#define NK_INCLUDE_STANDARD_IO // nuklear
#define NK_INCLUDE_STANDARD_VARARGS // nuklear
#define NK_INCLUDE_VERTEX_BUFFER_OUTPUT // nuklear
#define NK_MAX_LAYOUT_ROW_TEMPLATE_COLUMNS 64 // nuklear
#define NK_KEYSTATE_BASED_INPUT // nuklear
//--STRIP
#include "render_core/3rd_glad.h"
#include "render_core/3rd_glfw3.h"
#include "3rd_nuklear.h"
#include "3rd_nuklear_filebrowser.h"
//#include "3rd_nuklear_filebrowser.h"
#include "3rd_nuklear_glfw_gl3.h"
#include <cstring>
//--STRIP
@ -337,7 +352,7 @@ table[NK_COLOR_CHART_COLOR_HIGHLIGHT] = hover_hue; // nk_rgba(255, 0, 0, 255);
table[NK_COLOR_SELECT_ACTIVE] = main_hue;
// @transparent
#if !is(ems)
#if !defined(__EMSCRIPTEN__)
if( glfwGetWindowAttrib(window_handle(), GLFW_TRANSPARENT_FRAMEBUFFER) == GLFW_TRUE ) {
table[NK_COLOR_WINDOW].a =
table[NK_COLOR_HEADER].a = 255;
@ -1064,7 +1079,7 @@ void ui_render() {
nk_clear(&nk_glfw.ctx);
}
#if is(ems)
#if defined(__EMSCRIPTEN__)
glFinish();
#endif
@ -1514,7 +1529,7 @@ int ui_window_end() {
}
// @transparent
#if !is(ems)
#if !defined(__EMSCRIPTEN__)
static bool has_transparent_attrib = 0; do_once has_transparent_attrib = glfwGetWindowAttrib(window_handle(), GLFW_TRANSPARENT_FRAMEBUFFER) == GLFW_TRUE;
if( closed && has_transparent_attrib && !ui_has_menubar() ) {
bool any_open = 0;