Ok, I WAS trying to keep the code as simple as possible but ill show my exact code so you can get an idea of what I am trying to do
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
class game
{
public:
game();
// Irellivant functions that draw stuff to mWindow I made are here (they work!)
sf::RenderWindow mWindow;
// Irrelevant sf::Textures and such are here
};
game::game()
: mWindow(sf::VideoMode(1200, 720), Header)
{
// Load up all the textures
}
class MainMenu : public game // inherits all of the members of game
{
MainMenu();
// More irellivant functions
void drawButton();
sf::Sprite button;
sf::Texture buttonTexture
};
MainMenu::MainMenu()
{
// For the sake of simplicity, lets say I loaded the texture and assigned it to the "button" object
}
MainMenu::drawButton()
{
mWindow.draw(button); // this is the exact spot where the error "mWindow is an unknown type name" appears
}
This is where the IDE says it dosent know what mWindow is, I have read all the chapters in my book on classes and I deduced that since i inherited all of "game" public members I should also get "sf::RenderWindow mWindow"
Edit: AH HA! After flipping though my book for a few hours I remembered that the parent constructor is not automatically used! So as far as I could guess I was trying draw something onto something that didn't exist (as it was not initialized).
Well thanks for all your help guys and thanks for your patience