Base layout for the input manager

This commit is contained in:
2022-06-19 20:01:31 +02:00
parent 85f9c78adf
commit 3c30bf7fb7
17 changed files with 224 additions and 191 deletions

View File

@ -11,16 +11,13 @@
#include <string>
class ModelImporter {
public:
static std::vector<BarinkEngine::Mesh> Import(std::string path);
private:
void ImportFBX(std::string path);
void ImportBlend(std::string path);
void ImportGLTF(std::string path);
void ImportOBJ(std::string path);
static BarinkEngine::Mesh ModelImporter::processMesh(aiMesh* mesh, const aiScene* scene);
static std::vector<BarinkEngine::Mesh> ModelImporter::processNode(aiNode* node, const aiScene* scene);
public:
void Import(std::string path);
static std::vector<BarinkEngine::Mesh> Test();
};

View File

@ -13,6 +13,8 @@
#include "Graphics/Renderer.h"
#include "Graphics/GUI/GUIManager.h"
#include "Scene.h"
#include "PerfCounter.h"

View File

@ -5,7 +5,5 @@ struct Event
{
public:
std::string name;
int argc;
void** argv;
};

View File

@ -6,10 +6,12 @@ class EventEmitter {
public:
void Subscribe (EventListener& subscriber);
void Unsubscribe(EventListener& subscriber);
void EmitEvent(Event& incident);
protected:
std::list<EventListener*> subscribers;
void EmitEvent(Event& incident);
EventEmitter();

View File

@ -0,0 +1,18 @@
#pragma once
#include "Event.h"
struct KEY_DOWN_EVENT : public Event {
public:
int scancode;
int keycode;
int mods;
};
struct KEY_UP_EVENT : public Event {
public:
int scancode;
int keycode;
int mods;
};

View File

@ -28,10 +28,10 @@ public:
~Renderable();
static Renderable* Load();
static Renderable* Load(std::string& path);
void Draw();
private:
std::vector<BarinkEngine::Mesh> meshes;
Renderable();
Renderable(std::string& path);
};

View File

@ -0,0 +1,14 @@
#pragma once
#include "GLFW/glfw3.h"
namespace BarinkEngine {
namespace Input {
void BE_GLFW_KEYS(GLFWwindow* window, int key, int scancode, int action, int mods);
void BE_GLFW_CURSOR_POSITION(GLFWwindow* window, double x, double y);
void BE_GLFW_CURSOR_ENTER(GLFWwindow* window, int entered);
void BE_GLFW_MOUSE_BUTTON(GLFWwindow* window, int button, int action, int mods);
void BE_GLFW_SCROLL(GLFWwindow* window, double xoffset, double yoffset);
}
}

View File

@ -1,27 +1,29 @@
#pragma once
#include <vector>
#include <list>
#include "Graphics/Window.h"
#include "EventSystem/EventEmitter.h"
#include "../Include/Input/GLFWInput.h"
#include "BarinkEngine.h"
namespace BarinkEngine {
class InputManager : EventEmitter {
class InputManager : public EventEmitter {
public:
InputManager();
void PollEvents();
void attach(BarinkWindow* window);
void detach(BarinkWindow* window);
void setupGLFWInput(GLFWwindow* window);
// GLFW Handlers
static void KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods);
static void CursorPositionCallback(GLFWwindow* window, double x, double y);
static void CursorEnterCallback(GLFWwindow* window, int entered);
static void MouseButtonCallback(GLFWwindow* window, int button, int action, int mods);
static void ScrollCallback(GLFWwindow* window, double xoffset, double yoffset);
private:
std::vector<BarinkWindow*> windows;
std::list<BarinkWindow*> windows;
};
}