Просмотр исходного кода

Changed to SuperStrict. Extended flags to Long.

Brucey 3 лет назад
Родитель
Сommit
42e5040a4d

+ 45 - 42
d3d9max2d.mod/d3d9max2d.bmx

@@ -1,5 +1,5 @@
 
-Strict
+SuperStrict
 
 Rem
 bbdoc: Graphics/Direct3D9 Max2D
@@ -8,10 +8,13 @@ The Direct3D9 Max2D module provides a Direct3D9 driver for #Max2D.
 End Rem
 Module BRL.D3D9Max2D
 
-ModuleInfo "Version: 1.01"
+ModuleInfo "Version: 1.02"
 ModuleInfo "License: zlib/libpng"
 ModuleInfo "Copyright: Blitz Research Ltd"
 
+ModuleInfo "History: 1.02"
+ModuleInfo "History: Changed to SuperStrict"
+ModuleInfo "History: Extended flags to Long"
 ModuleInfo "History: 1.01"
 ModuleInfo "History: Changed Assert to Throw. One can at least catch a Throw."
 
@@ -23,30 +26,30 @@ Import BRL.DXGraphics
 'Import BRL.D3D7Max2D
 
 
-Const LOG_ERRS=True'False
+Const LOG_ERRS:Int=True'False
 
 Private
 
-Global _gw,_gh,_gd,_gr,_gf,_gx,_gy
-Global _color
-Global _clscolor
+Global _gw:Int,_gh:Int,_gd:Int,_gr:Int,_gf:Long,_gx:Int,_gy:Int
+Global _color:Int
+Global _clscolor:Int
 Global _ix#,_iy#,_jx#,_jy#
 Global _fverts#[24]
 Global _iverts:Int Ptr=Int Ptr( Varptr _fverts[0] )
 Global _lineWidth#
 
 Global _bound_texture:IDirect3DTexture9
-Global _texture_enabled
+Global _texture_enabled:Int
 
-Global _active_blend
+Global _active_blend:Int
 
 Global _driver:TD3D9Max2DDriver
 Global _d3dDev:IDirect3DDevice9
 Global _d3d9Graphics:TD3D9Graphics
 Global _max2dGraphics:TMax2dGraphics
 
-Function Pow2Size( n )
-	Local t=1
+Function Pow2Size:Int( n:Int )
+	Local t:Int=1
 	While t<n
 		t:*2
 	Wend
@@ -81,10 +84,10 @@ Type TD3D9ImageFrame Extends TImageFrame
 		EndIf
 	End Method
 
-	Method Create:TD3D9ImageFrame( pixmap:TPixmap,flags )
+	Method Create:TD3D9ImageFrame( pixmap:TPixmap,flags:Int )
 
-		Local width=pixmap.width,pow2width=Pow2Size( width )
-		Local height=pixmap.height,pow2height=Pow2Size( height )
+		Local width:Int=pixmap.width,pow2width:Int=Pow2Size( width )
+		Local height:Int=pixmap.height,pow2height:Int=Pow2Size( height )
 		
 		If width<pow2width Or height<pow2height
 			Local src:TPixmap=pixmap
@@ -103,21 +106,21 @@ Type TD3D9ImageFrame Extends TImageFrame
 			If pixmap.Format<>PF_BGRA8888 pixmap=pixmap.Convert( PF_BGRA8888 )
 		EndIf
 
-		Local levels=(flags & MIPMAPPEDIMAGE)=0
-		Local format=D3DFMT_A8R8G8B8
-		Local usage=0
-		Local pool=D3DPOOL_MANAGED
+		Local levels:Int=(flags & MIPMAPPEDIMAGE)=0
+		Local format:Int=D3DFMT_A8R8G8B8
+		Local usage:Int=0
+		Local pool:Int=D3DPOOL_MANAGED
 		
 		'_texture = New IDirect3DTexture9
 		If _d3dDev.CreateTexture( pow2width,pow2height,levels,usage,format,pool,_texture,Null )<0
 			d3derr "Unable to create texture~n"
 			_texture = Null
-			Return
+			Return null
 		EndIf
 		
 		_d3d9Graphics.AutoRelease _texture
 
-		Local level
+		Local level:Int
 		Local dstsurf:IDirect3DSurface9' = New IDirect3DSurface9
 		Repeat
 			If _texture.GetSurfaceLevel( level,dstsurf )<0
@@ -132,7 +135,7 @@ Type TD3D9ImageFrame Extends TImageFrame
 				d3derr "dstsurf.LockRect failed~n"
 			EndIf
 		
-			For Local y=0 Until pixmap.height
+			For Local y:Int=0 Until pixmap.height
 				Local src:Byte Ptr=pixmap.pixels+y*pixmap.pitch
 				Local dst:Byte Ptr=lockedrect.pBits+y*lockedrect.Pitch
 				MemCopy dst,src,Size_T(pixmap.width*4)
@@ -231,9 +234,9 @@ Type TD3D9ImageFrame Extends TImageFrame
 		_d3dDev.DrawPrimitiveUP D3DPT_TRIANGLEFAN,2,_fverts,24
 	End Method
 	
-	Field _texture:IDirect3DTexture9,_seq
+	Field _texture:IDirect3DTexture9,_seq:Int
 	
-	Field _magfilter,_minfilter,_mipfilter,_uscale#,_vscale#
+	Field _magfilter:Int,_minfilter:Int,_mipfilter:Int,_uscale#,_vscale#
 	
 	Field _fverts#[24],_iverts:Int Ptr=Int Ptr( Varptr _fverts[0] )
 
@@ -263,12 +266,12 @@ Type TD3D9Max2DDriver Extends TMax2dDriver
 		Return D3D9GraphicsDriver().GraphicsModes()
 	End Method
 	
-	Method AttachGraphics:TGraphics( widget:Byte Ptr,flags ) Override
+	Method AttachGraphics:TGraphics( widget:Byte Ptr,flags:Long ) Override
 		Local g:TD3D9Graphics=D3D9GraphicsDriver().AttachGraphics( widget,flags )
 		If g Return TMax2DGraphics.Create( g,Self )
 	End Method
 	
-	Method CreateGraphics:TGraphics( width,height,depth,hertz,flags,x,y ) Override
+	Method CreateGraphics:TGraphics( width:Int,height:Int,depth:Int,hertz:Int,flags:Long,x:Int,y:Int ) Override
 		Local g:TD3D9Graphics=D3D9GraphicsDriver().CreateGraphics( width,height,depth,hertz,flags,x,y )
 		If Not g Return Null
 		Return TMax2DGraphics.Create( g,Self )
@@ -308,7 +311,7 @@ Type TD3D9Max2DDriver Extends TMax2dDriver
 		
 	End Method
 	
-	Method Flip( sync ) Override
+	Method Flip:Int( sync:Int ) Override
 		_d3dDev.EndScene
 		If D3D9GraphicsDriver().Flip( sync )
 			_d3dDev.BeginScene
@@ -366,11 +369,11 @@ Type TD3D9Max2DDriver Extends TMax2dDriver
 	End Method
 
 	'***** TMax2DDriver *****
-	Method CreateFrameFromPixmap:TImageFrame( pixmap:TPixmap,flags ) Override
+	Method CreateFrameFromPixmap:TImageFrame( pixmap:TPixmap,flags:Int ) Override
 		Return New TD3D9ImageFrame.Create( pixmap,flags )
 	End Method
 	
-	Method SetBlend( blend ) Override
+	Method SetBlend( blend:Int ) Override
 		If blend=_active_blend Return
 		Select blend
 		Case SOLIDBLEND
@@ -407,7 +410,7 @@ Type TD3D9Max2DDriver Extends TMax2dDriver
 		_iverts[21]=_color
 	End Method
 	
-	Method SetColor( red,green,blue ) Override
+	Method SetColor( red:Int,green:Int,blue:Int ) Override
 		red=Max(Min(red,255),0)
 		green=Max(Min(green,255),0)
 		blue=Max(Min(blue,255),0)
@@ -426,7 +429,7 @@ Type TD3D9Max2DDriver Extends TMax2dDriver
 		_iverts[21]=_color
 	End Method
 	
-	Method SetClsColor( red,green,blue ) Override
+	Method SetClsColor( red:Int,green:Int,blue:Int ) Override
 		red=Max(Min(red,255),0)
 		green=Max(Min(green,255),0)
 		blue=Max(Min(blue,255),0)
@@ -437,12 +440,12 @@ Type TD3D9Max2DDriver Extends TMax2dDriver
 		_clscolor=$ff000000|color.ToARGB()
 	End Method
 	
-	Method SetViewport( x,y,width,height ) Override
+	Method SetViewport( x:Int,y:Int,width:Int,height:Int ) Override
 		If x=0 And y=0 And width=_gw And height=_gh 'GraphicsWidth() And height=GraphicsHeight()
 			_d3dDev.SetRenderState D3DRS_SCISSORTESTENABLE,False
 		Else
 			_d3dDev.SetRenderState D3DRS_SCISSORTESTENABLE,True
-			Local rect[]=[x,y,x+width,y+height]
+			Local rect:Int[]=[x,y,x+width,y+height]
 			_d3dDev.SetScissorRect rect
 		EndIf
 	End Method
