Mercurial > hg > orthanc-stone
comparison Applications/Sdl/SdlEngine.h @ 51:b340879da9bd
reorganization
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 27 Apr 2017 14:50:20 +0200 |
parents | Framework/Applications/Sdl/SdlEngine.h@28956ed68280 |
children | c2dc924f1a63 4cff7b1ed31d |
comparison
equal
deleted
inserted
replaced
49:c45f368de5c0 | 51:b340879da9bd |
---|---|
1 /** | |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * Copyright (C) 2017 Osimis, Belgium | |
6 * | |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU Affero General Public License | |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 | |
22 #pragma once | |
23 | |
24 #if ORTHANC_ENABLE_SDL == 1 | |
25 | |
26 #include "SdlBuffering.h" | |
27 #include "../BinarySemaphore.h" | |
28 | |
29 #include <boost/thread.hpp> | |
30 | |
31 namespace OrthancStone | |
32 { | |
33 class SdlEngine : public IViewport::IChangeObserver | |
34 { | |
35 private: | |
36 SdlWindow& window_; | |
37 IViewport& viewport_; | |
38 SdlBuffering buffering_; | |
39 boost::thread renderThread_; | |
40 bool continue_; | |
41 BinarySemaphore renderFrame_; | |
42 uint32_t refreshEvent_; | |
43 bool viewportChanged_; | |
44 | |
45 void RenderFrame(); | |
46 | |
47 static void RenderThread(SdlEngine* that); | |
48 | |
49 static KeyboardModifiers GetKeyboardModifiers(const uint8_t* keyboardState, | |
50 const int scancodeCount); | |
51 | |
52 void SetSize(unsigned int width, | |
53 unsigned int height); | |
54 | |
55 void Stop(); | |
56 | |
57 void Refresh(); | |
58 | |
59 public: | |
60 SdlEngine(SdlWindow& window, | |
61 IViewport& viewport); | |
62 | |
63 virtual ~SdlEngine(); | |
64 | |
65 virtual void NotifyChange(const IViewport& viewport) | |
66 { | |
67 viewportChanged_ = true; | |
68 } | |
69 | |
70 void Run(); | |
71 | |
72 static void GlobalInitialize(); | |
73 | |
74 static void GlobalFinalize(); | |
75 }; | |
76 } | |
77 | |
78 #endif |