SFML community forums
Help => Graphics => Topic started by: Jarwulf on January 21, 2010, 01:20:28 am
-
Hi I have
sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");
I have several objects on screen. I currently have all the objects displayed by
using App.Draw from main().
I want to make it so that the objects display under certain circumstances ie a collision between two causes them to disappear. So I figure I should transfer whether an object uses App.Draw from main to the object itself,controlled by an (if) statement. When I try to do something like
Object.objectwork(App);
I get errors. How would I accomplish what I want?
-
Detail about your errors please.
-
Detail about your errors please.
Something about can't access private member noncopyable. I guess that means a part of App is private and I can't use the whole thing as an argument so I wonder what part of App I can use. What sort of type is Draw?
-
sf::RenderWindow cannot be copied (for obvious reasons), you must pass it by reference to your function.
-
sf::RenderWindow cannot be copied (for obvious reasons), you must pass it by reference to your function.
Alright, I do that and I transfer responsibility for App.Draw to the objects themselves. so for
class obj
{
objaction(sf::RenderWindow& App)
{
App.Draw(Image);
App.Display
}
};
I get a flashing image. If I include App.Clear it gets even worse.
-
Don't call Display() after each element drawn, but call it once per frame (after drawing everything). The same applies to Clear() which should be called before anything is drawn on the screen.
-
nvrmind I think I figured it out