Merge pull request #14 from devZoGok/imp-13-mouse-wheel

Imp 13 mouse wheel
This commit is contained in:
devZoGok
2024-07-21 12:56:50 +00:00
committed by GitHub
2 changed files with 9 additions and 0 deletions
+1
View File
@@ -29,6 +29,7 @@ namespace gameBase {
virtual void onRawKeyPress(int){}
virtual void onRawCharPress(unsigned int){}
virtual void onRawMousePress(int){}
virtual void onRawMouseWheelScroll(bool){}
virtual void onRawJoystickMove(int, float){}
virtual void onRawJoystickPress(int){}
protected:
+8
View File
@@ -11,6 +11,12 @@ namespace gameBase{
int width, height;
StateManager *manager = nullptr;
void scroll_callback(GLFWwindow* window, double xOffset, double yOffset) {
if(manager)
for(AbstractAppState *a : manager->getAppStates())
a->onRawMouseWheelScroll(yOffset == 1);
}
void foo(GLFWwindow *window, double newPosX, double newPosY){
strX = (*posX - newPosX) / width, strY = (newPosY - *posY) / height;
}
@@ -118,6 +124,8 @@ namespace gameBase{
glfwSetCursorPosCallback(window, foo);
glfwSetScrollCallback(window, scroll_callback);
if(glfwJoystickPresent(GLFW_JOYSTICK_1)){
for(int i = 0; i < numAxis; i++)
if(abs(axis[i]) == 1)