FIXED inputsystem linker error

This commit is contained in:
Nigel Barink 2022-08-15 21:15:12 +02:00
parent ab5599f1fc
commit db6def3bc9
11 changed files with 49 additions and 56 deletions

View File

@ -15,10 +15,7 @@
#include "Scene.h" #include "Scene.h"
#include "PerfCounter.h" #include "PerfCounter.h"
extern void Start(); extern void Start();
extern void Update(); extern void Update();
extern void ImmediateGraphicsDraw(); extern void ImmediateGraphicsDraw();
extern void Stop(); extern void Stop();
extern BarinkEngine::InputManager InputSystem;

View File

@ -1,5 +0,0 @@
#include "EventListener.h"
void EventListener::ReceiveEvent(Event& incident)
{
}

View File

@ -1,8 +1,12 @@
#pragma once #pragma once
#include "Event.h"
#include <list> #include <list>
#include <iostream>
#include "spdlog/spdlog.h"
#include "Event.h"
class EventListener{ class EventListener{
public: public:
virtual void ReceiveEvent(Event& incident); virtual void ReceiveEvent(Event& incident) = 0 ;
}; };

View File

@ -2,12 +2,15 @@
#define GLFW_STATIC #define GLFW_STATIC
#include <glad/glad.h> #include <glad/glad.h>
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include "../Include/EventSystem/EventListener.h" #include <spdlog/spdlog.h>
#include "EventSystem/Event.h"
#include "EventSystem/EventListener.h"
class BarinkWindow : EventListener { class BarinkWindow : EventListener {
private: private:
@ -18,9 +21,6 @@ class BarinkWindow : EventListener {
static bool InitGLFW(); static bool InitGLFW();
public: public:
BarinkWindow(const int width, const int height); BarinkWindow(const int width, const int height);
~BarinkWindow(); ~BarinkWindow();

View File

@ -1,7 +1,11 @@
#pragma once #pragma once
#include <vector> #include <vector>
#include "Graphics/Window.h" #include <iostream>
#include "spdlog/spdlog.h"
#include "EventSystem/EventEmitter.h" #include "EventSystem/EventEmitter.h"
#include "EventSystem/EventListener.h"
#include "Graphics/Window.h"
namespace BarinkEngine { namespace BarinkEngine {
@ -12,8 +16,6 @@ namespace BarinkEngine {
void PollEvents(); void PollEvents();
void attach(BarinkWindow* window); void attach(BarinkWindow* window);
// GLFW Handlers // GLFW Handlers
static void KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods); static void KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods);
static void CursorPositionCallback(GLFWwindow* window, double x, double y); static void CursorPositionCallback(GLFWwindow* window, double x, double y);
@ -25,3 +27,5 @@ namespace BarinkEngine {
}; };
} }
extern BarinkEngine::InputManager InputSystem;

View File

@ -63,10 +63,10 @@ project "BarinkEngine"
filter { "system:windows"} filter { "system:windows"}
prebuildcommands { prebuildcommands {
-- Copy shaders -- Copy shaders
"copy graphics\\shaders\\fragment.shader ..\\build\\SandboxApplication\\Debug\\test.fs", "copy src\\graphics\\shaders\\fragment.shader ..\\build\\SandboxApplication\\Debug\\test.fs",
"copy graphics\\shaders\\vertex.shader ..\\build\\SandboxApplication\\Debug\\test.vs", "copy src\\graphics\\shaders\\vertex.shader ..\\build\\SandboxApplication\\Debug\\test.vs",
"copy graphics\\shaders\\RenderSurfaceFrag.shader ..\\build\\SandboxApplication\\Debug\\RenderSurface.fs", "copy src\\graphics\\shaders\\RenderSurfaceFrag.shader ..\\build\\SandboxApplication\\Debug\\RenderSurface.fs",
"copy graphics\\shaders\\RenderSurfaceVert.shader ..\\build\\SandboxApplication\\Debug\\RenderSurface.vs" "copy src\\graphics\\shaders\\RenderSurfaceVert.shader ..\\build\\SandboxApplication\\Debug\\RenderSurface.vs"
} }
@ -74,10 +74,10 @@ project "BarinkEngine"
filter { "system:linux" } filter { "system:linux" }
prebuildcommands { prebuildcommands {
-- Copy shaders -- Copy shaders
"cp graphics/shaders/fragment.shader ../build/SandboxApplication/Debug/test.fs", "cp src/graphics/shaders/fragment.shader ../build/SandboxApplication/Debug/test.fs",
"cp graphics/shaders/vertex.shader ../build/SandboxApplication/Debug/test.vs", "cp src/graphics/shaders/vertex.shader ../build/SandboxApplication/Debug/test.vs",
"cp graphics/shaders/RenderSurfaceFrag.shader ../build/SandboxApplication/Debug/RenderSurface.fs", "cp src/graphics/shaders/RenderSurfaceFrag.shader ../build/SandboxApplication/Debug/RenderSurface.fs",
"cp graphics/shaders/RenderSurfaceVert.shader ../build/SandboxApplication/Debug/RenderSurface.vs" "cp src/graphics/shaders/RenderSurfaceVert.shader ../build/SandboxApplication/Debug/RenderSurface.vs"
} }
include('../ImGui') include('../ImGui')

View File

@ -1,8 +1,6 @@
#include "BarinkEngine.h" #include "BarinkEngine.h"
#include <phonon.h>
EngineStatistics* ES; EngineStatistics* ES;
BarinkEngine::InputManager InputSystem;
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
// Setup performance sampler // Setup performance sampler

View File

@ -13,6 +13,7 @@ BarinkEngine::SceneObject* BarinkEngine::ModelImporter::Import(const std::string
std::vector<BarinkEngine::Mesh> meshes = processNode(currentNode, scene); std::vector<BarinkEngine::Mesh> meshes = processNode(currentNode, scene);
return root; return root;
} }

