Commit 1189153e4535abbbe7afb1a135e9d288cc9f8ad6

Authored by Olav Kjartan Larseng
1 parent 6863cc32

small patch, fixed text

SpaceShooterV4/app/main.cpp
... ... @@ -85,13 +85,14 @@ void display()
85 85 glColor3f(0.0, 0.0, 1.0);
86 86  
87 87 // Write text:
  88 + /*
88 89 strcpy_s(buffer, "Text example:");
89 90 _text.setPos(0.5f, 0.00f, -1.0f);
90 91 _text.printString(buffer, Text::FONT_NORMAL);
91   -
  92 + */
92 93 // Write sslf
93   - sprintf_s(buffer, "BLABLABLA");
94   - _text.setPos(0.00f, 0.00f, -1.0f);
  94 + sprintf_s(buffer, "WASD: Move, C: Change Weapon, Space: Shoot");
  95 + _text.setPos(-0.5f, -0.5f, -1.0f);
95 96 _text.printString(buffer, Text::FONT_NORMAL);
96 97  
97 98 // Write framerate
... ...
SpaceShooterV4/src/GameManager.cpp
... ... @@ -42,6 +42,13 @@ void GameManager::privateInit()
42 42 this->addSubObject(_enemy);
43 43 }
44 44  
  45 + for (int i = 0; i < 3; i++)
  46 + {
  47 + _enemy.reset(new Enemy(glm::vec3{ -130 + (25 * (i + 1)), 0, -1500 }, Enemy::Trajectory::FORWARD));
  48 + _enemy->_speed = 100.0f;
  49 + this->addSubObject(_enemy);
  50 + }
  51 +
45 52  
46 53 //_spotlight.reset(new Spotlight(glm::vec3{0,0,200}, 60, 80));
47 54 //this->addSubObject(_spotlight);
... ... @@ -129,6 +136,19 @@ void GameManager::fireFromSpaceship()
129 136 _bullet.reset(new Bullet(spaceshipmatrix, Bullet::Trajectory::FORWARD, 600.0f));
130 137 _bullet->addCollisionWith(this->getAllObjectOfType<Enemy>());
131 138 this->addSubObject(_bullet);
  139 +
  140 +
  141 + spaceshipmatrix[3].x -= 20;
  142 + spaceshipmatrix = glm::rotate(spaceshipmatrix, 0.2f, glm::vec3(0.0f, 1.0f, 0.0f));
  143 + _bullet.reset(new Bullet(spaceshipmatrix, Bullet::Trajectory::FORWARD, 600.0f));
  144 + _bullet->addCollisionWith(this->getAllObjectOfType<Enemy>());
  145 + this->addSubObject(_bullet);
  146 +
  147 + spaceshipmatrix[3].x += 20;
  148 + spaceshipmatrix = glm::rotate(spaceshipmatrix, 0.4f, glm::vec3(0.0f, -1.0f, 0.0f));
  149 + _bullet.reset(new Bullet(spaceshipmatrix, Bullet::Trajectory::FORWARD, 600.0f));
  150 + _bullet->addCollisionWith(this->getAllObjectOfType<Enemy>());
  151 + this->addSubObject(_bullet);
132 152 break;
133 153  
134 154 default:
... ... @@ -149,11 +169,14 @@ void GameManager::fireFromEnemy()
149 169 fireFlagEnemy = true;
150 170 _lastFireEnemy = Rolex::now();
151 171 auto enemies = this->getAllObjectOfType<Enemy>();
152   - int ran = this->random(int(0), int(enemies.size()) - int(1));
153   - auto enemyPick = enemies.at(ran);
154   - _bullet.reset(new Bullet(enemyPick->getMatrix(), Bullet::Trajectory::BACKWARD, 350.00f));
155   - _bullet->addCollisionWith(this->getSpaceShip());
156   - this->addSubObject(_bullet);
  172 + if (!enemies.empty())
  173 + {
  174 + int ran = this->random(int(0), int(enemies.size()) - int(1));
  175 + auto enemyPick = enemies.at(ran);
  176 + _bullet.reset(new Bullet(enemyPick->getMatrix(), Bullet::Trajectory::BACKWARD, 350.00f));
  177 + _bullet->addCollisionWith(this->getSpaceShip());
  178 + this->addSubObject(_bullet);
  179 + }
157 180 }
158 181 else if (duration_cast<milliseconds>(Rolex::now() - _lastFireEnemy).count() > 200)
159 182 {
... ...
SpaceShooterV4/x64/Debug/GameManager.obj
No preview for this file type
SpaceShooterV4/x64/Debug/SpaceShooterV4.log
1   - GameManager.cpp
  1 + main.cpp
  2 +d:\csmaster\opengl projects\projects\spaceshooterv4\spaceshooterv4\spaceshooterv4\include\fpscounter.hpp(60): warning C4244: 'return': conversion from '__int64' to 'double', possible loss of data
2 3 d:\csmaster\opengl projects\projects\spaceshooterv4\spaceshooterv4\spaceshooterv4\enemy.h(41): warning C4305: 'initializing': truncation from 'double' to 'float'
3 4 SOIL.lib(SOIL.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
4 5 LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification
... ...
SpaceShooterV4/x64/Debug/SpaceShooterV4.tlog/CL.write.1.tlog
1 1 Binary files a/SpaceShooterV4/x64/Debug/SpaceShooterV4.tlog/CL.write.1.tlog and b/SpaceShooterV4/x64/Debug/SpaceShooterV4.tlog/CL.write.1.tlog differ
... ...
SpaceShooterV4/x64/Debug/SpaceShooterV4.tlog/SpaceShooterV4.write.1u.tlog
1 1 Binary files a/SpaceShooterV4/x64/Debug/SpaceShooterV4.tlog/SpaceShooterV4.write.1u.tlog and b/SpaceShooterV4/x64/Debug/SpaceShooterV4.tlog/SpaceShooterV4.write.1u.tlog differ
... ...
SpaceShooterV4/x64/Debug/main.obj
No preview for this file type
SpaceShooterV4/x64/Debug/vc141.idb
No preview for this file type
SpaceShooterV4/x64/Debug/vc141.pdb
No preview for this file type
x64/Debug/SpaceShooterV4.exe
No preview for this file type
x64/Debug/SpaceShooterV4.pdb
No preview for this file type