From 7ce46d3e4409f1f25e454cd5dcc6482363c6462f Mon Sep 17 00:00:00 2001 From: Dominic Masters Date: Thu, 30 Sep 2021 11:44:58 -0700 Subject: [PATCH] Working on fixing stb --- CMakeLists.txt | 1 + client/glfw/CMakeLists.txt | 8 +++----- client/glfw/glwfwplatform.c | 3 ++- client/glfw/glwfwplatform.h | 10 ++++++---- lib/CMakeLists.txt | 8 ++++---- src/CMakeLists.txt | 4 +--- src/libs.h | 8 +------- 7 files changed, 18 insertions(+), 24 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fd31045f..618a8d16 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,7 @@ cmake_minimum_required(VERSION 3.13) set(CMAKE_C_STANDARD 99) set(CMAKE_C_STANDARD_REQUIRED ON) +project(Dawn VERSION 1.0) set(GAME_NAME DawnGame) set(GAME_VERSION 1.0) diff --git a/client/glfw/CMakeLists.txt b/client/glfw/CMakeLists.txt index c26e1743..ee59b1e6 100644 --- a/client/glfw/CMakeLists.txt +++ b/client/glfw/CMakeLists.txt @@ -3,10 +3,8 @@ # This software is released under the MIT License. # https://opensource.org/licenses/MIT -project(${GAME_NAME} VERSION ${GAME_VERSION}) - -file(GLOB_RECURSE SOURCES ${CMAKE_SOURCE_DIR}/*.c) -file(GLOB_RECURSE HEADERS ${CMAKE_SOURCE_DIR}/*.h) +file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.c) +file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.h) add_executable(${PROJECT_NAME} ${HEADERS} ${SOURCES}) -target_link_libraries(${PROJECT_NAME} src glfw) \ No newline at end of file +target_link_libraries(${PROJECT_NAME} src glfw glad_gl_core_33) \ No newline at end of file diff --git a/client/glfw/glwfwplatform.c b/client/glfw/glwfwplatform.c index 3ad690f4..5623be32 100644 --- a/client/glfw/glwfwplatform.c +++ b/client/glfw/glwfwplatform.c @@ -27,7 +27,8 @@ int32_t main() { // Load GLAD glfwMakeContextCurrent(window); glfwSwapInterval(0); - gladLoadGLLoader((GLADloadproc) glfwGetProcAddress); + gladLoadGL((GLADloadfunc)glfwGetProcAddress); + // gladLoadGLLoader((GLADloadproc) glfwGetProcAddress); // Setup window listeners glfwSetWindowSizeCallback(window, &glfwOnResize); diff --git a/client/glfw/glwfwplatform.h b/client/glfw/glwfwplatform.h index 580e611c..513fce3a 100644 --- a/client/glfw/glwfwplatform.h +++ b/client/glfw/glwfwplatform.h @@ -4,10 +4,12 @@ // https://opensource.org/licenses/MIT #pragma once -#include -#include "src/display/render.h" -#include "src/game/game.h" -#include "src/input/input.h" +#include +#include +#include +#include +#include +#include #define WINDOW_WIDTH_DEFAULT 1280 #define WINDOW_HEIGHT_DEFAULT WINDOW_WIDTH_DEFAULT/16*9 diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 842e22bf..9f2330df 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -3,15 +3,15 @@ # This software is released under the MIT License. # https://opensource.org/licenses/MIT -add_subdirectory(Unity) +#add_subdirectory(Unity) add_subdirectory(cglm) add_subdirectory(glfw) add_subdirectory(duktape) # STB -add_library(stb STATIC stb/stb_image.h) -set_target_properties(stb PROPERTIES LINKER_LANGUAGE C) -target_include_directories(stb PUBLIC stb/) +file(GLOB_RECURSE STB_SOURCES stb/*.h) +add_library(stb INTERFACE) +target_include_directories(stb INTERFACE stb) # GLAD add_subdirectory(glad2/cmake) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 343c9172..ebdf4ef4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -8,12 +8,10 @@ file(GLOB_RECURSE SOURCES *.c) add_library(src STATIC ${SOURCES}) target_include_directories(src PUBLIC ${CMAKE_CURRENT_LIST_DIR}) target_link_libraries(src PUBLIC - glfw - cglm - stb cglm duktape glad_gl_core_33 + stb ) # Set up flags diff --git a/src/libs.h b/src/libs.h index 2a56e9da..143fa8ee 100644 --- a/src/libs.h +++ b/src/libs.h @@ -7,7 +7,6 @@ // Static Libs #include -#include #include #include #include @@ -26,12 +25,7 @@ #if defined(_WIN32) || defined(_WIN64) // Windows Fixes # define strtok_r strtok_s - - #if defined(Sleep) - # define sleep(n) Sleep(n) - #else - # define sleep(n) _sleep(n) - #endif + # define sleep(n) Sleep(n) #else // Unix Fixes #include