Hello! Sorry, if this is a dumb question, I'm still learning!
I'm trying to implement Font/Text with SFML 3.0.0.
Game.h#pragma once
#include <iostream>
#include <vector>
#include <ctime>
#include <sstream>
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/Audio.hpp>
#include <SFML/Network.hpp>
//Class that acts as the game engine.
class Game
{
private:
//Variables
//Window
sf::RenderWindow* window;
//Mouse positions
sf::Vector2i mousePosWindow;
sf::Vector2f mousePosView;
//Resources
sf::Font font;
sf::Text uiText;
//Game logic
bool endGame;
unsigned points;
float enemySpawnTimer;
float enemySpawnTimerMax;
int maxEnemies;
bool mouseHeld;
int health;
//Game objects
std::vector<sf::RectangleShape> enemies;
sf::RectangleShape enemy;
//Private functions
void initVariables();
void initWindow();
void initFonts();
void initText();
void initEnemies();
public:
//constructors, destructors
Game();
virtual ~Game();
//Accessors
const bool running() const;
const bool getEndGame() const;
//Functions
void spawnEnemy();
void pollEvents();
void updateMousePositions();
void updateText();
void updateEnemies();
void update();
void renderText(sf::RenderTarget& target);
void renderEnemies(sf::RenderTarget& target);
void render();
};
Game.cppvoid Game::initFonts()
{
this->font.openFromFile("Fonts/apercumovistarbold.ttf");
}
void Game::initText()
{
this->uiText.setFont(this->font);
this->uiText.setCharacterSize(24);
this->uiText.setFillColor(sf::Color::White);
this->uiText.setString("None");
}
Game::Game()
{
this->initVariables();
this->initWindow();
this->initFonts();
this->initText();
this->initEnemies();
}
Game::~Game()
{
delete this->window;
}
(I included only important parts of the code for this problem).
The error I'm getting is:
"no default constructor exists for class "sf::Text"Any help would be appreciated