Cinder  0.8.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
AppImplMswBasic.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2012, The Cinder Project, All rights reserved.
3 
4  This code is intended for use with the Cinder C++ library: http://libcinder.org
5 
6  Redistribution and use in source and binary forms, with or without modification, are permitted provided that
7  the following conditions are met:
8 
9  * Redistributions of source code must retain the above copyright notice, this list of conditions and
10  the following disclaimer.
11  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
12  the following disclaimer in the documentation and/or other materials provided with the distribution.
13 
14  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
15  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
16  PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
17  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
18  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
19  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
20  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
21  POSSIBILITY OF SUCH DAMAGE.
22 */
23 
24 #pragma once
25 
26 #include <windows.h>
27 #undef min
28 #undef max
29 
30 #include "cinder/app/AppImplMsw.h"
32 #include "cinder/Display.h"
33 #include "cinder/app/Window.h"
34 
35 namespace cinder { namespace app {
36 
37 class WindowImplMswBasic;
38 
39 class AppImplMswBasic : public AppImplMsw {
40  public:
41  AppImplMswBasic( class AppBasic *aApp );
42  void run();
43 
44  class AppBasic* getApp() { return mApp; }
45 
46  void quit() { mShouldQuit = true; }
47 
48  float setFrameRate( float aFrameRate );
49  void disableFrameRate();
50  bool isFrameRateEnabled() const;
51 
52  size_t getNumWindows() const;
53  WindowRef getWindowIndex( size_t index );
55  fs::path getAppPath() const;
56 
57  void setupBlankingWindows( DisplayRef fullScreenDisplay );
59 
60  private:
61  void sleep( double seconds );
62 
63  WindowRef createWindow( Window::Format format );
64  virtual void closeWindow( class WindowImplMsw *windowImpl ) override;
65  virtual void setForegroundWindow( WindowRef window ) override;
66 
67  bool mShouldQuit;
68  class AppBasic *mApp;
69 
70 
71  HINSTANCE mInstance;
72  double mNextFrameTime;
73  bool mFrameRateEnabled;
74 
75  std::list<class WindowImplMswBasic*> mWindows;
76  std::list<BlankingWindowRef> mBlankingWindows;
77  WindowRef mForegroundWindow;
78 
79  friend LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
80  friend class AppBasic;
81 };
82 
84  public:
86  : WindowImplMsw( format, sharedRenderer, appImpl ), mAppImplBasic( appImpl ) {}
87 
88  virtual void WindowImplMswBasic::toggleFullScreen( const app::FullScreenOptions &options );
89 
90  protected:
93 };
94 
95 } } // namespace cinder::app
size_t getNumWindows() const
Definition: AppImplMswBasic.cpp:169
Options passed when entering fullscreen.
Definition: Window.h:110
friend AppImplMswBasic
Definition: AppImplMswBasic.h:92
Definition: AppImplMswBasic.h:83
void sleep(float milliseconds)
Suspends the execution of the current thread until milliseconds have passed. Supports sub-millisecond...
Definition: Utilities.cpp:286
AppImplMswBasic * mAppImplBasic
Definition: AppImplMswBasic.h:91
GLuint index
Definition: GLee.h:2259
void quit()
Definition: AppImplMswBasic.h:46
bool isFrameRateEnabled() const
Definition: AppImplMswBasic.cpp:227
class AppBasic * getApp()
Definition: AppImplMswBasic.h:44
float setFrameRate(float aFrameRate)
Definition: AppImplMswBasic.cpp:214
WindowRef getWindowIndex(size_t index)
Definition: AppImplMswBasic.cpp:174
std::shared_ptr< Window > WindowRef
Definition: Event.h:49
Definition: AppImplMsw.h:103
AppImplMswBasic(class AppBasic *aApp)
Definition: AppImplMswBasic.cpp:38
std::shared_ptr< class Renderer > RendererRef
Definition: Renderer.h:85
Definition: AppBasic.h:49
fs::path getAppPath() const
WindowRef getForegroundWindow() const
Definition: AppImplMswBasic.cpp:184
std::shared_ptr< class Display > DisplayRef
Definition: Display.h:53
Window window
Definition: GLee.h:17134
WindowImplMswBasic(const Window::Format &format, RendererRef sharedRenderer, AppImplMswBasic *appImpl)
Definition: AppImplMswBasic.h:85
void disableFrameRate()
Definition: AppImplMswBasic.cpp:222
Definition: AppImplMswBasic.h:39
void destroyBlankingWindows()
Definition: AppImplMswBasic.cpp:206
Definition: Window.h:140
virtual void toggleFullScreen(const app::FullScreenOptions &options)
Definition: AppImplMsw.cpp:490
GLenum GLsizei GLenum format
Definition: GLee.h:969
void setupBlankingWindows(DisplayRef fullScreenDisplay)
Definition: AppImplMswBasic.cpp:195
friend LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: AppImplMsw.cpp:789
Definition: AppImplMsw.h:63
void run()
Definition: AppImplMswBasic.cpp:44