added camera controls to editor

This commit is contained in:
2026-01-25 11:44:06 +01:00
parent bf4189bba0
commit 236da3059f
9 changed files with 271 additions and 15 deletions

View File

@@ -17,19 +17,22 @@ void TSE::GLFW::InputGlfw::KeyCallback(GLFWwindow *window, int key, int scancode
case 1: //down
for(auto handler : ((InputGlfw*)instance())->keyHandler)
{
handler->OnKeyDown((Key)key, (Modifier)mods);
if(handler->enabled())
handler->OnKeyDown((Key)key, (Modifier)mods);
}
break;
case 0: //up
for(auto handler : ((InputGlfw*)instance())->keyHandler)
{
handler->OnKeyUp((Key)key, (Modifier)mods);
if(handler->enabled())
handler->OnKeyUp((Key)key, (Modifier)mods);
}
break;
case 2: //hold
for(auto handler : ((InputGlfw*)instance())->keyHandler)
{
handler->OnKeyHold((Key)key, (Modifier)mods);
if(handler->enabled())
handler->OnKeyHold((Key)key, (Modifier)mods);
}
break;
}
@@ -42,19 +45,22 @@ void TSE::GLFW::InputGlfw::MouseButtonCallback(GLFWwindow *window, int button, i
case 1: //down
for(auto handler : ((InputGlfw*)instance())->cursorHandler)
{
handler->OnMouseButtonDown((MouseBtn)button, (Modifier)mods);
if(handler->enabled())
handler->OnMouseButtonDown((MouseBtn)button, (Modifier)mods);
}
break;
case 0: //up
for(auto handler : ((InputGlfw*)instance())->cursorHandler)
{
handler->OnMouseButtonUp((MouseBtn)button, (Modifier)mods);
if(handler->enabled())
handler->OnMouseButtonUp((MouseBtn)button, (Modifier)mods);
}
break;
case 2: //hold
for(auto handler : ((InputGlfw*)instance())->cursorHandler)
{
handler->OnMouseButtonHold((MouseBtn)button, (Modifier)mods);
if(handler->enabled())
handler->OnMouseButtonHold((MouseBtn)button, (Modifier)mods);
}
break;
}
@@ -64,7 +70,8 @@ void TSE::GLFW::InputGlfw::CursorPosCallback(GLFWwindow *window, double xpos, do
{
for(auto handler : ((InputGlfw*)instance())->cursorHandler)
{
handler->OnMousePosition(Vector2(xpos, ypos));
if(handler->enabled())
handler->OnMousePosition(Vector2(xpos, ypos));
}
}
@@ -72,7 +79,8 @@ void TSE::GLFW::InputGlfw::ScrollCallback(GLFWwindow *window, double xoffset, do
{
for(auto handler : ((InputGlfw*)instance())->cursorHandler)
{
handler->OnMouseScroll(Vector2(xoffset, yoffset));
if(handler->enabled())
handler->OnMouseScroll(Vector2(xoffset, yoffset));
}
}
@@ -106,6 +114,7 @@ void TSE::GLFW::InputGlfw::CharCallback(GLFWwindow *window, unsigned int codepoi
for(auto handler : ((InputGlfw*)instance())->keyHandler)
{
handler->OnChar(msg);
if(handler->enabled())
handler->OnChar(msg);
}
}