浏览代码

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

legacy
Sam Hocevar sam 13 年前
父节点
当前提交
7fd393b7ef
共有 2 个文件被更改,包括 21 次插入2 次删除
  1. +20
    -2
      src/platform/sdl/sdlinput.cpp
  2. +1
    -0
      src/platform/sdl/sdlinput.h

+ 20
- 2
src/platform/sdl/sdlinput.cpp 查看文件

@@ -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 查看文件

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

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

private:
SdlInputData *data;


正在加载...
取消
保存