The object has a member function that returns a pointer to SDL_Surface which holds the objects animation frames. It also has a function that returns the objects icon. The problem is that the object returns the icon successfully, but can’t return the animation frames!
If I call
screen.draw(object->getFrame(0), 100, 100);
it draws nothing to the screen (the function works properly, I’ve tested that). Then if I call
screen.draw(object->getIcon(), 100, 100);
it draws the objects icon perfectly well to the screen. What causes this? Is it a problem with SDL or with my C++ code?–
– Ville Koskinen @Ville_Koskinen
Finland
Please post the getFrame(int index);,
also are you sure, you are initialize well frames[ ]; ?
Jocelyn.
“Ville Koskinen” <viller.koskinen at iobox.com> a ?crit dans le message news:
mailman.1004607961.1046.sdl at libsdl.org…
Hi,
I’m coding a 2D 3rd-person shoot’em’up with C++ and have this problem with
classes and SDL:
class Screen
{
public:
void draw(SDL_Surface *what, int x, int y);
}
This function draws an SDL_Surface to the screen and it needs a pointer to
SDL_Surface.
The object has a member function that returns a pointer to SDL_Surface
which holds the objects animation frames. It also has a function that
returns the objects icon. The problem is that the object returns the icon
successfully, but can’t return the animation frames!
If I call
screen.draw(object->getFrame(0), 100, 100);
it draws nothing to the screen (the function works properly, I’ve tested
that). Then if I call
screen.draw(object->getIcon(), 100, 100);
it draws the objects icon perfectly well to the screen. What causes this?
Is it a problem with SDL or with my C++ code?>
– Ville Koskinen
viller.koskinen at iobox.com
Finland