Add some options for configuration

This commit is contained in:
Shylie
2024-05-23 21:33:15 -04:00
parent 17ea6a7f0a
commit b2164b76cf
5 changed files with 45 additions and 13 deletions

View File

@@ -0,0 +1,26 @@
#ifndef GLERMINAL_CONFIG_H
#define GLERMINAL_CONFIG_H
// THIS FILE IS CONFIGURED BY CMAKE
// MODIFY glerminal-config.h.in INSTEAD!
#ifdef __cplusplus
extern "C"
{
#endif
#cmakedefine GLERMINAL_OPENGL_DEBUG_CONTEXT
enum
{
GRID_WIDTH = @GLERMINAL_GRID_WIDTH@,
GRID_HEIGHT = @GLERMINAL_GRID_HEIGHT@,
LAYER_COUNT = @GLERMINAL_LAYER_COUNT@,
CELL_SCALE = @GLERMINAL_CELL_SCALE@
};
#ifdef __cplusplus
}
#endif
#endif//GLERMINAL_CONFIG_H

View File

@@ -12,13 +12,14 @@
namespace glerminal
{
constexpr unsigned int SCREEN_WIDTH = 1280;
constexpr unsigned int SCREEN_HEIGHT = 800;
constexpr unsigned int CELL_SIZE = 8;
constexpr unsigned int LAYER_COUNT = ::LAYER_COUNT;
constexpr unsigned int GRID_WIDTH = ::GRID_WIDTH;
constexpr unsigned int GRID_HEIGHT = ::GRID_HEIGHT;
constexpr unsigned int LAYER_COUNT = ::LAYER_COUNT;
constexpr unsigned int CELL_SCALE = ::CELL_SCALE;
constexpr unsigned int GRID_AREA = GRID_WIDTH * GRID_HEIGHT;
constexpr unsigned int SCREEN_WIDTH = GRID_WIDTH * CELL_SIZE * CELL_SCALE;
constexpr unsigned int SCREEN_HEIGHT = GRID_HEIGHT * CELL_SIZE * CELL_SCALE;
class glerminal
{

View File

@@ -295,7 +295,7 @@ namespace glerminal
// need to think about how to handle resizing to ensure
// that the window stays an integer number of "tiles" large
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
#ifdef _DEBUG
#ifdef GLERMINAL_OPENGL_DEBUG_CONTEXT
glfwWindowHint(GLFW_CONTEXT_DEBUG, GLFW_TRUE);
#endif
@@ -308,7 +308,7 @@ namespace glerminal
}
}
#ifdef _DEBUG
#ifdef GLERMINAL_OPENGL_DEBUG_CONTEXT
void glerminal::log(GLenum type, GLuint id, GLenum severity, const char* message) const
{
glDebugMessageInsert(GL_DEBUG_SOURCE_THIRD_PARTY, type, id, severity, -1, message);
@@ -325,7 +325,7 @@ namespace glerminal
throw std::runtime_error("Failed to initialize GLAD.");
}
#ifdef _DEBUG
#ifdef GLERMINAL_OPENGL_DEBUG_CONTEXT
glEnable(GL_DEBUG_OUTPUT);
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
glDebugMessageCallback([](GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam)