Labyrinth
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
help.hpp
1 //////////////////////////////
2 //
3 // File: lxs/game/help.hpp
4 // Author: Maciej Kaminski
5 // E-mail: maciej.a.kaminski@gmail.com
6 // Website: maciejkaminski.pl
7 //
8 // File creation date: Jun 16 2014
9 // This file is part of Project Labyrinth
10 // This file is going to be released under terms of GNU GPL in near future
11 //
12 //////////////////////////////
13 
14 #include <string>
15 #include <vector>
16 // classes describing ingame hints/help system
17 namespace LxS
18 {
19  namespace Windowing
20  {
21  class SplashWindow;
22  class Form;
23  class TextBox;
24  class Rectangle2D;
25  class Window;
26  class Button;
27  class Label;
28  }
29  namespace Game
30  {
31  //! in-game help messages system
32  namespace Help
33  {
34  class HelpMessage;
35  class HelpMessageLine;
36  typedef std::vector<HelpMessageLine> HelpMessageVector;
37  //! a box with help on some aspect of game
39  {
40  LxS::Windowing::Rectangle2D* background;
41  std::string message;
42  size_t line;// number of line that is being displayed
43  LxS::Windowing::Label * title;
45  HelpMessageVector::iterator msgit;
46  HelpMessage * associated_message;
47  void DispLine();
48  public:
49  HintBox(std::string msg);
50  void NextLine();
51  void PrevLine();
52  void Clicked(float x, float y);
53  void Initialize();
54  //! HintBox can be hidden/destroyed
55  bool Finished();
56  //! one before "finished" state
57  bool AtFirstLine();
58  //! one before "finished" state
59  bool AtLastLine();
60 
61  void Refresh();
63  {
64  Refresh();
65  }
67  {
68  Refresh();
69  }
70  ~HintBox();
71  };
72 
73  //! sequence of hintboxes
74  class Help: public Windowing::Form
75  {
78  HintBox* hb;
79  size_t current_hint;
80  void NextSlide(LxS::Windowing::Button *b);
81  void PrevSlide(LxS::Windowing::Button *b);
82  public:
83  Help();
84  virtual void Dragged(float x, float y){}
85  void Clicked(float x, float y);
86  void Initialize();
87  void Arrange();
88  };
89 
90  //! if hint named "hint" wasn't displayed,
91  //! display it right now.
92  HintBox* DisplayHintBoxIfRequired(std::string hint);
93  }
94  }
95 }