So I was happily coding away and then I realised that I had screwed up somewhere in a constructor (because the build failed)... ok... so I go to the constructor and this happened:
ok... this is ok... I can fix this... (or so I thought)
5 mins lateryeah...
Here is the code
/*
* Game.cpp
* Written by James Yeoman
*/
#include "Game.h"
Game::Game(uint16_t windowWidth, uint16_t windowHeight, std::string title)
{
this->window = sf::RenderWindow(sf::VideoMode(windowWidth, windowHeight), title);
this->window.setVerticalSyncEnabled(true);
this->score = 0;
this->isRoundOver = false;
}
void Game::createEntities()
{
p1 = Paddle(sf::Vector2f(20, 100), 1);
}
void Game::startLoop()
{
createEntities();
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
p1.Update();
window.draw(p1.getBody());
window.display();
}
}
/*
* Game.h
* Written by James Yeoman
*/
#pragma once
#include "Paddle.h"
#include "Ball.h"
#include <SFML/Graphics.hpp>
class Game
{
private:
sf::RenderWindow window;
uint16_t WindowWidth;
uint16_t WindowHeight;
uint8_t score;
Paddle p1;
Paddle p2;
bool isRoundOver;
void createEntities();
public:
Game(uint16_t, uint16_t, std::string);
void startLoop();
};