too tired to think
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#define OPEN_ENGINE_HPP
|
||||
|
||||
#include "open_engine/core.hpp"
|
||||
#include "open_engine/ref_scope.hpp"
|
||||
#include "open_engine/application.hpp"
|
||||
#include "open_engine/logging.hpp"
|
||||
#include "open_engine/events/key_event.hpp"
|
||||
@@ -10,6 +11,7 @@
|
||||
#include "open_engine/renderer/renderer.hpp"
|
||||
#include "open_engine/core/time.hpp"
|
||||
#include "open_engine/input/input_system.hpp"
|
||||
#include "open_engine/input/mouse_codes.hpp"
|
||||
#include "open_engine/input/keycodes.hpp"
|
||||
#include "open_engine/renderer/buffer.hpp"
|
||||
#include "open_engine/renderer/shader.hpp"
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
#ifndef APPLICATION_HPP
|
||||
#define APPLICATION_HPP
|
||||
|
||||
#include "open_engine/core.hpp"
|
||||
#include "open_engine/events/application_event.hpp"
|
||||
#include "open_engine/imgui/imgui_layer.hpp"
|
||||
#include "open_engine/window/window.hpp"
|
||||
#include "open_engine/layer_stack.hpp"
|
||||
#include "open_engine/layer.hpp"
|
||||
|
||||
int main(int argc, char **argv);
|
||||
|
||||
namespace OpenEngine {
|
||||
class Application
|
||||
{
|
||||
@@ -15,8 +16,6 @@ namespace OpenEngine {
|
||||
Application();
|
||||
~Application();
|
||||
|
||||
void Run();
|
||||
|
||||
virtual void OnEvent(Event& event);
|
||||
|
||||
void QueueLayerPush(Ref<Layer> layer);
|
||||
@@ -30,9 +29,11 @@ namespace OpenEngine {
|
||||
inline void StopRunning() { running = false; };
|
||||
|
||||
private:
|
||||
void Run();
|
||||
bool OnWindowClose(WindowCloseEvent& event);
|
||||
bool OnWindowResize(WindowResizeEvent& event);
|
||||
|
||||
private:
|
||||
inline static Application* instance;
|
||||
|
||||
bool running = true;
|
||||
@@ -40,6 +41,8 @@ namespace OpenEngine {
|
||||
|
||||
Ref<ImGuiLayer> imgui_layer;
|
||||
LayerStack layer_stack;
|
||||
|
||||
friend int ::main(int argc, char **argv);
|
||||
};
|
||||
|
||||
// Is defined by client
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
|
||||
#include "open_engine/instrumentor.hpp"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#ifdef OE_ENABLE_ASSERTS
|
||||
#include <signal.h>
|
||||
#define OE_ASSERT(x, ...) { if (!(x)) { OE_ERROR("Assertion Failed: {0}", __VA_ARGS__); raise(SIGTRAP); } }
|
||||
@@ -18,22 +16,4 @@
|
||||
|
||||
#define BIND_EVENT_FN(function) std::bind(&function, this, std::placeholders::_1)
|
||||
|
||||
namespace OpenEngine {
|
||||
template<typename T>
|
||||
using Scope = std::unique_ptr<T>;
|
||||
template<typename T, typename ... Args>
|
||||
constexpr Scope<T> CreateScope(Args&& ... args)
|
||||
{
|
||||
return std::make_unique<T>(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
using Ref = std::shared_ptr<T>;
|
||||
template<typename T, typename ... Args>
|
||||
constexpr Ref<T> CreateRef(Args&& ... args)
|
||||
{
|
||||
return std::make_shared<T>(std::forward<Args>(args)...);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // CORE_HPP
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef ENTRY_POINT_HPP
|
||||
#define ENTRY_POINT_HPP
|
||||
|
||||
#include "open_engine/instrumentor.hpp"
|
||||
#include "open_engine/core.hpp"
|
||||
#include "open_engine/application.hpp"
|
||||
#include "open_engine/logging.hpp"
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
#ifndef INSTRUMENTOR_HPP
|
||||
#define INSTRUMENTOR_HPP
|
||||
|
||||
#include "open_engine/logging.hpp"
|
||||
|
||||
#include <mutex>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <chrono>
|
||||
#include <algorithm>
|
||||
@@ -8,11 +12,15 @@
|
||||
#include <thread>
|
||||
|
||||
namespace OpenEngine {
|
||||
|
||||
using FloatingPointMicroseconds = std::chrono::duration<double, std::micro>;
|
||||
|
||||
struct ProfileResult
|
||||
{
|
||||
std::string name;
|
||||
long long start, end;
|
||||
uint32_t thread_id;
|
||||
FloatingPointMicroseconds start;
|
||||
std::chrono::microseconds elapsed_time;
|
||||
std::thread::id thread_id;
|
||||
};
|
||||
|
||||
struct InstrumentationSession
|
||||
@@ -30,45 +38,53 @@ namespace OpenEngine {
|
||||
|
||||
void BeginSession(const char* name, const std::string& filepath = "results.json")
|
||||
{
|
||||
std::lock_guard lock(mutex);
|
||||
if (current_session) {
|
||||
if (Logger::GetCoreLogger())
|
||||
OE_CORE_ERROR("Instrumentor::BeginSession({}), when session {} already exists", name, current_session->name);
|
||||
InternalEndSession();
|
||||
}
|
||||
|
||||
output_stream.open(filepath);
|
||||
WriteHeader();
|
||||
if(output_stream.is_open()) {
|
||||
current_session = new InstrumentationSession(name);
|
||||
WriteHeader();
|
||||
} else {
|
||||
if (Logger::GetCoreLogger())
|
||||
OE_CORE_ERROR("Instrumentor could not open results file: {}", filepath);
|
||||
}
|
||||
};
|
||||
|
||||
void EndSession()
|
||||
{
|
||||
WriteFooter();
|
||||
output_stream.flush();
|
||||
output_stream.close();
|
||||
profile_count = 0;
|
||||
std::lock_guard lock(mutex);
|
||||
InternalEndSession();
|
||||
};
|
||||
|
||||
void WriteProfile(const ProfileResult& result)
|
||||
{
|
||||
if (profile_count++ > 0)
|
||||
output_stream << ",";
|
||||
std::stringstream json;
|
||||
|
||||
std::string name = result.name;
|
||||
std::replace(name.begin(), name.end(), '"', '\'');
|
||||
|
||||
output_stream << "{";
|
||||
output_stream << "\"cat\":\"function\",";
|
||||
output_stream << "\"dur\":" << (result.end - result.start) << ',';
|
||||
output_stream << "\"name\":\"" << name << "\",";
|
||||
output_stream << "\"ph\":\"X\",";
|
||||
output_stream << "\"pid\":0,";
|
||||
output_stream << "\"tid\":" << result.thread_id << ",";
|
||||
output_stream << "\"ts\":" << result.start;
|
||||
output_stream << "}";
|
||||
};
|
||||
json << std::setprecision(3) << std::fixed;
|
||||
json << ",{";
|
||||
json << "\"cat\":\"function\",";
|
||||
json << "\"dur\":" << (result.elapsed_time.count()) << ',';
|
||||
json << "\"name\":\"" << name << "\",";
|
||||
json << "\"ph\":\"X\",";
|
||||
json << "\"pid\":0,";
|
||||
json << "\"tid\":" << result.thread_id << ",";
|
||||
json << "\"ts\":" << result.start.count();
|
||||
json << "}";
|
||||
|
||||
void WriteHeader()
|
||||
{
|
||||
output_stream << "{\"otherData\": {},\"traceEvents\":[";
|
||||
};
|
||||
std::lock_guard lock(mutex);
|
||||
|
||||
void WriteFooter()
|
||||
{
|
||||
output_stream << "]}";
|
||||
if (current_session) {
|
||||
output_stream << json.str();
|
||||
output_stream.flush();
|
||||
}
|
||||
};
|
||||
|
||||
static Instrumentor& Get()
|
||||
@@ -78,11 +94,32 @@ namespace OpenEngine {
|
||||
};
|
||||
|
||||
private:
|
||||
void WriteHeader()
|
||||
{
|
||||
output_stream << "{\"otherData\": {},\"traceEvents\":[{}";
|
||||
};
|
||||
|
||||
void WriteFooter()
|
||||
{
|
||||
output_stream << "]}";
|
||||
};
|
||||
|
||||
void InternalEndSession() {
|
||||
if (current_session) {
|
||||
WriteFooter();
|
||||
output_stream.close();
|
||||
delete current_session;
|
||||
current_session = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
Instrumentor()
|
||||
{
|
||||
};
|
||||
|
||||
private:
|
||||
std::mutex mutex;
|
||||
InstrumentationSession* current_session = nullptr;
|
||||
std::ofstream output_stream;
|
||||
int profile_count = 0;
|
||||
};
|
||||
@@ -106,11 +143,12 @@ namespace OpenEngine {
|
||||
{
|
||||
auto end_timepoint = std::chrono::high_resolution_clock::now();
|
||||
|
||||
long long start = std::chrono::time_point_cast<std::chrono::microseconds>(start_timepoint).time_since_epoch().count();
|
||||
long long end = std::chrono::time_point_cast<std::chrono::microseconds>(end_timepoint).time_since_epoch().count();
|
||||
auto start = FloatingPointMicroseconds{start_timepoint.time_since_epoch()};
|
||||
auto elapsed_time = std::chrono::time_point_cast<std::chrono::microseconds>(end_timepoint).time_since_epoch()
|
||||
- std::chrono::time_point_cast<std::chrono::microseconds>(start_timepoint).time_since_epoch();
|
||||
|
||||
uint32_t thread_id = std::hash<std::thread::id>{}(std::this_thread::get_id());
|
||||
Instrumentor::Get().WriteProfile({ name, start, end, thread_id });
|
||||
Instrumentor::Get().WriteProfile({ name, start, elapsed_time, std::this_thread::get_id() });
|
||||
|
||||
stopped = true;
|
||||
};
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
#ifndef LOGGING_HPP
|
||||
#define LOGGING_HPP
|
||||
|
||||
#include "open_engine/core.hpp"
|
||||
#include "open_engine/ref_scope.hpp"
|
||||
|
||||
#include <spdlog/logger.h>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <string>
|
||||
|
||||
|
||||
|
||||
namespace OpenEngine {
|
||||
spdlog::level::level_enum stringToLogLevel(std::string level_str);
|
||||
int setupMultisinkLogger(const std::string &file_path);
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace OpenEngine {
|
||||
void OnEvent(Event& e);
|
||||
|
||||
const OrthographicCamera& GetCamera() const { return camera; };
|
||||
OrthographicCamera GetCamera() { return camera;};
|
||||
OrthographicCamera& GetCamera() { return camera; };
|
||||
|
||||
float GetZoom() const { return zoom; }
|
||||
void SetZoom(float level) { zoom = level; };
|
||||
|
||||
24
open_engine/include/open_engine/ref_scope.hpp
Normal file
24
open_engine/include/open_engine/ref_scope.hpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef REF_SCOPE_HPP
|
||||
#define REF_SCOPE_HPP
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace OpenEngine {
|
||||
template<typename T>
|
||||
using Scope = std::unique_ptr<T>;
|
||||
template<typename T, typename ... Args>
|
||||
constexpr Scope<T> CreateScope(Args&& ... args)
|
||||
{
|
||||
return std::make_unique<T>(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
using Ref = std::shared_ptr<T>;
|
||||
template<typename T, typename ... Args>
|
||||
constexpr Ref<T> CreateRef(Args&& ... args)
|
||||
{
|
||||
return std::make_shared<T>(std::forward<Args>(args)...);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // REF_SCOPE_HPP
|
||||
@@ -2,8 +2,9 @@
|
||||
#define RENDER_COMMAND_HPP
|
||||
|
||||
#include "open_engine/core.hpp"
|
||||
#include "open_engine/renderer/renderer_api.hpp"
|
||||
#include "open_engine/opengl/opengl_renderer_api.hpp"
|
||||
#include "open_engine/renderer/renderer_api.hpp"
|
||||
#include "open_engine/ref_scope.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
@@ -1,13 +1,20 @@
|
||||
#ifndef RENDERER2D_HPP
|
||||
#define RENDERER2D_HPP
|
||||
|
||||
#include "open_engine/core.hpp"
|
||||
#include "open_engine/orthographic_camera.hpp"
|
||||
#include "open_engine/renderer/texture.hpp"
|
||||
#include "open_engine/ref_scope.hpp"
|
||||
|
||||
#include <glm/fwd.hpp>
|
||||
|
||||
namespace OpenEngine {
|
||||
struct Transform
|
||||
{
|
||||
glm::vec3 position = {0.0f, 0.0f, 0.0f};
|
||||
glm::vec3 size = {1.0f, 1.0f, 1.0f};
|
||||
float rotation = 0.0f;
|
||||
};
|
||||
|
||||
class Renderer2D
|
||||
{
|
||||
public:
|
||||
@@ -17,10 +24,8 @@ namespace OpenEngine {
|
||||
static void BeginScene(const OrthographicCamera& camera);
|
||||
static void EndScene();
|
||||
|
||||
static void DrawQuad(const glm::vec2& position, const glm::vec2& size, const glm::vec4& color);
|
||||
static void DrawQuad(const glm::vec3& position, const glm::vec2& size, const glm::vec4& color);
|
||||
static void DrawQuad(const glm::vec2& position, const glm::vec2& size, const Ref<Texture2D>& texture);
|
||||
static void DrawQuad(const glm::vec3& position, const glm::vec2& size, const Ref<Texture2D>& texture);
|
||||
static void DrawQuad(const Transform& transform_data, const glm::vec4& color);
|
||||
static void DrawQuad(const Transform& transform_data, const Ref<Texture2D>& texture, float tiling_factor = 1.0f);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef SHADER_HPP
|
||||
#define SHADER_HPP
|
||||
|
||||
#include <unordered_map>
|
||||
#include <open_engine/ref_scope.hpp>
|
||||
#include <glm/glm.hpp>
|
||||
#include <string>
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <input/input_system.hpp>
|
||||
#include <imgui/imgui_layer.hpp>
|
||||
#include <renderer/renderer.hpp>
|
||||
#include <instrumentor.hpp>
|
||||
#include <core/time.hpp>
|
||||
|
||||
#include <imgui.h>
|
||||
|
||||
@@ -332,7 +332,7 @@ namespace OpenEngine {
|
||||
{
|
||||
OE_PROFILE_FUNCTION();
|
||||
|
||||
static bool show = true;
|
||||
static bool show = false;
|
||||
if (show)
|
||||
ImGui::ShowDemoWindow(&show);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <pch.hpp>
|
||||
|
||||
#include <core.hpp>
|
||||
#include <logging.hpp>
|
||||
|
||||
#include <spdlog/sinks/stdout_color_sinks.h>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <pch.hpp>
|
||||
|
||||
#include <core.hpp>
|
||||
#include <opengl/opengl_buffer.hpp>
|
||||
|
||||
#include <glad/glad.h>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <pch.hpp>
|
||||
|
||||
#include <core.hpp>
|
||||
#include <opengl/opengl_context.hpp>
|
||||
#include <logging.hpp>
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace OpenEngine {
|
||||
{
|
||||
OE_PROFILE_FUNCTION();
|
||||
|
||||
#ifdef OE_DEBUG
|
||||
#ifdef OE_DEBUG_TOOLS
|
||||
glEnable(GL_DEBUG_OUTPUT);
|
||||
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
||||
glDebugMessageCallback(OpenGLMessageCallback, nullptr);
|
||||
|
||||
@@ -2,10 +2,12 @@
|
||||
|
||||
#include <opengl/opengl_shader.hpp>
|
||||
|
||||
#include <core.hpp>
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
#include <logging.hpp>
|
||||
#include <glad/glad.h>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#include <glad/glad.h>
|
||||
#include <alloca.h>
|
||||
#include <cstddef>
|
||||
#include <fstream>
|
||||
@@ -194,30 +196,44 @@ namespace OpenEngine {
|
||||
|
||||
void OpenGLShader::SetBool(const std::string &name, bool value) const
|
||||
{
|
||||
OE_PROFILE_FUNCTION();
|
||||
|
||||
UploadBool(name, value);
|
||||
}
|
||||
void OpenGLShader::SetInt(const std::string &name, int value) const
|
||||
{
|
||||
OE_PROFILE_FUNCTION();
|
||||
|
||||
UploadInt(name, value);
|
||||
}
|
||||
void OpenGLShader::SetFloat(const std::string &name, float value) const
|
||||
{
|
||||
OE_PROFILE_FUNCTION();
|
||||
|
||||
UploadFloat(name, value);
|
||||
}
|
||||
void OpenGLShader::SetMat4(const std::string &name, const glm::mat4& value) const
|
||||
{
|
||||
OE_PROFILE_FUNCTION();
|
||||
|
||||
UploadMat4(name, value);
|
||||
}
|
||||
void OpenGLShader::SetVec2(const std::string &name, const glm::vec2& value) const
|
||||
{
|
||||
OE_PROFILE_FUNCTION();
|
||||
|
||||
UploadVec2(name, value);
|
||||
}
|
||||
void OpenGLShader::SetVec3(const std::string &name, const glm::vec3& value) const
|
||||
{
|
||||
OE_PROFILE_FUNCTION();
|
||||
|
||||
UploadVec3(name, value);
|
||||
}
|
||||
void OpenGLShader::SetVec4(const std::string &name, const glm::vec4& value) const
|
||||
{
|
||||
OE_PROFILE_FUNCTION();
|
||||
|
||||
UploadVec4(name, value);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#include <filesystem>
|
||||
#include <glm/trigonometric.hpp>
|
||||
#include <pch.hpp>
|
||||
|
||||
#include <renderer/buffer.hpp>
|
||||
@@ -73,49 +75,43 @@ namespace OpenEngine {
|
||||
|
||||
renderer_data->texture_shader->Bind();
|
||||
renderer_data->texture_shader->SetMat4("u_ViewProjection", camera.GetViewProjectionMatrix());
|
||||
renderer_data->texture_shader->SetMat4("u_ViewProjection", camera.GetViewProjectionMatrix());
|
||||
}
|
||||
|
||||
void Renderer2D::EndScene()
|
||||
{
|
||||
}
|
||||
|
||||
void Renderer2D::DrawQuad(const glm::vec2& position, const glm::vec2& size, const Ref<Texture2D>& texture)
|
||||
{
|
||||
OE_PROFILE_FUNCTION();
|
||||
|
||||
DrawQuad(glm::vec3(position, 0.0f), size, texture);
|
||||
}
|
||||
void Renderer2D::DrawQuad(const glm::vec3& position, const glm::vec2& size, const Ref<Texture2D>& texture)
|
||||
void Renderer2D::DrawQuad(const Transform& transform_data, const Ref<Texture2D>& texture, float tiling_factor)
|
||||
{
|
||||
OE_PROFILE_FUNCTION();
|
||||
|
||||
renderer_data->texture_shader->SetVec4("u_Color", glm::vec4(1.0f));
|
||||
renderer_data->texture_shader->SetFloat("u_TilingFactor", tiling_factor);
|
||||
texture->Bind();
|
||||
|
||||
glm::mat4 transform = glm::translate(glm::mat4(1.0f), position) *
|
||||
glm::scale(glm::mat4(1.0f), {size.x, size.y, 1.0f});
|
||||
glm::mat4 transform = glm::translate(glm::mat4(1.0f), transform_data.position)
|
||||
* ((transform_data.rotation != 0) ?
|
||||
glm::rotate(glm::mat4(1.0f), glm::radians(transform_data.rotation), {0.0f, 0.0f, 1.0f})
|
||||
: 1.0f)
|
||||
* glm::scale(glm::mat4(1.0f), transform_data.size);
|
||||
renderer_data->texture_shader->SetMat4("u_Transform", transform);
|
||||
|
||||
renderer_data->vertex_array->Bind();
|
||||
RenderCommand::DrawIndexed(renderer_data->vertex_array);
|
||||
}
|
||||
|
||||
void Renderer2D::DrawQuad(const glm::vec2& position, const glm::vec2& size, const glm::vec4& color)
|
||||
{
|
||||
OE_PROFILE_FUNCTION();
|
||||
|
||||
DrawQuad(glm::vec3(position, 0.0f), size, color);
|
||||
}
|
||||
void Renderer2D::DrawQuad(const glm::vec3& position, const glm::vec2& size, const glm::vec4& color)
|
||||
void Renderer2D::DrawQuad(const Transform& transform_data, const glm::vec4& color)
|
||||
{
|
||||
OE_PROFILE_FUNCTION();
|
||||
|
||||
renderer_data->texture_shader->SetVec4("u_Color", color);
|
||||
renderer_data->white_texture->Bind();
|
||||
|
||||
glm::mat4 transform = glm::translate(glm::mat4(1.0f), position) *
|
||||
glm::scale(glm::mat4(1.0f), {size.x, size.y, 1.0f});
|
||||
glm::mat4 transform = glm::translate(glm::mat4(1.0f), transform_data.position)
|
||||
* ((transform_data.rotation != 0) ?
|
||||
glm::rotate(glm::mat4(1.0f), glm::radians(transform_data.rotation), {0.0f, 0.0f, 1.0f})
|
||||
: 1.0f)
|
||||
* glm::scale(glm::mat4(1.0f), transform_data.size);
|
||||
renderer_data->texture_shader->SetMat4("u_Transform", transform);
|
||||
|
||||
renderer_data->vertex_array->Bind();
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <events/mouse_event.hpp>
|
||||
#include <renderer/renderer.hpp>
|
||||
#include <events/key_event.hpp>
|
||||
#include <instrumentor.hpp>
|
||||
#include <logging.hpp>
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
@@ -103,19 +102,19 @@ namespace OpenEngine {
|
||||
switch (action) {
|
||||
case GLFW_PRESS:
|
||||
{
|
||||
KeyPressedEvent event(key, scancode, 0, mods);
|
||||
KeyPressedEvent event(static_cast<KeyCode>(key), scancode, 0, mods);
|
||||
data.event_callback(event);
|
||||
break;
|
||||
}
|
||||
case GLFW_RELEASE:
|
||||
{
|
||||
KeyReleasedEvent event(key, scancode, mods);
|
||||
KeyReleasedEvent event(static_cast<KeyCode>(key), scancode, mods);
|
||||
data.event_callback(event);
|
||||
break;
|
||||
}
|
||||
case GLFW_REPEAT:
|
||||
{
|
||||
KeyPressedEvent event(key, scancode, 1, mods);
|
||||
KeyPressedEvent event(static_cast<KeyCode>(key), scancode, 1, mods);
|
||||
data.event_callback(event);
|
||||
break;
|
||||
}
|
||||
@@ -126,7 +125,7 @@ namespace OpenEngine {
|
||||
{
|
||||
WindowData& data = *(WindowData*)glfwGetWindowUserPointer(window);
|
||||
|
||||
KeyTypedEvent event(keycode);
|
||||
KeyTypedEvent event(static_cast<KeyCode>(keycode));
|
||||
data.event_callback(event);
|
||||
});
|
||||
|
||||
@@ -137,13 +136,13 @@ namespace OpenEngine {
|
||||
switch (action) {
|
||||
case GLFW_PRESS:
|
||||
{
|
||||
MouseButtonPressedEvent event(button);
|
||||
MouseButtonPressedEvent event(static_cast<MouseCode>(button));
|
||||
data.event_callback(event);
|
||||
break;
|
||||
}
|
||||
case GLFW_RELEASE:
|
||||
{
|
||||
MouseButtonReleasedEvent event(button);
|
||||
MouseButtonReleasedEvent event(static_cast<MouseCode>(button));
|
||||
data.event_callback(event);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user