Mercurial > hg > orthanc-stone
comparison Applications/Sdl/SdlEngine.h @ 53:c2dc924f1a63 wasm
removing threading out of the framework
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 27 Apr 2017 16:57:49 +0200 |
parents | b340879da9bd |
children | 9e3c2e75b870 |
comparison
equal
deleted
inserted
replaced
52:37e504582af6 | 53:c2dc924f1a63 |
---|---|
23 | 23 |
24 #if ORTHANC_ENABLE_SDL == 1 | 24 #if ORTHANC_ENABLE_SDL == 1 |
25 | 25 |
26 #include "SdlBuffering.h" | 26 #include "SdlBuffering.h" |
27 #include "../BinarySemaphore.h" | 27 #include "../BinarySemaphore.h" |
28 #include "../BasicApplicationContext.h" | |
28 | 29 |
29 #include <boost/thread.hpp> | 30 #include <boost/thread.hpp> |
30 | 31 |
31 namespace OrthancStone | 32 namespace OrthancStone |
32 { | 33 { |
33 class SdlEngine : public IViewport::IChangeObserver | 34 class SdlEngine : public IViewport::IChangeObserver |
34 { | 35 { |
35 private: | 36 private: |
36 SdlWindow& window_; | 37 SdlWindow& window_; |
37 IViewport& viewport_; | 38 BasicApplicationContext& context_; |
38 SdlBuffering buffering_; | 39 SdlBuffering buffering_; |
39 boost::thread renderThread_; | 40 boost::thread renderThread_; |
40 bool continue_; | 41 bool continue_; |
41 BinarySemaphore renderFrame_; | 42 BinarySemaphore renderFrame_; |
42 uint32_t refreshEvent_; | 43 uint32_t refreshEvent_; |
43 bool viewportChanged_; | 44 bool viewportChanged_; |
44 | 45 |
45 void RenderFrame(); | 46 void RenderFrame(); |
46 | 47 |
47 static void RenderThread(SdlEngine* that); | 48 static void RenderThread(SdlEngine* that); |
48 | 49 |
49 static KeyboardModifiers GetKeyboardModifiers(const uint8_t* keyboardState, | 50 static KeyboardModifiers GetKeyboardModifiers(const uint8_t* keyboardState, |
50 const int scancodeCount); | 51 const int scancodeCount); |
51 | 52 |
52 void SetSize(unsigned int width, | 53 void SetSize(BasicApplicationContext::ViewportLocker& locker, |
54 unsigned int width, | |
53 unsigned int height); | 55 unsigned int height); |
54 | 56 |
55 void Stop(); | 57 void Stop(); |
56 | 58 |
57 void Refresh(); | 59 void Refresh(); |
58 | 60 |
59 public: | 61 public: |
60 SdlEngine(SdlWindow& window, | 62 SdlEngine(SdlWindow& window, |
61 IViewport& viewport); | 63 BasicApplicationContext& context); |
62 | 64 |
63 virtual ~SdlEngine(); | 65 virtual ~SdlEngine(); |
64 | 66 |
65 virtual void NotifyChange(const IViewport& viewport) | 67 virtual void NotifyChange(const IViewport& viewport) |
66 { | 68 { |