HoverRace  2.0
FormScene.h
Go to the documentation of this file.
1 
2 // FormScene.h
3 //
4 // Copyright (c) 2013, 2015 Michael Imamura.
5 //
6 // Licensed under GrokkSoft HoverRace SourceCode License v1.0(the "License");
7 // you may not use this file except in compliance with the License.
8 //
9 // A copy of the license should have been attached to the package from which
10 // you have taken this file. If you can not find the license you can not use
11 // this file.
12 //
13 //
14 // The author makes no representations about the suitability of
15 // this software for any purpose. It is provided "as is" "AS IS",
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17 // implied.
18 //
19 // See the License for the specific language governing permissions
20 // and limitations under the License.
21 
22 #pragma once
23 
24 #include "../../engine/Vec.h"
25 
26 #include "UiScene.h"
27 
28 namespace HoverRace {
29  namespace Control {
30  namespace Mouse {
31  struct Click;
32  struct Scroll;
33  }
34  }
35  namespace Display {
36  class Container;
37  class Display;
38  }
39 }
40 
41 namespace HoverRace {
42 namespace Client {
43 
48 class FormScene : public UiScene
49 {
50  using SUPER = UiScene;
51 
52 public:
53  FormScene(Display::Display &display, const std::string &name = "");
54  virtual ~FormScene();
55 
56 public:
57  void AttachController(Control::InputEventController &controller,
58  ConnList &conns) override;
59 
60 private:
61  void OnMouseMoved(const Vec2 &pos);
62  bool OnMousePressed(const Control::Mouse::Click &click);
63  bool OnMouseReleased(const Control::Mouse::Click &click);
64  bool OnMouseScrolled(const Control::Mouse::Scroll &scroll);
65 
66 protected:
67  Display::Container *GetRoot() const { return root.get(); }
68 
69 public:
70  void PrepareRender() override;
71  void Render() override;
72 
73 protected:
75 private:
76  std::shared_ptr<Display::Container> root;
77 };
78 
79 } // namespace Client
80 } // namespace HoverRace
Display::Container * GetRoot() const
Definition: FormScene.h:67
Base class for UI-centric scenes.
Definition: UiScene.h:42
Display::Display & display
Definition: FormScene.h:74
std::shared_ptr< Display::Container > root
Definition: FormScene.h:76
Mouse click events.
Definition: Action.h:67
std::array< boost::signals2::scoped_connection, 2 > conns
Definition: ProfileEditScene.cpp:152
Definition: Vec.h:38
Base class for display managers.
Definition: Display.h:73
Base class for full-scene menus and the like.
Definition: FormScene.h:48
Mouse scroll events.
Definition: Action.h:77
An invisible container for other UI widgets.
Definition: Container.h:49
Tracks connections as a group.
Definition: Scene.h:69
Definition: Announcement.h:24
Translates input events into actions.
Definition: Controller.h:106