WinRT: added mouse button event support
authorDavid Ludwig <dludwig@pobox.com>
Sun, 28 Oct 2012 20:47:33 -0400
changeset 8332ea83d191cc17
parent 8331 737dc8a4f49f
child 8333 49973bfb8d23
WinRT: added mouse button event support
src/video/windowsrt/SDL_WinRTApp.cpp
src/video/windowsrt/SDL_WinRTApp.h
src/video/windowsrt/SDL_winrtvideo.cpp
     1.1 --- a/src/video/windowsrt/SDL_WinRTApp.cpp	Sun Oct 28 20:04:26 2012 -0400
     1.2 +++ b/src/video/windowsrt/SDL_WinRTApp.cpp	Sun Oct 28 20:47:33 2012 -0400
     1.3 @@ -5,6 +5,8 @@
     1.4  #include "SDL_assert.h"
     1.5  #include "SDL_stdinc.h"
     1.6  #include "../SDL_sysvideo.h"
     1.7 +#include "../../events/SDL_mouse_c.h"
     1.8 +#include "SDL_events.h"
     1.9  }
    1.10  
    1.11  // HACK, DLudwig: The C-style main() will get loaded via the app's
    1.12 @@ -68,6 +70,9 @@
    1.13  	window->PointerPressed +=
    1.14  		ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &SDL_WinRTApp::OnPointerPressed);
    1.15  
    1.16 +    window->PointerReleased +=
    1.17 +		ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &SDL_WinRTApp::OnPointerReleased);
    1.18 +
    1.19  	window->PointerMoved +=
    1.20  		ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &SDL_WinRTApp::OnPointerMoved);
    1.21  
    1.22 @@ -129,7 +134,14 @@
    1.23  
    1.24  void SDL_WinRTApp::OnPointerPressed(CoreWindow^ sender, PointerEventArgs^ args)
    1.25  {
    1.26 -	// Insert your code here.
    1.27 +    // TODO, WinRT: consider attaching the SDL_Window to the mouse down button event
    1.28 +	SDL_SendMouseButton(NULL, SDL_PRESSED, SDL_BUTTON_LEFT);
    1.29 +}
    1.30 +
    1.31 +void SDL_WinRTApp::OnPointerReleased(CoreWindow^ sender, PointerEventArgs^ args)
    1.32 +{
    1.33 +    // TODO, WinRT: consider attaching the SDL_Window to the mouse up button event
    1.34 +	SDL_SendMouseButton(NULL, SDL_RELEASED, SDL_BUTTON_LEFT);
    1.35  }
    1.36  
    1.37  void SDL_WinRTApp::OnPointerMoved(CoreWindow^ sender, PointerEventArgs^ args)
     2.1 --- a/src/video/windowsrt/SDL_WinRTApp.h	Sun Oct 28 20:04:26 2012 -0400
     2.2 +++ b/src/video/windowsrt/SDL_WinRTApp.h	Sun Oct 28 20:47:33 2012 -0400
     2.3 @@ -33,6 +33,7 @@
     2.4  	void OnWindowClosed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CoreWindowEventArgs^ args);
     2.5  	void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args);
     2.6  	void OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
     2.7 +	void OnPointerReleased(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
     2.8  	void OnPointerMoved(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
     2.9  
    2.10  private:
     3.1 --- a/src/video/windowsrt/SDL_winrtvideo.cpp	Sun Oct 28 20:04:26 2012 -0400
     3.2 +++ b/src/video/windowsrt/SDL_winrtvideo.cpp	Sun Oct 28 20:47:33 2012 -0400
     3.3 @@ -41,6 +41,8 @@
     3.4  #include "SDL_winrtevents_c.h"
     3.5  #include "SDL_winrtframebuffer_c.h"
     3.6  
     3.7 +extern SDL_WinRTApp ^ SDL_WinRTGlobalApp;
     3.8 +
     3.9  #define WINRTVID_DRIVER_NAME "dummy"
    3.10  
    3.11  /* Initialization/Query functions */
    3.12 @@ -96,8 +98,6 @@
    3.13      WINRT_Available, WINRT_CreateDevice
    3.14  };
    3.15  
    3.16 -extern SDL_WinRTApp ^ SDL_WinRTGlobalApp;
    3.17 -
    3.18  int
    3.19  WINRT_VideoInit(_THIS)
    3.20  {