1 | /* |
---|
2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
3 | * > www.orxonox.net < |
---|
4 | * |
---|
5 | * |
---|
6 | * License notice: |
---|
7 | * |
---|
8 | * This program is free software; you can redistribute it and/or |
---|
9 | * modify it under the terms of the GNU General Public License |
---|
10 | * as published by the Free Software Foundation; either version 2 |
---|
11 | * of the License, or (at your option) any later version. |
---|
12 | * |
---|
13 | * This program is distributed in the hope that it will be useful, |
---|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | * GNU General Public License for more details. |
---|
17 | * |
---|
18 | * You should have received a copy of the GNU General Public License |
---|
19 | * along with this program; if not, write to the Free Software |
---|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
21 | * |
---|
22 | * Author: |
---|
23 | * Florian Zinggeler |
---|
24 | * |
---|
25 | */ |
---|
26 | |
---|
27 | #include "WagnisHUDinfo.h" |
---|
28 | |
---|
29 | #include "core/CoreIncludes.h" |
---|
30 | #include "core/XMLPort.h" |
---|
31 | #include "util/Convert.h" |
---|
32 | #include <string> |
---|
33 | |
---|
34 | namespace orxonox |
---|
35 | { |
---|
36 | RegisterClass(WagnisHUDinfo); |
---|
37 | |
---|
38 | WagnisHUDinfo::WagnisHUDinfo(Context* context) : OverlayText(context) |
---|
39 | { |
---|
40 | RegisterObject(WagnisHUDinfo); |
---|
41 | |
---|
42 | this->wagnisgame = nullptr; |
---|
43 | this->bShow_ = false; |
---|
44 | } |
---|
45 | |
---|
46 | void WagnisHUDinfo::tick(float dt) |
---|
47 | { |
---|
48 | SUPER(WagnisHUDinfo, tick, dt); |
---|
49 | if(wagnisgame==nullptr){ |
---|
50 | findWagnis(); |
---|
51 | } |
---|
52 | enum GameStage { NOT_READY, CHOOSE_PROVINCE_STAGE, REINFORCEMENT_STAGE, ATTACK_STAGE, MOVE_STAGE }; |
---|
53 | std::stringstream ss; |
---|
54 | switch(wagnisgame->gameStage){ |
---|
55 | case CHOOSE_PROVINCE_STAGE: { |
---|
56 | ss<<"Player "<<wagnisgame->active_player<<" choose a province to occupy"; |
---|
57 | setCaption( ss.str() ); |
---|
58 | break; |
---|
59 | } |
---|
60 | case REINFORCEMENT_STAGE: { |
---|
61 | ss<<"Player "<<wagnisgame->active_player<<" place your reinforcements"; |
---|
62 | setCaption( ss.str() ); |
---|
63 | break; |
---|
64 | } |
---|
65 | case ATTACK_STAGE: { |
---|
66 | ss<<"Player "<<wagnisgame->active_player<<" you can attack now"; |
---|
67 | setCaption( ss.str() ); |
---|
68 | break; |
---|
69 | } |
---|
70 | case MOVE_STAGE: { |
---|
71 | ss<<"Player "<<wagnisgame->active_player<<" you can reorganize your troops now"; |
---|
72 | setCaption( ss.str() ); |
---|
73 | break; |
---|
74 | } |
---|
75 | case NOT_READY: { |
---|
76 | ss<<""; |
---|
77 | setCaption( ss.str() ); |
---|
78 | break; |
---|
79 | } |
---|
80 | } |
---|
81 | } |
---|
82 | void WagnisHUDinfo::findWagnis(){ |
---|
83 | for (Wagnis* gb : ObjectList<Wagnis>()){ |
---|
84 | this->wagnisgame = gb; |
---|
85 | orxout()<<"Wagnis pointer found and added"<<endl; |
---|
86 | return; |
---|
87 | } |
---|
88 | } |
---|
89 | } |
---|