01-02-2005, 12:08 AM
Sorry again for reporting these bugs but there's a problem with redim. The compiler says there is a duplicate definition. Here's the code
Code:
'$include: 'win\kernel32.bi'
Type SDL_Rect
x as short
y as short
w as ushort
h as ushort
End Type
type SDL_PixelFormat
BitsPerPixel as ubyte
BytesPerPixel as ubyte
Rloss as ubyte
Gloss as ubyte
Bloss as ubyte
Aloss as ubyte
Rshift as ubyte
Gshift as ubyte
Bshift as ubyte
Ashift as ubyte
Rmask as uinteger
Gmask as uinteger
Bmask as uinteger
Amask as uinteger
colorkey as uinteger
alpha as ubyte
end type
Dim SDL_Init As Function CDECL (flags As UInteger) As Integer
Dim SDL_ListModes As Function CDECL (ByVal pixelfmt As Long, ByVal flags As UInteger) As Long
Dim CopyMemory As Sub(ByVal dst As Long ,ByVal src As Long ,ByVal size As Long)
Dim vidmodeptr As Long
Dim vidmodes() As SDL_Rect
Dim a As String, b As String, pixfmt As SDL_PixelFormat
Const SDL_INIT_VIDEO = &H20
Const SDL_FULLSCREEN = &H80000000
Function DLLFunc(dllname As String, dllproc As String) As Integer
Dim dllhand As Integer, tempfunc As Integer
dllhand = LoadLibrary(dllname)
If dllhand Then
tempfunc = GetProcAddress(dllhand, dllproc)
If tempfunc Then
DLLFunc = tempfunc
Else
DLLFunc = 0
End If
Else
DLLFunc = 0
End If
End Function
SDL_Init = DLLFunc("sdl.dll","SDL_Init")
SDL_ListModes = DLLFunc("sdl.dll", "SDL_ListModes")
CopyMemory = DLLFunc("kernel32.dll", "RtlMoveMemory")
Print "Init: ", SDL_Init(SDL_INIT_VIDEO)
ReDim vidmodes(7)
vidmodeptr = SDL_ListModes(Null,SDL_FULLSCREEN)
Print "Works: ", vidmodeptr
CopyMemory(VarPtr(vidmodes),vidmodeptr, Len(SDL_Rect)*7)
Print "Width: ", vidmodes(0)->w, "Height: ", vidmodes(0)->h
Do Until Inkey$ <> ""
Loop