diff --git a/cpp-voxel-engine/.vscode/c_cpp_properties.json b/cpp-voxel-engine/.vscode/c_cpp_properties.json index 04cf75a..0ca9213 100644 --- a/cpp-voxel-engine/.vscode/c_cpp_properties.json +++ b/cpp-voxel-engine/.vscode/c_cpp_properties.json @@ -3,7 +3,9 @@ { "name": "Win32", "includePath": [ - "${default}" + "${default}", + "${workspaceFolder}/**", + "C:\\msys64\\mingw64\\include\\**" ], "defines": [ "_DEBUG", @@ -11,10 +13,10 @@ "_UNICODE" ], "windowsSdkVersion": "10.0.22621.0", - "compilerPath": "cl.exe", + "compilerPath": "C:/msys64/mingw64/bin/g++.exe", "cStandard": "c17", - "cppStandard": "c++17", - "intelliSenseMode": "windows-msvc-x64" + "cppStandard": "c++20", + "intelliSenseMode": "linux-gcc-x64" } ], "version": 4 diff --git a/cpp-voxel-engine/Makefile b/cpp-voxel-engine/Makefile index 5e43bea..61e62d9 100644 --- a/cpp-voxel-engine/Makefile +++ b/cpp-voxel-engine/Makefile @@ -1,10 +1,19 @@ # Compiler settings CXX = g++ -CXXFLAGS = -std=c++11 -I. -I/path/to/glad/include -I/path/to/imgui -I. -LDFLAGS = -lglfw -ldl -lGL +CXXFLAGS = -std=c++11 -I. -Iimgui-docking -IC:/msys64/mingw64/include +LDFLAGS = -LC:/msys64/mingw64/lib -lglfw3 -lopengl32 -lgdi32 -# List source files -SRCS = main.cpp VoxelGame.cpp GreedyMesher.cpp +# List ImGui source files +IMGUISRCS = imgui-docking/imgui.cpp \ + imgui-docking/imgui_demo.cpp \ + imgui-docking/imgui_draw.cpp \ + imgui-docking/imgui_tables.cpp \ + imgui-docking/imgui_widgets.cpp \ + imgui-docking/imgui_impl_glfw.cpp \ + imgui-docking/imgui_impl_opengl3.cpp + +# List all source files +SRCS = main.cpp VoxelGame.cpp GreedyMesher.cpp $(IMGUISRCS) OBJS = $(SRCS:.cpp=.o) TARGET = voxelgame diff --git a/cpp-voxel-engine/VoxelGame.cpp b/cpp-voxel-engine/VoxelGame.cpp index 43e80cd..3cd942a 100644 --- a/cpp-voxel-engine/VoxelGame.cpp +++ b/cpp-voxel-engine/VoxelGame.cpp @@ -1,6 +1,6 @@ #include "VoxelGame.h" #include -#include +#include // Include stb_image implementation (ensure stb_image.h is in your include path) #define STB_IMAGE_IMPLEMENTATION @@ -32,7 +32,7 @@ bool VoxelGame::loadTextures() { unsigned char *data; // Load grass texture - data = stbi_load("grass.png", &width, &height, &nrChannels, 0); + data = stbi_load("grass.jpg", &width, &height, &nrChannels, 0); if (data) { glGenTextures(1, &textureGrass); glBindTexture(GL_TEXTURE_2D, textureGrass); @@ -50,7 +50,7 @@ bool VoxelGame::loadTextures() { } // Load dirt texture - data = stbi_load("dirt.png", &width, &height, &nrChannels, 0); + data = stbi_load("dirt.jpg", &width, &height, &nrChannels, 0); if (data) { glGenTextures(1, &textureDirt); glBindTexture(GL_TEXTURE_2D, textureDirt); @@ -122,7 +122,7 @@ void VoxelGame::render() { } void VoxelGame::debugUI() { - // Display a debug window using ImGui + ImGui::Begin("Debug"); ImGui::Text("Voxel Game Debug Window"); ImGui::Text("Mesh quads count: %d", (int)meshQuads.size()); diff --git a/cpp-voxel-engine/VoxelGame.h b/cpp-voxel-engine/VoxelGame.h index 5756ea2..f0de537 100644 --- a/cpp-voxel-engine/VoxelGame.h +++ b/cpp-voxel-engine/VoxelGame.h @@ -4,6 +4,11 @@ #include #include "GreedyMesher.h" + +#include "imgui.h" +#include "imgui_impl_glfw.h" +#include "imgui_impl_opengl3.h" + class VoxelGame { public: VoxelGame(); diff --git a/cpp-voxel-engine/main.cpp b/cpp-voxel-engine/main.cpp index b59faba..bb16b84 100644 --- a/cpp-voxel-engine/main.cpp +++ b/cpp-voxel-engine/main.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include "VoxelGame.h" @@ -27,11 +27,7 @@ GLFWwindow* initWindow(int width, int height, const char* title) { } glfwMakeContextCurrent(window); - // Initialize GLAD to load OpenGL function pointers - if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) { - std::cerr << "Failed to initialize GLAD\n"; - return nullptr; - } + return window; }