removed that backwards ass shit

This commit is contained in:
Ben Kyd
2022-11-01 00:24:25 +00:00
parent e22d070b16
commit f48d4bea0d
5 changed files with 28 additions and 55 deletions

View File

@@ -0,0 +1,21 @@
#type vertex
#version 330
in vec3 position;
uniform mat4 model;
uniform mat4 view;
uniform mat4 proj;
void main() {
gl_Position = proj * view * model * vec4(position, 1.0);
}
#type fragment
#version 330
out vec4 outColour;
void main() {
outColour = vec4(0.58, 0.61, 0.627, 1.0);
}

View File

@@ -10,7 +10,7 @@
#include <memory>
#include <chrono>
namespace inferno {
using namespace inferno;
Inferno::Inferno()
{
@@ -45,8 +45,6 @@ void Inferno::uiPreset()
int Inferno::run()
{
mWin->setKeyCallback(&handleKbd);
mWin->setMouseCallback(&handlePtr);
mWin->setFPSMode();
while (true) {
@@ -61,10 +59,12 @@ int Inferno::run()
ImGui::DockSpace(dockspace_id, ImVec2(0.0f, 0.0f), dockspace_flags);
// KBD & MOUSE
double xpos, ypos;
glfwGetCursorPos(mWin->getGLFWWindow(), &xpos, &ypos);
std::cout << mouseDelta.x << " " << mouseDelta.y << std::endl;
ImGui::Begin("Preview");
ImGui::End();
@@ -94,22 +94,4 @@ int Inferno::run()
delete mWin;
return 0;
}
void handleKbd(int key, int scan, int action, int mod)
{
}
void handlePtr(double x, double y)
{
int iX = floor(x);
int iY = floor(x);
static int oX, oY;
glm::vec2 mouseDelta = { iX - oX, iY - oY };
Inferno::GetInstance().mouseDelta = mouseDelta;
oX = iX;
oY = iY;
}
}
}

View File

@@ -7,7 +7,6 @@
namespace inferno {
class Window;
class GLFWwindow;
class RasterizeRenderer;
class Scene;
@@ -24,9 +23,6 @@ public:
public:
glm::vec2 mouseDelta;
glm::vec3 kbdDelta;
private:
friend void handleKbd(int key, int scan, int action, int mod);
friend void handlePtr(double x, double y);
private:
RasterizeRenderer* mRasterRenderer;
@@ -36,7 +32,4 @@ private:
Window* mWin;
};
void handleKbd(int key, int scan, int action, int mod);
void handlePtr(double x, double y);
}

View File

@@ -22,7 +22,6 @@ void Window::init(std::string title, int width, int height)
setupGLFW(title);
glfwSetKeyCallback(getGLFWWindow(), glfwKeyCallback);
glfwSetCursorPosCallback(getGLFWWindow(), glfwMouseCallback);
setupImGui();
}
@@ -66,21 +65,11 @@ void Window::setKeyCallback(KeyCallback callback)
mKeyCallback = callback;
}
void Window::setMouseCallback(MouseCallback callback)
{
mMouseCallback = callback;
}
KeyCallback Window::getKeyCallback()
{
return mKeyCallback;
}
MouseCallback Window::getMouseCallback()
{
return mMouseCallback;
}
bool Window::newFrame()
{
glfwPollEvents();
@@ -196,14 +185,6 @@ void Window::glfwKeyCallback(GLFWwindow* window, int key, int scancode, int acti
}
}
void Window::glfwMouseCallback(GLFWwindow* window, double xpos, double ypos)
{
if (Window::GetInstance().getMouseCallback() != nullptr)
{
Window::GetInstance().getMouseCallback()(xpos, ypos);
}
}
void Window::glfwErrorCallback(int error, const char* description) {
spdlog::error("[GLFW {0}] {1}", error, description);
}

View File

@@ -40,9 +40,7 @@ public:
void setFPSMode();
void setKeyCallback(KeyCallback callback);
void setMouseCallback(MouseCallback callback);
KeyCallback getKeyCallback();
MouseCallback getMouseCallback();
private:
WINDOW_MODE mWinMode = WIN_MODE_DEFAULT;
@@ -54,9 +52,7 @@ private:
void shutdownGLFW();
static void glfwKeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods);
static void glfwMouseCallback(GLFWwindow* window, double xpos, double ypos);
KeyCallback mKeyCallback = nullptr;
MouseCallback mMouseCallback = nullptr;
private:
static void glfwErrorCallback(int error, const char* description);