View File

@ -1,10 +1,4 @@
#include "Graphics/Window.h" #include "Graphics/Window.h"
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <GLFW/glfw3.h>
#include <spdlog/spdlog.h>
#include "../Include/EventSystem/Event.h"
bool BarinkWindow::InitGLFW(){ bool BarinkWindow::InitGLFW(){
if(!glfwInit()) if(!glfwInit())
@ -76,9 +70,8 @@ void BarinkWindow::SwapBuffers()
glfwSwapBuffers(window); glfwSwapBuffers(window);
} }
void BarinkWindow::ReceiveEvent(Event& incident) void BarinkWindow::ReceiveEvent(Event& incident)
{ {
std::cout << "EVENT RECEIVED: " << incident.name << std::endl; std::cout << "EVENT RECEIVED: " << incident.name << std::endl;
} }

View File

@ -1,12 +1,12 @@
#include "BarinkEngine.h"
#include "Input/InputManager.h" #include "Input/InputManager.h"
#include "GLFW/glfw3.h" BarinkEngine::InputManager InputSystem;
#include "spdlog/spdlog.h"
#include <iostream>
void BarinkEngine::InputManager::PollEvents() void BarinkEngine::InputManager::PollEvents()
{ {
for (auto it = windows.begin(); it != windows.end(); ++it) { for (auto it = windows.begin(); it != windows.end(); ++it) {
(*it)->Poll(); auto window = *it;
window->Poll();
} }
} }

View File

@ -21,7 +21,7 @@ const std::string fragmentShaderSource = "build/SandboxApplication/Debug/test.fs
BarinkEngine::ModelImporter* MI = new BarinkEngine::ModelImporter(); BarinkEngine::ModelImporter* MI = new BarinkEngine::ModelImporter();
Scene* Level1; Scene* Level1;
// BarinkEngine::SceneObject* cube;
/* /*
* Runs once at startup * Runs once at startup
* - USe to initialize the game/sandbox/demo * - USe to initialize the game/sandbox/demo
@ -38,7 +38,9 @@ void Start() {
// Create a cube node // Create a cube node
// Load a model // Load a model
// *(MI->Import("build/SandboxApplication/Debug/Models/Cube.obj")) //cube = MI->Import("build/SandboxApplication/Debug/Models/Cube.obj");
//Level1->GetRoot().addChild(*cube);
std::string groupName("Nested-Group"); std::string groupName("Nested-Group");
auto testGroup = new Group(groupName); auto testGroup = new Group(groupName);
@ -89,22 +91,21 @@ void Update()
* NOTE: this needs to move to the renderer * NOTE: this needs to move to the renderer
* Render code should not appear in the sandbox file * Render code should not appear in the sandbox file
*/ */
glm::mat4 projection = glm::perspective(glm::radians(cam->Zoom), (800.0f / 600.0f), 0.001f, 100.0f); //glm::mat4 projection = glm::perspective(glm::radians(cam->Zoom), (800.0f / 600.0f), 0.001f, 100.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
shader->Use(); shader->Use();
shader->setUniformMat4("P", projection); //shader->setUniformMat4("P", projection);
//shader->setUniformMat4("M", CalculateModelMat(Cube->transform)); //shader->setUniformMat4("M", CalculateModelMat(cube->transform));
shader->setUniformMat4("V", cam->GetViewMatrix()); shader->setUniformMat4("V", cam->GetViewMatrix());
//matCube->Apply();
//cube->renderable->material->Apply();
//Cube->Draw(); //Cube->Draw();
//shader->setUniformMat4("M", CalculateModelMat(Cube2->transform));
// matCube2->Apply();
//Cube2->Draw();
} }