}
m_gl_context = SDL_GL_CreateContext(m_window);
+
+ ResizeViewport(800, 600);
}
break;
}
break;
+ case SDL_MOUSEMOTION:
+ m_last_mouse_x = evt.motion.x;
+ m_last_mouse_y = evt.motion.y;
+ if (m_mouse_handler)
+ {
+ m_mouse_handler(evt.motion.x, evt.motion.y,evt.motion.state, 0);
+ }
+ break;
+ case SDL_MOUSEBUTTONDOWN:
+ case SDL_MOUSEBUTTONUP:
+ m_last_mouse_x = evt.button.x;
+ m_last_mouse_y = evt.button.y;
+ if (m_mouse_handler)
+ {
+ m_mouse_handler(evt.button.x, evt.button.y, evt.button.state, 0);
+ }
+ break;
+ case SDL_MOUSEWHEEL:
+ if (m_mouse_handler)
+ {
+ m_mouse_handler(m_last_mouse_x, m_last_mouse_y, 0, evt.wheel.y);
+ }
+ break;
default:
break;
}
return no_quit_requested;
}
+void Screen::SetMouseCursor(Screen::MouseCursors cursor)
+{
+ SDL_SystemCursor system_cursor_id = SDL_SYSTEM_CURSOR_ARROW;
+ switch (cursor)
+ {
+ case CursorArrow: system_cursor_id = SDL_SYSTEM_CURSOR_ARROW; break;
+ case CursorWait: system_cursor_id = SDL_SYSTEM_CURSOR_WAIT; break;
+ case CursorWaitArrow: system_cursor_id = SDL_SYSTEM_CURSOR_WAITARROW; break;
+ case CursorMove: system_cursor_id = SDL_SYSTEM_CURSOR_SIZEALL; break;
+ case CursorHand: system_cursor_id = SDL_SYSTEM_CURSOR_HAND; break;
+ default: break;
+ }
+ SDL_Cursor *system_cursor = SDL_CreateSystemCursor(system_cursor_id);
+ SDL_SetCursor(system_cursor);
+ //TODO: Check if we need to free the system cursors.
+}
+
void Screen::Present()
{
SDL_GL_SwapWindow(m_window);