News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Problem when using SDL...

Started by Transcendencja, April 04, 2007, 06:44:57 PM

Previous topic - Next topic

Transcendencja

Hello again!
I'm trying to write simple game with SDL and I don't know what's going on.
My code:

        push SDL_INIT_VIDEO
        call [SDL_Init]
        add esp, 0x4

        push SDL_SWSURFACE
        push 0x20
        push 0x1E0
        push 0x280
        call [SDL_SetVideoMode]
        add esp, 0x10

        mov dword [sdl_screen_ptr], eax
       
        push eax
        call [SDL_LockSurface]
        add esp, 0x4

Now, I want to use SDL_Surface.pixels pointer (SDL_SetVideoMode returns pointer to SDL_Surface *screen) and draw something, but it has value 0x0000baad. I tried doing it with locking and without locking, but results was the same. Applications written in C++ work fine. Maybe I'm missing something? :/

japheth

search your definition of SDL_Surface. For MASM it should begin like this:

SDL_Surface struct 4

It's important that members are dword aligned

Transcendencja