Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

WinRT: added mouse button event support

  • Loading branch information
DavidLudwig committed Oct 29, 2012
1 parent 6720dba commit 6d9be94032fd4c250eb94cee8b02d6fc9effb6c3
@@ -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)
@@ -33,6 +33,7 @@ ref class SDL_WinRTApp sealed : public Windows::ApplicationModel::Core::IFramewo
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:
@@ -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)
{

0 comments on commit 6d9be94

Please sign in to comment.