comparison Deprecated/Samples/Sdl/TrackerSample.cpp @ 1402:65e1e4b08302

moved deprecated samples into Deprecated
author Alain Mazy <alain@mazy.be>
date Wed, 29 Apr 2020 20:50:53 +0200
parents Samples/Deprecated/Sdl/TrackerSample.cpp@eac254fb6791
children
comparison
equal deleted inserted replaced
1401:f6a2d46d2b76 1402:65e1e4b08302
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-2020 Osimis S.A., 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 #include "TrackerSampleApp.h"
22
23 // From Stone
24 #include "../../Framework/OpenGL/SdlOpenGLContext.h"
25 #include "../../Framework/Scene2D/CairoCompositor.h"
26 #include "../../Framework/Scene2D/ColorTextureSceneLayer.h"
27 #include "../../Framework/Scene2D/OpenGLCompositor.h"
28 #include "../../Framework/StoneInitialization.h"
29
30 #include <Core/Logging.h>
31 #include <Core/OrthancException.h>
32
33
34 #include <boost/shared_ptr.hpp>
35 #include <boost/weak_ptr.hpp>
36
37 #include <SDL.h>
38 #include <stdio.h>
39
40 /*
41 TODO:
42
43 - to decouple the trackers from the sample, we need to supply them with
44 the scene rather than the app
45
46 - in order to do that, we need a GetNextFreeZIndex function (or something
47 along those lines) in the scene object
48
49 */
50
51 boost::weak_ptr<OrthancStone::TrackerSampleApp> g_app;
52
53 void TrackerSample_SetInfoDisplayMessage(std::string key, std::string value)
54 {
55 boost::shared_ptr<OrthancStone::TrackerSampleApp> app = g_app.lock();
56 if (app)
57 {
58 app->SetInfoDisplayMessage(key, value);
59 }
60 }
61
62 /**
63 * IMPORTANT: The full arguments to "main()" are needed for SDL on
64 * Windows. Otherwise, one gets the linking error "undefined reference
65 * to `SDL_main'". https://wiki.libsdl.org/FAQWindows
66 **/
67 int main(int argc, char* argv[])
68 {
69 using namespace OrthancStone;
70
71 StoneInitialize();
72 Orthanc::Logging::EnableInfoLevel(true);
73 // Orthanc::Logging::EnableTraceLevel(true);
74
75 try
76 {
77 MessageBroker broker;
78 boost::shared_ptr<TrackerSampleApp> app(new TrackerSampleApp(broker));
79 g_app = app;
80 app->PrepareScene();
81 app->Run();
82 }
83 catch (Orthanc::OrthancException& e)
84 {
85 LOG(ERROR) << "EXCEPTION: " << e.What();
86 }
87
88 StoneFinalize();
89
90 return 0;
91 }
92
93