-
Notifications
You must be signed in to change notification settings - Fork 1
/
StateCity.cpp
491 lines (390 loc) · 20.2 KB
/
StateCity.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
//|||||||||||||||||||||||||||||||||||||||||||||||
#include "StateCity.h"
//|||||||||||||||||||||||||||||||||||||||||||||||
StateCity::StateCity()
{
m_pCamera = 0;
m_pLightP = 0;
m_pLightD_Left = 0;
m_pLightS = 0;
m_pMouse = 0;
m_pKey = 0;
m_pAnima = 0;
}
//|||||||||||||||||||||||||||||||||||||||||||||||
void StateCity::enter()
{
// Create SceneManager
OgreFramework::getSingletonPtr()->m_pLog->logMessage("Entering StateCity...");
m_pSceneMgr = OgreFramework::getSingletonPtr()->m_pRoot->createSceneManager(ST_EXTERIOR_CLOSE, "GameSceneMgr");
m_pSceneMgr->setShadowTechnique(SHADOWTYPE_STENCIL_ADDITIVE);
// m_pSceneMgr->setWorldGeometry("terrain.cfg");
// BeastMELEE
OgreFramework::getSingletonPtr()->m_pInstanceMgrBeastMelee = m_pSceneMgr->createInstanceManager("InstanceBeastMelee", "unit_beast_orc_level01.mesh", ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME, Ogre::InstanceManager::TextureVTF, 300, IM_USEALL);
// UndeadMELEE
OgreFramework::getSingletonPtr()->m_pInstanceMgrUndeadMelee = m_pSceneMgr->createInstanceManager("InstanceUndeadMelee", "undead_zombie_level01.mesh", ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME, Ogre::InstanceManager::TextureVTF, 300, IM_USEALL);
// HumanMELEE
// OgreFramework::getSingletonPtr()->m_pInstanceMgrHumanMelee = m_pSceneMgr->createInstanceManager("InstanceMelee", ".mesh", ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME, Ogre::InstanceManager::TextureVTF, 300, IM_USEALL);
// BeastRANGED
OgreFramework::getSingletonPtr()->m_pInstanceMgrBeastRanged = m_pSceneMgr->createInstanceManager("InstanceBeastRanged", "unit_beast_goblin_level01.mesh", ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME, Ogre::InstanceManager::TextureVTF, 300, IM_USEALL);
// UndeadRANGED
// OgreFramework::getSingletonPtr()->m_pInstanceMgrUndeadRanged = m_pSceneMgr->createInstanceManager("InstanceUndeadRanged", ".mesh", ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME, Ogre::InstanceManager::TextureVTF, 300, IM_USEALL);
// HumanRANGED
OgreFramework::getSingletonPtr()->m_pInstanceMgrHumanRanged = m_pSceneMgr->createInstanceManager("InstanceHumanRanged", "unit_human_level01_elf.mesh", ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME, Ogre::InstanceManager::TextureVTF, 300, IM_USEALL);
// BeastRIDER
OgreFramework::getSingletonPtr()->m_pInstanceMgrBeastRider = m_pSceneMgr->createInstanceManager("InstanceBeastRider", "unit_beast_centaur_level01.mesh", ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME, Ogre::InstanceManager::TextureVTF, 300, IM_USEALL);
// UndeadRIDER
// OgreFramework::getSingletonPtr()->m_pInstanceMgrUndeadRider = m_pSceneMgr->createInstanceManager("InstanceUndeadRider", ".mesh", ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME, Ogre::InstanceManager::TextureVTF, 300, IM_USEALL);
// HumanRIDER
// OgreFramework::getSingletonPtr()->m_pInstanceMgrHumanRider = m_pSceneMgr->createInstanceManager("InstanceHumanRider", ".mesh", ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME, Ogre::InstanceManager::TextureVTF, 300, IM_USEALL);
// UndeadMONSTER
OgreFramework::getSingletonPtr()->m_pInstanceMgrUndeadMonster = m_pSceneMgr->createInstanceManager("InstanceUndeadMonster", "unit_undead_level01_demon.mesh", ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME, Ogre::InstanceManager::TextureVTF, 300, IM_USEALL);
// BeastMONSTER
OgreFramework::getSingletonPtr()->m_pInstanceMgrBeastMonster = m_pSceneMgr->createInstanceManager("InstanceBeastMonster", "unit_beast_minotaur_level01.mesh", ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME, Ogre::InstanceManager::TextureVTF, 300, IM_USEALL);
// HumanMONSTER
OgreFramework::getSingletonPtr()->m_pInstanceMgrHumanMonster = m_pSceneMgr->createInstanceManager("InstanceHumanMonster", "unit_human_level01_golem.mesh", ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME, Ogre::InstanceManager::TextureVTF, 300, IM_USEALL);
// BeastWIZARD
OgreFramework::getSingletonPtr()->m_pInstanceMgrBeastWizard = m_pSceneMgr->createInstanceManager("InstanceBeastWizard", "unit_beast_level01_shaman.mesh", ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME, Ogre::InstanceManager::TextureVTF, 300, IM_USEALL);
// UndeadWIZARD
OgreFramework::getSingletonPtr()->m_pInstanceMgrUndeadWizard = m_pSceneMgr->createInstanceManager("InstanceUndeadWizard", "unit_undead_nicromante_level01.mesh", ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME, Ogre::InstanceManager::TextureVTF, 300, IM_USEALL);
// HumanWIZARD
// OgreFramework::getSingletonPtr()->m_pInstanceMgrHumanWizard = m_pSceneMgr->createInstanceManager("InstanceHumanWizard", ".mesh", ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME, Ogre::InstanceManager::TextureVTF, 300, IM_USEALL);
// HumanELITE
OgreFramework::getSingletonPtr()->m_pInstanceMgrHumanElite = m_pSceneMgr->createInstanceManager("InstanceHumanElite", "unit_human_level01_dwarf.mesh", ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME, Ogre::InstanceManager::TextureVTF, 300, IM_USEALL);
// BeastELITE
OgreFramework::getSingletonPtr()->m_pInstanceMgrBeastElite = m_pSceneMgr->createInstanceManager("InstanceBeastElite", "unit_beast_werewolf_level01.mesh", ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME, Ogre::InstanceManager::TextureVTF, 300, IM_USEALL);
// UndeadELITE
// OgreFramework::getSingletonPtr()->m_pInstanceMgrUndeadElite = m_pSceneMgr->createInstanceManager("InstanceUndeadElite", ".mesh", ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME, Ogre::InstanceManager::TextureVTF, 300, IM_USEALL);
// Initialize CameraCity
m_pCamera = new CameraCity();
m_pCamera->enter();
// Initialize the Input
m_pMouse = new InputMouse();
m_pKey = new InputKey();
m_pKey->openXML("keyKOK.xml");
m_pKey->parseXML();
// Initialize Lights
m_pLight_Custom = new LightDir(m_pSceneMgr, "Dir7", ColourValue(1.0f, 1.0f, 1.0f), ColourValue (0.0f, 0.0f, 0.0f), true, true);
// TERRAIN
//////////////////////////////////////////////////////////////////////////////////
m_pCamera->getOgreCamera()->setPosition(Ogre::Vector3(1683, 50, 2116));
m_pCamera->getOgreCamera()->lookAt(Ogre::Vector3(1963, 50, 1660));
m_pCamera->getOgreCamera()->setNearClipDistance(0.1);
m_pCamera->getOgreCamera()->setFarClipDistance(50000);
if (OgreFramework::getSingletonPtr()->m_pRoot->getRenderSystem()->getCapabilities()->hasCapability(Ogre::RSC_INFINITE_FAR_PLANE))
{
m_pCamera->getOgreCamera()->setFarClipDistance(0); // enable infinite far clip distance if we can
}
m_pSceneMgr->setAmbientLight(Ogre::ColourValue(0.2f, 0.2f, 0.2f));
createScene();
}
//|||||||||||||||||||||||||||||||||||||||||||||||
void StateCity::createScene()
{
/*
Plane plane;
plane.normal = Ogre::Vector3::UNIT_Y;
plane.d = 0;
MeshManager::getSingleton().createPlane("Myplane",
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane,
1500,1500,25,25,true,1,5,5,Ogre::Vector3::UNIT_Z);
Entity* pPlaneEnt = m_pSceneMgr->createEntity( "plane", "Myplane" );
pPlaneEnt->setMaterialName("Examples/Rockwall");
pPlaneEnt->setCastShadows(true);
m_pSceneMgr->getRootSceneNode()->createChildSceneNode(Ogre::Vector3(0,0,0))->attachObject(pPlaneEnt);
// Configure Lights
m_pLight_Custom->dirDirection(Ogre::Vector3(-0.5, -0.5, 0.0));
// Configure CameraCity
m_pCamera->getOgreCamera()->setNearClipDistance(0.1f);
m_pCamera->getOgreCamera()->setPosition(0, 0, -10);
m_pCamera->getOgreCamera()->lookAt(0, 0, 10);
m_pCamera->getOgreCamera()->getViewport()->setClearEveryFrame(true);
buildGUI();
FactoryEntity::getSingletonPtr()->newAIBuilding(ATTACK_MODE, BARRACK, 0, Ogre::Vector2(200, 200), Ogre::Vector2(0,0));
FactoryEntity::getSingletonPtr()->newAIBuilding(DEFENSE_MODE, HALL, 0, Ogre::Vector2(-200, -200), Ogre::Vector2(0,0));
FactoryEntity::getSingletonPtr()->newAIBuilding(DEFENSE_MODE, WALLS, 0, Ogre::Vector2(0, 0), Ogre::Vector2(0,0));
EntityCityManager::getSingletonPtr()->Enter();
for(int i = 0; i<2; i++)
{
// ATTACK A BARRACKS DE HALL
for(int j = 0; j<2; j++)
{
for(int k = 0; k<2; k++)
{
FactoryEntity::getSingletonPtr()->newAIUnit(DEFENSE_MODE, ELITE, HUMAN, Vector2(EntityCityManager::getSingletonPtr()->GetType(HALL)[0]->getPosition().x + k*30, EntityCityManager::getSingletonPtr()->GetType(HALL)[0]->getPosition().y + j*30),
Vector2(0, 0));
}
for(int k = 2; k<4; k++)
{
FactoryEntity::getSingletonPtr()->newAIUnit(DEFENSE_MODE, ELITE, HUMAN, Vector2(EntityCityManager::getSingletonPtr()->GetType(HALL)[0]->getPosition().x + k*30, EntityCityManager::getSingletonPtr()->GetType(HALL)[0]->getPosition().y + j*30),
Vector2(0, 0));
}
for(int k = 4; k<6; k++)
{
FactoryEntity::getSingletonPtr()->newAIUnit(DEFENSE_MODE, MONSTER, HUMAN, Vector2(EntityCityManager::getSingletonPtr()->GetType(HALL)[0]->getPosition().x + k*30, EntityCityManager::getSingletonPtr()->GetType(HALL)[0]->getPosition().y + j*30),
Vector2(0, 0));
}
for(int k = 6; k<8; k++)
{
FactoryEntity::getSingletonPtr()->newAIUnit(DEFENSE_MODE, MONSTER, HUMAN, Vector2(EntityCityManager::getSingletonPtr()->GetType(HALL)[0]->getPosition().x + k*30, EntityCityManager::getSingletonPtr()->GetType(HALL)[0]->getPosition().y + j*30),
Vector2(0, 0));
}
for(int k = 8; k<10; k++)
{
FactoryEntity::getSingletonPtr()->newAIUnit(DEFENSE_MODE, RANGED, HUMAN, Vector2(EntityCityManager::getSingletonPtr()->GetType(HALL)[0]->getPosition().x + k*30, EntityCityManager::getSingletonPtr()->GetType(HALL)[0]->getPosition().y + j*30),
Vector2(0, 0));
}
for(int k = 10; k<12; k++)
{
FactoryEntity::getSingletonPtr()->newAIUnit(DEFENSE_MODE, RANGED, HUMAN, Vector2(EntityCityManager::getSingletonPtr()->GetType(HALL)[0]->getPosition().x + k*30, EntityCityManager::getSingletonPtr()->GetType(HALL)[0]->getPosition().y + j*30),
Vector2(0, 0));
}
}
}
for(int i = 0; i<2; i++)
{
// ATTACK A BARRACKS DE HALL
for(int j = 0; j<2; j++)
{
for(int k = 0; k<2; k++)
{
FactoryEntity::getSingletonPtr()->newAIUnit(ATTACK_MODE, MELEE, BEAST, Vector2(EntityCityManager::getSingletonPtr()->GetType(HALL)[0]->getPosition().x + k*30, EntityCityManager::getSingletonPtr()->GetType(BARRACK)[0]->getPosition().y + j*30),
Vector2(0, 0));
}
for(int k = 2; k<4; k++)
{
FactoryEntity::getSingletonPtr()->newAIUnit(ATTACK_MODE, MELEE, BEAST, Vector2(EntityCityManager::getSingletonPtr()->GetType(HALL)[0]->getPosition().x + k*30, EntityCityManager::getSingletonPtr()->GetType(BARRACK)[0]->getPosition().y + j*30),
Vector2(0, 0));
}
for(int k = 4; k<6; k++)
{
FactoryEntity::getSingletonPtr()->newAIUnit(ATTACK_MODE, RANGED, BEAST, Vector2(EntityCityManager::getSingletonPtr()->GetType(HALL)[0]->getPosition().x + k*30, EntityCityManager::getSingletonPtr()->GetType(BARRACK)[0]->getPosition().y + j*30),
Vector2(0, 0));
}
for(int k = 6; k<8; k++)
{
FactoryEntity::getSingletonPtr()->newAIUnit(ATTACK_MODE, RANGED, BEAST, Vector2(EntityCityManager::getSingletonPtr()->GetType(HALL)[0]->getPosition().x + k*30, EntityCityManager::getSingletonPtr()->GetType(BARRACK)[0]->getPosition().y + j*30),
Vector2(0, 0));
}
for(int k = 8; k<10; k++)
{
FactoryEntity::getSingletonPtr()->newAIUnit(ATTACK_MODE, RIDER, BEAST, Vector2(EntityCityManager::getSingletonPtr()->GetType(HALL)[0]->getPosition().x + k*30, EntityCityManager::getSingletonPtr()->GetType(BARRACK)[0]->getPosition().y + j*30),
Vector2(0, 0));
}
for(int k = 10; k<12; k++)
{
FactoryEntity::getSingletonPtr()->newAIUnit(ATTACK_MODE, RIDER, BEAST, Vector2(EntityCityManager::getSingletonPtr()->GetType(HALL)[0]->getPosition().x + k*30, EntityCityManager::getSingletonPtr()->GetType(BARRACK)[0]->getPosition().y + j*30),
Vector2(0, 0));
}
for(int k = 12; k<14; k++)
{
FactoryEntity::getSingletonPtr()->newAIUnit(ATTACK_MODE, WIZARD, BEAST, Vector2(EntityCityManager::getSingletonPtr()->GetType(HALL)[0]->getPosition().x + k*30, EntityCityManager::getSingletonPtr()->GetType(BARRACK)[0]->getPosition().y + j*30),
Vector2(0, 0));
}
for(int k = 14; k<16; k++)
{
FactoryEntity::getSingletonPtr()->newAIUnit(ATTACK_MODE, WIZARD, BEAST, Vector2(EntityCityManager::getSingletonPtr()->GetType(HALL)[0]->getPosition().x + k*30, EntityCityManager::getSingletonPtr()->GetType(BARRACK)[0]->getPosition().y + j*30),
Vector2(0, 0));
}
for(int k = 16; k<18; k++)
{
FactoryEntity::getSingletonPtr()->newAIUnit(ATTACK_MODE, MONSTER, BEAST, Vector2(EntityCityManager::getSingletonPtr()->GetType(HALL)[0]->getPosition().x + k*30, EntityCityManager::getSingletonPtr()->GetType(BARRACK)[0]->getPosition().y + j*30),
Vector2(0, 0));
}
for(int k = 18; k<20; k++)
{
FactoryEntity::getSingletonPtr()->newAIUnit(ATTACK_MODE, MONSTER, BEAST, Vector2(EntityCityManager::getSingletonPtr()->GetType(HALL)[0]->getPosition().x + k*30, EntityCityManager::getSingletonPtr()->GetType(BARRACK)[0]->getPosition().y + j*30),
Vector2(0, 0));
}
}
}*/
}
//|||||||||||||||||||||||||||||||||||||||||||||||
void StateCity::update(double timeSinceLastFrame)
{
/*
EntityCityManager::getSingletonPtr()->Update(timeSinceLastFrame * 0.03);
FactoryGraphics::getSingletonPtr()->Update(timeSinceLastFrame);
*/
m_FrameEvent.timeSinceLastFrame = timeSinceLastFrame;
OgreFramework::getSingletonPtr()->m_pTrayMgr->frameRenderingQueued(m_FrameEvent);
// getInput();
// m_pCamera->update(timeSinceLastFrame);
}
//|||||||||||||||||||||||||||||||||||||||||||||||
bool StateCity::pause()
{
OgreFramework::getSingletonPtr()->m_pLog->logMessage("Pausing StateCity...");
return true;
}
//|||||||||||||||||||||||||||||||||||||||||||||||
void StateCity::resume()
{
OgreFramework::getSingletonPtr()->m_pLog->logMessage("Resuming StateCity...");
}
//|||||||||||||||||||||||||||||||||||||||||||||||
void StateCity::exit()
{
OgreFramework::getSingletonPtr()->m_pLog->logMessage("Leaving StateCity...");
delete m_pCamera;
delete m_pKey;
delete m_pMouse;
delete m_pAnima;
if (m_pSceneMgr)
OgreFramework::getSingletonPtr()->m_pRoot->destroySceneManager(m_pSceneMgr);
}
//|||||||||||||||||||||||||||||||||||||||||||||||
bool StateCity::keyPressed(const OIS::KeyEvent &keyEventRef)
{
if (m_pKey->keyESC())
{
shutdown();
return true;
}
return true;
}
//|||||||||||||||||||||||||||||||||||||||||||||||
bool StateCity::keyReleased(const OIS::KeyEvent &keyEventRef)
{
OgreFramework::getSingletonPtr()->keyPressed(keyEventRef);
return true;
}
//|||||||||||||||||||||||||||||||||||||||||||||||
bool StateCity::mouseMoved(const OIS::MouseEvent &evt)
{
m_pMouse->setMouseInUpRegion(false);
m_pMouse->setMouseInDownRegion(false);
m_pMouse->setMouseInLeftRegion(false);
m_pMouse->setMouseInRightRegion(false);
m_pMouse->mouseMov(evt);
// Zoom Camera
if (m_pCamera) m_pCamera->zoomCam(evt.state.Z.rel);
// Rotate Camera
if (m_pMouse->getRMouseDown())
m_pCamera->rotCam(evt.state.X.rel,evt.state.Y.rel);
else
{
float w = (m_pMouse->getWidth() / float(evt.state.width));
float v = (m_pMouse->getHeight() / float(evt.state.height));
// Move Camera to Right when cursor is in the Right zone
if (w>0.95)
{
m_pMouse->setMouseInRightRegion(true);
return true;
}
// Move Camera to Left when cursor is in the Left zone
if (w<0.05)
{
m_pMouse->setMouseInLeftRegion(true);
return true;
}
// Move Camera to Down when cursor is in the Down zone
if (v>0.95)
{
m_pMouse->setMouseInDownRegion(true);
return true;
}
// Move Camera to Up when cursor is in the Up zone
if (v<0.05)
{
m_pMouse->setMouseInUpRegion(true);
return true;
}
}
return true;
}
//|||||||||||||||||||||||||||||||||||||||||||||||
bool StateCity::mousePressed(const OIS::MouseEvent &evt, OIS::MouseButtonID id)
{
if (OgreFramework::getSingletonPtr()->m_pTrayMgr->injectMouseDown(evt, id))
return true;
// Left Button Mouse is pressed
if (id == OIS::MB_Left)
{
onLeftPressed(evt);
m_pMouse->setLMouseDown(true);
}
// Right Button Mouse is pressed
else if (id == OIS::MB_Right)
{
m_pMouse->hide();
m_pMouse->setRMouseDown(true);
}
if (evt.state.buttonDown(OIS::MB_Left)||evt.state.buttonDown(OIS::MB_Right))
{
m_pMouse->convertB(id);
}
return true;
}
//|||||||||||||||||||||||||||||||||||||||||||||||
bool StateCity::mouseReleased(const OIS::MouseEvent &evt, OIS::MouseButtonID id)
{
if (m_pMouse->mouseRel(evt, id))
{
// Left Button Mouse is released
if (id == OIS::MB_Left)
{
m_pMouse->setLMouseDown(false);
}
// Right Button Mouse is released
else if (id == OIS::MB_Right)
{
m_pMouse->show();
m_pMouse->setRMouseDown(false);
}
}
return true;
}
//|||||||||||||||||||||||||||||||||||||||||||||||
bool StateCity::onLeftPressed(const OIS::MouseEvent &evt)
{
return true;
}
//|||||||||||||||||||||||||||||||||||||||||||||||
bool StateCity::getInput()
{
m_pCamera->cameraDir();
m_pCamera->setTranslateVector(Ogre::Vector3::ZERO);
if (m_pKey->keyLeft() || m_pMouse->getMouseInLeftRegion())
{
m_pCamera->moveLeft();
return true;
}
if (m_pKey->keyRight() || m_pMouse->getMouseInRightRegion())
{
m_pCamera->moveRight();
return true;
}
if (m_pKey->keyUp() || m_pMouse->getMouseInUpRegion())
{
m_pCamera->moveUp();
return true;
}
if (m_pKey->keyDown() || m_pMouse->getMouseInDownRegion())
{
m_pCamera->moveDown();
return true;
}
Ogre::Vector3 auxT = m_pCamera->getTranslateVector();
auxT.normalise();
m_pCamera->setTranslateVector(auxT);
m_pCamera->setTranslateVector(m_pCamera->getTranslateVector()*m_pCamera->getMoveScale());
return true;
}
//|||||||||||||||||||||||||||||||||||||||||||||||
void StateCity::buildGUI()
{
OgreFramework::getSingletonPtr()->m_pTrayMgr->showFrameStats(OgreBites::TL_BOTTOMLEFT);
OgreFramework::getSingletonPtr()->m_pTrayMgr->showLogo(OgreBites::TL_BOTTOMRIGHT);
OgreFramework::getSingletonPtr()->m_pTrayMgr->createLabel(OgreBites::TL_TOP, "GameLbl", "Game mode", 250);
OgreFramework::getSingletonPtr()->m_pTrayMgr->showCursor();
Ogre::StringVector items;
items.push_back("cam.pX");
items.push_back("cam.pY");
items.push_back("cam.pZ");
items.push_back("cam.oW");
items.push_back("cam.oX");
items.push_back("cam.oY");
items.push_back("cam.oZ");
items.push_back("Mode");
}