ScummVM API documentation
CreditScreen.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 /*
23  * This code is based on the CRAB engine
24  *
25  * Copyright (c) Arvind Raja Yadav
26  *
27  * Licensed under MIT
28  *
29  */
30 
31 #ifndef CRAB_CREDITSCREEN_H
32 #define CRAB_CREDITSCREEN_H
33 
34 #include "crab/ui/button.h"
35 #include "crab/ui/ImageData.h"
36 #include "crab/ui/TextData.h"
37 
38 namespace Crab {
39 
40 namespace pyrodactyl {
41 namespace ui {
42 class CreditScreen {
43  // Text and formatting information
44  struct CreditText {
45  // Title of the section (stuff like programmer, designer etc)
46  Common::String _text;
47 
48  // The style it should be drawn in
49  bool _heading;
50  };
51 
52  // The background image and company logo
53  pyrodactyl::ui::ImageData _bg, _logo;
54 
55  // The names displayed in the credits
57 
58  // The starting position
59  Vector2i _start;
60 
61  // The current position
62  Vector2D<long> _cur;
63 
64  // Text parameters
65  struct TextParam {
66  int _inc, _color;
67  FontKey _font;
68  Align _align;
69 
70  TextParam() {
71  _inc = 30;
72  _color = 0;
73  _font = 1;
74  _align = ALIGN_CENTER;
75  }
76 
77  void load(rapidxml::xml_node<char> *node) {
78  loadNum(_inc, "inc", node);
79  loadNum(_color, "color", node);
80  LoadFontKey(_font, "font", node);
81  loadAlign(_align, node);
82  }
83  } _heading, _paragraph;
84 
85  // All speed levels at which credits can scroll through
86  struct ScrollSpeed {
87  // The current speed
88  float _cur;
89 
90  // Various levels
91  float _slow, _fast, _reverse;
92 
93  ScrollSpeed() {
94  _slow = 1.0f;
95  _fast = 4.0f;
96  _reverse = -2.0f;
97  _cur = _slow;
98  }
99  } _speed;
100 
101  // Speed controls for credits
102  Button _fast, _slow, _reverse, _pause;
103 
104  // The back button, website and twitter buttons
105  Button _back, _website, _twitter;
106 
107 public:
108  CreditScreen() {
109  reset();
110  }
111 
112  ~CreditScreen() {}
113 
114  void load(const Common::Path &filename);
115  void reset();
116 
117  bool handleEvents(Common::Event &event);
118 
119  void draw();
120 
121  void setUI();
122 };
123 } // End of namespace ui
124 } // End of namespace pyrodactyl
125 
126 } // End of namespace Crab
127 
128 #endif // CRAB_CREDITSCREEN_H
Definition: str.h:59
Definition: CreditScreen.h:42
Definition: ImageData.h:40
Definition: path.h:52
Definition: events.h:199
Definition: moveeffect.h:37
Definition: button.h:86