app.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #pragma once
  2. #include <string>
  3. #include <wrl.h>
  4. #include "os_winrt.h"
  5. #include "GLES2/gl2.h"
  6. namespace $ext_safeprojectname$
  7. {
  8. ref class App sealed : public Windows::ApplicationModel::Core::IFrameworkView
  9. {
  10. public:
  11. App();
  12. // IFrameworkView Methods.
  13. virtual void Initialize(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView);
  14. virtual void SetWindow(Windows::UI::Core::CoreWindow^ window);
  15. virtual void Load(Platform::String^ entryPoint);
  16. virtual void Run();
  17. virtual void Uninitialize();
  18. private:
  19. void RecreateRenderer();
  20. // Application lifecycle event handlers.
  21. void OnActivated(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView, Windows::ApplicationModel::Activation::IActivatedEventArgs^ args);
  22. // Window event handlers.
  23. void OnWindowSizeChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ args);
  24. void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args);
  25. void OnWindowClosed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CoreWindowEventArgs^ args);
  26. void pointer_event(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args, bool p_pressed);
  27. void OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
  28. void OnPointerReleased(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
  29. void OnPointerMoved(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
  30. void UpdateWindowSize(Windows::Foundation::Size size);
  31. void InitializeEGL(Windows::UI::Core::CoreWindow^ window);
  32. void CleanupEGL();
  33. bool mWindowClosed;
  34. bool mWindowVisible;
  35. GLsizei mWindowWidth;
  36. GLsizei mWindowHeight;
  37. EGLDisplay mEglDisplay;
  38. EGLContext mEglContext;
  39. EGLSurface mEglSurface;
  40. CoreWindow^ window;
  41. OSWinrt* os;
  42. int last_touch_x[32]; // 20 fingers, index 31 reserved for the mouse
  43. int last_touch_y[32];
  44. };
  45. }