Base layout for the input manager
This commit is contained in:
		@ -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();
 | 
			
		||||
};
 | 
			
		||||
@ -13,6 +13,8 @@
 | 
			
		||||
#include "Graphics/Renderer.h"
 | 
			
		||||
#include "Graphics/GUI/GUIManager.h"
 | 
			
		||||
#include "Scene.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#include "PerfCounter.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -5,7 +5,5 @@ struct Event
 | 
			
		||||
{
 | 
			
		||||
  public:
 | 
			
		||||
    std::string name;
 | 
			
		||||
    int argc;
 | 
			
		||||
    void** argv;
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
};
 | 
			
		||||
@ -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();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										18
									
								
								BarinkEngine/Include/EventSystem/InputSystemEvents.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								BarinkEngine/Include/EventSystem/InputSystemEvents.h
									
									
									
									
									
										Normal 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;
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
@ -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);
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										14
									
								
								BarinkEngine/Include/Input/GLFWInput.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								BarinkEngine/Include/Input/GLFWInput.h
									
									
									
									
									
										Normal 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);
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@ -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;
 | 
			
		||||
 | 
			
		||||
	};
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user