Browse Source

Use pointers instead of Int.

woollybah 11 years ago
parent
commit
563ab82d89

+ 8 - 8
glgraphics.mod/glgraphics.bmx

@@ -65,11 +65,11 @@ Incbin "gldrawtextfont.bin"
 Extern
 	Function bbGLGraphicsShareContexts()
 	Function bbGLGraphicsGraphicsModes( buf:Byte Ptr,size )
-	Function bbGLGraphicsAttachGraphics( widget,flags )
-	Function bbGLGraphicsCreateGraphics( width,height,depth,hertz,flags )
-	Function bbGLGraphicsGetSettings( context,width Var,height Var,depth Var,hertz Var,flags Var )
-	Function bbGLGraphicsClose( context )	
-	Function bbGLGraphicsSetGraphics( context )
+	Function bbGLGraphicsAttachGraphics:Byte Ptr( widget:Byte Ptr,flags )
+	Function bbGLGraphicsCreateGraphics:Byte Ptr( width,height,depth,hertz,flags )
+	Function bbGLGraphicsGetSettings( context:Byte Ptr,width Var,height Var,depth Var,hertz Var,flags Var )
+	Function bbGLGraphicsClose( context:Byte Ptr )	
+	Function bbGLGraphicsSetGraphics( context:Byte Ptr )
 	Function bbGLGraphicsFlip( sync )
 End Extern
 
@@ -99,7 +99,7 @@ Type TGLGraphics Extends TGraphics
 		_context=0
 	End Method
 	
-	Field _context
+	Field _context:Byte Ptr
 	
 End Type
 
@@ -121,7 +121,7 @@ Type TGLGraphicsDriver Extends TGraphicsDriver
 		Return modes
 	End Method
 	
-	Method AttachGraphics:TGLGraphics( widget,flags )
+	Method AttachGraphics:TGLGraphics( widget:Byte Ptr,flags )
 		Local t:TGLGraphics=New TGLGraphics
 		t._context=bbGLGraphicsAttachGraphics( widget,flags )
 		Return t
@@ -134,7 +134,7 @@ Type TGLGraphicsDriver Extends TGraphicsDriver
 	End Method
 	
 	Method SetGraphics( g:TGraphics )
-		Local context
+		Local context:Byte Ptr
 		Local t:TGLGraphics=TGLGraphics( g )
 		If t context=t._context
 		bbGLGraphicsSetGraphics context

+ 4 - 4
glgraphics.mod/glgraphics.linux.c

@@ -51,14 +51,14 @@ typedef struct BBGLContext BBGLContext;
 
 struct BBGLContext{
 	int mode,width,height,depth,hertz,flags,sync;
-	int window;
+	Window window;
 	GLXContext glContext;
 };
 
 // glgraphics.bmx interface
 
 int bbGLGraphicsGraphicsModes( int *imodes,int maxcount );
-BBGLContext *bbGLGraphicsAttachGraphics( int window,int flags );
+BBGLContext *bbGLGraphicsAttachGraphics( void * window,int flags );
 BBGLContext *bbGLGraphicsCreateGraphics( int width,int height,int depth,int hz,int flags );
 void bbGLGraphicsGetSettings( BBGLContext *context,int *width,int *height,int *depth,int *hz,int *flags );
 void bbGLGraphicsClose( BBGLContext *context );
@@ -130,13 +130,13 @@ static void _swapBuffers( BBGLContext *context ){
 	bbSystemPoll();
 }
 
-BBGLContext *bbGLGraphicsAttachGraphics( int window,int flags ){
+BBGLContext *bbGLGraphicsAttachGraphics( void * window,int flags ){
 	BBGLContext *context=(BBGLContext*)malloc( sizeof(BBGLContext) );
 	memset( context,0,sizeof(BBGLContext) );
 	context->mode=MODE_WIDGET;
 	context->flags=flags;
 	context->sync=-1;	
-	context->window=window;
+	context->window=(Window)window;
 	return context;
 }
 

+ 1 - 2
glmax2d.mod/glmax2d.bmx

@@ -101,7 +101,6 @@ Function DeleteTex( name,seq )
 End Function
 
 Function CreateTex( width,height,flags )
-
 	'alloc new tex
 	Local name
 	glGenTextures 1,Varptr name
@@ -289,7 +288,7 @@ Type TGLMax2DDriver Extends TMax2DDriver
 		Return GLGraphicsDriver().GraphicsModes()
 	End Method
 	
-	Method AttachGraphics:TMax2DGraphics( widget,flags )
+	Method AttachGraphics:TMax2DGraphics( widget:Byte Ptr,flags )
 		Local g:TGLGraphics=GLGraphicsDriver().AttachGraphics( widget,flags )
 		If g Return TMax2DGraphics.Create( g,Self )
 	End Method

+ 12 - 12
graphics.mod/graphics.bmx

@@ -78,7 +78,7 @@ Type TGraphicsDriver
 
 	Method GraphicsModes:TGraphicsMode[]() Abstract
 	
-	Method AttachGraphics:TGraphics( widget,flags ) Abstract
+	Method AttachGraphics:TGraphics( widget:Byte Ptr,flags ) Abstract
 	
 	Method CreateGraphics:TGraphics( width,height,depth,hertz,flags ) Abstract
 	
@@ -181,11 +181,11 @@ about:
 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 )
-	Local mode:TGraphicsMode=GraphicsModes()[index]
-	width=mode.width
-	height=mode.height
-	depth=mode.depth
-	hertz=mode.hertz
+	Local Mode:TGraphicsMode=GraphicsModes()[index]
+	width=Mode.width
+	height=Mode.height
+	depth=Mode.depth
+	hertz=Mode.hertz
 End Function
 
 Rem
@@ -196,11 +196,11 @@ 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 )
-	For Local mode:TGraphicsMode=EachIn GraphicsModes()
-		If width And width<>mode.width Continue
-		If height And height<>mode.height Continue
-		If depth And depth<>mode.depth Continue
-		If hertz And hertz<>mode.hertz Continue
+	For Local Mode:TGraphicsMode=EachIn GraphicsModes()
+		If width And width<>Mode.width Continue
+		If height And height<>Mode.height Continue
+		If depth And depth<>Mode.depth Continue
+		If hertz And hertz<>Mode.hertz Continue
 		Return True
 	Next
 	Return False
@@ -229,7 +229,7 @@ Function CreateGraphics:TGraphics( width,height,depth,hertz,flags )
 	Return g
 End Function
 
-Function AttachGraphics:TGraphics( widget,flags )
+Function AttachGraphics:TGraphics( widget:Byte Ptr,flags )
 	flags:|_defaultFlags
 	Local g:TGraphics
 	Try