ScummVM API documentation
LoadingScreen.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_LOADINGSCREEN_H
32 #define CRAB_LOADINGSCREEN_H
33 
34 #include "crab/image/Image.h"
35 #include "crab/ScreenSettings.h"
36 #include "crab/timer.h"
37 #include "crab/vectors.h"
38 
39 namespace Crab {
40 
42  struct Screen {
43  // The background image
45 
46  Screen(rapidxml::xml_node<char> *node) {
47  _bg.load(node, "bg");
48  }
49 
50  void clear() {
51  _bg.deleteImage();
52  }
53 
54  void draw() {
55  _bg.draw((g_engine->_screenSettings->_cur.w - _bg.w()) / 2, (g_engine->_screenSettings->_cur.h - _bg.h()) / 2);
56  }
57  };
58 
59  // The different loading screens
60  Common::Array<Screen> _screen;
61 
62  // The current loading screen
63  uint _cur;
64 
65  // The text image (says loading)
67 
68 public:
69  LoadingScreen() { _cur = 0; };
70  ~LoadingScreen(){};
71 
72  void change() {
73  _cur = g_engine->getRandomNumber(_screen.size() - 1);
74  }
75 
76  void load();
77  void draw();
78  void dim();
79  void quit();
80 };
81 
82 } // End of namespace Crab
83 
84 #endif // CRAB_LOADINGSCREEN_H
Engine * g_engine
Definition: LoadingScreen.h:41
Definition: Image.h:51
size_type size() const
Definition: array.h:315
Definition: moveeffect.h:37