1 ////////////////////////////////////////////////////////////////////////////////
2 // Scorched3D (c) 2000-2009
4 // This file is part of Scorched3D.
6 // Scorched3D is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
11 // Scorched3D is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with Scorched3D; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 ////////////////////////////////////////////////////////////////////////////////
21 #include <engine/GameStateI.h>
23 std::vector
<std::string
> GameStateI::perfCounterNames_
;
25 GameStateI::GameStateI(const char *name
) :
31 GameStateI::~GameStateI()
36 void GameStateI::simulate(const unsigned state
, float simTime
)
41 void GameStateI::draw(const unsigned state
)
46 void GameStateI::keyboardCheck(const unsigned state
, float frameTime
,
47 char *buffer
, unsigned int keyState
,
48 KeyboardHistory::HistoryElement
*, int hcount
,
54 void GameStateI::mouseDown(const unsigned state
, GameState::MouseButton button
,
55 int x
, int y
, bool &skipRest
)
60 void GameStateI::mouseUp(const unsigned state
, GameState::MouseButton button
,
61 int x
, int y
, bool &skipRest
)
66 void GameStateI::mouseDrag(const unsigned state
, GameState::MouseButton button
,
67 int x
, int y
, int dx
, int dy
, bool &skipRest
)
72 void GameStateI::mouseWheel(const unsigned state
, int x
, int y
, int z
, bool &skipRest
)
77 void GameStateI::enterState(const unsigned state
)
82 int GameStateI::getPerfCounter(const char *perfName
)
84 for (int i
=0; i
<(int) perfCounterNames_
.size(); i
++)
86 if (0 == strcmp(perfCounterNames_
[i
].c_str(), perfName
)) return i
;
89 perfCounterNames_
.push_back(perfName
);
90 return int(perfCounterNames_
.size() - 1);
93 void GameStateI::startPerfCount(int counter
)
95 while (int(perfCounters_
.size()) <= counter
)
97 perfCounters_
.push_back(new GameStatePerfCounter(perfCounterNames_
[perfCounters_
.size()].c_str()));
99 perfCounters_
[counter
]->start();
102 void GameStateI::endPerfCount(int counter
)
104 while (int(perfCounters_
.size()) <= counter
)
106 perfCounters_
.push_back(new GameStatePerfCounter(perfCounterNames_
[perfCounters_
.size()].c_str()));
108 perfCounters_
[counter
]->end();