Update Input

This commit is contained in:
Nomango 2020-01-17 16:46:17 +08:00
parent bcc92abbef
commit 297e028779
13 changed files with 294 additions and 214 deletions

View File

@ -37,22 +37,22 @@ namespace kiwano
io.ImeWindowHandle = target_window_;
// Keyboard mapping. ImGui will use those indices to peek into the io.KeysDown[] array that we will update during the application lifetime.
io.KeyMap[ImGuiKey_Tab] = KeyCode::Tab;
io.KeyMap[ImGuiKey_LeftArrow] = KeyCode::Left;
io.KeyMap[ImGuiKey_RightArrow] = KeyCode::Right;
io.KeyMap[ImGuiKey_UpArrow] = KeyCode::Up;
io.KeyMap[ImGuiKey_DownArrow] = KeyCode::Down;
io.KeyMap[ImGuiKey_Delete] = KeyCode::Delete;
io.KeyMap[ImGuiKey_Backspace] = KeyCode::Back;
io.KeyMap[ImGuiKey_Space] = KeyCode::Space;
io.KeyMap[ImGuiKey_Enter] = KeyCode::Enter;
io.KeyMap[ImGuiKey_Escape] = KeyCode::Esc;
io.KeyMap[ImGuiKey_A] = KeyCode::A;
io.KeyMap[ImGuiKey_C] = KeyCode::C;
io.KeyMap[ImGuiKey_V] = KeyCode::V;
io.KeyMap[ImGuiKey_X] = KeyCode::X;
io.KeyMap[ImGuiKey_Y] = KeyCode::Y;
io.KeyMap[ImGuiKey_Z] = KeyCode::Z;
io.KeyMap[ImGuiKey_Tab] = (int)KeyCode::Tab;
io.KeyMap[ImGuiKey_LeftArrow] = (int)KeyCode::Left;
io.KeyMap[ImGuiKey_RightArrow] = (int)KeyCode::Right;
io.KeyMap[ImGuiKey_UpArrow] = (int)KeyCode::Up;
io.KeyMap[ImGuiKey_DownArrow] = (int)KeyCode::Down;
io.KeyMap[ImGuiKey_Delete] = (int)KeyCode::Delete;
io.KeyMap[ImGuiKey_Backspace] = (int)KeyCode::Back;
io.KeyMap[ImGuiKey_Space] = (int)KeyCode::Space;
io.KeyMap[ImGuiKey_Enter] = (int)KeyCode::Enter;
io.KeyMap[ImGuiKey_Escape] = (int)KeyCode::Esc;
io.KeyMap[ImGuiKey_A] = (int)KeyCode::A;
io.KeyMap[ImGuiKey_C] = (int)KeyCode::C;
io.KeyMap[ImGuiKey_V] = (int)KeyCode::V;
io.KeyMap[ImGuiKey_X] = (int)KeyCode::X;
io.KeyMap[ImGuiKey_Y] = (int)KeyCode::Y;
io.KeyMap[ImGuiKey_Z] = (int)KeyCode::Z;
ImGui_Impl_Init(Renderer::Instance());
}
@ -104,7 +104,7 @@ namespace kiwano
{
if (evt->IsType<MouseDownEvent>())
{
int button = dynamic_cast<MouseDownEvent*>(evt)->button;
MouseButton button = dynamic_cast<MouseDownEvent*>(evt)->button;
int index = 0;
if (button == MouseButton::Left) index = 0;
else if (button == MouseButton::Right) index = 1;
@ -113,7 +113,7 @@ namespace kiwano
}
else if (evt->IsType<MouseUpEvent>())
{
int button = dynamic_cast<MouseUpEvent*>(evt)->button;
MouseButton button = dynamic_cast<MouseUpEvent*>(evt)->button;
int index = 0;
if (button == MouseButton::Left) index = 0;
else if (button == MouseButton::Right) index = 1;
@ -130,13 +130,13 @@ namespace kiwano
{
if (evt->IsType<KeyDownEvent>())
{
int key = dynamic_cast<KeyDownEvent*>(evt)->code;
io.KeysDown[key] = true;
KeyCode key = dynamic_cast<KeyDownEvent*>(evt)->code;
io.KeysDown[(int)key] = true;
}
else if (evt->IsType<KeyUpEvent>())
{
int key = dynamic_cast<KeyUpEvent*>(evt)->code;
io.KeysDown[key] = false;
KeyCode key = dynamic_cast<KeyUpEvent*>(evt)->code;
io.KeysDown[(int)key] = false;
}
else if (evt->IsType<KeyCharEvent>())
{

View File

@ -48,7 +48,7 @@ namespace kiwano
void Stage::RenderBorder(RenderContext& ctx)
{
ctx.SetBrushOpacity(1.0f);
ctx.SetBrushOpacity(GetDisplayedOpacity());
if (!border_fill_brush_)
{

View File

@ -117,8 +117,8 @@ namespace kiwano
current_stage_.reset();
next_stage_.reset();
debug_actor_.reset();
transition_.reset();
debug_actor_.reset();
}
void Director::OnUpdate(Duration dt)
@ -163,11 +163,8 @@ namespace kiwano
else if (current_stage_)
{
current_stage_->Render(ctx);
}
if (render_border_enabled_)
{
if (current_stage_)
{
current_stage_->RenderBorder(ctx);
}

View File

@ -10,13 +10,13 @@ namespace kiwano
KeyDownEvent::KeyDownEvent()
: KeyEvent(KGE_EVENT(KeyDownEvent))
, code(0)
, code()
{
}
KeyUpEvent::KeyUpEvent()
: KeyEvent(KGE_EVENT(KeyUpEvent))
, code(0)
, code()
{
}

View File

@ -49,7 +49,7 @@ namespace kiwano
: public KeyEvent
{
public:
KeyCode::Value code; ///< ¼üÖµ
KeyCode code; ///< ¼üÖµ
KeyDownEvent();
};
@ -60,7 +60,7 @@ namespace kiwano
: public KeyEvent
{
public:
KeyCode::Value code; ///< ¼üÖµ
KeyCode code; ///< ¼üÖµ
KeyUpEvent();
};

View File

@ -15,19 +15,19 @@ namespace kiwano
MouseDownEvent::MouseDownEvent()
: MouseEvent(KGE_EVENT(MouseDownEvent))
, button(0)
, button()
{
}
MouseUpEvent::MouseUpEvent()
: MouseEvent(KGE_EVENT(MouseUpEvent))
, button(0)
, button()
{
}
MouseClickEvent::MouseClickEvent()
: MouseEvent(KGE_EVENT(MouseClickEvent))
, button(0)
, button()
{
}

View File

@ -65,7 +65,7 @@ namespace kiwano
: public MouseEvent
{
public:
MouseButton::Value button; ///< 報炎囚峙
MouseButton button; ///< 報炎囚峙
MouseDownEvent();
};
@ -76,7 +76,7 @@ namespace kiwano
: public MouseEvent
{
public:
MouseButton::Value button; ///< 報炎囚峙
MouseButton button; ///< 報炎囚峙
MouseUpEvent();
};
@ -87,7 +87,7 @@ namespace kiwano
: public MouseEvent
{
public:
MouseButton::Value button; ///< 報炎囚峙
MouseButton button; ///< 報炎囚峙
MouseClickEvent();
};

View File

@ -25,44 +25,37 @@ namespace kiwano
{
/// \~chinese
/// @brief 鼠标按键
struct MouseButton
enum class MouseButton
{
typedef int Value;
Left, ///< 鼠标左键
Right, ///< 鼠标右键
Middle, ///< 鼠标中键
enum : Value
{
Left = VK_LBUTTON, ///< 鼠标左键
Right = VK_RBUTTON, ///< 鼠标右键
Middle = VK_MBUTTON ///< 鼠标中键
};
Last
};
/// \~chinese
/// @brief 按键键值
struct KeyCode
enum class KeyCode
{
typedef int Value;
Unknown, ///< 未知
Up, ///< 上键
Left, ///< 左键
Right, ///< 右键
Down, ///< 下键
Enter, ///< 回车键
Space, ///< 空格键
Esc, ///< 退出键
Ctrl, ///< CTRL键
Shift, ///< SHIFT键
Alt, ///< ALT键
Tab, ///< TAB键
Delete, ///< 删除键
Back, ///< 退格键
Super, ///< Cmd|Super|Windows键
enum : Value
{
Unknown = 0, ///< 未知
Up = VK_UP, ///< 上键
Left = VK_LEFT, ///< 左键
Right = VK_RIGHT, ///< 右键
Down = VK_DOWN, ///< 下键
Enter = VK_RETURN, ///< 回车键
Space = VK_SPACE, ///< 空格键
Esc = VK_ESCAPE, ///< 退出键
Ctrl = VK_CONTROL, ///< CTRL键
Shift = VK_SHIFT, ///< SHIFT键
Alt = VK_MENU, ///< ALT键
Tab = VK_TAB, ///< TAB键
Delete = VK_DELETE, ///< 删除键
Back = VK_BACK, ///< 退格键
Super = VK_LWIN, ///< Cmd/Super/Windows键
A = 0x41, ///< A键
A, ///< A键
B, ///< B键
C, ///< C键
D, ///< D键
@ -89,7 +82,7 @@ namespace kiwano
Y, ///< Y键
Z, ///< Z键
Num0 = 0x30, ///< 数字0键
Num0, ///< 数字0键
Num1, ///< 数字1键
Num2, ///< 数字2键
Num3, ///< 数字3键
@ -100,7 +93,7 @@ namespace kiwano
Num8, ///< 数字8键
Num9, ///< 数字9键
Numpad0 = VK_NUMPAD0, ///< 数字小键盘0键
Numpad0, ///< 数字小键盘0键
Numpad1, ///< 数字小键盘1键
Numpad2, ///< 数字小键盘2键
Numpad3, ///< 数字小键盘3键
@ -111,7 +104,7 @@ namespace kiwano
Numpad8, ///< 数字小键盘8键
Numpad9, ///< 数字小键盘9键
F1 = VK_F1, ///< F1键
F1, ///< F1键
F2, ///< F2键
F3, ///< F3键
F4, ///< F4键
@ -123,6 +116,7 @@ namespace kiwano
F10, ///< F10键
F11, ///< F11键
F12, ///< F12键
};
Last
};
}

View File

@ -26,10 +26,10 @@
namespace kiwano
{
Input::Input()
: want_update_(false)
: want_update_keys_(false)
, want_update_buttons_(false)
, buttons_{}
, keys_{}
, keys_pressed_{}
, keys_released_{}
{
}
@ -39,37 +39,59 @@ namespace kiwano
void Input::AfterUpdate()
{
if (want_update_)
if (want_update_keys_)
{
want_update_ = false;
want_update_keys_ = false;
::memcpy(keys_[Prev].data(), keys_[Current].data(), KEY_NUM * sizeof(bool));
}
keys_pressed_.fill(false);
keys_released_.fill(false);
if (want_update_buttons_)
{
want_update_buttons_ = false;
buttons_[Prev] = buttons_[Current];
}
}
bool Input::IsDown(int key_or_btn) const
bool Input::IsDown(KeyCode key) const
{
KGE_ASSERT(key_or_btn >= 0 && key_or_btn < KEY_NUM);
if (key_or_btn >= 0 && key_or_btn < KEY_NUM)
return keys_[key_or_btn];
if (key == KeyCode::Unknown || key == KeyCode::Last)
return false;
return keys_[Current][size_t(key)];
}
bool Input::WasPressed(int key_or_btn) const
bool Input::WasPressed(KeyCode key) const
{
KGE_ASSERT(key_or_btn >= 0 && key_or_btn < KEY_NUM);
if (key_or_btn >= 0 && key_or_btn < KEY_NUM)
return keys_pressed_[key_or_btn];
if (key == KeyCode::Unknown || key == KeyCode::Last)
return false;
return keys_[Current][size_t(key)] && !keys_[Prev][size_t(key)];
}
bool Input::WasReleased(int key_or_btn) const
bool Input::WasReleased(KeyCode key) const
{
KGE_ASSERT(key_or_btn >= 0 && key_or_btn < KEY_NUM);
if (key_or_btn >= 0 && key_or_btn < KEY_NUM)
return keys_released_[key_or_btn];
if (key == KeyCode::Unknown || key == KeyCode::Last)
return false;
return !keys_[Current][size_t(key)] && keys_[Prev][size_t(key)];
}
bool Input::IsDown(MouseButton btn) const
{
if (btn == MouseButton::Last)
return false;
return buttons_[Current][size_t(btn)];
}
bool Input::WasPressed(MouseButton btn) const
{
if (btn == MouseButton::Last)
return false;
return buttons_[Current][size_t(btn)] && !buttons_[Prev][size_t(btn)];
}
bool Input::WasReleased(MouseButton btn) const
{
if (btn == MouseButton::Last)
return false;
return !buttons_[Current][size_t(btn)] && buttons_[Prev][size_t(btn)];
}
float Input::GetMouseX() const
@ -87,16 +109,22 @@ namespace kiwano
return mouse_pos_;
}
void Input::UpdateKey(int key, bool down)
void Input::UpdateKey(KeyCode key, bool down)
{
if (down && !keys_[key])
keys_pressed_[key] = true;
if (!down && keys_[key])
keys_released_[key] = true;
if (key == KeyCode::Unknown || key == KeyCode::Last)
return;
keys_[key] = down;
keys_[Current][size_t(key)] = down;
want_update_keys_ = true;
}
want_update_ = true;
void Input::UpdateButton(MouseButton btn, bool down)
{
if (btn == MouseButton::Last)
return;
buttons_[Current][size_t(btn)] = down;
want_update_buttons_ = true;
}
void Input::UpdateMousePos(const Point& pos)
@ -114,11 +142,11 @@ namespace kiwano
}
else if (evt->IsType<MouseDownEvent>())
{
UpdateKey(dynamic_cast<MouseDownEvent*>(evt)->button, true);
UpdateButton(dynamic_cast<MouseDownEvent*>(evt)->button, true);
}
else if (evt->IsType<MouseUpEvent>())
{
UpdateKey(dynamic_cast<MouseUpEvent*>(evt)->button, false);
UpdateButton(dynamic_cast<MouseUpEvent*>(evt)->button, false);
}
}
else if (evt->IsType<KeyEvent>())

View File

@ -41,30 +41,44 @@ namespace kiwano
public:
/**
* \~chinese
* @brief
* @param key_or_btn
* @return
* @see kiwano::KeyCode kiwano::MouseButton
* @brief
* @param key
*/
bool IsDown(int key_or_btn) const;
bool IsDown(KeyCode key) const;
/**
* \~chinese
* @brief
* @param key_or_btn
* @return
* @see kiwano::KeyCode kiwano::MouseButton
* @brief
* @param key
*/
bool WasPressed(int key_or_btn) const;
bool WasPressed(KeyCode key) const;
/**
* \~chinese
* @brief
* @param key_or_btn
* @return
* @see kiwano::KeyCode kiwano::MouseButton
* @brief
* @param key
*/
bool WasReleased(int key_or_btn) const;
bool WasReleased(KeyCode key) const;
/**
* \~chinese
* @brief
* @param btn
*/
bool IsDown(MouseButton btn) const;
/**
* \~chinese
* @brief
* @param btn
*/
bool WasPressed(MouseButton btn) const;
/**
* \~chinese
* @brief
* @param btn
*/
bool WasReleased(MouseButton btn) const;
/**
* \~chinese
@ -101,17 +115,27 @@ namespace kiwano
~Input();
void UpdateKey(int, bool);
void UpdateKey(KeyCode key, bool down);
void UpdateButton(MouseButton btn, bool down);
void UpdateMousePos(const Point& pos);
private:
static const int KEY_NUM = 256;
static const int KEY_NUM = int(KeyCode::Last);
static const int BUTTON_NUM = int(MouseButton::Last);
bool want_update_;
bool want_update_keys_;
bool want_update_buttons_;
Point mouse_pos_;
std::array<bool, KEY_NUM> keys_;
std::array<bool, KEY_NUM> keys_pressed_;
std::array<bool, KEY_NUM> keys_released_;
enum KeyIndex : size_t
{
Current = 0,
Prev
};
std::array<bool, BUTTON_NUM> buttons_[2];
std::array<bool, KEY_NUM> keys_[2];
};
}

View File

@ -89,11 +89,6 @@ namespace kiwano
void Window::Destroy()
{
while (!event_queue_.empty())
{
event_queue_.pop();
}
should_close_ = true;
}

View File

@ -181,9 +181,9 @@ namespace kiwano
/**
* \~chinese
* @brief
* @brief
*/
virtual bool ShouldClose() = 0;
bool ShouldClose();
/**
* \~chinese

View File

@ -28,6 +28,7 @@
#include <kiwano/core/event/WindowEvent.h>
#include <kiwano/core/Logger.h>
#include <Windowsx.h> // GET_X_LPARAM, GET_Y_LPARAM
#include <imm.h> // ImmAssociateContext
#pragma comment(lib, "imm32.lib")
@ -117,14 +118,12 @@ namespace kiwano
void SetCursor(CursorType cursor) override;
bool ShouldClose() override;
void Destroy() override;
private:
void PumpEvents() override;
DWORD GetWindowStyle() const;
DWORD GetStyle() const;
void UpdateCursor();
@ -138,6 +137,8 @@ namespace kiwano
wchar_t* device_name_;
WindowHandle handle_;
CursorType mouse_cursor_;
std::array<KeyCode, 256> key_map_;
};
WindowImpl::WindowImpl()
@ -146,7 +147,48 @@ namespace kiwano
, is_fullscreen_(false)
, resizable_(false)
, mouse_cursor_(CursorType::Arrow)
, key_map_{}
{
// Keys
key_map_[VK_UP] = KeyCode::Up;
key_map_[VK_LEFT] = KeyCode::Left;
key_map_[VK_RIGHT] = KeyCode::Right;
key_map_[VK_DOWN] = KeyCode::Down;
key_map_[VK_RETURN] = KeyCode::Enter;
key_map_[VK_SPACE] = KeyCode::Space;
key_map_[VK_ESCAPE] = KeyCode::Esc;
key_map_[VK_CONTROL] = KeyCode::Ctrl;
key_map_[VK_SHIFT] = KeyCode::Shift;
key_map_[VK_MENU] = KeyCode::Alt;
key_map_[VK_TAB] = KeyCode::Tab;
key_map_[VK_DELETE] = KeyCode::Delete;
key_map_[VK_BACK] = KeyCode::Back;
// VK_L* and VK_R*
key_map_[VK_LCONTROL] = KeyCode::Ctrl;
key_map_[VK_RCONTROL] = KeyCode::Ctrl;
key_map_[VK_LSHIFT] = KeyCode::Shift;
key_map_[VK_RSHIFT] = KeyCode::Shift;
key_map_[VK_LMENU] = KeyCode::Alt;
key_map_[VK_RMENU] = KeyCode::Alt;
key_map_[VK_LWIN] = KeyCode::Super;
key_map_[VK_RWIN] = KeyCode::Super;
// A - Z
for (size_t i = 0, size = ('Z' - 'A'); i <= size; ++i)
key_map_['A' + i] = KeyCode(size_t(KeyCode::A) + i);
// Num 0 - 9
for (size_t i = 0; i < 9; ++i)
key_map_['0' + i] = KeyCode(size_t(KeyCode::Num0) + i);
// Numpad 0 - 9
for (size_t i = 0; i < 9; ++i)
key_map_[VK_NUMPAD0 + i] = KeyCode(size_t(KeyCode::Numpad0) + i);
// F1 - F12
for (size_t i = 0; i < 12; ++i)
key_map_[VK_F1 + i] = KeyCode(size_t(KeyCode::F1) + i);
}
WindowImpl::~WindowImpl()
@ -216,7 +258,7 @@ namespace kiwano
uint32_t screenh = monitor_info_ex.rcWork.bottom - monitor_info_ex.rcWork.top;
uint32_t win_width, win_height;
AdjustWindow(width, height, GetWindowStyle(), &win_width, &win_height);
AdjustWindow(width, height, GetStyle(), &win_width, &win_height);
left = monitor_info_ex.rcWork.left + (screenw - win_width) / 2;
top = monitor_info_ex.rcWork.top + (screenh - win_height) / 2;
@ -228,7 +270,7 @@ namespace kiwano
is_fullscreen_ ? WS_EX_TOPMOST : 0,
KGE_WND_CLASS_NAME,
config.title.c_str(),
GetWindowStyle(),
GetStyle(),
left,
top,
width,
@ -309,7 +351,7 @@ namespace kiwano
if (handle_ && !is_fullscreen_)
{
RECT rc = { 0, 0, LONG(width), LONG(height) };
::AdjustWindowRect(&rc, GetWindowStyle(), false);
::AdjustWindowRect(&rc, GetStyle(), false);
width = rc.right - rc.left;
height = rc.bottom - rc.top;
@ -335,7 +377,7 @@ namespace kiwano
MONITORINFOEX info = GetMoniterInfoEx(handle_);
::SetWindowLongPtr(handle_, GWL_STYLE, GetWindowStyle());
::SetWindowLongPtr(handle_, GWL_STYLE, GetStyle());
::SetWindowPos(handle_, HWND_TOPMOST, info.rcMonitor.top, info.rcMonitor.left, width, height, SWP_NOACTIVATE);
}
else
@ -350,7 +392,7 @@ namespace kiwano
int left = screenw > width ? ((screenw - width) / 2) : 0;
int top = screenh > height ? ((screenh - height) / 2) : 0;
::SetWindowLongPtr(handle_, GWL_STYLE, GetWindowStyle());
::SetWindowLongPtr(handle_, GWL_STYLE, GetStyle());
::SetWindowPos(handle_, HWND_NOTOPMOST, left, top, width, height, SWP_DRAWFRAME | SWP_FRAMECHANGED);
}
@ -363,11 +405,6 @@ namespace kiwano
mouse_cursor_ = cursor;
}
bool WindowImpl::ShouldClose()
{
return handle_ == nullptr;
}
void WindowImpl::Destroy()
{
if (is_fullscreen_)
@ -388,7 +425,7 @@ namespace kiwano
Window::Destroy();
}
DWORD WindowImpl::GetWindowStyle() const
DWORD WindowImpl::GetStyle() const
{
return is_fullscreen_ ? (WINDOW_FULLSCREEN_STYLE) : (resizable_ ? (WINDOW_RESIZABLE_STYLE) : (WINDOW_FIXED_STYLE));
}
@ -446,26 +483,34 @@ namespace kiwano
{
case WM_KEYDOWN:
case WM_SYSKEYDOWN:
{
KeyCode key = window->key_map_[size_t(wparam)];
if (key != KeyCode::Unknown)
{
KeyDownEventPtr evt = new KeyDownEvent;
evt->code = static_cast<int>(wparam);
evt->code = key;
window->PushEvent(evt);
}
}
break;
case WM_KEYUP:
case WM_SYSKEYUP:
{
KeyCode key = window->key_map_[size_t(wparam)];
if (key != KeyCode::Unknown)
{
KeyUpEventPtr evt = new KeyUpEvent;
evt->code = static_cast<int>(wparam);
evt->code = key;
window->PushEvent(evt);
}
}
break;
case WM_CHAR:
{
KeyCharEventPtr evt = new KeyCharEvent;
evt->value = static_cast<char>(wparam);
evt->value = char(wparam);
window->PushEvent(evt);
}
break;
@ -475,7 +520,7 @@ namespace kiwano
case WM_MBUTTONDOWN: case WM_MBUTTONDBLCLK:
{
MouseDownEventPtr evt = new MouseDownEvent;
evt->pos = Point(((float)(int)(short)LOWORD(lparam)), ((float)(int)(short)HIWORD(lparam)));
evt->pos = Point((float)GET_X_LPARAM(lparam), (float)GET_Y_LPARAM(lparam));
if (msg == WM_LBUTTONDOWN || msg == WM_LBUTTONDBLCLK) { evt->button = MouseButton::Left; }
else if (msg == WM_RBUTTONDOWN || msg == WM_RBUTTONDBLCLK) { evt->button = MouseButton::Right; }
@ -490,7 +535,7 @@ namespace kiwano
case WM_RBUTTONUP:
{
MouseUpEventPtr evt = new MouseUpEvent;
evt->pos = Point(((float)(int)(short)LOWORD(lparam)), ((float)(int)(short)HIWORD(lparam)));
evt->pos = Point((float)GET_X_LPARAM(lparam), (float)GET_Y_LPARAM(lparam));
if (msg == WM_LBUTTONUP) { evt->button = MouseButton::Left; }
else if (msg == WM_RBUTTONUP) { evt->button = MouseButton::Right; }
@ -503,7 +548,7 @@ namespace kiwano
case WM_MOUSEMOVE:
{
MouseMoveEventPtr evt = new MouseMoveEvent;
evt->pos = Point(((float)(int)(short)LOWORD(lparam)), ((float)(int)(short)HIWORD(lparam)));
evt->pos = Point((float)GET_X_LPARAM(lparam), (float)GET_Y_LPARAM(lparam));
window->PushEvent(evt);
}
break;
@ -511,7 +556,7 @@ namespace kiwano
case WM_MOUSEWHEEL:
{
MouseWheelEventPtr evt = new MouseWheelEvent;
evt->pos = Point(((float)(int)(short)LOWORD(lparam)), ((float)(int)(short)HIWORD(lparam)));
evt->pos = Point((float)GET_X_LPARAM(lparam), (float)GET_Y_LPARAM(lparam));
evt->wheel = GET_WHEEL_DELTA_WPARAM(wparam) / (float)WHEEL_DELTA;
window->PushEvent(evt);
}
@ -525,7 +570,7 @@ namespace kiwano
}
else
{
// KGE_SYS_LOG(L"WindowImpl resized");
// KGE_SYS_LOG(L"Window resized");
window->SetInternalSize(((uint32_t)(short)LOWORD(lparam)), ((uint32_t)(short)HIWORD(lparam)));
@ -539,12 +584,9 @@ namespace kiwano
case WM_MOVE:
{
int x = ((int)(short)LOWORD(lparam));
int y = ((int)(short)HIWORD(lparam));
WindowMovedEventPtr evt = new WindowMovedEvent;
evt->x = x;
evt->y = y;
evt->x = GET_X_LPARAM(lparam);
evt->y = GET_Y_LPARAM(lparam);
window->PushEvent(evt);
}
break;