Mercurial > hg > orthanc-stone
annotate Samples/MultiPlatform/BasicScene/BasicScene.h @ 1046:513a4053c54a
merge
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 09 Oct 2019 17:18:29 +0200 |
parents | a911f5bb48da |
children | 2d8ab34c8c91 |
rev | line source |
---|---|
916
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
1 /** |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
2 * Stone of Orthanc |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
6 * |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
7 * This program is free software: you can redistribute it and/or |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Affero General Public License |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
9 * as published by the Free Software Foundation, either version 3 of |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
10 * the License, or (at your option) any later version. |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
11 * |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, but |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
13 * WITHOUT ANY WARRANTY; without even the implied warranty of |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
15 * Affero General Public License for more details. |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
16 * |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Affero General Public License |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
19 **/ |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
20 |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
21 #pragma once |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
22 |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
23 #include <boost/shared_ptr.hpp> |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
24 #include "Framework/Scene2DViewport/ViewportController.h" |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
25 #include "Framework/Scene2D/Scene2D.h" |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
26 |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
27 extern const unsigned int BASIC_SCENE_FONT_SIZE; |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
28 extern const int BASIC_SCENE_LAYER_POSITION; |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
29 |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
30 extern void PrepareScene(OrthancStone::Scene2D& scene); |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
31 extern void TakeScreenshot(const std::string& target, |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
32 const OrthancStone::Scene2D& scene, |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
33 unsigned int canvasWidth, |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
34 unsigned int canvasHeight); |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
35 |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
36 |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
37 #include "Applications/Generic/Scene2DInteractor.h" |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
38 #include "Framework/Scene2DViewport/IFlexiblePointerTracker.h" |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
39 |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
40 |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
41 class BasicScene2DInteractor : public OrthancStone::Scene2DInteractor |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
42 { |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
43 boost::shared_ptr<OrthancStone::IFlexiblePointerTracker> currentTracker_; |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
44 bool showCursorInfo_; |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
45 public: |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
46 BasicScene2DInteractor(boost::shared_ptr<OrthancStone::ViewportController> viewportController) : |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
47 Scene2DInteractor(viewportController), |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
48 showCursorInfo_(false) |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
49 {} |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
50 |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
51 virtual bool OnMouseEvent(const OrthancStone::GuiAdapterMouseEvent& event, const OrthancStone::PointerEvent& pointerEvent) override; |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
52 virtual bool OnKeyboardEvent(const OrthancStone::GuiAdapterKeyboardEvent& guiEvent) override; |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
53 virtual bool OnWheelEvent(const OrthancStone::GuiAdapterWheelEvent& guiEvent) override; |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
54 }; |
a911f5bb48da
MultiPlatform Basic Scene sample (so far: SDL + Qt)
Alain Mazy <alain@mazy.be>
parents:
diff
changeset
|
55 |