@@ -523,13 +526,13 @@ Type TD3D9Max2DDriver Extends TMax2dDriver
 	Method DrawOval( x0#,y0#,x1#,y1#,tx#,ty# ) Override
 		Local xr#=(x1-x0)*.5
 		Local yr#=(y1-y0)*.5
-		Local segs=Abs(xr)+Abs(yr)
+		Local segs:Int=Abs(xr)+Abs(yr)
 		segs=Max(segs,12)&~3
 		x0:+xr
 		y0:+yr
 		Local fverts#[segs*6]
 		Local iverts:Int Ptr=Int Ptr( Varptr fverts[0] )
-		For Local i=0 Until segs
+		For Local i:Int=0 Until segs
 			Local th#=-i*360#/segs
 			Local x#=x0+Cos(th)*xr
 			Local y#=y0-Sin(th)*yr
@@ -543,10 +546,10 @@ Type TD3D9Max2DDriver Extends TMax2dDriver
 	
 	Method DrawPoly( verts#[],handlex#,handley#,tx#,ty# ) Override
 		If verts.length<6 Or (verts.length&1) Return
-		Local segs=verts.length/2
+		Local segs:Int=verts.length/2
 		Local fverts#[segs*6]
 		Local iverts:Int Ptr=Int Ptr( Varptr fverts[0] )
-		For Local i=0 Until segs
+		For Local i:Int=0 Until segs
 			Local x#=verts[i*2+0]+handlex
 			Local y#=verts[i*2+1]+handley
 			fverts[i*6+0]= x*_ix + y*_iy + tx
@@ -558,8 +561,8 @@ Type TD3D9Max2DDriver Extends TMax2dDriver
 	End Method
 		
 	'GetDC/BitBlt MUCH faster than locking backbuffer!	
-	Method DrawPixmap( pixmap:TPixmap,x,y ) Override
-		Local width=pixmap.width,height=pixmap.height
+	Method DrawPixmap( pixmap:TPixmap,x:Int,y:Int ) Override
+		Local width:Int=pixmap.width,height:Int=pixmap.height
 	
 		Local dstsurf:IDirect3DSurface9' = New IDirect3DSurface9
 		If _d3dDev.GetRenderTarget( 0,dstsurf )<0
@@ -572,7 +575,7 @@ Type TD3D9Max2DDriver Extends TMax2dDriver
 			d3derr "GetDesc failed~n"
 		EndIf
 		
-		Local rect[]=[x,y,x+width,y+height]
+		Local rect:Int[]=[x,y,x+width,y+height]
 		Local lockedrect:D3DLOCKED_RECT=New D3DLOCKED_RECT
 		If dstsurf.LockRect( lockedrect,rect,0 )<0
 			d3derr "Unable to lock render target surface~n"
@@ -589,7 +592,7 @@ Type TD3D9Max2DDriver Extends TMax2dDriver
 	End Method
 
 	'GetDC/BitBlt MUCH faster than locking backbuffer!	
-	Method GrabPixmap:TPixmap( x,y,width,height ) Override
+	Method GrabPixmap:TPixmap( x:Int,y:Int,width:Int,height:Int ) Override
 	
 		Local srcsurf:IDirect3DSurface9
 		If _d3dDev.GetRenderTarget( 0,srcsurf )<0
@@ -624,10 +627,10 @@ Type TD3D9Max2DDriver Extends TMax2dDriver
 		Local pixmap:TPixmap=CreatePixmap( width,height,PF_BGRA8888 )
 		
 		'Copy and set alpha in the process...
-		For Local y=0 Until height
+		For Local y:Int=0 Until height
 			Local src:Int Ptr=Int Ptr( lockedrect.pBits+y*lockedrect.Pitch )
 			Local dst:Int Ptr=Int Ptr( pixmap.PixelPtr( 0,y ) )
-			For Local x=0 Until width
+			For Local x:Int=0 Until width
 				dst[x]=src[x] | $ff000000
 			Next
 		Next
@@ -656,7 +659,7 @@ about:
 The returned driver can be used with #SetGraphicsDriver to enable Direct3D9 Max2D rendering.
 End Rem
 Function D3D9Max2DDriver:TD3D9Max2DDriver()
-	Global _done
+	Global _done:Int
 	If Not _done
 		_driver=New TD3D9Max2DDriver.Create()
 		_done=True

+ 11 - 11
dxgraphics.mod/d3d9graphics.bmx

@@ -1,5 +1,5 @@
 
-Strict
+SuperStrict
 
 Import BRL.Graphics
 
@@ -52,7 +52,7 @@ Function D3D9WndProc:Byte Ptr( hwnd:Byte Ptr,msg:UInt,wp:WParam,lp:LParam) "win3
 
 End Function
 
-Function OpenD3DDevice:Int( hwnd:Byte Ptr,width:Int,height:Int,depth:Int,hertz:Int,flags:Int)
+Function OpenD3DDevice:Int( hwnd:Byte Ptr,width:Int,height:Int,depth:Int,hertz:Int,flags:Long)
 	If _d3dDevRefs
 		If Not _presentParams.Windowed Return False
 		If depth<>0 Return False
@@ -162,7 +162,7 @@ Global UseDX9RenderLagFix:Int = 0
 
 Type TD3D9Graphics Extends TGraphics
 
-	Method Attach:TD3D9Graphics( hwnd:Byte Ptr,flags:Int )
+	Method Attach:TD3D9Graphics( hwnd:Byte Ptr,flags:Long )
 		Local rect:Int[4]
 		GetClientRect hwnd,rect
 		Local width:Int=rect[2]-rect[0]
@@ -179,7 +179,7 @@ Type TD3D9Graphics Extends TGraphics
 		Return Self
 	End Method
 	
-	Method Create:TD3D9Graphics( width:Int,height:Int,depth:Int,hertz:Int,flags:Int,x:Int,y:Int)
+	Method Create:TD3D9Graphics( width:Int,height:Int,depth:Int,hertz:Int,flags:Long,x:Int,y:Int)
 		Const SM_CYCAPTION:Int = 4
 		Const SM_CXBORDER:Int = 5
 		Const SM_CYFIXEDFRAME:Int = 8
@@ -300,7 +300,7 @@ Type TD3D9Graphics Extends TGraphics
 		Return _driver
 	End Method
 	
-	Method GetSettings:Int( width:Int Var,height:Int Var,depth:Int Var,hertz:Int Var,flags:Int Var, x:Int Var, y:Int Var ) Override
+	Method GetSettings( width:Int Var,height:Int Var,depth:Int Var,hertz:Int Var,flags:Long Var, x:Int Var, y:Int Var ) Override
 		'
 		ValidateSize
 		'
@@ -311,8 +311,8 @@ Type TD3D9Graphics Extends TGraphics
 		flags=_flags
 	End Method
 
-	Method Close:Int() Override
-		If Not _hwnd Return False
+	Method Close() Override
+		If Not _hwnd Return
 		CloseD3DDevice
 		If Not _attached DestroyWindow( _hwnd )
 		_hwnd=0
@@ -408,11 +408,11 @@ Type TD3D9GraphicsDriver Extends TGraphicsDriver
 		Return _modes
 	End Method
 	
-	Method AttachGraphics:TD3D9Graphics( widget:Byte Ptr,flags:Int ) Override
-		Return New TD3D9Graphics.Attach( widget:Byte Ptr,flags:Int )
+	Method AttachGraphics:TD3D9Graphics( widget:Byte Ptr,flags:Long ) Override
+		Return New TD3D9Graphics.Attach( widget,flags )
 	End Method
 	
-	Method CreateGraphics:TD3D9Graphics( width:Int,height:Int,depth:Int,hertz:Int,flags:Int,x:Int,y:Int) Override
+	Method CreateGraphics:TD3D9Graphics( width:Int,height:Int,depth:Int,hertz:Int,flags:Long,x:Int,y:Int) Override
 		Return New TD3D9Graphics.Create( width,height,depth,hertz,flags,x,y )
 	End Method
 
@@ -424,7 +424,7 @@ Type TD3D9GraphicsDriver Extends TGraphicsDriver
 		_graphics=TD3D9Graphics( g )
 	End Method
 	
-	Method Flip( sync:Int ) Override
+	Method Flip:Int( sync:Int ) Override
 		Local present:Int = _graphics.Flip(sync)
 		If UseDX9RenderLagFix Then
 			Local pixelsdrawn:Int

+ 5 - 2
dxgraphics.mod/dxgraphics.bmx

@@ -1,14 +1,17 @@
 
-Strict
+SuperStrict
 
 Module BRL.DXGraphics
 
-ModuleInfo "Version: 1.31"
+ModuleInfo "Version: 1.32"
 ModuleInfo "Author: Simon Armstrong, Mark Sibly"
 ModuleInfo "License: zlib/libpng"
 ModuleInfo "Copyright: Blitz Research Ltd"
 ModuleInfo "Modserver: BRL"
 
+ModuleInfo "History: 1.32"
+ModuleInfo "History: Changed to SuperStrict"
+ModuleInfo "History: Extended flags to Long"
 ModuleInfo "History: 1.31"
 ModuleInfo "History: Added Occlussion Query render lag fix."
 ModuleInfo "History: 1.30 Release"

+ 5 - 2
glgraphics.mod/glgraphics.bmx

@@ -1,17 +1,20 @@
 
-Strict
+SuperStrict
 
 Rem
 bbdoc: Graphics/OpenGL Graphics
 End Rem
 Module BRL.GLGraphics
 
-ModuleInfo "Version: 1.15"
+ModuleInfo "Version: 1.16"
 ModuleInfo "Author: Mark Sibly, Simon Armstrong"
 ModuleInfo "License: zlib/libpng"
 ModuleInfo "Copyright: Blitz Research Ltd"
 ModuleInfo "Modserver: BRL"
 
+ModuleInfo "History: 1.16"
+ModuleInfo "History: Changed to SuperStrict"
+ModuleInfo "History: Extended flags to Long"
 ModuleInfo "History: 1.15 Release"
 ModuleInfo "History: Increased OS X depth buffer size to 24 bits"
 ModuleInfo "History: 1.14 Release"

+ 10 - 8
glgraphics.mod/glgraphics.linux.c

@@ -50,7 +50,9 @@ enum{
 typedef struct BBGLContext BBGLContext;
 
 struct BBGLContext{
-	int mode,width,height,depth,hertz,flags,sync;
+	int mode,width,height,depth,hertz;
+	BBInt64 flags;
+	int sync;
 	Window window;
 	GLXContext glContext;
 };
@@ -58,9 +60,9 @@ struct BBGLContext{
 // glgraphics.bmx interface
 
 int bbGLGraphicsGraphicsModes( int *imodes,int maxcount );
-BBGLContext *bbGLGraphicsAttachGraphics( void * window,int flags );
-BBGLContext *bbGLGraphicsCreateGraphics( int width,int height,int depth,int hz,int flags, int x, int y );
-void bbGLGraphicsGetSettings( BBGLContext *context,int *width,int *height,int *depth,int *hz,int *flags );
+BBGLContext *bbGLGraphicsAttachGraphics( void * window,BBInt64 flags );
+BBGLContext *bbGLGraphicsCreateGraphics( int width,int height,int depth,int hz,BBInt64 flags, int x, int y );
+void bbGLGraphicsGetSettings( BBGLContext *context,int *width,int *height,int *depth,int *hz,BBInt64 *flags );
 void bbGLGraphicsClose( BBGLContext *context );
 void bbGLGraphicsSetGraphics( BBGLContext *context );
 void bbGLGraphicsFlip( int sync );
@@ -84,7 +86,7 @@ int _calchertz(XF86VidModeModeInfo *m){
 }
 
 int _initDisplay(){
-	int		major,minor;
+	int major,minor;
 	if (xdisplay) return 0;
 	xdisplay=bbSystemDisplay();
 	if (!xdisplay) return -1;
@@ -130,7 +132,7 @@ static void _swapBuffers( BBGLContext *context ){
 	bbSystemPoll();
 }
 
-BBGLContext *bbGLGraphicsAttachGraphics( void * window,int flags ){
+BBGLContext *bbGLGraphicsAttachGraphics( void * window,BBInt64 flags ){
 	BBGLContext *context=(BBGLContext*)malloc( sizeof(BBGLContext) );
 	memset( context,0,sizeof(BBGLContext) );
 	context->mode=MODE_WIDGET;
@@ -140,7 +142,7 @@ BBGLContext *bbGLGraphicsAttachGraphics( void * window,int flags ){
 	return context;
 }
 
-XVisualInfo *_chooseVisual(flags){
+XVisualInfo *_chooseVisual(BBInt64 flags){
 	int glspec[32],*s;
 	s=glspec;
 	*s++=GLX_RGBA;
@@ -210,7 +212,7 @@ void bbGLGraphicsShareContexts(){
 	_sharedContext=bbGLGraphicsCreateGraphics(0,0,0,0,0,0,0);
 }
 
-BBGLContext *bbGLGraphicsCreateGraphics( int width,int height,int depth,int hz,int flags, int x, int y ){
+BBGLContext *bbGLGraphicsCreateGraphics( int width,int height,int depth,int hz,BBInt64 flags, int x, int y ){
 	XSetWindowAttributes swa;
 	XVisualInfo *vizinfo;
 	XEvent event;

+ 9 - 7
glgraphics.mod/glgraphics.macos.m

@@ -46,7 +46,9 @@ enum{
 typedef struct BBGLContext BBGLContext;
 
 struct BBGLContext{
-	int mode,width,height,depth,hertz,flags,sync;
+	int mode,width,height,depth,hertz;
+	BBInt64 flags;
+	int sync;
 
 	NSView *view;
 	BBGLWindow *window;
@@ -61,10 +63,10 @@ static CFDictionaryRef oldDisplayMode;
 extern void bbFlushAutoreleasePool();
 
 void bbGLGraphicsClose( BBGLContext *context );
-void bbGLGraphicsGetSettings( BBGLContext *context,int *width,int *height,int *depth,int *hertz,int *flags );
+void bbGLGraphicsGetSettings( BBGLContext *context,int *width,int *height,int *depth,int *hertz,BBInt64 *flags );
 void bbGLGraphicsSetGraphics( BBGLContext *context );
 
-static int _initAttrs( CGLPixelFormatAttribute attrs[16],int flags ){
+static int _initAttrs( CGLPixelFormatAttribute attrs[16],BBInt64 flags ){
 	int n=0;
 	if( flags & FLAGS_BACKBUFFER ) attrs[n++]=kCGLPFADoubleBuffer;
 	if( flags & FLAGS_ALPHABUFFER ){ attrs[n++]=kCGLPFAAlphaSize;attrs[n++]=1; }
@@ -99,7 +101,7 @@ static void _validateSize( BBGLContext *context ){
 }
 
 static void _validateContext( BBGLContext *context ){
-	int flags;
+	BBInt64 flags;
 	NSOpenGLContext *shared;
 	NSOpenGLContext *glContext;
 	NSOpenGLPixelFormat *glFormat;
@@ -200,7 +202,7 @@ int bbGLGraphicsGraphicsModes( int *modes,int count ){
 	return n;
 }
 
-BBGLContext *bbGLGraphicsAttachGraphics( NSView *view,int flags ){
+BBGLContext *bbGLGraphicsAttachGraphics( NSView *view,BBInt64 flags ){
 	NSRect rect;
 	BBGLContext *context;
 
@@ -220,7 +222,7 @@ BBGLContext *bbGLGraphicsAttachGraphics( NSView *view,int flags ){
 	return context;
 }
 
-BBGLContext *bbGLGraphicsCreateGraphics( int width,int height,int depth,int hertz,int flags, int x, int y ){
+BBGLContext *bbGLGraphicsCreateGraphics( int width,int height,int depth,int hertz,BBInt64 flags, int x, int y ){
 	int mode;
 	BBGLWindow *window=0;
 	BBGLContext *context;
@@ -305,7 +307,7 @@ BBGLContext *bbGLGraphicsCreateGraphics( int width,int height,int depth,int hert
 	return context;
 }
 
-void bbGLGraphicsGetSettings( BBGLContext *context,int *width,int *height,int *depth,int *hertz, int *flags ){
+void bbGLGraphicsGetSettings( BBGLContext *context,int *width,int *height,int *depth,int *hertz, BBInt64 *flags ){
 	_validateSize( context );
 	*width=context->width;
 	*height=context->height;

+ 6 - 5
glgraphics.mod/glgraphics.win32.c

@@ -142,7 +142,8 @@ typedef struct BBGLContext BBGLContext;
 
 struct BBGLContext{
 	BBGLContext *succ;
-	int mode,width,height,depth,hertz,flags;
+	int mode,width,height,depth,hertz;
+	BBInt64 flags;
 	
 	HDC hdc;
 	HWND hwnd;
@@ -156,10 +157,10 @@ static BBGLContext *_currentContext;
 typedef BOOL (APIENTRY * WGLSWAPINTERVALEXT) (int);
 
 void bbGLGraphicsClose( BBGLContext *context );
-void bbGLGraphicsGetSettings( BBGLContext *context,int *width,int *height,int *depth,int *hertz,int *flags );
+void bbGLGraphicsGetSettings( BBGLContext *context,int *width,int *height,int *depth,int *hertz,BBInt64 *flags );
 void bbGLGraphicsSetGraphics( BBGLContext *context );
 
-static void _initPfd( PIXELFORMATDESCRIPTOR *pfd,int flags ){
+static void _initPfd( PIXELFORMATDESCRIPTOR *pfd,BBInt64 flags ){
 
 	memset( pfd,0,sizeof(*pfd) );
 
@@ -358,7 +359,7 @@ int bbGLGraphicsGraphicsModes( int *modes,int count ){
 	return n;
 }
 
-BBGLContext *bbGLGraphicsAttachGraphics( HWND hwnd,int flags ){
+BBGLContext *bbGLGraphicsAttachGraphics( HWND hwnd,BBInt64 flags ){
 	BBGLContext *context;
 	
 	HDC hdc;
@@ -509,7 +510,7 @@ BBGLContext *bbGLGraphicsCreateGraphics( int width,int height,int depth,int hert
 	return context;
 }
 
-void bbGLGraphicsGetSettings( BBGLContext *context,int *width,int *height,int *depth,int *hertz,int *flags ){
+void bbGLGraphicsGetSettings( BBGLContext *context,int *width,int *height,int *depth,int *hertz,BBInt64 *flags ){
 	_validateSize( context );
 	*width=context->width;
 	*height=context->height;

+ 36 - 36
glgraphics.mod/source.bmx

@@ -1,4 +1,4 @@
-Strict
+SuperStrict
 
 Import BRL.Graphics
 Import BRL.Pixmap
@@ -12,13 +12,13 @@ Incbin "gldrawtextfont.bin"
 
 Extern
 	Function bbGLGraphicsShareContexts()
-	Function bbGLGraphicsGraphicsModes( buf:Byte Ptr,size )
-	Function bbGLGraphicsAttachGraphics:Byte Ptr( widget:Byte Ptr,flags )
-	Function bbGLGraphicsCreateGraphics:Byte Ptr( width,height,depth,hertz,flags,x,y )
-	Function bbGLGraphicsGetSettings( context:Byte Ptr,width Var,height Var,depth Var,hertz Var,flags Var )
+	Function bbGLGraphicsGraphicsModes:Int( buf:Byte Ptr,size:Int )
+	Function bbGLGraphicsAttachGraphics:Byte Ptr( widget:Byte Ptr,flags:Long )
+	Function bbGLGraphicsCreateGraphics:Byte Ptr( width:Int,height:Int,depth:Int,hertz:Int,flags:Long,x:Int,y:Int )
+	Function bbGLGraphicsGetSettings( context:Byte Ptr,width:Int Var,height:Int Var,depth:Int Var,hertz:Int Var,flags:Long Var )
 	Function bbGLGraphicsClose( context:Byte Ptr )	
 	Function bbGLGraphicsSetGraphics( context:Byte Ptr )
-	Function bbGLGraphicsFlip( sync )
+	Function bbGLGraphicsFlip( sync:Int )
 End Extern
 
 Public
@@ -30,9 +30,9 @@ Type TGLGraphics Extends TGraphics
 		Return GLGraphicsDriver()
 	End Method
 	
-	Method GetSettings( width Var,height Var,depth Var,hertz Var,flags Var, x Var, y Var ) Override
+	Method GetSettings( width:Int Var,height:Int Var,depth:Int Var,hertz:Int Var,flags:Long Var, x:Int Var, y:Int Var ) Override
 		Assert _context
-		Local w,h,d,r,f,xp,yp
+		Local w:Int,h:Int,d:Int,r:Int,f:Long,xp:Int,yp:Int
 		bbGLGraphicsGetSettings _context,w,h,d,r,f
 		width=w
 		height=h
@@ -62,10 +62,10 @@ End Type
 Type TGLGraphicsDriver Extends TGraphicsDriver
 
 	Method GraphicsModes:TGraphicsMode[]() Override
-		Local buf[1024*4]
-		Local count=bbGLGraphicsGraphicsModes( buf,1024 )
+		Local buf:Int[1024*4]
+		Local count:Int=bbGLGraphicsGraphicsModes( buf,1024 )
 		Local modes:TGraphicsMode[count],p:Int Ptr=buf
-		For Local i=0 Until count
+		For Local i:Int=0 Until count
 			Local t:TGraphicsMode=New TGraphicsMode
 			t.width=p[0]
 			t.height=p[1]
@@ -77,13 +77,13 @@ Type TGLGraphicsDriver Extends TGraphicsDriver
 		Return modes
 	End Method
 	
-	Method AttachGraphics:TGLGraphics( widget:Byte Ptr,flags ) Override
+	Method AttachGraphics:TGLGraphics( widget:Byte Ptr,flags:Long ) Override
 		Local t:TGLGraphics=New TGLGraphics
 		t._context=bbGLGraphicsAttachGraphics( widget,flags )
 		Return t
 	End Method
 	
-	Method CreateGraphics:TGLGraphics( width,height,depth,hertz,flags,x,y ) Override
+	Method CreateGraphics:TGLGraphics( width:Int,height:Int,depth:Int,hertz:Int,flags:Long,x:Int,y:Int ) Override
 		Local t:TGLGraphics=New TGLGraphics
 		t._context=bbGLGraphicsCreateGraphics( width,height,depth,hertz,flags,x,y )
 		Return t
@@ -96,7 +96,7 @@ Type TGLGraphicsDriver Extends TGraphicsDriver
 		bbGLGraphicsSetGraphics context
 	End Method
 	
-	Method Flip( sync ) Override
+	Method Flip:Int( sync:Int) Override
 		bbGLGraphicsFlip sync
 	End Method
 	
@@ -119,7 +119,7 @@ returns: An OpenGL graphics object
 about:
 This is a convenience function that allows you to easily create an OpenGL graphics context.
 End Rem
-Function GLGraphics:TGraphics( width,height,depth=0,hertz=60,flags=GRAPHICS_BACKBUFFER|GRAPHICS_DEPTHBUFFER )
+Function GLGraphics:TGraphics( width:Int,height:Int,depth:Int=0,hertz:Int=60,flags:Long=GRAPHICS_BACKBUFFER|GRAPHICS_DEPTHBUFFER )
 	SetGraphicsDriver GLGraphicsDriver()
 	Return Graphics( width,height,depth,hertz,flags )
 End Function
@@ -130,13 +130,13 @@ SetGraphicsDriver GLGraphicsDriver()
 
 Private
 
-Global fontTex
-Global fontSeq
+Global fontTex:Int
+Global fontSeq:Int
 
 Global ortho_mv![16],ortho_pj![16]
 
 Function BeginOrtho()
-	Local vp[4]
+	Local vp:Int[4]
 	
 	glPushAttrib GL_ENABLE_BIT|GL_TEXTURE_BIT|GL_TRANSFORM_BIT
 	
@@ -170,9 +170,9 @@ Rem
 bbdoc: Helper function to calculate nearest valid texture size
 about: This functions rounds @width and @height up to the nearest valid texture size
 End Rem
-Function GLAdjustTexSize( width Var,height Var )
-	Function Pow2Size( n )
-		Local t=1
+Function GLAdjustTexSize( width:Int Var,height:Int Var )
+	Function Pow2Size:Int( n:Int )
+		Local t:Int=1
 		While t<n
 			t:*2
 		Wend
@@ -181,7 +181,7 @@ Function GLAdjustTexSize( width Var,height Var )
 	width=Pow2Size( width )
 	height=Pow2Size( height )
 	Repeat
-		Local t
+		Local t:Int
 		glTexImage2D GL_PROXY_TEXTURE_2D,0,4,width,height,0,GL_RGBA,GL_UNSIGNED_BYTE,Null
 		glGetTexLevelParameteriv GL_PROXY_TEXTURE_2D,0,GL_TEXTURE_WIDTH,Varptr t
 		If t Return
@@ -196,21 +196,21 @@ bbdoc: Helper function to create a texture from a pixmap
 returns: Integer GL Texture name
 about: @pixmap is resized to a valid texture size before conversion.
 end rem
-Function GLTexFromPixmap( pixmap:TPixmap,mipmap=True )
+Function GLTexFromPixmap:Int( pixmap:TPixmap,mipmap:Int=True )
 	If pixmap.format<>PF_RGBA8888 pixmap=pixmap.Convert( PF_RGBA8888 )
-	Local width=pixmap.width,height=pixmap.height
+	Local width:Int=pixmap.width,height:Int=pixmap.height
 	GLAdjustTexSize width,height
 	If width<>pixmap.width Or height<>pixmap.height pixmap=ResizePixmap( pixmap,width,height )
 	
-	Local old_name,old_row_len
+	Local old_name:Int,old_row_len:Int
 	glGetIntegerv GL_TEXTURE_BINDING_2D,Varptr old_name
 	glGetIntegerv GL_UNPACK_ROW_LENGTH,Varptr old_row_len
 
-	Local name
+	Local name:Int
 	glGenTextures 1,Varptr name
 	glBindtexture GL_TEXTURE_2D,name
 	
-	Local mip_level
+	Local mip_level:Int
 	Repeat
 		glPixelStorei GL_UNPACK_ROW_LENGTH,pixmap.pitch/BytesPerPixel[pixmap.format]
 		glTexImage2D GL_TEXTURE_2D,mip_level,GL_RGBA8,width,height,0,GL_RGBA,GL_UNSIGNED_BYTE,pixmap.pixels
@@ -233,7 +233,7 @@ bbdoc:Helper function to output a simple rectangle
 about:
 Draws a rectangle relative to top-left of current viewport.
 End Rem
-Function GLDrawRect( x,y,width,height )
+Function GLDrawRect( x:Int,y:Int,width:Int,height:Int )
 	BeginOrtho
 	glBegin GL_QUADS
 	glVertex2i x,y
@@ -253,15 +253,15 @@ The font used is an internal fixed point 8x16 font.<br/>
 <br/>
 This function is intended for debugging purposes only - performance is unlikely to be stellar.
 End Rem
-Function GLDrawText( Text$,x,y )
+Function GLDrawText( Text$,x:Int,y:Int )
 '	If fontSeq<>graphicsSeq
 	If Not fontTex
 		Local pixmap:TPixmap=TPixmap.Create( 1024,16,PF_RGBA8888 )
 		Local p:Byte Ptr=IncbinPtr( "gldrawtextfont.bin" )
-		For Local y=0 Until 16
-			For Local x=0 Until 96
-				Local b=p[x]
-				For Local n=0 Until 8
+		For Local y:Int=0 Until 16
+			For Local x:Int=0 Until 96
+				Local b:Int=p[x]
+				For Local n:Int=0 Until 8
 					If b & (1 Shl n) 
 						pixmap.WritePixel x*8+n,y,~0
 					Else
@@ -280,8 +280,8 @@ Function GLDrawText( Text$,x,y )
 	glEnable GL_TEXTURE_2D
 	glBindTexture GL_TEXTURE_2D,fontTex
 	
-	For Local i=0 Until Text.length
-		Local c=Text[i]-32
+	For Local i:Int=0 Until Text.length
+		Local c:Int=Text[i]-32
 		If c>=0 And c<96
 			Const adv#=8/1024.0
 			Local t#=c*adv;
@@ -309,7 +309,7 @@ Draws the pixmap relative to top-left of current viewport.<br/>
 <br/>
 This function is intended for debugging purposes only - performance is unlikely to be stellar.
 End Rem
-Function GLDrawPixmap( pixmap:TPixmap,x,y )
+Function GLDrawPixmap( pixmap:TPixmap,x:Int,y:Int )
 	BeginOrtho
 
 	Local t:TPixmap=YFlipPixmap(pixmap)

+ 49 - 46
glmax2d.mod/glmax2d.bmx

@@ -1,5 +1,5 @@
 
-Strict
+SuperStrict
 
 Rem
 bbdoc: Graphics/OpenGL Max2D
@@ -8,12 +8,15 @@ The OpenGL Max2D module provides an OpenGL driver for #Max2D.
 End Rem
 Module BRL.GLMax2D
 
-ModuleInfo "Version: 1.13"
+ModuleInfo "Version: 1.14"
 ModuleInfo "Author: Mark Sibly"
 ModuleInfo "License: zlib/libpng"
 ModuleInfo "Copyright: Blitz Research Ltd"
 ModuleInfo "Modserver: BRL"
 
+ModuleInfo "History: 1.14"
+ModuleInfo "History: Changed to SuperStrict"
+ModuleInfo "History: Extended flags to Long"
 ModuleInfo "History: 1.13 Release"
 ModuleInfo "History: Cleaned up SetGraphics"
 ModuleInfo "History: 1.12 Release"
@@ -44,25 +47,25 @@ Private
 Global _driver:TGLMax2DDriver
 
 'Naughty!
-Const GL_BGR=$80E0
-Const GL_BGRA=$80E1
-Const GL_CLAMP_TO_EDGE=$812F
-Const GL_CLAMP_TO_BORDER=$812D
+Const GL_BGR:Int=$80E0
+Const GL_BGRA:Int=$80E1
+Const GL_CLAMP_TO_EDGE:Int=$812F
+Const GL_CLAMP_TO_BORDER:Int=$812D
 
 Global ix#,iy#,jx#,jy#
 Global color4ub:Byte[4]
 
-Global state_blend
-Global state_boundtex
-Global state_texenabled
+Global state_blend:Int
+Global state_boundtex:Int
+Global state_texenabled:Int
 
-Function BindTex( name )
+Function BindTex( name:Int )
 	If name=state_boundtex Return
 	glBindTexture GL_TEXTURE_2D,name
 	state_boundtex=name
 End Function
 
-Function EnableTex( name )
+Function EnableTex( name:Int )
 	BindTex name
 	If state_texenabled Return
 	glEnable GL_TEXTURE_2D
@@ -75,32 +78,32 @@ Function DisableTex()
 	state_texenabled=False
 End Function
 
-Function Pow2Size( n )
-	Local t=1
+Function Pow2Size:Int( n:Int )
+	Local t:Int=1
 	While t<n
 		t:*2
 	Wend
 	Return t
 End Function
 
-Global dead_texs:TDynamicArray = New TDynamicArray(32),dead_tex_seq
+Global dead_texs:TDynamicArray = New TDynamicArray(32),dead_tex_seq:Int
 
 Extern
 	Function bbAtomicAdd:Int( target:Int Ptr,value:Int )="int bbAtomicAdd( int *,int )!"
 End Extern
 
 'Enqueues a texture for deletion, to prevent release textures on wrong thread.
-Function DeleteTex( name,seq )
+Function DeleteTex( name:Int,seq:Int )
 	If seq<>dead_tex_seq Return
 
 	dead_texs.AddLast(name)
 End Function
 
-Function CreateTex( width,height,flags,pixmap:TPixmap )
+Function CreateTex:Int( width:Int,height:Int,flags:Int,pixmap:TPixmap )
 	If pixmap.dds_fmt<>0 Return pixmap.tex_name ' if dds texture already exists
 	
 	'alloc new tex
-	Local name
+	Local name:Int
 	glGenTextures 1,Varptr name
 	
 	'flush dead texs
@@ -137,7 +140,7 @@ Function CreateTex( width,height,flags,pixmap:TPixmap )
 		EndIf
 	EndIf
 
-	Local mip_level
+	Local mip_level:Int
 
 	Repeat
 		glTexImage2D GL_TEXTURE_2D,mip_level,GL_RGBA8,width,height,0,GL_RGBA,GL_UNSIGNED_BYTE,Null
@@ -151,8 +154,8 @@ Function CreateTex( width,height,flags,pixmap:TPixmap )
 	Return name
 End Function
 
-Function UploadTex( pixmap:TPixmap,flags )
-	Local mip_level
+Function UploadTex( pixmap:TPixmap,flags:Int )
+	Local mip_level:Int
 	If pixmap.dds_fmt<>0 Return ' if dds texture already exists
 	Repeat
 		glPixelStorei GL_UNPACK_ROW_LENGTH,pixmap.pitch/BytesPerPixel[pixmap.format]
@@ -172,12 +175,12 @@ Function UploadTex( pixmap:TPixmap,flags )
 	glPixelStorei GL_UNPACK_ROW_LENGTH,0
 End Function
 
-Function AdjustTexSize( width Var,height Var )
+Function AdjustTexSize( width:Int Var,height:Int Var )
 	'calc texture size
 	width=Pow2Size( width )
 	height=Pow2Size( height )
 	Repeat
-		Local t
+		Local t:Int
 		glTexImage2D GL_PROXY_TEXTURE_2D,0,4,width,height,0,GL_RGBA,GL_UNSIGNED_BYTE,Null
 		glGetTexLevelParameteriv GL_PROXY_TEXTURE_2D,0,GL_TEXTURE_WIDTH,Varptr t
 		If t Return
@@ -250,7 +253,7 @@ Type TGLImageFrame Extends TImageFrame
 
 	Field u0#,v0#,u1#,v1#,uscale#,vscale#
 
-	Field name,seq
+	Field name:Int,seq:Int
 	
 	Method New()
 		seq=GraphicsSeq
@@ -283,15 +286,15 @@ Type TGLImageFrame Extends TImageFrame
 		glEnd
 	End Method
 	
-	Function CreateFromPixmap:TGLImageFrame( src:TPixmap,flags )
+	Function CreateFromPixmap:TGLImageFrame( src:TPixmap,flags:Int )
 		'determine tex size
-		Local tex_w=src.width
-		Local tex_h=src.height
+		Local tex_w:Int=src.width
+		Local tex_h:Int=src.height
 		AdjustTexSize tex_w,tex_h
 		
 		'make sure pixmap fits texture
-		Local width=Min( src.width,tex_w )
-		Local height=Min( src.height,tex_h )
+		Local width:Int=Min( src.width,tex_w )
+		Local height:Int=Min( src.height,tex_h )
 		If src.width<>width Or src.height<>height src=ResizePixmap( src,width,height )
 
 		'create texture pixmap
@@ -317,7 +320,7 @@ Type TGLImageFrame Extends TImageFrame
 		EndIf
 		
 		'create tex
-		Local name=CreateTex( tex_w,tex_h,flags,tex )
+		Local name:Int=CreateTex( tex_w,tex_h,flags,tex )
 		
 		'upload it
 		UploadTex tex,flags
@@ -348,12 +351,12 @@ Type TGLMax2DDriver Extends TMax2DDriver
 		Return GLGraphicsDriver().GraphicsModes()
 	End Method
 	
-	Method AttachGraphics:TMax2DGraphics( widget:Byte Ptr,flags ) Override
+	Method AttachGraphics:TMax2DGraphics( widget:Byte Ptr,flags:Long ) Override
 		Local g:TGLGraphics=GLGraphicsDriver().AttachGraphics( widget,flags )
 		If g Return TMax2DGraphics.Create( g,Self )
 	End Method
 	
-	Method CreateGraphics:TMax2DGraphics( width,height,depth,hertz,flags,x,y ) Override
+	Method CreateGraphics:TMax2DGraphics( width:Int,height:Int,depth:Int,hertz:Int,flags:Long,x:Int,y:Int ) Override
 		Local g:TGLGraphics=GLGraphicsDriver().CreateGraphics( width,height,depth,hertz,flags,x,y )
 		If g Return TMax2DGraphics.Create( g,Self )
 	End Method
@@ -376,7 +379,7 @@ Type TGLMax2DDriver Extends TMax2DDriver
 	End Method
 	
 	Method ResetGLContext( g:TGraphics )
-		Local gw,gh,gd,gr,gf,gx,gy
+		Local gw:Int,gh:Int,gd:Int,gr:Int,gf:Long,gx:Int,gy:Int
 		g.GetSettings gw,gh,gd,gr,gf,gx,gy
 		
 		state_blend=0
@@ -391,7 +394,7 @@ Type TGLMax2DDriver Extends TMax2DDriver
 		glViewport 0,0,gw,gh
 	End Method
 	
-	Method Flip( sync ) Override
+	Method Flip:Int( sync:Int ) Override
 		GLGraphicsDriver().Flip sync
 	End Method
 	
@@ -399,13 +402,13 @@ Type TGLMax2DDriver Extends TMax2DDriver
 		Return "OpenGL"
 	End Method
 
-	Method CreateFrameFromPixmap:TGLImageFrame( pixmap:TPixmap,flags ) Override
+	Method CreateFrameFromPixmap:TGLImageFrame( pixmap:TPixmap,flags:Int ) Override
 		Local frame:TGLImageFrame
 		frame=TGLImageFrame.CreateFromPixmap( pixmap,flags )
 		Return frame
 	End Method
 
-	Method SetBlend( blend ) Override
+	Method SetBlend( blend:Int ) Override
 		If blend=state_blend Return
 		state_blend=blend
 		Select blend
@@ -445,7 +448,7 @@ Type TGLMax2DDriver Extends TMax2DDriver
 		glLineWidth width
 	End Method
 	
-	Method SetColor( red,green,blue ) Override
+	Method SetColor( red:Int,green:Int,blue:Int ) Override
 		color4ub[0]=Min(Max(red,0),255)
 		color4ub[1]=Min(Max(green,0),255)
 		color4ub[2]=Min(Max(blue,0),255)
@@ -459,7 +462,7 @@ Type TGLMax2DDriver Extends TMax2DDriver
 		glColor4ubv color4ub
 	End Method
 
-	Method SetClsColor( red,green,blue ) Override
+	Method SetClsColor( red:Int,green:Int,blue:Int ) Override
 		red=Min(Max(red,0),255)
 		green=Min(Max(green,0),255)
 		blue=Min(Max(blue,0),255)
@@ -470,7 +473,7 @@ Type TGLMax2DDriver Extends TMax2DDriver
 		glClearColor color.r/255.0,color.g/255.0,color.b/255.0,1.0
 	End Method
 	
-	Method SetViewport( x,y,w,h ) Override
+	Method SetViewport( x:Int,y:Int,w:Int,h:Int ) Override
 		If x=0 And y=0 And w=GraphicsWidth() And h=GraphicsHeight()
 			glDisable GL_SCISSOR_TEST
 		Else
@@ -519,7 +522,7 @@ Type TGLMax2DDriver Extends TMax2DDriver
 	
 		Local xr#=(x1-x0)*.5
 		Local yr#=(y1-y0)*.5
-		Local segs=Abs(xr)+Abs(yr)
+		Local segs:Int=Abs(xr)+Abs(yr)
 		
 		segs=Max(segs,12)&~3
 
@@ -528,7 +531,7 @@ Type TGLMax2DDriver Extends TMax2DDriver
 		
 		DisableTex
 		glBegin GL_POLYGON
-		For Local i=0 Until segs
+		For Local i:Int=0 Until segs
 			Local th#=i*360#/segs
 			Local x#=x0+Cos(th)*xr
 			Local y#=y0-Sin(th)*yr
@@ -543,7 +546,7 @@ Type TGLMax2DDriver Extends TMax2DDriver
 		
 		DisableTex
 		glBegin GL_POLYGON
-		For Local i=0 Until Len xy Step 2
+		For Local i:Int=0 Until Len xy Step 2
 			Local x#=xy[i+0]+handle_x
 			Local y#=xy[i+1]+handle_y
 			glVertex2f x*ix+y*iy+origin_x,x*jx+y*jy+origin_y
@@ -551,8 +554,8 @@ Type TGLMax2DDriver Extends TMax2DDriver
 		glEnd
 	End Method
 		
-	Method DrawPixmap( p:TPixmap,x,y ) Override
-		Local blend=state_blend
+	Method DrawPixmap( p:TPixmap,x:Int,y:Int ) Override
+		Local blend:Int=state_blend
 		DisableTex
 		SetBlend SOLIDBLEND
 	
@@ -570,8 +573,8 @@ Type TGLMax2DDriver Extends TMax2DDriver
 		SetBlend blend
 	End Method
 
-	Method GrabPixmap:TPixmap( x,y,w,h ) Override
-		Local blend=state_blend
+	Method GrabPixmap:TPixmap( x:Int,y:Int,w:Int,h:Int ) Override
+		Local blend:Int=state_blend
 		SetBlend SOLIDBLEND
 		Local p:TPixmap=CreatePixmap( w,h,PF_RGBA8888 )
 		glReadPixels x,GraphicsHeight()-h-y,w,h,GL_RGBA,GL_UNSIGNED_BYTE,p.pixels
@@ -596,7 +599,7 @@ The returned driver can be used with #SetGraphicsDriver to enable OpenGL Max2D
 rendering.
 End Rem
 Function GLMax2DDriver:TGLMax2DDriver()
-	Global _done
+	Global _done:Int
 	If Not _done
 		_driver=New TGLMax2DDriver.Create()
 		_done=True

+ 40 - 36
graphics.mod/graphics.bmx

@@ -1,17 +1,20 @@
 
-Strict
+SuperStrict
 
 Rem
 bbdoc: Graphics/Graphics
 End Rem
 Module BRL.Graphics
 
-ModuleInfo "Version: 1.08"
+ModuleInfo "Version: 1.09"
 ModuleInfo "Author: Mark Sibly"
 ModuleInfo "License: zlib/libpng"
 ModuleInfo "Copyright: Blitz Research Ltd"
 ModuleInfo "Modserver: BRL"
 
+ModuleInfo "History: 1.09"
+ModuleInfo "History: Changed to SuperStrict"
+ModuleInfo "History: Extended flags to Long"
 ModuleInfo "History: 1.08 Release"
 ModuleInfo "History: Mouse repositioned only in fullscreen mode"
 ModuleInfo "History: 1.07 Release"
@@ -38,14 +41,14 @@ about:
 Use this id with #AddHook to register a function that
 is called every #Flip.
 End Rem
-Global FlipHook=AllocHookId()
+Global FlipHook:Int=AllocHookId()
 
-Const GRAPHICS_BACKBUFFER=	$2
-Const GRAPHICS_ALPHABUFFER=	$4
-Const GRAPHICS_DEPTHBUFFER=	$8
-Const GRAPHICS_STENCILBUFFER=	$10
-Const GRAPHICS_ACCUMBUFFER=	$20
-Const GRAPHICS_BORDERLESS=$40
+Const GRAPHICS_BACKBUFFER:Int=	$2
+Const GRAPHICS_ALPHABUFFER:Int=	$4
+Const GRAPHICS_DEPTHBUFFER:Int=	$8
+Const GRAPHICS_STENCILBUFFER:Int=	$10
+Const GRAPHICS_ACCUMBUFFER:Int=	$20
+Const GRAPHICS_BORDERLESS:Int=$40
 
 'Const GRAPHICS_SWAPINTERVAL0=	$40
 'Const GRAPHICS_SWAPINTERVAL1=	$80
@@ -59,7 +62,7 @@ Type TGraphics
 
 	Method Driver:TGraphicsDriver() Abstract
 
-	Method GetSettings( width Var,height Var,depth Var,hertz Var,flags Var, x Var, y Var ) Abstract
+	Method GetSettings( width:Int Var,height:Int Var,depth:Int Var,hertz:Int Var,flags:Long Var, x:Int Var, y:Int Var ) Abstract
 
 	Method Close() Abstract
 	
@@ -71,10 +74,11 @@ End Type
 
 Type TGraphicsMode
 
-	Field width,height,depth,hertz
+	Field width:Int,height:Int,depth:Int,hertz:Int
+	Field display:Int
 	
 	Method ToString$() Override
-		Return width+","+height+","+depth+" "+hertz+"Hz"
+		Return width+","+height+","+depth+" "+hertz+"Hz (" + display + ")"
 	End Method
 
 End Type
@@ -83,13 +87,13 @@ Type TGraphicsDriver
 
 	Method GraphicsModes:TGraphicsMode[]() Abstract
 	
-	Method AttachGraphics:TGraphics( widget:Byte Ptr,flags ) Abstract
+	Method AttachGraphics:TGraphics( widget:Byte Ptr,flags:Long ) Abstract
 	
-	Method CreateGraphics:TGraphics( width,height,depth,hertz,flags,x,y ) Abstract
+	Method CreateGraphics:TGraphics( width:Int,height:Int,depth:Int,hertz:Int,flags:Long,x:Int,y:Int ) Abstract
 	
 	Method SetGraphics( g:TGraphics ) Abstract
 	
-	Method Flip( sync ) Abstract
+	Method Flip:Int( sync:Int ) Abstract
 	
 	Method CanResize:Int()
 		Return False
@@ -99,19 +103,19 @@ End Type
 
 Private
 
-Global _defaultFlags
+Global _defaultFlags:Long
 Global _driver:TGraphicsDriver
 Global _graphicsModes:TGraphicsMode[]
-Global _graphics:TGraphics,_gWidth,_gHeight,_gDepth,_gHertz,_gFlags,_gx,_gy
+Global _graphics:TGraphics,_gWidth:Int,_gHeight:Int,_gDepth:Int,_gHertz:Int,_gFlags:Long,_gx:Int,_gy:Int
 
 Global _exGraphics:TGraphics
 
 'Only valid if _exGraphics=_graphics
-Global _softSync,_hardSync,_syncRate,_syncPeriod,_syncFrac,_syncAccum,_syncTime
+Global _softSync:Int,_hardSync:Int,_syncRate:Int,_syncPeriod:Int,_syncFrac:Int,_syncAccum:Int,_syncTime:Int
 
 Public
 
-Global GraphicsSeq=1
+Global GraphicsSeq:Int=1
 
 Function BumpGraphicsSeq()
 	GraphicsSeq:+1
@@ -130,7 +134,7 @@ used to obtain a graphics driver.
 The @defaultFlags parameter allows you to specify graphics flags that will be applied to any
 graphics created with #CreateGraphics or #Graphics.
 End Rem
-Function SetGraphicsDriver( driver:TGraphicsDriver,defaultFlags=GRAPHICS_BACKBUFFER )
+Function SetGraphicsDriver( driver:TGraphicsDriver,defaultFlags:Long=GRAPHICS_BACKBUFFER )
 	BumpGraphicsSeq
 	If driver<>_driver
 		If _driver And _graphics _driver.SetGraphics Null
@@ -160,7 +164,7 @@ End Function
 Rem
 bbdoc: Get current default graphics flags
 End Rem
-Function DefaultGraphicsFlags()
+Function DefaultGraphicsFlags:Long()
 	Return _defaultFlags
 End Function
 
@@ -181,7 +185,7 @@ returns: Number of available Graphics modes
 about:
 Use #GetGraphicsMode To obtain information about an individual Graphics mode
 End Rem
-Function CountGraphicsModes()
+Function CountGraphicsModes:Int()
 	Return GraphicsModes().length
 End Function
 
@@ -191,7 +195,7 @@ about:
 #GetGraphicsMode returns information about a specific graphics mode. @mode should be
 in the range 0 (inclusive) to the value returned by #CountGraphicsModes (exclusive).
 End Rem
-Function GetGraphicsMode( index,width Var,height Var,depth Var,hertz Var )
+Function GetGraphicsMode( index:Int,width:Int Var,height:Int Var,depth:Int Var,hertz:Int Var )
 	Local Mode:TGraphicsMode=GraphicsModes()[index]
 	width=Mode.width
 	height=Mode.height
@@ -206,7 +210,7 @@ about:
 A value of 0 for any of @width, @height, @depth or @hertz will cause that
 parameter to be ignored.
 End Rem
-Function GraphicsModeExists( width,height,depth=0,hertz=0 )
+Function GraphicsModeExists:Int( width:Int,height:Int,depth:Int=0,hertz:Int=0 )
 	For Local Mode:TGraphicsMode=EachIn GraphicsModes()
 		If width And width<>Mode.width Continue
 		If height And height<>Mode.height Continue
@@ -227,7 +231,7 @@ first have to select it using #SetGraphics.
 The kind of graphics object returned depends upon the current graphics driver as set by
 #SetGraphicsDriver.
 End Rem
-Function CreateGraphics:TGraphics( width,height,depth,hertz,flags,x,y )
+Function CreateGraphics:TGraphics( width:Int,height:Int,depth:Int,hertz:Int,flags:Long,x:Int,y:Int )
 	flags:|_defaultFlags
 	Local g:TGraphics
 	Try
@@ -240,7 +244,7 @@ Function CreateGraphics:TGraphics( width,height,depth,hertz,flags,x,y )
 	Return g
 End Function
 
-Function AttachGraphics:TGraphics( widget:Byte Ptr,flags )
+Function AttachGraphics:TGraphics( widget:Byte Ptr,flags:Long )
 	flags:|_defaultFlags
 	Local g:TGraphics
 	Try
@@ -322,7 +326,7 @@ returns: The width, in pixels, of the current graphics object
 about:
 The current graphics object can be changed using #SetGraphics.
 End Rem
-Function GraphicsWidth()
+Function GraphicsWidth:Int()
 	Return _gWidth
 End Function
 
@@ -332,7 +336,7 @@ returns: The height, in pixels, of the current graphics object
 about:
 The current graphics object can be changed using #SetGraphics.
 End Rem
-Function GraphicsHeight()
+Function GraphicsHeight:Int()
 	Return _gHeight
 End Function
 
@@ -342,7 +346,7 @@ returns: The depth, in bits, of the current graphics object
 about:
 The current graphics object can be changed using #SetGraphics.
 End Rem
-Function GraphicsDepth()
+Function GraphicsDepth:Int()
 	Return _gDepth
 End Function
 
@@ -352,7 +356,7 @@ returns: The refresh rate, in frames per second, of the current graphics object
 about:
 The current graphics object can be changed using #SetGraphics.
 End Rem
-Function GraphicsHertz()
+Function GraphicsHertz:Int()
 	Return _gHertz
 End Function
 
@@ -362,7 +366,7 @@ returns: The flags of the current graphics object
 about:
 The current graphics object can be changed using #SetGraphics.
 End Rem
-Function GraphicsFlags()
+Function GraphicsFlags:Long()
 	Return _gFlags
 End Function
 
@@ -389,7 +393,7 @@ created with a refresh rate of 0 in which case flip occurs immediately.
 If @sync is -1 and the current graphics object was NOT created with the #Graphics command,
 then the flip will occur on the next vertical blank.
 End Rem
-Function Flip( sync=-1 )
+Function Flip( sync:Int=-1 )
 	RunHooks FlipHook,Null
 
 	If sync<>-1
@@ -409,7 +413,7 @@ Function Flip( sync=-1 )
 			_syncAccum:-_syncRate
 			_syncTime:+1
 		EndIf
-		Local dt=_syncTime-MilliSecs()
+		Local dt:Int=_syncTime-MilliSecs()
 		If dt>0
 			Delay dt
 		Else
@@ -466,12 +470,12 @@ Once #Graphics has executed, you can begin rendering immediately without any nee
 #Graphics also enables #{polled input} mode, providing a simple way to monitor the keyboard
 and mouse.
 End Rem
-Function Graphics:TGraphics( width,height,depth=0,hertz=60,flags=0,x=-1,y=-1 )
+Function Graphics:TGraphics( width:Int,height:Int,depth:Int=0,hertz:Int=60,flags:Long=0,x:Int=-1,y:Int=-1 )
 	EndGraphics
 	flags:|_defaultFlags
 	
 	Local g:TGraphics=CreateGraphics( width,height,depth,hertz,flags,x,y )
-	If Not g Return
+	If Not g Return Null
 	
 	BumpGraphicsSeq
 
@@ -498,7 +502,7 @@ Function Graphics:TGraphics( width,height,depth=0,hertz=60,flags=0,x=-1,y=-1 )
 	
 	_exGraphics=g
 	
-	Global _onEnd
+	Global _onEnd:Int
 	If Not _onEnd
 		_onEnd=True
 		OnEnd EndGraphics

+ 17 - 17
max2d.mod/driver.bmx

@@ -1,21 +1,21 @@
 
-Strict
+SuperStrict
 
 Import BRL.Pixmap
 Import BRL.Graphics
 
 'modes for SetBlend
-Const MASKBLEND=1
-Const SOLIDBLEND=2
-Const ALPHABLEND=3
-Const LIGHTBLEND=4
-Const SHADEBLEND=5
+Const MASKBLEND:Int=1
+Const SOLIDBLEND:Int=2
+Const ALPHABLEND:Int=3
+Const LIGHTBLEND:Int=4
+Const SHADEBLEND:Int=5
 
 'flags for frames/images
-Const MASKEDIMAGE=		$1
-Const FILTEREDIMAGE=	$2
-Const MIPMAPPEDIMAGE=	$4
-Const DYNAMICIMAGE=		$8
+Const MASKEDIMAGE:Int=		$1
+Const FILTEREDIMAGE:Int=	$2
+Const MIPMAPPEDIMAGE:Int=	$4
+Const DYNAMICIMAGE:Int=		$8
 
 'current driver
 Global _max2dDriver:TMax2DDriver
@@ -28,13 +28,13 @@ End Type
 
 Type TMax2DDriver Extends TGraphicsDriver
 
-	Method CreateFrameFromPixmap:TImageFrame( pixmap:TPixmap,flags ) Abstract
+	Method CreateFrameFromPixmap:TImageFrame( pixmap:TPixmap,flags:Int ) Abstract
 	
-	Method SetBlend( blend ) Abstract
+	Method SetBlend( blend:Int ) Abstract
 	Method SetAlpha( alpha# ) Abstract
-	Method SetColor( red,green,blue ) Abstract
-	Method SetClsColor( red,green,blue ) Abstract
-	Method SetViewport( x,y,width,height ) Abstract
+	Method SetColor( red:Int,green:Int,blue:Int ) Abstract
+	Method SetClsColor( red:Int,green:Int,blue:Int ) Abstract
+	Method SetViewport( x:Int,y:Int,width:Int,height:Int ) Abstract
 	Method SetTransform( xx#,xy#,yx#,yy# ) Abstract
 	Method SetLineWidth( width# ) Abstract
 
@@ -52,8 +52,8 @@ Type TMax2DDriver Extends TGraphicsDriver
 	Method DrawOval( x0#,y0#,x1#,y1#,tx#,ty# ) Abstract
 	Method DrawPoly( xy#[],handlex#,handley#,originx#,originy# ) Abstract
 		
-	Method DrawPixmap( pixmap:TPixmap,x,y ) Abstract
-	Method GrabPixmap:TPixmap( x,y,width,height ) Abstract
+	Method DrawPixmap( pixmap:TPixmap,x:Int,y:Int ) Abstract
+	Method GrabPixmap:TPixmap( x:Int,y:Int,width:Int,height:Int ) Abstract
 	
 	Method SetResolution( width#,height# ) Abstract
 

+ 18 - 18
max2d.mod/image.bmx

@@ -1,5 +1,5 @@
 
-Strict
+SuperStrict
 
 Import "driver.bmx"
 
@@ -8,18 +8,18 @@ bbdoc: Max2D Image type
 End Rem
 Type TImage
 
-	Field width,height,flags
-	Field mask_r,mask_g,mask_b
+	Field width:Int,height:Int,flags:Int
+	Field mask_r:Int,mask_g:Int,mask_b:Int
 	Field handle_x#,handle_y#
 	Field pixmaps:TPixmap[]
 
 	Field frames:TImageFrame[]
-	Field seqs[]
+	Field seqs:Int[]
 	
 	Method _pad()
 	End Method
 	
-	Method Frame:TImageFrame( index )
+	Method Frame:TImageFrame( index:Int )
 		Assert index < seqs.length And index < frames.length Else "Index out of bounds"
 		If seqs[index]=GraphicsSeq Return frames[index]
 		frames[index]=_max2dDriver.CreateFrameFromPixmap( Lock(index,True,False),flags )
@@ -27,7 +27,7 @@ Type TImage
 		Return frames[index]
 	End Method
 	
-	Method Lock:TPixmap( index,read,write )
+	Method Lock:TPixmap( index:Int,read:Int,write:Int )
 		Assert index < seqs.length And index < frames.length Else "Index out of bounds"
 		If write
 			seqs[index]=0
@@ -39,7 +39,7 @@ Type TImage
 		Return pixmaps[index]
 	End Method
 	
-	Method SetPixmap( index,pixmap:TPixmap )
+	Method SetPixmap( index:Int,pixmap:TPixmap )
 		Assert index < seqs.length And index < frames.length And index < pixmaps.length Else "Index out of bounds"
 		If (flags & MASKEDIMAGE) And AlphaBitsPerPixel[pixmap.format]=0
 			pixmap=MaskPixmap( pixmap,mask_r,mask_g,mask_b )
@@ -51,7 +51,7 @@ Type TImage
 		frames[index]=Null
 	End Method
 	
-	Function Create:TImage( width,height,frames,flags,mr,mg,mb )
+	Function Create:TImage( width:Int,height:Int,frames:Int,flags:Int,mr:Int,mg:Int,mb:Int )
 		Assert width > 0 And height > 0 Else "Image dimensions out of bounds"
 		Local t:TImage=New TImage
 		t.width=width
@@ -66,30 +66,30 @@ Type TImage
 		Return t
 	End Function
 	
-	Function Load:TImage( url:Object,flags,mr,mg,mb )
+	Function Load:TImage( url:Object,flags:Int,mr:Int,mg:Int,mb:Int )
 		Local pixmap:TPixmap=TPixmap(url)
 		If Not pixmap pixmap=LoadPixmap(url)
-		If Not pixmap Return
+		If Not pixmap Return null
 		Local t:TImage=Create( pixmap.width,pixmap.height,1,flags,mr,mg,mb )
 		t.SetPixmap 0,pixmap
 		Return t
 	End Function
 
-	Function LoadAnim:TImage( url:Object,cell_width,cell_height,first,count,flags,mr,mg,mb )
+	Function LoadAnim:TImage( url:Object,cell_width:Int,cell_height:Int,first:Int,count:Int,flags:Int,mr:Int,mg:Int,mb:Int )
 		Assert cell_width > 0 And cell_height > 0 Else "Cell dimensions out of bounds"
 		Local pixmap:TPixmap=TPixmap(url)
 		If Not pixmap pixmap=LoadPixmap(url)
-		If Not pixmap Return
+		If Not pixmap Return null
 
-		Local x_cells=pixmap.width/cell_width
-		Local y_cells=pixmap.height/cell_height
-		If first+count>x_cells*y_cells Return
+		Local x_cells:Int=pixmap.width/cell_width
+		Local y_cells:Int=pixmap.height/cell_height
+		If first+count>x_cells*y_cells Return null
 		
 		Local t:TImage=Create( cell_width,cell_height,count,flags,mr,mg,mb )
 
-		For Local cell=first To first+count-1
-			Local x=cell Mod x_cells * cell_width
-			Local y=cell / x_cells * cell_height
+		For Local cell:Int=first To first+count-1
+			Local x:Int=cell Mod x_cells * cell_width
+			Local y:Int=cell / x_cells * cell_height
 			Local window:TPixmap=pixmap.Window( x,y,cell_width,cell_height )
 			t.SetPixmap cell-first,window.Copy()
 		Next

+ 18 - 18
max2d.mod/imagefont.bmx

@@ -1,5 +1,5 @@
 
-Strict
+SuperStrict
 
 Import BRL.Font
 
@@ -10,7 +10,7 @@ Incbin "blitzfont.bin"
 Type TImageGlyph
 
 	Field _image:TImage
-	Field _advance#,_x,_y,_w,_h
+	Field _advance#,_x:Int,_y:Int,_w:Int,_h:Int
 	
 	Method Pixels:TImage()
 		Return _image
@@ -20,7 +20,7 @@ Type TImageGlyph
 		Return _advance
 	End Method
 	
-	Method GetRect( x Var,y Var,w Var,h Var )
+	Method GetRect( x:Int Var,y:Int Var,w:Int Var,h:Int Var )
 		x=_x
 		y=_y
 		w=_w
@@ -33,29 +33,29 @@ Type TImageFont
 
 	Field _src_font:TFont
 	Field _glyphs:TImageGlyph[]
-	Field _imageFlags
+	Field _imageFlags:Int
 
-	Method Style()
+	Method Style:Int()
 		If _src_font Return _src_font.Style()
 		Return 0
 	End Method
 
-	Method Height()
+	Method Height:Int()
 		If _src_font Return _src_font.Height()
 		Return 16
 	End Method
 	
-	Method CountGlyphs()
+	Method CountGlyphs:Int()
 		Return _glyphs.length
 	End Method
 	
-	Method CharToGlyph( char )
+	Method CharToGlyph:Int( char:Int )
 		If _src_font Return _src_font.CharToGlyph( char )
 		If char>=32 And char<128 Return char-32
 		Return -1
 	End Method
 	
-	Method LoadGlyph:TImageGlyph( index )
+	Method LoadGlyph:TImageGlyph( index:Int )
 
 		Assert index>=0 And index<_glyphs.length
 
@@ -81,9 +81,9 @@ Type TImageFont
 	
 	Method Draw( text$,x#,y#,ix#,iy#,jx#,jy# )
 
-		For Local i=0 Until text.length
+		For Local i:Int=0 Until text.length
 		
-			Local n=CharToGlyph( text[i] )
+			Local n:Int=CharToGlyph( text[i] )
 			If n<0 Continue
 			
 			Local glyph:TImageGlyph=LoadGlyph(n)
@@ -104,10 +104,10 @@ Type TImageFont
 		
 	End Method
 	
-	Function Load:TImageFont( url:Object,size,style )
+	Function Load:TImageFont( url:Object,size:Int,style:Int )
 	
 		Local src:TFont=LoadFont( url,size,style )
-		If Not src Return
+		If Not src Return null
 		
 		Local font:TImageFont=New TImageFont
 		font._src_font=src
@@ -127,10 +127,10 @@ Type TImageFont
 		
 		Local p:Byte Ptr=IncbinPtr( "blitzfont.bin" )
 	
-		For Local y=0 Until 16
-			For Local x=0 Until 96
-				Local b=p[x]
-				For Local n=0 Until 8
+		For Local y:Int=0 Until 16
+			For Local x:Int=0 Until 96
+				Local b:Int=p[x]
+				For Local n:Int=0 Until 8
 					If b & (1 Shl n) 
 						pixmap.WritePixel x*8+n,y,~0
 					Else
@@ -141,7 +141,7 @@ Type TImageFont
 			p:+96
 		Next
 
-		For Local n=0 Until 96
+		For Local n:Int=0 Until 96
 			Local glyph:TImageGlyph=New TImageGlyph
 			font._glyphs[n]=glyph
 			glyph._advance=8

+ 130 - 127
max2d.mod/max2d.bmx

@@ -1,17 +1,20 @@
 
-Strict
+SuperStrict
 
 Rem
 bbdoc: Graphics/Max2D
 End Rem
 Module BRL.Max2D
 
-ModuleInfo "Version: 1.22"
+ModuleInfo "Version: 1.23"
 ModuleInfo "Author: Mark Sibly, Simon Armstrong"
 ModuleInfo "License: zlib/libpng"
 ModuleInfo "Copyright: Blitz Research Ltd"
 ModuleInfo "Modserver: BRL"
 
+ModuleInfo "History: 1.23"
+ModuleInfo "History: Changed to SuperStrict"
+ModuleInfo "History: Extended flags to Long"
 ModuleInfo "History: 1.22 Release"
 ModuleInfo "History: fixed ResetCollision not resetting recycled collision quads"
 ModuleInfo "History: 1.21 Release"
@@ -91,29 +94,29 @@ Type TMax2DGraphics Extends TGraphics
 	Field line_width#
 	Field tform_rot#,tform_scale_x#,tform_scale_y#
 	Field tform_ix#,tform_iy#,tform_jx#,tform_jy#
-	Field viewport_x,viewport_y,viewport_w,viewport_h
+	Field viewport_x:Int,viewport_y:Int,viewport_w:Int,viewport_h:Int
 	Field origin_x#,origin_y#
 	Field handle_x#,handle_y#
 	Field image_font:TImageFont
-	Field blend_mode
+	Field blend_mode:Int
 	Field vres_width#,vres_height#
 	Field vres_mousexscale#,vres_mouseyscale#
 
-	Field g_width,g_height
+	Field g_width:Int,g_height:Int
 
 	Global default_font:TImageFont
-	Global mask_red,mask_green,mask_blue
-	Global auto_midhandle
-	Global auto_imageflags=MASKEDIMAGE|FILTEREDIMAGE
+	Global mask_red:Int,mask_green:Int,mask_blue:Int
+	Global auto_midhandle:Int
+	Global auto_imageflags:Int=MASKEDIMAGE|FILTEREDIMAGE
 
-	Field _graphics:TGraphics,_driver:TMax2DDriver,_setup
+	Field _graphics:TGraphics,_driver:TMax2DDriver,_setup:Int
 	
 	Method Driver:TMax2DDriver() Override
 		Return _driver
 	End Method
 	
-	Method GetSettings( width Var,height Var,depth Var,hertz Var,flags Var, x Var, y Var ) Override
-		Local w,h,d,r,f,xp,yp
+	Method GetSettings( width:Int Var,height:Int Var,depth:Int Var,hertz:Int Var,flags:Long Var, x:Int Var, y:Int Var ) Override
+		Local w:Int,h:Int,d:Int,r:Int,f:Long,xp:Int,yp:Int
 		_graphics.GetSettings w,h,d,r,f,xp,yp
 		width=w
 		height=h
@@ -132,7 +135,7 @@ Type TMax2DGraphics Extends TGraphics
 	End Method
 	
 	Method Validate()
-		Local w,h,d,r,f,xp,yp
+		Local w:Int,h:Int,d:Int,r:Int,f:Long,xp:Int,yp:Int
 		_graphics.GetSettings w,h,d,r,f,xp,yp
 		If w<>g_width Or h<>g_height
 			g_width=w
@@ -179,7 +182,7 @@ Type TMax2DGraphics Extends TGraphics
 	End Function
 	
 	Function Create:TMax2DGraphics( g:TGraphics,d:TMax2DDriver )
-		Local gw,gh,gd,gr,gf,gx,gy
+		Local gw:Int,gh:Int,gd:Int,gr:Int,gf:Long,gx:Int,gy:Int
 		g.GetSettings gw,gh,gd,gr,gf,gx,gy
 		
 		If Not default_font default_font=TImageFont.CreateDefault()
@@ -246,7 +249,7 @@ The @red, @green and @blue parameters should be in the range of 0 to 255.
 
 The default cls color is black.
 End Rem
-Function SetClsColor( red,green,blue )
+Function SetClsColor( red:Int,green:Int,blue:Int )
 	gc.clscolor = New SColor8(red, green, blue)
 	_max2dDriver.SetClsColor red,green,blue
 End Function
@@ -260,7 +263,7 @@ Rem
 bbdoc: Get red, green and blue component of current cls color.
 returns: Red, green and blue values in the range 0..255 in the variables supplied.
 End Rem
-Function GetClsColor( red Var,green Var,blue Var )
+Function GetClsColor( red:Int Var,green:Int Var,blue:Int Var )
 	red=gc.clscolor.r
 	green=gc.clscolor.g
 	blue=gc.clscolor.b
@@ -303,7 +306,7 @@ BlitzMax commands that affect the drawing of lines include #SetLineWidth, #SetCo
 The optional @draw_last_pixel parameter can be used to control whether the last pixel of the line is drawn or not.
 Not drawing the last pixel can be useful if you are using certain blending modes.
 End Rem 
-Function DrawLine( x#,y#,x2#,y2#,draw_last_pixel=True )
+Function DrawLine( x#,y#,x2#,y2#,draw_last_pixel:Int=True )
 	_max2dDriver.DrawLine..
 	gc.handle_x,gc.handle_y,..
 	gc.handle_x+x2-x,gc.handle_y+y2-y,..
@@ -373,7 +376,7 @@ Drawing is affected by the current blend mode, color, scale and rotation.
 If the blend mode is ALPHABLEND the image is affected by the current alpha value
 and images with alpha channels are blended correctly with the background.
 End Rem
-Function DrawImage( image:TImage,x#,y#,frame=0 )
+Function DrawImage( image:TImage,x#,y#,frame:Int=0 )
 	Local x0#=-image.handle_x,x1#=x0+image.width
 	Local y0#=-image.handle_y,y1#=y0+image.height
 	Local iframe:TImageFrame=image.Frame(frame)
@@ -391,7 +394,7 @@ Drawing is affected by the current blend mode, color, scale and rotation.
 
 If the blend mode is ALPHABLEND, then the image is also affected by the current alpha value.
 End Rem
-Function DrawImageRect( image:TImage,x#,y#,w#,h#,frame=0 )
+Function DrawImageRect( image:TImage,x#,y#,w#,h#,frame:Int=0 )
 	Local x0#=-image.handle_x,x1#=x0+w
 	Local y0#=-image.handle_y,y1#=y0+h
 	Local iframe:TImageFrame=image.Frame(frame)
@@ -413,7 +416,7 @@ Drawing is affected by the current blend mode, color, scale and rotation.
 
 If the blend mode is ALPHABLEND, then the image is also affected by the current alpha value.
 End Rem
-Function DrawSubImageRect( image:TImage,x#,y#,w#,h#,sx#,sy#,sw#,sh#,hx#=0,hy#=0,frame=0 )
+Function DrawSubImageRect( image:TImage,x#,y#,w#,h#,sx#,sy#,sw#,sh#,hx#=0,hy#=0,frame:Int=0 )
 	Local x0#=-hx*w/sw,x1#=x0+w
 	Local y0#=-hy*h/sh,y1#=y0+h
 	Local iframe:TImageFrame=image.Frame(frame)
@@ -425,31 +428,31 @@ bbdoc: Draw an image in a tiled pattern
 about:
 #TileImage draws an image in a repeating, tiled pattern, filling the current viewport.
 End Rem
-Function TileImage( image:TImage,x#=0#,y#=0#,frame=0 )
+Function TileImage( image:TImage,x#=0#,y#=0#,frame:Int=0 )
 	Local iframe:TImageFrame=image.Frame(frame)
 	If Not iframe Return
 	
 	_max2dDriver.SetTransform 1,0,0,1
 
-	Local w=image.width
-	Local h=image.height
-	Local ox=gc.viewport_x-w+1
-	Local oy=gc.viewport_y-h+1
+	Local w:Int=image.width
+	Local h:Int=image.height
+	Local ox:Int=gc.viewport_x-w+1
+	Local oy:Int=gc.viewport_y-h+1
 	Local px#=x+gc.origin_x-image.handle_x
 	Local py#=y+gc.origin_y-image.handle_y
 	Local fx#=px-Floor(px)
 	Local fy#=py-Floor(py)
-	Local tx=Floor(px)-ox
-	Local ty=Floor(py)-oy
+	Local tx:Int=Floor(px)-ox
+	Local ty:Int=Floor(py)-oy
 
 	If tx>=0 tx=tx Mod w + ox Else tx=w - -tx Mod w + ox
 	If ty>=0 ty=ty Mod h + oy Else ty=h - -ty Mod h + oy
 
-	Local vr=gc.viewport_x+gc.viewport_w,vb=gc.viewport_y+gc.viewport_h
+	Local vr:Int=gc.viewport_x+gc.viewport_w,vb:Int=gc.viewport_y+gc.viewport_h
 
-	Local iy=ty
+	Local iy:Int=ty
 	While iy<vb
-		Local ix=tx
+		Local ix:Int=tx
 		While ix<vr
 			iframe.Draw 0,0,w,h,ix+fx,iy+fy,0,0,w,h
 			ix=ix+w
@@ -469,7 +472,7 @@ The #SetColor command affects the color of #Plot, #DrawRect, #DrawLine, #DrawTex
 
 The @red, @green and @blue parameters should be in the range of 0 to 255.
 End Rem
-Function SetColor( red,green,blue )
+Function SetColor( red:Int,green:Int,blue:Int )
 	gc.color = New SColor8(red, green, blue)
 	_max2dDriver.SetColor red,green,blue
 End Function
@@ -483,7 +486,7 @@ Rem
 bbdoc: Get red, green and blue component of current color.
 returns: Red, green and blue values in the range 0..255 in the variables supplied.
 End Rem
-Function GetColor( red Var,green Var,blue Var )
+Function GetColor( red:Int Var,green:Int Var,blue:Int Var )
 	red=gc.color.r
 	green=gc.color.g
 	blue=gc.color.b
@@ -509,7 +512,7 @@ commands are used in BlitzMax.
 * SHADEBLEND | Pixel colors are multiplied with backbuffer pixel colors, giving a 'shading' effect
 ]
 End Rem
-Function SetBlend( blend )
+Function SetBlend( blend:Int )
 	gc.blend_mode=blend
 	_max2dDriver.SetBlend blend
 End Function
@@ -520,7 +523,7 @@ returns: The current blend mode.
 About:
 See #SetBlend for possible return values.
 End Rem
-Function GetBlend()
+Function GetBlend:Int()
 	Return gc.blend_mode
 End Function
 
@@ -568,7 +571,7 @@ about:
 The current mask color is used to build an alpha mask when images are loaded or modified.
 The @red, @green and @blue parameters should be in the range of 0 to 255.
 End Rem
-Function SetMaskColor( red,green,blue )
+Function SetMaskColor( red:Int,green:Int,blue:Int )
 	gc.mask_red=red
 	gc.mask_green=green
 	gc.mask_blue=blue
@@ -578,7 +581,7 @@ Rem
 bbdoc: Get red, green and blue component of current mask color
 returns: Red, green and blue values in the range 0..255 
 End Rem
-Function GetMaskColor( red Var,green Var,blue Var )
+Function GetMaskColor( red:Int Var,green:Int Var,blue:Int Var )
 	red=gc.mask_red
 	green=gc.mask_green
 	blue=gc.mask_blue
@@ -655,15 +658,15 @@ about:
 The current ViewPort defines an area within the back buffer that all drawing is clipped to. Any
 regions of a DrawCommand that fall outside the current ViewPort are not drawn.
 End Rem
-Function SetViewport( x,y,width,height )
+Function SetViewport( x:Int,y:Int,width:Int,height:Int )
 	gc.viewport_x=x
 	gc.viewport_y=y
 	gc.viewport_w=width
 	gc.viewport_h=height
-	Local x0=Floor( x / gc.vres_mousexscale )
-	Local y0=Floor( y / gc.vres_mouseyscale )
-	Local x1=Floor( (x+width) / gc.vres_mousexscale )
-	Local y1=Floor( (y+height) / gc.vres_mouseyscale )
+	Local x0:Int=Floor( x / gc.vres_mousexscale )
+	Local y0:Int=Floor( y / gc.vres_mouseyscale )
+	Local x1:Int=Floor( (x+width) / gc.vres_mousexscale )
+	Local y1:Int=Floor( (y+height) / gc.vres_mouseyscale )
 	_max2dDriver.SetViewport x0,y0,(x1-x0),(y1-y0)
 End Function
 
@@ -671,7 +674,7 @@ Rem
 bbdoc: Get dimensions of current Viewport.
 returns: The horizontal, vertical, width and height values of the current Viewport in the variables supplied.
 End Rem
-Function GetViewport( x Var,y Var,width Var,height Var )
+Function GetViewport( x:Int Var,y:Int Var,width:Int Var,height:Int Var )
 	x=gc.viewport_x
 	y=gc.viewport_y
 	width=gc.viewport_w
@@ -799,7 +802,7 @@ about:
 flags. Use the SMOOTHFONT flag for improved filtering if the font is to be rotated or
 scaled.
 End Rem
-Function LoadImageFont:TImageFont( url:Object,size,style=SMOOTHFONT )
+Function LoadImageFont:TImageFont( url:Object,size:Int,style:Int=SMOOTHFONT )
 	Return TImageFont.Load( url,size,style )
 End Function
 
@@ -831,10 +834,10 @@ about:
 This command is useful for calculating horizontal alignment of text when using 
 the #DrawText command.
 End Rem
-Function TextWidth( Text$ )
-	Local width=0
-	For Local n=0 Until Text.length
-		Local i=gc.image_font.CharToGlyph( Text[n] )
+Function TextWidth:Int( Text$ )
+	Local width:Int=0
+	For Local n:Int=0 Until Text.length
+		Local i:Int=gc.image_font.CharToGlyph( Text[n] )
 		If i<0 Continue
 		width:+gc.image_font.LoadGlyph(i).Advance()
 	Next
@@ -848,7 +851,7 @@ about:
 This command is useful for calculating vertical alignment of text when using 
 the #DrawText command.
 End Rem
-Function TextHeight( Text$ )
+Function TextHeight:Int( Text$ )
 	Return gc.image_font.Height()
 	Rem
 	Local height=0
@@ -891,10 +894,10 @@ If flags is -1, the auto image flags are used: See #AutoImageFlags.
 
 To combine flags, use the | (boolean OR) operator.
 End Rem
-Function LoadImage:TImage( url:Object,flags=-1 )
+Function LoadImage:TImage( url:Object,flags:Int=-1 )
 	If flags=-1 flags=gc.auto_imageflags
 	Local image:TImage=TImage.Load( url,flags,gc.mask_red,gc.mask_green,gc.mask_blue )
-	If Not image Return
+	If Not image Return null
 	If gc.auto_midhandle MidHandleImage image
 	Return image
 End Function
@@ -908,10 +911,10 @@ existing pixmap.
 
 See #LoadImage for valid @flags values.
 End Rem
-Function LoadAnimImage:TImage( url:Object,cell_width,cell_height,first_cell,cell_count,flags=-1 )
+Function LoadAnimImage:TImage( url:Object,cell_width:Int,cell_height:Int,first_cell:Int,cell_count:Int,flags:Int=-1 )
 	If flags=-1 flags=gc.auto_imageflags
 	Local image:TImage=TImage.LoadAnim( url,cell_width,cell_height,first_cell,cell_count,flags,gc.mask_red,gc.mask_green,gc.mask_blue )
-	If Not image Return
+	If Not image Return null
 	If gc.auto_midhandle MidHandleImage image
 	Return image
 End Function 
@@ -935,7 +938,7 @@ when they are created. If auto midhandle mode is disabled, images are handled by
 
 AutoMidHandle defaults to False after calling #Graphics.
 End Rem
-Function AutoMidHandle( enable )
+Function AutoMidHandle( enable:Int )
 	gc.auto_midhandle=enable
 End Function
 
@@ -946,7 +949,7 @@ The auto image flags are used by #LoadImage and #CreateImage when no image
 flags are specified. See #LoadImage for a full list of valid image flags. 
 AutoImageFlags defaults to MASKEDIMAGE | FILTEREDIMAGE.
 End Rem
-Function AutoImageFlags( flags )
+Function AutoImageFlags( flags:Int )
 	If flags=-1 Return
 	gc.auto_imageflags=flags
 End Function
@@ -967,7 +970,7 @@ Rem
 bbdoc: Get width of an image
 returns: The width, in pixels, of @image
 End Rem
-Function ImageWidth( image:TImage )
+Function ImageWidth:Int( image:TImage )
 	Return image.width
 End Function
 
@@ -975,7 +978,7 @@ Rem
 bbdoc: Get height of an image
 returns: The height, in pixels, of @image
 End Rem
-Function ImageHeight( image:TImage )
+Function ImageHeight:Int( image:TImage )
 	Return image.height
 End Function
 
@@ -988,7 +991,7 @@ before being drawn.
 
 Please refer to #LoadImage for valid @flags values. The @flags value is always combined with DYNAMICIMAGE.
 End Rem
-Function CreateImage:TImage( width,height,frames=1,flags=-1 )
+Function CreateImage:TImage( width:Int,height:Int,frames:Int=1,flags:Int=-1 )
 	If flags=-1 flags=gc.auto_imageflags
 	Local image:TImage=TImage.Create( width,height,frames,flags|DYNAMICIMAGE,gc.mask_red,gc.mask_green,gc.mask_blue )
 	If gc.auto_midhandle MidHandleImage image
@@ -1005,7 +1008,7 @@ Only images created with the DYNAMICIMAGE flag can be locked.
 
 Locked images must eventually be unlocked with #UnlockImage before they can be drawn.
 End Rem
-Function LockImage:TPixmap( image:TImage,frame=0,read_lock=True,write_lock=True )
+Function LockImage:TPixmap( image:TImage,frame:Int=0,read_lock:Int=True,write_lock:Int=True )
 	Return image.Lock( frame,read_lock,write_lock )
 End Function
 
@@ -1014,7 +1017,7 @@ bbdoc: Unlock an image
 about:
 Unlocks an image previously locked with #LockImage.
 end rem
-Function UnlockImage( image:TImage,frame=0 )
+Function UnlockImage( image:TImage,frame:Int=0 )
 End Function
 
 Rem
@@ -1024,7 +1027,7 @@ Copies pixels from the back buffer to an image frame.
 
 Only images created with the DYNAMICIMAGE flag can be grabbed.
 End Rem
-Function GrabImage( image:TImage,x,y,frame=0 )
+Function GrabImage( image:TImage,x:Int,y:Int,frame:Int=0 )
 	Local pixmap:TPixmap=_max2dDriver.GrabPixmap( x,y,image.width,image.height )
 	If image.flags&MASKEDIMAGE 
 		pixmap=MaskPixmap( pixmap,gc.mask_red,gc.mask_green,gc.mask_blue )
@@ -1035,50 +1038,50 @@ End Function
 Rem
 bbdoc: Draw pixmap
 end rem
-Function DrawPixmap( pixmap:TPixmap,x,y )
+Function DrawPixmap( pixmap:TPixmap,x:Int,y:Int )
 	_max2dDriver.DrawPixmap pixmap,x,y
 End Function
 
 Rem
 bbdoc: Grab pixmap
 end rem
-Function GrabPixmap:TPixmap( x,y,width,height )
+Function GrabPixmap:TPixmap( x:Int,y:Int,width:Int,height:Int )
 	Return _max2dDriver.GrabPixmap( x,y,width,height )
 End Function
 
-Const COLLISION_LAYER_ALL=0
-Const COLLISION_LAYER_1=$0001
-Const COLLISION_LAYER_2=$0002
-Const COLLISION_LAYER_3=$0004
-Const COLLISION_LAYER_4=$0008
-Const COLLISION_LAYER_5=$0010
-Const COLLISION_LAYER_6=$0020
-Const COLLISION_LAYER_7=$0040
-Const COLLISION_LAYER_8=$0080
-Const COLLISION_LAYER_9=$0100
-Const COLLISION_LAYER_10=$0200
-Const COLLISION_LAYER_11=$0400
-Const COLLISION_LAYER_12=$0800
-Const COLLISION_LAYER_13=$1000
-Const COLLISION_LAYER_14=$2000
-Const COLLISION_LAYER_15=$4000
-Const COLLISION_LAYER_16=$8000
-Const COLLISION_LAYER_17=$00010000
-Const COLLISION_LAYER_18=$00020000
-Const COLLISION_LAYER_19=$00040000
-Const COLLISION_LAYER_20=$00080000
-Const COLLISION_LAYER_21=$00100000
-Const COLLISION_LAYER_22=$00200000
-Const COLLISION_LAYER_23=$00400000
-Const COLLISION_LAYER_24=$00800000
-Const COLLISION_LAYER_25=$01000000
-Const COLLISION_LAYER_26=$02000000
-Const COLLISION_LAYER_27=$04000000
-Const COLLISION_LAYER_28=$08000000
-Const COLLISION_LAYER_29=$10000000
-Const COLLISION_LAYER_30=$20000000
-Const COLLISION_LAYER_31=$40000000
-Const COLLISION_LAYER_32=$80000000
+Const COLLISION_LAYER_ALL:Int=0
+Const COLLISION_LAYER_1:Int=$0001
+Const COLLISION_LAYER_2:Int=$0002
+Const COLLISION_LAYER_3:Int=$0004
+Const COLLISION_LAYER_4:Int=$0008
+Const COLLISION_LAYER_5:Int=$0010
+Const COLLISION_LAYER_6:Int=$0020
+Const COLLISION_LAYER_7:Int=$0040
+Const COLLISION_LAYER_8:Int=$0080
+Const COLLISION_LAYER_9:Int=$0100
+Const COLLISION_LAYER_10:Int=$0200
+Const COLLISION_LAYER_11:Int=$0400
+Const COLLISION_LAYER_12:Int=$0800
+Const COLLISION_LAYER_13:Int=$1000
+Const COLLISION_LAYER_14:Int=$2000
+Const COLLISION_LAYER_15:Int=$4000
+Const COLLISION_LAYER_16:Int=$8000
+Const COLLISION_LAYER_17:Int=$00010000
+Const COLLISION_LAYER_18:Int=$00020000
+Const COLLISION_LAYER_19:Int=$00040000
+Const COLLISION_LAYER_20:Int=$00080000
+Const COLLISION_LAYER_21:Int=$00100000
+Const COLLISION_LAYER_22:Int=$00200000
+Const COLLISION_LAYER_23:Int=$00400000
+Const COLLISION_LAYER_24:Int=$00800000
+Const COLLISION_LAYER_25:Int=$01000000
+Const COLLISION_LAYER_26:Int=$02000000
+Const COLLISION_LAYER_27:Int=$04000000
+Const COLLISION_LAYER_28:Int=$08000000
+Const COLLISION_LAYER_29:Int=$10000000
+Const COLLISION_LAYER_30:Int=$20000000
+Const COLLISION_LAYER_31:Int=$40000000
+Const COLLISION_LAYER_32:Int=$80000000
 
 Rem
 bbdoc: Tests if two images collide
@@ -1087,7 +1090,7 @@ about:
 #ImagesCollide uses the current Rotation and Scale factors from the most previous
 call to #SetScale and #SetRotation to calculate at a pixel level if the two images collide. 
 End Rem
-Function ImagesCollide(image1:TImage,x1,y1,frame1,image2:TImage,x2,y2,frame2)
+Function ImagesCollide:Int(image1:TImage,x1:Int,y1:Int,frame1:Int,image2:TImage,x2:Int,y2:Int,frame2:Int)
 	ResetCollisions COLLISION_LAYER_32
 	CollideImage image1,x1,y1,frame1,0,COLLISION_LAYER_32
 	If CollideImage(image2,x2,y2,frame2,COLLISION_LAYER_32,0) Return True
@@ -1100,8 +1103,8 @@ about:
 #ImagesCollide2 uses the specified Rotation and Scale paramteters
 to calculate at a pixel level if the two images collide (overlap).
 End Rem
-Function ImagesCollide2(image1:TImage,x1,y1,frame1,rot1#,scalex1#,scaley1#,image2:TImage,x2,y2,frame2,rot2#,scalex2#,scaley2#)
-	Local	_scalex#,_scaley#,_rot#,res
+Function ImagesCollide2:Int(image1:TImage,x1:Int,y1:Int,frame1:Int,rot1#,scalex1#,scaley1#,image2:TImage,x2:Int,y2:Int,frame2:Int,rot2#,scalex2#,scaley2#)
+	Local	_scalex#,_scaley#,_rot#,res:Int
 	_rot=GetRotation()
 	GetScale _scalex,_scaley
 	ResetCollisions COLLISION_LAYER_32
@@ -1146,7 +1149,7 @@ Note: COLLISION_LAYER_32 is used by the #ImagesCollide and #ImagesCollide2 comma
 ]
 EndRem
 Function ResetCollisions(mask%=0)
-	Local	i,q:TQuad
+	Local	i:Int,q:TQuad
 	For i=0 To 31
 		If mask=0 Or mask&(1 Shl i)
 			q=quadlayer[i]
@@ -1176,7 +1179,7 @@ The @writemask specifies which if any collision layers the @image is added to in
 
 The id specifies an object to be returned to future #CollideImage calls when collisions occur. 
 EndRem
-Function CollideImage:Object[](image:TImage,x,y,frame,collidemask%,writemask%,id:Object=Null) 
+Function CollideImage:Object[](image:TImage,x:Int,y:Int,frame:Int,collidemask%,writemask%,id:Object=Null) 
 	Local	q:TQuad
 	q=CreateQuad(image,frame,x,y,image.width,image.height,id)
 	Return CollideQuad(q,collidemask,writemask)
@@ -1191,7 +1194,7 @@ The @writemask specifies which if any collision layers the @image is added to in
 
 The @id specifies an object to be returned to future #CollideImage calls when collisions occur.
 EndRem
-Function CollideRect:Object[](x,y,w,h,collidemask%,writemask%,id:Object=Null) 
+Function CollideRect:Object[](x:Int,y:Int,w:Int,h:Int,collidemask%,writemask%,id:Object=Null) 
 	Local	q:TQuad
 	q=CreateQuad(Null,0,x,y,w,h,id)
 	Return CollideQuad(q,collidemask,writemask)
@@ -1209,22 +1212,22 @@ Function SetCollisions2DTransform(ix#,iy#,jx#,jy#)	'callback from module Blitz2D
 End Function
 
 Global TextureMaps:TPixmap[]
-Global LineBuffer[]
+Global LineBuffer:Int[]
 Global quadlayer:TQuad[32]
 Global freequads:TQuad
 
-Const POLYX=0
-Const POLYY=1
-Const POLYU=2
-Const POLYV=3
+Const POLYX:Int=0
+Const POLYY:Int=1
+Const POLYU:Int=2
+Const POLYV:Int=3
 
-Function DotProduct(x0#,y0#,x1#,y1#,x2#,y2#)
+Function DotProduct:Int(x0#,y0#,x1#,y1#,x2#,y2#)
 	Return (((x2-x1)*(y1-y0))-((x1-x0)*(y2-y1)))
 End Function
 
-Function ClockwisePoly(data#[],channels)	'flips order if anticlockwise
-	Local	count,clk,i,j
-	Local	r0,r1,r2
+Function ClockwisePoly(data#[],channels:Int)	'flips order if anticlockwise
+	Local	count:Int,clk:Int,i:Int,j:Int
+	Local	r0:Int,r1:Int,r2:Int
 	Local	t#
 	
 	count=Len(data)/channels
@@ -1255,18 +1258,18 @@ End Function
 Type rpoly
 	Field	texture:TPixmap
 	Field	data#[]
-	Field	channels,count,size
+	Field	channels:Int,count:Int,size:Int
 	Field	ldat#[],ladd#[]
 	Field	rdat#[],radd#[]
-	Field	Left,Right,top
-	Field	state
+	Field	Left:Int,Right:Int,top:Int
+	Field	state:Int
 End Type
 
-Function RenderPolys(vdata#[][],channels[],textures:TPixmap[],renderspans(polys:TList,count,ypos))
-	Local	polys:rpoly[],p:rpoly,pcount
+Function RenderPolys:Int(vdata#[][],channels:Int[],textures:TPixmap[],renderspans:Int(polys:TList,count:Int,ypos:Int))
+	Local	polys:rpoly[],p:rpoly,pcount:Int
 	Local	active:TList
-	Local	top,bot
-	Local	n,y,h,i,j,res
+	Local	top:Int,bot:Int
+	Local	n:Int,y:Int,h:Int,i:Int,j:Int,res:Int
 	Local	data#[]
 
 	bot=$80000000
@@ -1382,15 +1385,15 @@ Function RenderPolys(vdata#[][],channels[],textures:TPixmap[],renderspans(polys:
 	Return res
 End Function
 
-Function CollideSpans(polys:TList,count,y)
+Function CollideSpans:Int(polys:TList,count:Int,y:Int)
 	Local	p:rpoly
-	Local	startx,endx
-	Local	x0,x1,w,x
+	Local	startx:Int,endx:Int
+	Local	x0:Int,x1:Int,w:Int,x:Int
 	Local	u#,v#,ui#,vi#
-	Local	pix Ptr
+	Local	pix:Int Ptr
 	Local	src:TPixmap
-	Local	tw,th,tp,argb
-	Local	width,skip#
+	Local	tw:Int,th:Int,tp:Int,argb:Int
+	Local	width:Int,skip#
 	
 
 	startx=$7fffffff
@@ -1459,7 +1462,7 @@ Type TQuad
 	Field	link:TQuad
 	Field	id:Object
 	Field	mask:TPixmap
-	Field	frame	
+	Field	frame:Int
 	Field	minx#,miny#,maxx#,maxy#
 	Field	xyuv#[16]
 		
@@ -1487,11 +1490,11 @@ Type TQuad
 	End Method
 End Type
 
-Function QuadsCollide(p:TQuad,q:TQuad)
+Function QuadsCollide:Int(p:TQuad,q:TQuad)
 	If p.maxx<q.minx Or p.maxy<q.miny Or p.minx>q.maxx Or p.miny>q.maxy Return False
 	Local	vertlist#[][2]
 	Local	textures:TPixmap[2]
-	Local	channels[2]	
+	Local	channels:Int[2]	
 	vertlist[0]=p.xyuv	
 	vertlist[1]=q.xyuv	
 	textures[0]=p.mask
@@ -1501,7 +1504,7 @@ Function QuadsCollide(p:TQuad,q:TQuad)
 	Return RenderPolys(vertlist,channels,textures,CollideSpans)
 End Function
 
-Function CreateQuad:TQuad(image:TImage,frame,x#,y#,w#,h#,id:Object)
+Function CreateQuad:TQuad(image:TImage,frame:Int,x#,y#,w#,h#,id:Object)
 	Local	x0#,y0#,x1#,y1#,tx#,ty#
 	Local	tx0#,ty0#,tx1#,ty1#,tx2#,ty2#,tx3#,ty3#
 	Local	minx#,miny#,maxx#,maxy#
@@ -1543,7 +1546,7 @@ End Function
 Function CollideQuad:Object[](pquad:TQuad,collidemask%,writemask%) 
 	Local	result:Object[]
 	Local	p:TQuad,q:TQuad
-	Local	i,j,count
+	Local	i:Int,j:Int,count:Int
 
 	p=pquad				'CreateImageQuad(image,frame,x,y)
 ' check for collisions