Mercurial > hg > orthanc-stone
comparison Samples/Deprecated/Sdl/TrackerSample.cpp @ 1348:eac254fb6791 broker
Moved Application/Samples/* to Application/Samples/Deprecated/* (remaining) + moved Samples/* to Samples/Deprecated/*
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Tue, 07 Apr 2020 14:31:28 +0200 |
parents | Samples/Sdl/TrackerSample.cpp@2d8ab34c8c91 |
children |
comparison
equal
deleted
inserted
replaced
1347:bfd77672d825 | 1348:eac254fb6791 |
---|---|
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 |