Add GLFW as submodule
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -10,3 +10,6 @@
|
||||
[submodule "lib/tinygltf"]
|
||||
path = lib/tinygltf
|
||||
url = https://github.com/syoyo/tinygltf.git
|
||||
[submodule "lib/glfw"]
|
||||
path = lib/glfw
|
||||
url = https://github.com/glfw/glfw.git
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
project(
|
||||
Fall-Fever
|
||||
@@ -9,7 +9,6 @@ project(
|
||||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
find_package(glfw3 REQUIRED)
|
||||
find_package(glm REQUIRED)
|
||||
find_package(spdlog REQUIRED)
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
"warnings": {
|
||||
"dev": true,
|
||||
"deprecated": true,
|
||||
"uninitialized": true,
|
||||
"unusedCli": true,
|
||||
"systemVars": false
|
||||
},
|
||||
|
||||
12
lib/CMakeLists.txt
vendored
12
lib/CMakeLists.txt
vendored
@@ -1,9 +1,13 @@
|
||||
option(SPDLOG_NO_EXCEPTIONS "" ON)
|
||||
|
||||
set(TINYGLTF_HEADER_ONLY OFF CACHE INTERNAL "" FORCE)
|
||||
set(TINYGLTF_INSTALL OFF CACHE INTERNAL "" FORCE)
|
||||
set(TINYGLTF_NOEXCEPTION OFF CACHE INTERNAL "" FORCE)
|
||||
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/glad)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/entt)
|
||||
|
||||
option(TINYGLTF_HEADER_ONLY "" OFF)
|
||||
option(TINYGLTF_INSTALL "" OFF)
|
||||
option(TINYGLTF_NOEXCEPTION "" ON)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tinygltf)
|
||||
|
||||
option(GLFW_BUILD_DOCS "" OFF)
|
||||
option(GLFW_INSTALL "" OFF)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/glfw)
|
||||
|
||||
1
lib/glfw
vendored
Submodule
1
lib/glfw
vendored
Submodule
Submodule lib/glfw added at dd8a678a66
@@ -25,7 +25,7 @@ Controller::Controller()
|
||||
|
||||
std::string err;
|
||||
std::string warn;
|
||||
bool ret = loader.LoadASCIIFromFile(&m_model, &err, &warn, "glTF/ABeautifulGame.gltf");
|
||||
bool ret = loader.LoadASCIIFromFile(&m_model, &err, &warn, "glTF/DamagedHelmet.gltf");
|
||||
// bool ret = loader.LoadASCIIFromFile(&m_model, &err, &warn, "minimal.gltf");
|
||||
|
||||
if (!warn.empty()) {
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
|
||||
Window::Window()
|
||||
{
|
||||
// Hint Wayland preference to GLFW
|
||||
glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_WAYLAND);
|
||||
|
||||
// Initialize GLFW
|
||||
if (glfwInit() == 0) {
|
||||
std::terminate();
|
||||
@@ -31,6 +34,7 @@ Window::Window()
|
||||
m_glfw_window = std::shared_ptr<GLFWwindow>(
|
||||
glfwCreateWindow(static_cast<int>(m_width), static_cast<int>(m_height), "OpenGL", nullptr, nullptr),
|
||||
[](GLFWwindow *window) { glfwDestroyWindow(window); });
|
||||
|
||||
if (!m_glfw_window) {
|
||||
Log::logger().critical("Failed to create window");
|
||||
}
|
||||
@@ -56,7 +60,7 @@ Window::Window()
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
Log::logger().debug("OpenGL version: {}", reinterpret_cast<const char *>(glGetString(GL_VERSION)));
|
||||
Log::logger().debug("OpenGL version: {}", reinterpret_cast<const char *>(glGetString(GL_VERSION))); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
|
||||
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
||||
glDebugMessageCallback(Helper::gl_debug_callback, nullptr);
|
||||
|
||||
@@ -138,8 +142,9 @@ void Window::framebuffer_size_callback(GLFWwindow *window, int width, int height
|
||||
glViewport(0, 0, width, height);
|
||||
}
|
||||
|
||||
void Window::key_callback(GLFWwindow *glfw_window, int key, int scancode, int action,
|
||||
int mods) // NOLINT(bugprone-easily-swappable-parameters)
|
||||
// NOLINTBEGIN(bugprone-easily-swappable-parameters)
|
||||
void Window::key_callback(GLFWwindow *glfw_window, int key, int scancode, int action, int mods)
|
||||
// NOLINTEND(bugprone-easily-swappable-parameters)
|
||||
{
|
||||
(void)mods;
|
||||
(void)scancode;
|
||||
@@ -157,9 +162,10 @@ void Window::key_callback(GLFWwindow *glfw_window, int key, int scancode, int ac
|
||||
window.m_key_input[key] = (action == GLFW_PRESS);
|
||||
}
|
||||
}
|
||||
|
||||
// NOLINTBEGIN(bugprone-easily-swappable-parameters)
|
||||
void Window::mouse_button_callback(GLFWwindow *glfw_window, int button, int action,
|
||||
int mods) // NOLINT(bugprone-easily-swappable-parameters)
|
||||
// NOLINTEND(bugprone-easily-swappable-parameters)
|
||||
{
|
||||
(void)mods;
|
||||
(void)button;
|
||||
|
||||
Reference in New Issue
Block a user