[SDL] BMP is not drawed

sebastian at barfoot.mine.nu sebastian at barfoot.mine.nu
Wed Sep 7 13:08:53 PDT 2005


Yes i do call LoadBMP() in the konstruktor of the class.

>
> 	maybe it's an obvious thing, but did you call testi.loadBMP() before
> calling to testi.draw(...) ?
>
> ++++++++++++++++++++++++++++++++
> ALBERT FERNANDEZ MARSAL
> CIRSA INTERACTIVE CORP. SL
> Analista senior y programador
> ++++++++++++++++++++++++++++++++
>
>
>
> -----Mensaje original-----
> De: sdl-bounces+afmarsal=cirsa.com at libsdl.org
> [mailto:sdl-bounces+afmarsal=cirsa.com at libsdl.org] En nombre de
> sebastian at barfoot.mine.nu
> Enviado el: miércoles, 07 de septiembre de 2005 17:23
> Para: sdl at libsdl.org
> Asunto: [SDL] BMP is not drawed
>
> Hello
>
> I've got a little problem with my first project with SDL
>
> Theres a class "CPlayer" (short version):
>  -------------------------------------------------------------------
> class CPlayer {
>    public:
>       /* Spielerbitmap laden */
>       int LoadBMP();
>       /* Spieler zeichnen */
>       void Draw(SDL_Surface *target);
>    private:
>        /* SDL_Surface für das Bitmap */
>        SDL_Surface *bmp;
>        /* Muss der Spieler geupdatet werden */
>        bool update;
> };
>
> int CPlayer::LoadBMP() {
>    bmp = SDL_LoadBMP("gfx/player.bmp");
>    if (!bmp) {
>         fprintf(stderr, "Bitmap konnte nicht geladen werden: %s\n",
>             SDL_GetError());
>         exit(4);
>     }
>     return 0;
> }
>
> void CPlayer::Draw(SDL_Surface *target) {
>    if(update) {
>       SDL_BlitSurface(bmp, 0, target, 0);
>       SDL_UpdateRect(target, 0, 0, 0, 0);
>    }
> }
>  -------------------------------------------------------------------
> n
> With this class i create a player named "testi". "testi" gets some
> information with a konstruktor (position, update or no update, LoadBMP()
> etc.).
>
> Then i try to draw the picture with "testi.draw(screen)" but nothing
> happens. The variable update hast the value true and the Surface screen
> does exist.
>
> If i do the whole thing without a class it works.
> can you help me?
>
>
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
>
>
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
>






More information about the SDL mailing list