I have recently created my account here and wanted to ask this simple question just to start getting familiar with the forum.
I am starting my first project with SFML wich is a basic 2D scroller prototype. I decided to implement a State Machine for the Main Menu and the Game scene, using inheritance. Something like:
// Base class
class State {
...
virtual void Update(float deltaTime);
...
}
// Derived classes
class MainMenu : public State {
...
}
class GameScene : public State {
...
}
Should I make my State class inherit from sf::Drawable? That enables me to do:
_window->draw(myAmazingState.top());
// rather than myAmazingState.top().Draw(_window);
Do you think this will cause me any trouble late in the development?
By the way, this will be called in my Application::Draw() function:
void Application::Draw() {
_window->clear(0,0,0,255);
...
_window->draw(myAmazingState.top());
...
_window->display();
}
I found SFML very well written. So I would love to start participating in this froum. Thanks in advance!