Cinder  0.8.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
AppImplWinRTBasic.h
Go to the documentation of this file.
1 // The copyright in this software is being made available under the BSD License, included below.
2 // This software may be subject to other third party and contributor rights, including patent rights,
3 // and no such rights are granted under this license.
4 //
5 // Copyright (c) 2013, Microsoft Open Technologies, Inc.
6 // All rights reserved.
7 //
8 // Redistribution and use in source and binary forms, with or without modification,
9 // are permitted provided that the following conditions are met:
10 //
11 // - Redistributions of source code must retain the above copyright notice,
12 // this list of conditions and the following disclaimer.
13 // - Redistributions in binary form must reproduce the above copyright notice,
14 // this list of conditions and the following disclaimer in the documentation
15 // and/or other materials provided with the distribution.
16 // - Neither the name of Microsoft Open Technologies, Inc. nor the names of its contributors
17 // may be used to endorse or promote products derived from this software
18 // without specific prior written permission.
19 //
20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
21 // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22 // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23 // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
27 // EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 
29 
30 #pragma once
31 
32 #include <windows.h>
33 #undef min
34 #undef max
35 
38 #include "cinder/Display.h"
39 #include "cinder/app/Window.h"
40 
41 namespace cinder { namespace app {
42 
43 class WindowImplWinRTBasic;
44 
46 public:
47  AppImplWinRTBasic( class AppBasic *aApp );
48  void run();
49  void runReady(Windows::UI::Core::CoreWindow^ window);
50  void handlePointerDown(Windows::UI::Core::PointerEventArgs^ args);
51  void handlePointerMoved(Windows::UI::Core::PointerEventArgs^ args);
52  void handlePointerUp(Windows::UI::Core::PointerEventArgs^ args);
53  void setVisible(bool isVisible) { mIsVisible = isVisible; };
54  void UpdateForWindowSizeChange(Windows::UI::Core::CoreWindow^ window);
55 
56  class AppBasic* getApp() { return mApp; }
57 
58  void quit() { mShouldQuit = true; }
59 
60  float setFrameRate( float aFrameRate );
61  void disableFrameRate();
62  bool isFrameRateEnabled() const;
63 
64  size_t getNumWindows() const;
65  WindowRef getWindowIndex( size_t index );
67  fs::path getAppPath() const;
68 
69 
70 private:
71  void sleep( double seconds );
72 
73 
74 
75  virtual void closeWindow( class WindowImplWinRT *windowImpl ) override;
76  virtual void setForegroundWindow( WindowRef window ) override;
77 
78  bool mShouldQuit;
79  class AppBasic *mApp;
80  DX_WINDOW_TYPE mWnd;
81 
82  HINSTANCE mInstance;
83  double mNextFrameTime;
84  bool mFrameRateEnabled;
85  bool mIsVisible;
86  class WindowImplWinRTBasic* mWindow;
87 
88  // MultiTouch
89  std::map<DWORD,Vec2f> mMultiTouchPrev;
90  std::vector<TouchEvent::Touch> mActiveTouches;
91 
92  friend class AppBasic;
93 };
94 
96  public:
98  : WindowImplWinRT( format, appImpl ) {};
99 
100  WindowImplWinRTBasic( DX_WINDOW_TYPE hwnd, RendererRef renderer, AppImplWinRTBasic *appImpl )
101  : WindowImplWinRT( hwnd, renderer, appImpl ) {};
102 
103  protected:
104  friend AppImplWinRTBasic;
105 };
106 
107 } } // namespace cinder::app
fs::path getAppPath() const
void handlePointerMoved(Windows::UI::Core::PointerEventArgs^args)
Definition: AppImplWinRTBasic.cpp:236
Definition: AppImplWinRTBasic.h:45
void run()
Definition: AppImplWinRTBasic.cpp:60
void sleep(float milliseconds)
Suspends the execution of the current thread until milliseconds have passed. Supports sub-millisecond...
Definition: Utilities.cpp:286
void handlePointerUp(Windows::UI::Core::PointerEventArgs^args)
Definition: AppImplWinRTBasic.cpp:241
GLuint index
Definition: GLee.h:2259
float setFrameRate(float aFrameRate)
Definition: AppImplWinRTBasic.cpp:211
size_t getNumWindows() const
Definition: AppImplWinRTBasic.cpp:191
void runReady(Windows::UI::Core::CoreWindow^window)
Definition: AppImplWinRTBasic.cpp:68
Definition: AppImplWinRTBasic.h:95
WindowRef getWindowIndex(size_t index)
Definition: AppImplWinRTBasic.cpp:196
std::shared_ptr< Window > WindowRef
Definition: Event.h:49
WindowImplWinRTBasic(const Window::Format &format, AppImplWinRTBasic *appImpl)
Definition: AppImplWinRTBasic.h:97
void UpdateForWindowSizeChange(Windows::UI::Core::CoreWindow^window)
Definition: AppImplWinRTBasic.cpp:246
friend AppImplWinRTBasic
Definition: AppImplWinRTBasic.h:101
void handlePointerDown(Windows::UI::Core::PointerEventArgs^args)
Definition: AppImplWinRTBasic.cpp:231
std::shared_ptr< class Renderer > RendererRef
Definition: Renderer.h:85
void disableFrameRate()
Definition: AppImplWinRTBasic.cpp:219
Definition: AppBasic.h:49
class AppBasic * getApp()
Definition: AppImplWinRTBasic.h:56
Definition: AppImplWinRT.h:95
Window window
Definition: GLee.h:17134
Definition: AppImplWinRT.h:49
void setVisible(bool isVisible)
Definition: AppImplWinRTBasic.h:53
WindowRef getForegroundWindow() const
Definition: AppImplWinRTBasic.cpp:201
Definition: Window.h:140
bool isFrameRateEnabled() const
Definition: AppImplWinRTBasic.cpp:224
GLenum GLsizei GLenum format
Definition: GLee.h:969
WindowImplWinRTBasic(DX_WINDOW_TYPE hwnd, RendererRef renderer, AppImplWinRTBasic *appImpl)
Definition: AppImplWinRTBasic.h:100
AppImplWinRTBasic(class AppBasic *aApp)
Definition: AppImplWinRTBasic.cpp:54
void quit()
Definition: AppImplWinRTBasic.h:58