46
General / Trouble understanding SFML
« on: December 29, 2009, 01:00:44 am »
Since I'm one of the people switching from Allegro to SFML I'm just having a bit of trouble understanding how to correctly use the API (my brain is stuck to think in the way that works for Allegro). My main problem right now is not knowing where to correctly use sf::Event, sf:: Input, and sf::RenderWindow. Like if I have a separate function for my games main menu, another function for the options screen, and another function for the actual game itself do I need to create a whole new set of Event, Input, and RenderWindow classes for each function? Example:
And another thing... is there a way to quickly output numbers to the screen? sf::String doesn't work with integers (atleast it won't for me).
-Thanks in advance.
Code: [Select]
void main_menu_loop()
{
// New RenderWindow?
// New Input?
// New Event?
/*
The main menu loop.
*/
}
int main()
{
RenderWindow Screen(VideoMode(800, 600, 32), "DUEL", Style::Close);
const Input & iInput = Screen.GetInput();
Event eEvent;
main_menu_loop();
while(Screen.IsOpened())
{
//Main game loop
}
return 0;
}
And another thing... is there a way to quickly output numbers to the screen? sf::String doesn't work with integers (atleast it won't for me).
-Thanks in advance.