-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgame.cpp
More file actions
39 lines (33 loc) · 900 Bytes
/
Copy pathgame.cpp
File metadata and controls
39 lines (33 loc) · 900 Bytes
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
#include <SFML/Graphics.hpp>
#include <string>
#include "game.hpp"
#include <iostream>
Game::Game()
{
window.setFramerateLimit(60);
}
void Game::run(){
while(true)
{
window.clear(Color::Black);
if (Keyboard::isKeyPressed(Keyboard::Key::Escape)) break;
window.setTitle("Hova | mx: " + std::to_string(Mouse::getPosition(window).x) + " , my: " + std::to_string(Mouse::getPosition(window).y) + " | sx: " + std::to_string(ship.getPosition().x) + " , sy: " + std::to_string(ship.getPosition().y));
inputPhase();
updatePhase();
renderPhase();
}
}
void Game::inputPhase(){
}
void Game::updatePhase(){
ship.applyGravity();
//ship.followMouseLine(Mouse::getPosition(window));
ship.followMouseThrusters(Mouse::getPosition(window));
ship.update();
shipVector.update();
}
void Game::renderPhase(){
window.draw(ship.getShape());
window.draw(shipVector.getShape());
window.display();
}