No errors at all just doesnt display the text.
#include <SFML\Graphics.hpp>
#pragma once
class Menu
{
public:
Menu(void);
~Menu(void);
bool MainMenuLoad();
void Display(sf::RenderWindow* Display);
void SetText(sf::Text &Text,char* Output,int Size);
private:
sf::Font MainMenuFont;
sf::Text MainMenuText[5];
sf::Texture MainMenuTexture[5];
sf::Sprite MainMenuSprite[5];
};
#include "Menu.h"
Menu::Menu(void)
{
MainMenuLoad();
}
bool Menu::MainMenuLoad()
{
//Font
MainMenuFont.loadFromFile("Textures\\ka1.ttf");
MainMenuText[0].setFont(MainMenuFont);
MainMenuText[0].setString("Version: 0.1a");
MainMenuText[0].setCharacterSize(30);
MainMenuText[0].setPosition(0,1080-MainMenuText[0].getLocalBounds().height);
MainMenuText[1].setFont(MainMenuFont);
MainMenuText[1].setString("Singleplayer");
MainMenuText[1].setCharacterSize(75);
MainMenuText[1].setPosition(1920-MainMenuText[1].getLocalBounds().width,330);
MainMenuText[2].setFont(MainMenuFont);
MainMenuText[2].setString("Multiplayer");
MainMenuText[2].setCharacterSize(75);
MainMenuText[2].setPosition(1920-MainMenuText[2].getLocalBounds().width,420);
MainMenuText[3].setFont(MainMenuFont);
MainMenuText[3].setString("Options");
MainMenuText[3].setCharacterSize(75);
MainMenuText[3].setPosition(1920-MainMenuText[3].getLocalBounds().width,510);
MainMenuText[4].setFont(MainMenuFont);
MainMenuText[4].setString("Exit");
MainMenuText[4].setCharacterSize(75);
MainMenuText[4].setPosition(1920-MainMenuText[4].getLocalBounds().width,600);
//SetText(MainMenuText[0],"Version: 0.1a",100);
//Background Image
MainMenuTexture[0].loadFromFile("Textures\\Main_1.png");
MainMenuSprite[0].setTexture(MainMenuTexture[0]);
//Logo
MainMenuTexture[1].loadFromFile("Textures\\Logo.png");
MainMenuSprite[1].setTexture(MainMenuTexture[1]);
MainMenuSprite[1].scale(sf::Vector2f(1.5,1.5));
return true;
}
void Menu::SetText(sf::Text &Text,char* Output,int Size)
{
Text.setColor(sf::Color::White);
Text.setString(Output);
Text.setCharacterSize(Size);
Text.setPosition(0,0);
}
void Menu::Display(sf::RenderWindow* Display)
{
Display->draw(MainMenuSprite[0]);
Display->draw(MainMenuSprite[1]);
Display->draw(MainMenuText[0]);
Display->draw(MainMenuText[1]);
Display->draw(MainMenuText[2]);
Display->draw(MainMenuText[3]);
Display->draw(MainMenuText[4]);
}
So this is what I have so far. If I write out every single line like I have on the top it works. but when I try to use the SetText function which I made it. It complies with no errors but nothing actually shows up on the screen, which should be white text that says "Version: 0.1a".