src/video/windowsrt/SDL_WinRTApp.h
author David Ludwig <dludwig@pobox.com>
Tue, 08 Jan 2013 23:11:22 -0500
changeset 8384 bc7a52629e1e
parent 8378 357a8e1166e5
child 8400 1315402d9028
permissions -rw-r--r--
WinRT: converted tabs to spaces in src/video/windowsrt/*
dludwig@8322
     1
#pragma once
dludwig@8322
     2
dludwig@8322
     3
#include "SDLmain_WinRT_common.h"
dludwig@8333
     4
#include "SDL_winrtvideo.h"
dludwig@8342
     5
#include "SDL_winrtrenderer.h"
dludwig@8329
     6
#include <vector>
dludwig@8329
     7
dludwig@8329
     8
using namespace Windows::UI::Core;
dludwig@8322
     9
dludwig@8322
    10
ref class SDL_WinRTApp sealed : public Windows::ApplicationModel::Core::IFrameworkView
dludwig@8322
    11
{
dludwig@8322
    12
public:
dludwig@8384
    13
    SDL_WinRTApp();
dludwig@8384
    14
    
dludwig@8384
    15
    // IFrameworkView Methods.
dludwig@8384
    16
    virtual void Initialize(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView);
dludwig@8384
    17
    virtual void SetWindow(Windows::UI::Core::CoreWindow^ window);
dludwig@8384
    18
    virtual void Load(Platform::String^ entryPoint);
dludwig@8384
    19
    virtual void Run();
dludwig@8384
    20
    virtual void Uninitialize();
dludwig@8322
    21
dludwig@8329
    22
internal:
dludwig@8329
    23
    // SDL-specific methods
dludwig@8329
    24
    SDL_DisplayMode GetMainDisplayMode();
dludwig@8331
    25
    void PumpEvents();
dludwig@8335
    26
    const SDL_WindowData * GetSDLWindowData() const;
dludwig@8334
    27
    bool HasSDLWindowData() const;
dludwig@8378
    28
    void SetRelativeMouseMode(bool enable);
dludwig@8335
    29
    void SetSDLWindowData(const SDL_WindowData * windowData);
dludwig@8342
    30
    void UpdateWindowFramebuffer(SDL_Surface * surface, SDL_Rect * rects, int numrects);
dludwig@8367
    31
    void ResizeMainTexture(int w, int h);
dludwig@8372
    32
    Windows::Foundation::Point TransformCursor(Windows::Foundation::Point rawPosition);
dludwig@8329
    33
dludwig@8322
    34
protected:
dludwig@8384
    35
    // Event Handlers.
dludwig@8384
    36
    void OnWindowSizeChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ args);
dludwig@8384
    37
    void OnLogicalDpiChanged(Platform::Object^ sender);
dludwig@8384
    38
    void OnActivated(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView, Windows::ApplicationModel::Activation::IActivatedEventArgs^ args);
dludwig@8384
    39
    void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ args);
dludwig@8384
    40
    void OnResuming(Platform::Object^ sender, Platform::Object^ args);
dludwig@8384
    41
    void OnWindowClosed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CoreWindowEventArgs^ args);
dludwig@8384
    42
    void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args);
dludwig@8384
    43
    void OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
dludwig@8384
    44
    void OnPointerReleased(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
dludwig@8384
    45
    void OnPointerMoved(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
dludwig@8378
    46
    void OnMouseMoved(Windows::Devices::Input::MouseDevice^ mouseDevice, Windows::Devices::Input::MouseEventArgs^ args);
dludwig@8336
    47
    void OnKeyDown(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args);
dludwig@8336
    48
    void OnKeyUp(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args);
dludwig@8322
    49
dludwig@8322
    50
private:
dludwig@8384
    51
    SDL_winrtrenderer^ m_renderer;
dludwig@8384
    52
    bool m_windowClosed;
dludwig@8384
    53
    bool m_windowVisible;
dludwig@8333
    54
    const SDL_WindowData* m_sdlWindowData;
dludwig@8378
    55
    bool m_useRelativeMouseMode;
dludwig@8322
    56
};
dludwig@8322
    57
dludwig@8322
    58
ref class Direct3DApplicationSource sealed : Windows::ApplicationModel::Core::IFrameworkViewSource
dludwig@8322
    59
{
dludwig@8322
    60
public:
dludwig@8384
    61
    virtual Windows::ApplicationModel::Core::IFrameworkView^ CreateView();
dludwig@8322
    62
};