WinRT: added mouse button event support

This commit is contained in:
David Ludwig 2012-10-28 20:47:33 -04:00
parent c5a3281bc7
commit 9dfe3da5aa
3 changed files with 16 additions and 3 deletions

View file

@ -5,6 +5,8 @@ extern "C" {
#include "SDL_assert.h"
#include "SDL_stdinc.h"
#include "../SDL_sysvideo.h"
#include "../../events/SDL_mouse_c.h"
#include "SDL_events.h"
}
// HACK, DLudwig: The C-style main() will get loaded via the app's
@ -68,6 +70,9 @@ void SDL_WinRTApp::SetWindow(CoreWindow^ window)
window->PointerPressed +=
ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &SDL_WinRTApp::OnPointerPressed);
window->PointerReleased +=
ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &SDL_WinRTApp::OnPointerReleased);
window->PointerMoved +=
ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &SDL_WinRTApp::OnPointerMoved);
@ -129,7 +134,14 @@ void SDL_WinRTApp::OnWindowClosed(CoreWindow^ sender, CoreWindowEventArgs^ args)
void SDL_WinRTApp::OnPointerPressed(CoreWindow^ sender, PointerEventArgs^ args)
{
// Insert your code here.
// TODO, WinRT: consider attaching the SDL_Window to the mouse down button event
SDL_SendMouseButton(NULL, SDL_PRESSED, SDL_BUTTON_LEFT);
}
void SDL_WinRTApp::OnPointerReleased(CoreWindow^ sender, PointerEventArgs^ args)
{
// TODO, WinRT: consider attaching the SDL_Window to the mouse up button event
SDL_SendMouseButton(NULL, SDL_RELEASED, SDL_BUTTON_LEFT);
}
void SDL_WinRTApp::OnPointerMoved(CoreWindow^ sender, PointerEventArgs^ args)

View file

@ -33,6 +33,7 @@ protected:
void OnWindowClosed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CoreWindowEventArgs^ args);
void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args);
void OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
void OnPointerReleased(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
void OnPointerMoved(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
private:

View file

@ -41,6 +41,8 @@ extern "C" {
#include "SDL_winrtevents_c.h"
#include "SDL_winrtframebuffer_c.h"
extern SDL_WinRTApp ^ SDL_WinRTGlobalApp;
#define WINRTVID_DRIVER_NAME "dummy"
/* Initialization/Query functions */
@ -96,8 +98,6 @@ VideoBootStrap WINRT_bootstrap = {
WINRT_Available, WINRT_CreateDevice
};
extern SDL_WinRTApp ^ SDL_WinRTGlobalApp;
int
WINRT_VideoInit(_THIS)
{