Sfoglia il codice sorgente

Added graphics examples.

woollybah 6 anni fa
parent
commit
efac416783

+ 20 - 0
graphics.mod/doc/flip.bmx

@@ -0,0 +1,20 @@
+SuperStrict
+
+Graphics 640,480
+
+Local x:Int = 100
+Local sync:Int = 0
+
+While Not (KeyHit(KEY_ESCAPE) Or AppTerminate())
+	Cls 
+	DrawText "Sync=" + Sync , x , 100
+	x :+ 1 
+	If x > 300 Then
+		x = 100
+		sync :+ 1
+		If sync >1 Then
+			sync=-1
+		End If
+  End If
+  Flip sync
+Wend

+ 8 - 0
graphics.mod/doc/graphics.bmx

@@ -0,0 +1,8 @@
+SuperStrict
+
+Graphics 640,480
+
+DrawRect 50,50,200,100
+Flip
+Repeat
+Until KeyDown(KEY_ESCAPE) Or AppTerminate()

+ 27 - 0
graphics.mod/doc/graphics_1.bmx

@@ -0,0 +1,27 @@
+SuperStrict
+
+Import MaxGUI.Drivers
+
+Local G:TGraphics = Graphics(640,480) 'creates the normal graphic screen first
+Local MyWindow:TGadget=CreateWindow("Canvas Example", 200,200,320,240)
+Local MyCanvas:TGadget=CreateCanvas(10,10,290,140,MyWindow)
+
+Repeat
+	WaitEvent()
+	Select EventID()
+		Case EVENT_WINDOWCLOSE
+			End
+		Case EVENT_GADGETPAINT
+			SetGraphics CanvasGraphics (MyCanvas)
+			SetColor Int(Rnd(255)),Int(Rnd(255)),Int(Rnd(255))
+			DrawRect 20 , 20 , 50 , 80
+			Flip
+			SetGraphics G
+			SetColor Int(Rnd(255)),Int(Rnd(255)),Int(Rnd(255))
+			DrawOval 100,100,100,100
+			Flip
+		Case EVENT_MOUSEMOVE
+			RedrawGadget(MyCanvas)
+	End Select
+
+Until AppTerminate()

+ 10 - 0
graphics.mod/doc/graphicsdepth.bmx

@@ -0,0 +1,10 @@
+SuperStrict
+
+Graphics 640,480,0,60
+
+DrawText "Graphics Width: "+GraphicsWidth(), 10 , 10
+DrawText "Graphics Height: "+GraphicsHeight(), 10 , 30
+DrawText "Graphics Depth: "+GraphicsDepth(), 10 , 50
+DrawText "Graphics Hertz: "+GraphicsHertz(), 10 , 70
+Flip
+WaitKey()

+ 10 - 0
graphics.mod/doc/graphicsheight.bmx

@@ -0,0 +1,10 @@
+SuperStrict
+
+Graphics 640,480,0,60
+
+DrawText "Graphics Width: "+GraphicsWidth(), 10 , 10
+DrawText "Graphics Height: "+GraphicsHeight(), 10 , 30
+DrawText "Graphics Depth: "+GraphicsDepth(), 10 , 50
+DrawText "Graphics Hertz: "+GraphicsHertz(), 10 , 70
+Flip
+WaitKey()

+ 10 - 0
graphics.mod/doc/graphicshertz.bmx

@@ -0,0 +1,10 @@
+SuperStrict
+
+Graphics 640,480,0,60
+
+DrawText "Graphics Width: "+GraphicsWidth(), 10 , 10
+DrawText "Graphics Height: "+GraphicsHeight(), 10 , 30
+DrawText "Graphics Depth: "+GraphicsDepth(), 10 , 50
+DrawText "Graphics Hertz: "+GraphicsHertz(), 10 , 70
+Flip
+WaitKey()

+ 10 - 0
graphics.mod/doc/graphicswidth.bmx

@@ -0,0 +1,10 @@
+SuperStrict
+
+Graphics 640,480,0,60
+
+DrawText "Graphics Width: "+GraphicsWidth(), 10 , 10
+DrawText "Graphics Height: "+GraphicsHeight(), 10 , 30
+DrawText "Graphics Depth: "+GraphicsDepth(), 10 , 50
+DrawText "Graphics Hertz: "+GraphicsHertz(), 10 , 70
+Flip
+WaitKey()

+ 27 - 0
graphics.mod/doc/setgraphics.bmx

@@ -0,0 +1,27 @@
+SuperStrict
+
+Import MaxGUI.Drivers
+
+Local G:TGraphics = Graphics(640,480) 'creates the normal graphic screen first
+Local MyWindow:TGadget=CreateWindow("Canvas Example", 200,200,320,240)
+Local MyCanvas:TGadget=CreateCanvas(10,10,290,140,MyWindow)
+
+Repeat
+	WaitEvent()
+	Select EventID()
+		Case EVENT_WINDOWCLOSE
+			End
+		Case EVENT_GADGETPAINT
+			SetGraphics CanvasGraphics (MyCanvas)
+			SetColor Int(Rnd(255)),Int(Rnd(255)),Int(Rnd(255))
+			DrawRect 20 , 20 , 50 , 80
+			Flip
+			SetGraphics G
+			SetColor Int(Rnd(255)),Int(Rnd(255)),Int(Rnd(255))
+			DrawOval 100,100,100,100
+			Flip
+		Case EVENT_MOUSEMOVE
+			RedrawGadget(MyCanvas)
+	End Select
+
+Until AppTerminate()

+ 0 - 1
graphics.mod/doc/setgraphicsdriver.bmx

@@ -15,4 +15,3 @@ glClear GL_COLOR_BUFFER_BIT
 GLDrawText "'Raw' OpenGL Graphics! Hit any key...",0,0
 Flip
 WaitKey
-