SFML community forums
General => General discussions => Topic started by: drarem on May 21, 2011, 02:28:33 pm
-
In other words,
I want to have something like:
SFML * app;
app = new SFML(1024,768,32,fullscreen);
The value in this is I can build everything else into the class and only use the main code to do my calls. I am beginning to realize how simple SFML is and wondering this may make it somewhat more complicated but anyway..
app->loadsprites(char *spritedat, IMG *img, int xwid, int yhgt, int count);
-
I don't really understand your problem. Why don't you write an own class which has the behavior you want to achieve?
By the way, you don't need new to create an object of a class.
-
Erhm.. That looks like HGE... The gods forbid that SFML ever adopts that design!
-
Never heard of HGE, maybe picked it up along the way as a bad habit.
As for your question, I was thinking of not having to pass by reference the App pointer everywhere I go but then again that is what you're suggesting? Never thought of it that way.
-
As for your question, I was thinking of not having to pass by reference the App pointer everywhere I go
Passing it everywhere is certainly a bad idea. Only pass the sf::RenderWindow to the functions that really need access to it, i.e. input-handling or rendering functions. An even worse idea however is to have the window as a global variable.
But can you explain a little more precisely what you actually want to do? Do you want a single god class that is responsible of everything? What doesn't please you at SFML's current design?
-
I don't want to have to recreate the wheel every time in my games using the SFML library. Code one object manager, sprite manager, ... and be done with it. If I don't put my stuff into a class, how will my class be able to see SFML stuff without passing it? Let me know if I'm not making sense.
Rather than picking the pieces ouf of one game to start another, I would rather use something more modular.
-
I don't want to have to recreate the wheel every time in my games using the SFML library.
Do it like me: Develop a library that contains commonly used functionality and reuse code.
Code one object manager, sprite manager, ... and be done with it.
Then do it ;)
SFML is a basic multimedia library, no game engine. So, these things are out of scope for a direct integration. But you can use one of the many extensions (look at the wiki) or program your own one. It needn't be open source.
If I don't put my stuff into a class, how will my class be able to see SFML stuff without passing it? Let me know if I'm not making sense.
Your classes can also create SFML objects on their own, depending on the responsibility they have. Otherwise, pass objects around, where is the problem?