Your problem is the SDL_SetVideoMode function returns a pointer to that structure.
For some reason, this doesn't work (I get an unhandled memory exception in the catch):
For some reason, this doesn't work (I get an unhandled memory exception in the catch):
Import "-lsdl" Extern "C" Type SDL_Surface Field flags:Int Field format:Byte Ptr Field w:Int, h:Int Field pitch:Short Field __unused_align_1:Short Field pixels:Byte Ptr Field offset:Int Field hwdata:Byte Ptr Field clip_rect_x:Short Field clip_rect_y:Short Field clip_rect_w:Short Field clip_rect_h:Short Field unused1:Int Field locked:Int Field map:Byte Ptr Field format_version:Int Field refcount:Int End Type Function SDL_Init(Flags:Int) Function SDL_SetVideoMode:SDL_Surface Ptr (Width:Int, Height:Int, Depth:Int, Flags:Int) Function SDL_Flip(Screen:SDL_Surface Ptr) Function SDL_FillRect(dst:SDL_Surface Ptr, dstrect:Byte Ptr, color:Int) End Extern Const SDL_INIT_VIDEO = $00000020 Const SDL_HWSURFACE = $00000001 Const SDL_DOUBLEBUF = $40000000 Const SDL_FULLSCREEN = $80000000 If SDL_Init(SDL_INIT_VIDEO)=-1 End EndIf Print "Hello!" Local ScreenSurface:SDL_Surface Ptr = SDL_SetVideoMode(800,600,32,SDL_HWSURFACE|SDL_DOUBLEBUF) Try Print ScreenSurface[0].w Print ScreenSurface[0].h Catch e : Object Print e.ToString(); End Try WaitKey Repeat SDL_FillRect(ScreenSurface,Null,$FFFFFF) SDL_Flip(ScreenSurface) FlushMem() Until KeyHit(KEY_ESCAPE)