First of all, here's my code:
#include "PlayState.hpp"
using namespace std;
PlayState::PlayState(Game *_game) {
game = _game;
/* Set up FPS string */
fps.setCharacterSize(12);
fps.setPosition(400, 320);
fps.setColor(sf::Color::Red);
player = new Player();
currentMap = new Tilemap("res/map1.txt", &(game->window));
}
void PlayState::setup() { }
void PlayState::update() {
sf::Event event;
while (game->window.pollEvent(event)) {
if (event.type == sf::Event::Closed) {
game->window.close();
} else if (event.type == sf::Event::KeyPressed) {
if (event.key.code == sf::Keyboard::Escape) {
game->window.close();
}
}
}
player->update();
}
void PlayState::draw() {
game->window.clear();
/* Draw the player */
//game->window.draw(*player);
/* Draw the map */
//currentMap->draw(400, 320);
/* Draw FPS */
fps.setString("Hi");
game->window.draw(fps);
game->window.display();
}
The only thing I'm drawing to the screen is a sf::Text, but it's not appearing on the screen. I'm using built-from-git SFML. I tried an older build, and it worked, I could see the sf::Text. When I changed its color, though, I got a floating point exception.
Any ideas on what I'm doing wrong?
EDITI also tried to dynamically allocate the sf::Text fps; and then do "fps = new sf::Text();" and what not, but it also didn't work.