Mercurial > hg > orthanc-stone
comparison Applications/Sdl/BasicSdlApplication.cpp @ 293:017044be141b am-2
renaming
author | am@osimis.io |
---|---|
date | Thu, 30 Aug 2018 17:15:22 +0200 |
parents | 8f5d7495076d |
children |
comparison
equal
deleted
inserted
replaced
292:df5011cf903c | 293:017044be141b |
---|---|
35 #include <Plugins/Samples/Common/OrthancHttpConnection.h> | 35 #include <Plugins/Samples/Common/OrthancHttpConnection.h> |
36 #include "../../Platforms/Generic/OracleWebService.h" | 36 #include "../../Platforms/Generic/OracleWebService.h" |
37 | 37 |
38 namespace OrthancStone | 38 namespace OrthancStone |
39 { | 39 { |
40 void BasicSdlApplication::Initialize() | 40 void SdlStoneApplicationRunner::Initialize() |
41 { | 41 { |
42 SdlWindow::GlobalInitialize(); | 42 SdlWindow::GlobalInitialize(); |
43 } | 43 } |
44 | 44 |
45 void BasicSdlApplication::DeclareCommandLineOptions(boost::program_options::options_description& options) | 45 void SdlStoneApplicationRunner::DeclareCommandLineOptions(boost::program_options::options_description& options) |
46 { | 46 { |
47 boost::program_options::options_description sdl("SDL options"); | 47 boost::program_options::options_description sdl("SDL options"); |
48 sdl.add_options() | 48 sdl.add_options() |
49 ("width", boost::program_options::value<int>()->default_value(1024), "Initial width of the SDL window") | 49 ("width", boost::program_options::value<int>()->default_value(1024), "Initial width of the SDL window") |
50 ("height", boost::program_options::value<int>()->default_value(768), "Initial height of the SDL window") | 50 ("height", boost::program_options::value<int>()->default_value(768), "Initial height of the SDL window") |
52 ; | 52 ; |
53 | 53 |
54 options.add(sdl); | 54 options.add(sdl); |
55 } | 55 } |
56 | 56 |
57 void BasicSdlApplication::ParseCommandLineOptions(const boost::program_options::variables_map& parameters) | 57 void SdlStoneApplicationRunner::ParseCommandLineOptions(const boost::program_options::variables_map& parameters) |
58 { | 58 { |
59 if (!parameters.count("width") || | 59 if (!parameters.count("width") || |
60 !parameters.count("height") || | 60 !parameters.count("height") || |
61 !parameters.count("opengl")) | 61 !parameters.count("opengl")) |
62 { | 62 { |
86 LOG(WARNING) << "OpenGL is disabled, enable it with option \"--opengl=on\" for best performance"; | 86 LOG(WARNING) << "OpenGL is disabled, enable it with option \"--opengl=on\" for best performance"; |
87 } | 87 } |
88 | 88 |
89 } | 89 } |
90 | 90 |
91 void BasicSdlApplication::Run(BasicNativeApplicationContext& context, const std::string& title, int argc, char* argv[]) | 91 void SdlStoneApplicationRunner::Run(NativeStoneApplicationContext& context, const std::string& title, int argc, char* argv[]) |
92 { | 92 { |
93 /************************************************************** | 93 /************************************************************** |
94 * Run the application inside a SDL window | 94 * Run the application inside a SDL window |
95 **************************************************************/ | 95 **************************************************************/ |
96 | 96 |
98 | 98 |
99 SdlWindow window(title.c_str(), width_, height_, enableOpenGl_); | 99 SdlWindow window(title.c_str(), width_, height_, enableOpenGl_); |
100 SdlEngine sdl(window, context); | 100 SdlEngine sdl(window, context); |
101 | 101 |
102 { | 102 { |
103 BasicNativeApplicationContext::GlobalMutexLocker locker(context); | 103 NativeStoneApplicationContext::GlobalMutexLocker locker(context); |
104 context.GetCentralViewport().Register(sdl); // (*) | 104 context.GetCentralViewport().Register(sdl); // (*) |
105 } | 105 } |
106 | 106 |
107 context.Start(); | 107 context.Start(); |
108 sdl.Run(); | 108 sdl.Run(); |
116 // destructed object (the "SdlEngine" is deleted with the | 116 // destructed object (the "SdlEngine" is deleted with the |
117 // lexical scope). | 117 // lexical scope). |
118 context.Stop(); | 118 context.Stop(); |
119 } | 119 } |
120 | 120 |
121 void BasicSdlApplication::Finalize() | 121 void SdlStoneApplicationRunner::Finalize() |
122 { | 122 { |
123 SdlWindow::GlobalFinalize(); | 123 SdlWindow::GlobalFinalize(); |
124 } | 124 } |
125 | 125 |
126 | 126 |