src/core/winrt/SDL_winrtapp_direct3d.h
author David Ludwig <dludwig@pobox.com>
Wed, 26 Nov 2014 21:34:15 -0500
changeset 9240 dc4ad21d8596
parent 8666 20d52dc1a24a
child 9619 b94b6d0bff0f
permissions -rw-r--r--
WinRT: added initial SDL_TEXTINPUT support

Further support regarding IME and on-screen keyboards is pending, some of
which might not be 100% compatible with other platforms, given WinRT platform
restrictions. An MSDN article at http://msdn.microsoft.com/en-us/library/windows/apps/hh465404.aspx
indicates that on-screen keyboard display requires that the user first tap on
a Windows/XAML text control.

This change adds basic SDL_TEXTINPUT support, with input coming from hardware
keyboards, at a minimum, and without the need for XAML integration (which is
still pending integration into SDL, by and large).
slouken@8616
     1
/*
slouken@8616
     2
  Simple DirectMedia Layer
slouken@8616
     3
  Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
slouken@8582
     4
slouken@8616
     5
  This software is provided 'as-is', without any express or implied
slouken@8616
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@8616
     7
  arising from the use of this software.
slouken@8616
     8
slouken@8616
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@8616
    10
  including commercial applications, and to alter it and redistribute it
slouken@8616
    11
  freely, subject to the following restrictions:
slouken@8616
    12
slouken@8616
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@8616
    14
     claim that you wrote the original software. If you use this software
slouken@8616
    15
     in a product, an acknowledgment in the product documentation would be
slouken@8616
    16
     appreciated but is not required.
slouken@8616
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@8616
    18
     misrepresented as being the original software.
slouken@8616
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@8616
    20
*/
slouken@8582
    21
#include <Windows.h>
slouken@8582
    22
slouken@8582
    23
extern int SDL_WinRTInitNonXAMLApp(int (*mainFunction)(int, char **));
slouken@8582
    24
slouken@8582
    25
ref class SDL_WinRTApp sealed : public Windows::ApplicationModel::Core::IFrameworkView
slouken@8582
    26
{
slouken@8582
    27
public:
slouken@8582
    28
    SDL_WinRTApp();
slouken@8582
    29
    
slouken@8582
    30
    // IFrameworkView Methods.
slouken@8582
    31
    virtual void Initialize(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView);
slouken@8582
    32
    virtual void SetWindow(Windows::UI::Core::CoreWindow^ window);
slouken@8582
    33
    virtual void Load(Platform::String^ entryPoint);
slouken@8582
    34
    virtual void Run();
slouken@8582
    35
    virtual void Uninitialize();
slouken@8582
    36
slouken@8582
    37
internal:
slouken@8582
    38
    // SDL-specific methods
slouken@8582
    39
    void PumpEvents();
slouken@8582
    40
slouken@8582
    41
protected:
dludwig@8666
    42
    bool ShouldWaitForAppResumeEvents();
dludwig@8666
    43
slouken@8582
    44
    // Event Handlers.
slouken@8582
    45
slouken@8582
    46
#if WINAPI_FAMILY == WINAPI_FAMILY_APP  // for Windows 8/8.1/RT apps... (and not Phone apps)
slouken@8582
    47
    void OnSettingsPaneCommandsRequested(
slouken@8582
    48
        Windows::UI::ApplicationSettings::SettingsPane ^p,
slouken@8582
    49
        Windows::UI::ApplicationSettings::SettingsPaneCommandsRequestedEventArgs ^args);
slouken@8582
    50
#endif // if WINAPI_FAMILY == WINAPI_FAMILY_APP
slouken@8582
    51
dludwig@8621
    52
#if NTDDI_VERSION > NTDDI_WIN8
dludwig@8621
    53
    void OnOrientationChanged(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args);
dludwig@8621
    54
#else
slouken@8582
    55
    void OnOrientationChanged(Platform::Object^ sender);
dludwig@8621
    56
#endif
slouken@8582
    57
    void OnWindowSizeChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ args);
slouken@8582
    58
    void OnLogicalDpiChanged(Platform::Object^ sender);
slouken@8582
    59
    void OnActivated(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView, Windows::ApplicationModel::Activation::IActivatedEventArgs^ args);
slouken@8582
    60
    void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ args);
slouken@8582
    61
    void OnResuming(Platform::Object^ sender, Platform::Object^ args);
slouken@8582
    62
    void OnExiting(Platform::Object^ sender, Platform::Object^ args);
slouken@8582
    63
    void OnWindowClosed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CoreWindowEventArgs^ args);
slouken@8582
    64
    void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args);
slouken@8582
    65
    void OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
slouken@8582
    66
    void OnPointerReleased(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
slouken@8582
    67
    void OnPointerWheelChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
slouken@8582
    68
    void OnPointerMoved(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
slouken@8582
    69
    void OnMouseMoved(Windows::Devices::Input::MouseDevice^ mouseDevice, Windows::Devices::Input::MouseEventArgs^ args);
slouken@8582
    70
    void OnKeyDown(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args);
slouken@8582
    71
    void OnKeyUp(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args);
dludwig@9240
    72
    void OnCharacterReceived(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CharacterReceivedEventArgs^ args);
slouken@8582
    73
slouken@8582
    74
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
slouken@8582
    75
    void OnBackButtonPressed(Platform::Object^ sender, Windows::Phone::UI::Input::BackPressedEventArgs^ args);
slouken@8582
    76
#endif
slouken@8582
    77
slouken@8582
    78
private:
slouken@8582
    79
    bool m_windowClosed;
slouken@8582
    80
    bool m_windowVisible;
slouken@8582
    81
};
slouken@8582
    82
slouken@8582
    83
extern SDL_WinRTApp ^ SDL_WinRTGlobalApp;