Browse Source

sdl: on Windows, perform the input tick in the main drawing thread.

legacy
Sam Hocevar sam 13 years ago
parent
commit
7fd393b7ef
2 changed files with 21 additions and 2 deletions
  1. +20
    -2
      src/platform/sdl/sdlinput.cpp
  2. +1
    -0
      src/platform/sdl/sdlinput.h

+ 20
- 2
src/platform/sdl/sdlinput.cpp View File

@@ -31,6 +31,8 @@ class SdlInputData
friend class SdlInput;

private:
void Tick(float deltams);

static ivec2 GetMousePos();
};

@@ -43,16 +45,32 @@ SdlInput::SdlInput()
{
#if defined USE_SDL
SDL_Init(SDL_INIT_TIMER);
#endif

m_gamegroup = GAMEGROUP_BEFORE;
#endif
}

void SdlInput::TickGame(float deltams)
{
#if defined USE_SDL
Entity::TickGame(deltams);

#if !defined _WIN32
data->Tick(deltams);
#endif
}

void SdlInput::TickDraw(float deltams)
{
Entity::TickDraw(deltams);

#if defined _WIN32
data->Tick(deltams);
#endif
}

void SdlInputData::Tick(float deltams)
{
#if defined USE_SDL
/* Handle mouse input */
ivec2 mouse = SdlInputData::GetMousePos();;
Input::SetMousePos(mouse);


+ 1
- 0
src/platform/sdl/sdlinput.h View File

@@ -31,6 +31,7 @@ public:

protected:
virtual void TickGame(float deltams);
virtual void TickDraw(float deltams);

private:
SdlInputData *data;


Loading…
Cancel
Save