| @@ -29,7 +29,12 @@ static class InputData | |||||
| friend class Input; | friend class Input; | ||||
| public: | public: | ||||
| int dummy; | |||||
| InputData() | |||||
| { | |||||
| mouse.x = mouse.y = -1; | |||||
| } | |||||
| Int2 mouse; | |||||
| } | } | ||||
| inputdata; | inputdata; | ||||
| @@ -59,3 +64,13 @@ Float2 Input::GetAxis(int axis) | |||||
| return f; | return f; | ||||
| } | } | ||||
| void Input::SetMousePos(Int2 coord) | |||||
| { | |||||
| data->mouse = coord; | |||||
| } | |||||
| Int2 Input::GetMousePos() | |||||
| { | |||||
| return data->mouse; | |||||
| } | |||||
| @@ -22,6 +22,8 @@ class Input | |||||
| { | { | ||||
| public: | public: | ||||
| static Float2 GetAxis(int axis); | static Float2 GetAxis(int axis); | ||||
| static void SetMousePos(Int2 coord); | |||||
| static Int2 GetMousePos(); | |||||
| }; | }; | ||||
| #endif // __DH_INPUT_H__ | #endif // __DH_INPUT_H__ | ||||
| @@ -48,7 +48,12 @@ void SdlInput::TickGame(float deltams) | |||||
| Entity::TickGame(deltams); | Entity::TickGame(deltams); | ||||
| /* Handle mouse input */ | /* Handle mouse input */ | ||||
| SDL_GetMouseState(&data->mx, &data->my); | |||||
| Int2 mouse; | |||||
| if (SDL_GetAppState() & SDL_APPMOUSEFOCUS) | |||||
| SDL_GetMouseState(&mouse.x, &mouse.y); | |||||
| else | |||||
| mouse.x = mouse.y = -1; | |||||
| Input::SetMousePos(mouse); | |||||
| /* Handle keyboard and WM events */ | /* Handle keyboard and WM events */ | ||||
| SDL_Event event; | SDL_Event event; | ||||