add release checks

main
Brett 2024-05-15 14:09:58 -04:00
parent ae2ad8d1ab
commit c9475afb2a
4 changed files with 21 additions and 4 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.25)
set(BLT_GRAPHICS_VERSION 0.13.18)
set(BLT_GRAPHICS_VERSION 0.13.19)
set(BLT_GRAPHICS_TEST_VERSION 0.0.1)
project(BLT_WITH_GRAPHICS VERSION ${BLT_GRAPHICS_VERSION})

View File

@ -33,7 +33,9 @@ namespace blt::gfx
double scroll = 0;
bool mouse_moved = false;
bool key_pressed = false;
bool key_released = false;
bool mouse_pressed = false;
bool mouse_released = false;
private:
KEY_STATE* key_state;
MOUSE_STATE* mouse_state;
@ -81,8 +83,10 @@ namespace blt::gfx
void clear()
{
key_pressed = false;
key_released = false;
mouse_moved = false;
mouse_pressed = false;
mouse_released = false;
}
bool isKeyPressed(std::size_t key)

View File

@ -120,11 +120,15 @@ namespace blt::gfx
bool mousePressedLastFrame();
bool mouseReleaseLastFrame();
bool isKeyPressed(int key);
// TODO: maybe make this per key?
bool keyPressedLastFrame();
bool keyReleasedLastFrame();
double getFrameDeltaSeconds();
double getFrameDeltaMilliseconds();

View File

@ -35,7 +35,7 @@ void gl_error_callback(GLenum source, GLenum type, GLuint id, GLenum severity, G
if (type == GL_DEBUG_TYPE_ERROR)
{
BLT_ERROR("[OpenGL Error] message = '%s', type = 0x%x, severity = 0x%x, source = 0x%x, id = %d",
message, type, severity, source, id);
message, type, severity, source, id);
} else
{
BLT_WARN("[OpenGL Error] message = '%s', type = 0x%x, severity = 0x%x, source = 0x%x, id = %d",
@ -74,15 +74,17 @@ namespace blt::gfx
{
case GLFW_PRESS:
state = KEY_STATE::PRESS;
window_state.inputManager.key_pressed = true;
break;
case GLFW_REPEAT:
state = KEY_STATE::REPEAT;
break;
default:
state = KEY_STATE::RELEASE;
window_state.inputManager.key_released = true;
break;
}
window_state.inputManager.key(key) = state;
window_state.inputManager.key_pressed = true;
});
/* Setup mouse button callback */
@ -94,13 +96,14 @@ namespace blt::gfx
{
case GLFW_PRESS:
state = MOUSE_STATE::PRESS;
window_state.inputManager.mouse_pressed = true;
break;
default:
state = MOUSE_STATE::RELEASE;
window_state.inputManager.mouse_released = true;
break;
}
window_state.inputManager.mouse(button) = state;
window_state.inputManager.mouse_pressed = true;
});
/* Setup mouse cursor callback */
@ -385,6 +388,12 @@ namespace blt::gfx
i32 getWindowWidth()
{ return window_state.width; }
bool keyReleasedLastFrame()
{ return window_state.inputManager.key_released; }
bool mouseReleaseLastFrame()
{ return window_state.inputManager.mouse_released; }
window_data& window_data::setWindowSize(int32_t new_width, int32_t new_height)
{
width = new_width;