HoverRace  2.0
ConsoleScene.h
Go to the documentation of this file.
1 
2 // ConsoleScene.h
3 //
4 // Copyright (c) 2013, 2015-2016 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/Control/Action.h"
25 #include "../UiScene.h"
26 #include "SysConsole.h"
27 
28 namespace HoverRace {
29  namespace Client {
30  class GameDirector;
31  }
32  namespace Display {
33  class ActiveText;
34  class Display;
35  class Label;
36  class ScreenFade;
37  }
38 }
39 
40 namespace HoverRace {
41 namespace Client {
42 namespace HoverScript {
43 
48 class ConsoleScene : public UiScene
49 {
50  using SUPER = UiScene;
51 
52 public:
54  SysConsole &console);
55  virtual ~ConsoleScene();
56 
57 private:
58  void OnDisplayConfigChanged();
59 
60  void OnConsoleToggle();
61  void OnConsoleUp();
62  void OnConsoleDown();
63  void OnConsoleTop();
64  void OnConsoleBottom();
65  void OnConsolePrevCmd();
66  void OnConsoleNextCmd();
67  void OnTextInput(const std::string &s);
68  void OnTextControl(Control::TextControl::key_t key);
69 
70  void OnLogCleared();
71  void OnLogAdded(int idx);
72 
73  void AppendLogLine(const SysConsole::LogLine &line);
74  void UpdateCommandLine();
75  void Layout() override;
76 
77 public:
78  // Scene
79  void AttachController(Control::InputEventController &controller,
80  ConnList &conns) override;
81  void DetachController(Control::InputEventController &controller,
82  ConnList &conns) override;
83 public:
84  void Advance(Util::OS::timestamp_t tick) override;
85  void PrepareRender() override;
86  void Render() override;
87 
88 private:
91 
92  class LogLines;
93  std::unique_ptr<LogLines> logLines;
96 
97  boost::signals2::scoped_connection displayConfigChangedConn;
98 
99  boost::signals2::scoped_connection logClearedConn;
100  boost::signals2::scoped_connection logAddedConn;
101 
103 
104  std::unique_ptr<Display::ScreenFade> fader;
105  std::unique_ptr<Display::ActiveText> inputLbl;
106 
107  bool cursorOn;
109 
110  std::unique_ptr<Display::Label> measureLbl;
112 };
113 
114 } // namespace HoverScript
115 } // namespace Client
116 } // namespace HoverRace
UI for the system console.
Definition: ConsoleScene.h:48
boost::signals2::scoped_connection logClearedConn
Definition: ConsoleScene.h:99
Interface for game client shells.
Definition: GameDirector.h:57
boost::signals2::scoped_connection displayConfigChangedConn
Definition: ConsoleScene.h:97
Base class for UI-centric scenes.
Definition: UiScene.h:42
GameDirector & director
Definition: TestLabScene.cpp:160
std::array< boost::signals2::scoped_connection, 2 > conns
Definition: ProfileEditScene.cpp:152
Definition: Vec.h:38
std::unique_ptr< Display::ActiveText > inputLbl
Definition: ConsoleScene.h:105
bool logsChanged
Definition: ConsoleScene.h:95
Vec2 charSize
Definition: ConsoleScene.h:111
bool layoutChanged
Definition: ConsoleScene.h:102
Base class for display managers.
Definition: Display.h:73
std::unique_ptr< Display::Label > measureLbl
Used to measure the size of glyphs.
Definition: ConsoleScene.h:110
boost::signals2::scoped_connection logAddedConn
Definition: ConsoleScene.h:100
int lastLogIdx
Definition: ConsoleScene.h:94
bool cursorOn
Definition: ConsoleScene.h:107
std::unique_ptr< LogLines > logLines
Definition: ConsoleScene.h:92
GameDirector & director
Definition: ConsoleScene.h:89
Scenes are analogous to fullscreen windows that are layered on top of each other. ...
Definition: Scene.h:43
Util::OS::timestamp_t cursorTick
Definition: ConsoleScene.h:108
int idx
Definition: SdlDisplay.cpp:254
Tracks connections as a group.
Definition: Scene.h:69
Definition: Announcement.h:24
key_t
Keycodes used for text input control.
Definition: Action.h:48
SysConsole & console
Definition: ConsoleScene.h:90
std::unique_ptr< Display::ScreenFade > fader
Definition: ConsoleScene.h:104
Translates input events into actions.
Definition: Controller.h:106
Global always-on console.
Definition: SysConsole.h:60
MR_Int64 timestamp_t
Definition: OS.h:55