mirror of
https://github.com/devZoGok/gameBase.git
synced 2026-08-26 19:43:28 +00:00
Merge pull request #14 from devZoGok/imp-13-mouse-wheel
Imp 13 mouse wheel
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -10,6 +10,12 @@ namespace gameBase{
|
||||
double *posX, *posY, strX, strY;
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user