瀏覽代碼

Added examples.

woollybah 6 年之前
父節點
當前提交
e9a6032df6

+ 26 - 0
docs/api/brl/brl.bankstream/tbankstream.md

@@ -7,6 +7,19 @@ sidebar_label: TBankStream
 BankStream Object
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+Local bank:TBank = CreateBank(1)  'This bank will resize itself with stream
+Local stream:TBankStream = TBankStream.Create(bank)
+WriteString(stream, "Hello World")
+CloseStream(stream)
+
+For Local i:Int = 0 Until BankSize(bank)
+	Print Chr(PeekByte(bank , i) )
+Next
+```
 ## Functions
 
 ### `Function Create:TBankStream( bank:TBank )`
@@ -22,4 +35,17 @@ can be used in place of a stream.
 A bank stream object
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+Local bank:TBank = CreateBank(1)  'This bank will resize itself from stream
+Local stream:TBankStream = TBankStream.Create(bank)
+WriteString(stream, "Hello World")
+CloseStream(stream)
+
+For Local i:Int = 0 Until BankSize(bank)
+	Print Chr(PeekByte(bank , i) )
+Next
+```
 

+ 55 - 0
docs/api/brl/brl.pixmap/tpixmap.md

@@ -7,6 +7,39 @@ sidebar_label: TPixmap
 The Pixmap type
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+'Prompt the user for an image file
+Local path:String = RequestFile("Select an Image File","Image Files:png,jpg,bmp")
+
+Local pix:TPixmap
+
+'Load the file into a TPixmap according to its format
+Select ExtractExt(path)
+	Case "png"
+		pix = LoadPixmapPNG(path)
+	Case "jpg"
+		pix = LoadPixmapJPeg(path)
+	Default
+		pix = LoadPixmap(path)
+EndSelect
+
+'Ensure the file loaded
+If Not pix Then
+	Notify "The File Could Not Load. The Program Will Now End."
+	End
+End If
+
+'Setup the window
+Graphics 600,600,0,60,2
+Repeat
+	Cls
+	DrawPixmap Image , 20 , 20
+	Flip
+Until KeyDown(KEY_ESCAPE) Or AppTerminate()
+```
 ## Fields
 
 ### `Field pixels:Byte Ptr`
@@ -100,6 +133,28 @@ Write a pixel to a pixmap
 
 Clear a pixmap
 
+#### Example
+```blitzmax
+SuperStrict
+
+Graphics 800 , 600
+
+Local mypix:TPixmap = LoadPixmap(BlitzMaxPath()+"/samples/hitoro/gfx/boing.png")
+If mypix = Null Then
+	RuntimeError ("Error Loading Image")
+End If
+
+DrawPixmap mypix, 0, 0
+
+ClearPixels(mypix, $FFFFFF)
+ 
+
+DrawPixmap mypix, 300, 0
+
+Flip
+
+WaitKey
+```
 
 ## Functions
 

+ 17 - 0
docs/api/brl/brl.pixmap/tpixmaploader.md

@@ -22,4 +22,21 @@ Load a pixmap
 This method must be implemented by extending types.
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+Graphics 640,480
+Local player:TPixmap=LoadPixmap(blitzmaxpath()+"\samples\hitoro\gfx\boing.png")
+
+If player = Null Then
+	RuntimeError ("Error Loading Image")
+End If
+
+Repeat
+	Cls
+	DrawPixmap Player,10,10
+	Flip
+Until KeyHit(key_escape) Or AppTerminate()
+```
 

+ 13 - 0
docs/api/brl/brl_bankstream.md

@@ -33,4 +33,17 @@ can be used in place of a stream.
 A bank stream object
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+Local bank:TBank = CreateBank(1)  'This bank will resize itself with stream
+Local stream:TBankStream = CreateBankStream(bank)
+WriteString(stream, "Hello World")
+CloseStream(stream)
+
+For Local i:Int = 0 Until BankSize(bank)
+	Print Chr(PeekByte(bank , i) )
+Next
+```
 

+ 84 - 0
docs/api/brl/brl_blitz.md

@@ -48,6 +48,21 @@ Stop program execution and enter debugger
 If there is no debugger present, this command is ignored.
 
 
+#### Example
+```blitzmax
+'
+' Run in debug mode
+'
+SuperStrict
+
+Graphics 640,480
+Local a:Int
+
+Repeat
+	a = Rnd(20)
+Until KeyDown(KEY_ESCAPE)
+DebugStop
+```
 
 ### `Function DebugLog( message$ )`
 
@@ -56,6 +71,15 @@ Write a string to debug log
 If there is no debugger present, this command is ignored.
 
 
+#### Example
+```blitzmax
+'
+' Run in debug mode to see the output
+'
+SuperStrict
+
+DebugLog "My debug text"
+```
 
 ### `Function OnEnd( fun() )`
 
@@ -115,6 +139,19 @@ Wait for a given number of milliseconds
 A millisecond is one thousandth of a second.
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+Print "This is a test line."
+
+Delay 3000
+
+Print "This line was printed 3000 milliseconds later."
+Print "This program will end in 2000 milliseconds."
+
+Delay 2000
+```
 
 ### `Function MilliSecs:Int()`
 
@@ -131,6 +168,16 @@ A millisecond is one thousandth of a second.
 Milliseconds since computer turned on.
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+Local start:Int = MilliSecs()
+
+Input("Type Anything >")
+
+Print "You took "+(MilliSecs()-start)+" milliseconds to type that."
+```
 
 ### `Function MemAlloc:Byte Ptr( size:Size_T )`
 
@@ -349,6 +396,20 @@ Initially, [AppTitle](../../brl/brl.blitz/#global-apptitle-bbapptitle) is set to
 [AppTitle](../../brl/brl.blitz/#global-apptitle-bbapptitle) at any time with a simple assignment.
 
 
+#### Example
+```blitzmax
+'Apptitle Example
+
+SuperStrict
+
+AppTitle = "Just a TITLE"
+Graphics 400, 400
+
+Repeat
+	DrawText "Hello World", 10, 20
+	Flip
+Until AppTerminate()
+```
 
 ### `Global AppArgs$[]="bbAppArgs"`
 
@@ -1095,6 +1156,17 @@ Wend
 
 End a While block
 
+#### Example
+```blitzmax
+SuperStrict
+
+Local i:Int=0
+
+While i < 5
+  Print i
+  i :+ 1
+EndWhile  'can also use Wend
+```
 
 ### `Repeat`
 
@@ -2123,6 +2195,18 @@ Include effectively 'inserts' the specified file into the file being compiled.
 
 Framework builds the BlitzMax application with only the module(s) specified rather than the standard set of modules.
 
+#### Example
+```blitzmax
+' Use the Framework and Import functions to only include the function sets
+' that you want to use
+'
+SuperStrict
+
+Framework Brl.standardio ' so we can use print
+Import Brl.random ' so we can use the Rnd Function
+
+Print Rnd(255)
+```
 
 ### `Import`
 

+ 18 - 0
docs/api/brl/brl_event.md

@@ -71,6 +71,24 @@ Create an event object
 A new event object
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+Graphics 640,480
+
+Const MY_EVENT:Int = 99
+Local myEvent:TEvent=CreateEvent(MY_EVENT)
+Local myTimer:TTImer = CreateTimer(10,myEvent)
+Repeat
+	WaitEvent
+	Cls
+	If EventID() = MY_EVENT
+		DrawText "Timer has ticked " + TimerTicks(myTimer) + " times",10,15
+	EndIf
+	Flip
+Until AppTerminate()
+```
 
 ### `Function AllocUserEventId:Int( description$="" )`
 

+ 120 - 0
docs/api/brl/brl_eventqueue.md

@@ -84,6 +84,23 @@ Get current event id
 The <b>id</b> field of the [CurrentEvent](../../brl/brl.eventqueue/#global-currentevent-tevent-nullevent) global variable
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+Import MaxGUI.Drivers
+
+Local MyWindow:TGadget=CreateWindow("Button Example", 200,200,320,240)
+Local MyButton:TGadget=CreateButton("Click Me",140,60,80,40, MyWindow)
+
+Repeat
+  WaitEvent()
+  Select EventID()
+  Case EVENT_WINDOWCLOSE
+     End
+   End Select
+Forever
+```
 
 ### `Function EventData:Int()`
 
@@ -93,6 +110,26 @@ Get current event data
 The <b>data</b> field of the [CurrentEvent](../../brl/brl.eventqueue/#global-currentevent-tevent-nullevent) global variable
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+Import MaxGUI.Drivers
+
+Local window:tgadget=CreateWindow("leftclick/rightclick",0,0,320,240)
+
+Local canvas:tgadget=CreateCanvas(4,4,160,160,window,1)
+
+Repeat
+	WaitEvent()
+	If EventID()=EVENT_WINDOWCLOSE End
+	
+	Select EventData()
+		Case 1 Print "leftclick"
+		Case 2 Print "rightclick"
+	End Select
+Forever
+```
 
 ### `Function EventMods:Int()`
 
@@ -111,6 +148,25 @@ Get current event x value
 The <b>x</b> field of the [CurrentEvent](../../brl/brl.eventqueue/#global-currentevent-tevent-nullevent) global variable
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+Import MaxGUI.Drivers
+
+Local window:tgadget=CreateWindow("move mouse",0,0,320,240)
+
+Local canvas:tgadget=CreateCanvas(4,4,160,160,window,1)
+
+Repeat
+	WaitEvent()
+	If EventID()=EVENT_WINDOWCLOSE End
+	
+	If EventID()=EVENT_MOUSEMOVE
+		Print EventX()
+	EndIf
+Forever
+```
 
 ### `Function EventY:Int()`
 
@@ -120,6 +176,25 @@ Get current event y value
 The <b>y</b> field of the [CurrentEvent](../../brl/brl.eventqueue/#global-currentevent-tevent-nullevent) global variable
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+Import MaxGUI.Drivers
+
+Local window:tgadget=CreateWindow("move mouse",0,0,320,240)
+
+Local canvas:tgadget=CreateCanvas(4,4,160,160,window,1)
+
+Repeat
+	WaitEvent()
+	If EventID()=EVENT_WINDOWCLOSE End
+	
+	If EventID()=EVENT_MOUSEMOVE
+		Print EventY()
+	EndIf
+Forever
+```
 
 ### `Function EventExtra:Object()`
 
@@ -138,6 +213,26 @@ Get current event extra value converted to a string
 The <b>extra</b> field of the [CurrentEvent](../../brl/brl.eventqueue/#global-currentevent-tevent-nullevent) global variable converted to a string
 
 
+#### Example
+```blitzmax
+'
+' Drop a file onto the window to see EventText() return the path.
+'
+SuperStrict
+
+Import MaxGUI.Drivers
+
+Local window:tgadget=CreateWindow("move mouse",0,0,320,240,Null,15|WINDOW_ACCEPTFILES)
+
+Repeat
+	WaitEvent()
+	If EventID()=EVENT_WINDOWCLOSE End
+	
+	If EventID()=EVENT_WINDOWACCEPT
+		Print EventText()
+	EndIf
+Forever
+```
 
 ### `Function EventSource:Object()`
 
@@ -147,6 +242,31 @@ Get current event source object
 The <b>source</b> field of the [CurrentEvent](../../brl/brl.eventqueue/#global-currentevent-tevent-nullevent) global variable
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+Import MaxGUI.Drivers
+
+Local MyWindow:TGadget=CreateWindow("Two Buttons Example", 200,200,320,240)
+Local Button1:TGadget=CreateButton("One",140,40,80,40, MyWindow)
+Local Button2:TGadget=CreateButton("Two",140,100,80,40, MyWindow)
+
+Repeat
+  WaitEvent()
+  Select EventID()
+  Case EVENT_WINDOWCLOSE
+     End
+  Case EVENT_GADGETACTION
+    Select EventSource()
+      Case Button1
+         SetGadgetText(Button1,"One clicked")
+      Case Button2
+         SetGadgetText(Button2,"Two clicked")
+      End Select
+   End Select
+Forever
+```
 
 ### `Function EventSourceHandle:Size_T()`
 

+ 116 - 0
docs/api/brl/brl_graphics.md

@@ -219,6 +219,36 @@ Set current graphics object
 than the current driver.
 
 
+#### Example
+```blitzmax
+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()
+```
 
 ### `Function GraphicsResize( width:Int, height:Int )`
 
@@ -237,6 +267,19 @@ The current graphics object can be changed using [SetGraphics](../../brl/brl.gra
 The width, in pixels, of the current graphics object
 
 
+#### Example
+```blitzmax
+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()
+```
 
 ### `Function GraphicsHeight()`
 
@@ -250,6 +293,19 @@ The current graphics object can be changed using [SetGraphics](../../brl/brl.gra
 The height, in pixels, of the current graphics object
 
 
+#### Example
+```blitzmax
+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()
+```
 
 ### `Function GraphicsDepth()`
 
@@ -263,6 +319,19 @@ The current graphics object can be changed using [SetGraphics](../../brl/brl.gra
 The depth, in bits, of the current graphics object
 
 
+#### Example
+```blitzmax
+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()
+```
 
 ### `Function GraphicsHertz()`
 
@@ -276,6 +345,19 @@ The current graphics object can be changed using [SetGraphics](../../brl/brl.gra
 The refresh rate, in frames per second, of the current graphics object
 
 
+#### Example
+```blitzmax
+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()
+```
 
 ### `Function GraphicsFlags()`
 
@@ -308,6 +390,29 @@ If <b>sync</b> is -1 and the current graphics object was NOT created with the [G
 then the flip will occur on the next vertical blank.
 
 
+#### Example
+```blitzmax
+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
+```
 
 ### `Function Graphics:TGraphics( width,height,depth=0,hertz=60,flags=0 )`
 
@@ -328,6 +433,17 @@ and mouse.
 A graphics object
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+Graphics 640,480
+
+DrawRect 50,50,200,100
+Flip
+Repeat
+Until KeyDown(KEY_ESCAPE) Or AppTerminate()
+```
 
 ### `Function EndGraphics()`
 

+ 35 - 1
docs/api/brl/brl_hook.md

@@ -38,6 +38,38 @@ The returned hook id can be used with [AddHook](../../brl/brl.hook/#function-add
 An integer hook id
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+Global myHookID:Int=AllocHookId()
+
+' This function will be called everytime RunHook is executed due to the AddHook action below
+Function MyHook:Object( id:Int,data:Object,context:Object )
+	Global count:Int
+	
+	count:+1
+	If count Mod 10=0 Then
+		Print "Flips="+count
+	End If
+	
+End Function
+
+'Add the MyHook function to our hook ID
+AddHook myHookID,MyHook
+
+'Some simple graphics
+Graphics 640,480,0
+
+While Not KeyHit( KEY_ESCAPE )
+
+   Cls
+   DrawText MouseX()+","+MouseY(),0,0
+   RunHooks myHookID, Null
+   Flip
+
+Wend
+```
 
 ### `Function AddHook( id,func:Object( id,data:Object,context:Object ),context:Object=Null,priority=0 )`
 
@@ -60,7 +92,9 @@ Function MyHook:Object( id:Int,data:Object,context:Object )
 	Global count:Int
 	
 	count:+1
-	If count Mod 10=0 Print "Flips="+count
+	If count Mod 10=0 Then
+		Print "Flips="+count
+	End If
 	
 End Function
 

+ 274 - 0
docs/api/brl/brl_math.md

@@ -15,6 +15,25 @@ Check if a value is NAN
 True if <b>x</b> is 'not a number' (eg: Sqr(-1))
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+For Local f:Float=-0.4 Until 0.4 Step 0.2
+    If IsNan(Sqr(f)) = True Then
+       Print "Square Root of "+f+" is not a real number"
+    Else
+       Print "Square Root of  "+f+" = "+Sqr(f)
+    EndIf
+Next
+
+' ===================
+' Output
+' Square Root of -0.400000006 is not a real number
+' Square Root of -0.200000003 is not a real number
+' Square Root of  0.000000000 = 0.00000000000000000
+' Square Root of  0.200000003 = 0.44721359883195888
+```
 
 ### `Function IsInf( x:Double )`
 
@@ -24,84 +43,339 @@ Check if a value is infinite (eg: 1.0/0.0)
 True if <b>x</b> is infinite
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+For Local f:Float=-0.4 Until 0.4 Step 0.2
+    If IsInf(1.0 / f) = True Then
+       Print "Divide by Zero"
+    Else
+       Print "inverse of "+f+" = "+String(1.0/f)
+    EndIf
+Next
+
+' ===================
+' Output
+' inverse of -0.400000006 = -2.50000000
+' inverse of -0.200000003 = -5.00000000
+' Divide by Zero
+' inverse of 0.200000003 = 5.00000000
+```
 
 ### `Function Sqr:Double( x:Double )`
 
 Square root of <b>x</b>
 
+#### Example
+```blitzmax
+'IsNan (Not a Number)
+SuperStrict
+
+For Local f:Float=-0.4 Until 0.4 Step 0.2
+    If IsNan(Sqr(f)) = True Then
+       Print "Square Root of "+f+" is not a real number"
+    Else
+       Print "Square Root of  "+f+" = "+Sqr(f)
+    EndIf
+Next
+
+' ===================
+' Output
+' Square Root of -0.400000006 is not a real number
+' Square Root of -0.200000003 is not a real number
+' Square Root of  0.000000000 = 0.00000000000000000
+' Square Root of  0.200000003 = 0.44721359883195888
+```
 
 ### `Function Sin:Double( x:Double )`
 
 Sine of <b>x</b> degrees
 
+#### Example
+```blitzmax
+Rem
+Sin:Double( x:Double )
+End Rem
+
+SuperStrict
+
+For Local d:Int = 0 To 360 Step 45
+	Print "Sin("+d+")="+Sin(d)
+Next
+```
 
 ### `Function Cos:Double( x:Double )`
 
 Cosine of <b>x</b> degrees
 
+#### Example
+```blitzmax
+Rem
+Cosine of x
+End Rem
+
+SuperStrict
+
+For Local d:Int = 0 To 360 Step 45
+	Print "Cos("+d+")="+Cos(d)
+Next
+```
 
 ### `Function Tan:Double( x:Double )`
 
 Tangent of <b>x</b> degrees
 
+#### Example
+```blitzmax
+Rem
+Tangent of x degrees
+End Rem
+
+SuperStrict
+
+For Local d:Int = 0 To 360 Step 45
+	Print "Tan("+d+")="+Float(Tan(d))
+Next
+```
 
 ### `Function ASin:Double( x:Double )`
 
 Inverse Sine of <b>x</b>
 
+#### Example
+```blitzmax
+Rem
+Inverse Sine of x
+End Rem
+
+SuperStrict
+
+For Local d:Double = -1.0 To 1.0 Step 0.125
+	Print "ASin("+d+")="+ASin(d)
+Next
+```
 
 ### `Function ACos:Double( x:Double )`
 
 Inverse Cosine of <b>x</b>
 
+#### Example
+```blitzmax
+Rem
+Inverse Cosine of x
+End Rem
+
+SuperStrict
+
+For Local d:Double = -1.0 To 1.0 Step 0.125
+	Print "ACos("+d+")="+ACos(d)
+Next
+```
 
 ### `Function ATan:Double( x:Double )`
 
 Inverse Tangent of <b>x</b>
 
+#### Example
+```blitzmax
+Rem
+ATan returns the Inverse Tangent of x
+End Rem
+
+SuperStrict
+
+For Local d:Double = -1.0 To 1.0 Step 0.125
+	Print "ATan("+d+")="+ATan(d)
+Next
+```
 
 ### `Function ATan2:Double( y:Double,x:Double )`
 
 Inverse Tangent of two variables <b>x</b> , <b>y</b>
 
+#### Example
+```blitzmax
+Rem
+ATan2 returns the Inverse Tangent of two variables
+End Rem
+
+SuperStrict
+
+Function Angle:Double(x0:Double,y0:Double,x1:Double,y1:Double)
+	Return ATan2(y1-y0,x1-x0)
+End Function
+
+Graphics 640,480
+While Not KeyHit(KEY_ESCAPE)
+	Cls
+	Local x:Float = MouseX()
+	Local y:Float = MouseY()
+	DrawLine 320,240,x,y
+	DrawText "Angle="+Angle(320,240,x,y),20,20
+	Flip
+Wend
+```
 
 ### `Function Sinh:Double( x:Double )`
 
 Hyperbolic sine of <b>x</b>
 
+#### Example
+```blitzmax
+'
+' Sinh Hyperbolic Sine
+'
+SuperStrict
+
+Graphics 640,480
+
+For Local t:Float=-7To 7 Step .1
+	Plot 100+t*10,Float(240+Sinh(t))
+Next
+
+Flip
+
+Repeat Until KeyDown(KEY_ESCAPE) Or AppTerminate()
+```
 
 ### `Function Cosh:Double( x:Double )`
 
 Hyperbolic cosine of <b>x</b>
 
+#### Example
+```blitzmax
+'
+' Cosh Hyperbolic Cosine
+'
+SuperStrict
+
+Graphics 640,480
+
+For Local t:Float = - 7To 7 Step .1
+	SetColor 255,0,0 'red cosh
+	Plot 100 + t * 10 , Float(240 + Cosh(t))
+	SetColor 0,255,255 
+	Plot 200 + t * 10 , Float(240 + Sinh(t))
+Next
+
+Flip
+
+Repeat Until KeyDown(KEY_ESCAPE) Or AppTerminate()
+```
 
 ### `Function Tanh:Double( x:Double )`
 
 Hyperbolic tangent of <b>x</b>
 
+#### Example
+```blitzmax
+'
+' Tanh Hyperbolic Cosine
+'
+SuperStrict
+
+Graphics 640,480
+
+For Local t:Float = -.2 To .2 Step .001
+	SetColor 255,0,0 'red cosh
+	Plot 100 + t * 500 , Float(240 + Tanh(t)*500)
+Print t*500+":"+Tanh(t)*500
+Next
+
+Flip
+
+Repeat Until KeyDown(KEY_ESCAPE) Or AppTerminate()
+```
 
 ### `Function Exp:Double( x:Double )`
 
 Exponential function
 
+#### Example
+```blitzmax
+'
+' Exponential
+'
+SuperStrict
+
+Graphics 640,480
+
+For Local t:Float = - 7 To 7 Step .1
+	Plot 100 + t * 10 , Float(240 - Exp(t))
+	Print Exp(t)
+Next
+
+Flip
+
+Repeat Until KeyDown(KEY_ESCAPE) Or AppTerminate()
+```
 
 ### `Function Log:Double( x:Double )`
 
 Natural logarithm
 
+#### Example
+```blitzmax
+Rem
+Log(n#) returns the natural logarithm of n
+End Rem
+
+SuperStrict
+
+For n:Float = 1 To 20
+	Print "Log("+n+")="+Log(n)
+Next
+```
 
 ### `Function Log10:Double( x:Double )`
 
 Base 10 logarithm
 
+#### Example
+```blitzmax
+Rem
+Log10(n#) returns the Base 10 logarithm of n
+End Rem
+
+SuperStrict
+
+For Local n:Float = 0 To 100 Step 10
+	Print "Log10("+n+")="+Log10(n)
+Next
+```
 
 ### `Function Ceil:Double( x:Double )`
 
 Smallest integral value not less than <b>x</b>
 
+#### Example
+```blitzmax
+Rem
+Ceil(x#) returns the smallest integral value not less than x
+End Rem
+
+SuperStrict
+
+For Local i:Float = -1 To 1 Step .2
+	Print "Ceil("+i+")="+Ceil(i)
+Next
+```
 
 ### `Function Floor:Double( x:Double )`
 
 Largest integral value not greater than <b>x</b>
 
+#### Example
+```blitzmax
+Rem
+Floor(x!) returns the largest integral value not greater than x
+End Rem
+
+SuperStrict
+
+For Local i:Double = -1 To 1 Step .2
+	Print "Floor("+i+")="+Floor(i)
+Next
+```
 

+ 182 - 0
docs/api/brl/brl_pixmap.md

@@ -78,6 +78,27 @@ Copy a pixmap
 A new pixmap object
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+Graphics 640 , 480
+
+Local pix:TPixmap=LoadPixmap(blitzmaxpath()+"\samples\hitoro\gfx\boing.png")
+If pix = Null Then
+	RuntimeError ("Error Loading Image")
+End If
+
+
+Local newPix:TPixmap=CopyPixmap(pix)
+
+Repeat
+	Cls
+	DrawPixmap pix, 50, 50
+	DrawPixmap newPix, MouseX(), MouseY()
+	Flip
+Until KeyHit(key_escape) Or AppTerminate()
+```
 
 ### `Function ConvertPixmap:TPixmap( pixmap:TPixmap,format )`
 
@@ -100,6 +121,26 @@ Get pixmap width
 The width, in pixels, of <b>pixmap</b>
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+Graphics 640,480
+Local pix:TPixmap=LoadPixmap(blitzmaxpath()+"\samples\hitoro\gfx\boing.png")
+
+If pix = Null Then
+	RuntimeError ("Error Loading Image")
+End If
+
+Repeat
+	Cls
+	' Display Information
+	DrawText "Image Width:"+PixmapWidth(pix)+"  Image Height:"+PixmapHeight(pix),0,0 
+
+	DrawPixmap pix,100,100
+	Flip
+Until KeyHit(key_escape) Or AppTerminate()
+```
 
 ### `Function PixmapHeight( pixmap:TPixmap )`
 
@@ -109,6 +150,28 @@ Get pixmap width
 The height, in pixels, of <b>pixmap</b>
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+Graphics 640,480
+
+Local pix:TPixmap = LoadPixmap(blitzmaxpath()+"\samples\hitoro\gfx\boing.png")
+
+If pix = Null Then
+	RuntimeError ("Error Loading Image")
+End If
+
+Repeat
+	Cls
+	
+	' Display Information
+	DrawText "Image Width:"+PixmapWidth(pix)+"  Image Height:"+PixmapHeight(pix),0,0 
+
+	DrawPixmap pix,100,100
+	Flip
+Until KeyHit(key_escape) Or AppTerminate()
+```
 
 ### `Function PixmapPitch( pixmap:TPixmap )`
 
@@ -179,6 +242,35 @@ Flip a pixmap horizontally
 A new pixmap object
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+Graphics 640,480
+
+Local pix:TPixmap=LoadPixmap(blitzmaxpath()+"\samples\hitoro\gfx\boing.png")
+
+If pix = Null Then
+	RuntimeError ("Error Loading Image")
+End If
+
+Repeat
+	Cls
+	DrawText "Press Key X or Y to change Orientation" , 10 , 10
+	
+	' Change pixmap orientation
+	If KeyHit(KEY_X) Then
+		pix = XFlipPixmap(pix)
+	End If
+	
+	If KeyHit(KEY_Y) Then
+		pix = YFlipPixmap(pix)
+	End If
+	
+	DrawPixmap pix,50,50
+	Flip
+Until KeyHit(key_escape) Or AppTerminate()
+```
 
 ### `Function YFlipPixmap:TPixmap( pixmap:TPixmap ) NoDebug`
 
@@ -188,6 +280,35 @@ Flip a pixmap vertically
 A new pixmap object
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+Graphics 640,480
+
+Local pix:TPixmap=LoadPixmap(blitzmaxpath()+"\samples\hitoro\gfx\boing.png")
+
+If pix = Null Then
+	RuntimeError ("Error Loading Image")
+End If
+
+Repeat
+	Cls
+	DrawText "Press Key X or Y to change Orientation" , 10 , 10
+	
+	' Change pixmap orientation
+	If KeyHit(KEY_X) Then
+		pix = XFlipPixmap(pix)
+	End If
+	
+	If KeyHit(KEY_Y) Then
+		pix = YFlipPixmap(pix)
+	End If
+	
+	DrawPixmap pix,50,50
+	Flip
+Until KeyHit(key_escape) Or AppTerminate()
+```
 
 ### `Function ResizePixmap:TPixmap( pixmap:TPixmap,width,height ) NoDebug`
 
@@ -197,6 +318,28 @@ Resize a pixmap
 A new pixmap object of the specified <b>width</b> and <b>height</b>
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+Graphics 640 , 480
+
+Local pix:TPixmap=LoadPixmap(blitzmaxpath()+"\samples\hitoro\gfx\boing.png")
+
+If pix = Null Then
+	RuntimeError ("Error Loading Image")
+End If
+
+'Reduce Image by 50%
+Local newPix:TPixmap=ResizePixmap(pix, Int(PixmapWidth(pix)*.5), Int(PixmapHeight(pix)*.5))
+
+Repeat
+	Cls
+	DrawPixmap pix, 50, 50
+	DrawPixmap newPix, MouseX() , MouseY()
+	Flip
+Until KeyHit(key_escape) Or AppTerminate()
+```
 
 ### `Function LoadPixmap:TPixmap( url:Object )`
 
@@ -206,6 +349,23 @@ Load a pixmap
 A pixmap object
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+Graphics 640,480
+Local player:TPixmap=LoadPixmap(blitzmaxpath()+"\samples\hitoro\gfx\boing.png")
+
+If player = Null Then
+	RuntimeError ("Error Loading Image")
+End If
+
+Repeat
+	Cls
+	DrawPixmap Player,10,10
+	Flip
+Until KeyHit(key_escape) Or AppTerminate()
+```
 
 ### `Function ReadPixel( pixmap:TPixmap,x,y )`
 
@@ -248,4 +408,26 @@ The 32 bit <b>argb</b> value contains the following components:
 
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+Graphics 800 , 600
+
+Local mypix:TPixmap = LoadPixmap(BlitzMaxPath()+"/samples/hitoro/gfx/boing.png")
+If mypix = Null Then
+	RuntimeError ("Error Loading Image")
+End If
+
+DrawPixmap mypix, 0, 0
+
+ClearPixels(mypix, $FFFFFF)
+ 
+
+DrawPixmap mypix, 300, 0
+
+Flip
+
+WaitKey
+```
 

+ 40 - 0
docs/api/brl/brl_polledinput.md

@@ -22,6 +22,23 @@ Get app suspended state
 True if application is currently suspended.
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+SetGraphicsDriver GLMax2DDriver()
+Graphics 800,600
+
+While Not KeyHit(KEY_ESCAPE)
+	Cls
+	If AppSuspended() = True
+		DrawText "Application Suspended!",10,10
+	Else
+		DrawText "Application Running...",10,10
+	EndIf
+	Flip
+Wend
+```
 
 ### `Function AppTerminate()`
 
@@ -338,6 +355,16 @@ See the key codes module for a list of valid keycodes.
 The keycode of the pressed key
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+Graphics 640,480
+
+DrawText "Press any key to end this program.", 10 , 10
+Flip
+WaitKey()
+```
 
 ### `Function WaitChar()`
 
@@ -368,6 +395,19 @@ clicked or 3 if the middle mouse button was clicked.
 The clicked button
 
 
+#### Example
+```blitzmax
+'detects which mouse button was pressed 
+
+SuperStrict
+
+Graphics 640,480
+
+Repeat
+	DrawText "Click Mouse to exit" , 200 , 200
+	Flip 
+Until WaitMouse()
+```
 
 ### `Function SetAutoPoll(value:Int)`
 

+ 99 - 0
docs/api/brl/brl_retro.md

@@ -42,6 +42,13 @@ For compatibility with classic BASIC, the <b>pos</b> parameter is 'one based'.
 A sequence of characters from <b>str</b> starting at position <b>pos</b> and of length <b>size</b>
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+Local a:String = "abcd1234efgh"
+Print Mid(a,5,5)   ' prints 1234e
+```
 
 ### `Function Instr( str$,sub$,start=1 )`
 
@@ -58,6 +65,20 @@ are both 'one based'.
 The position within <b>str</b> of the first matching occurance of <b>sub</b>
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+Local mystring:String = "*sniffage*, I need more media!"
+
+' check for the position
+Print Instr(mystring,"more")
+
+If Instr(mystring,"new PC") Print "large!"
+If Not Instr(mystring,"new PC") Print "*sniff*"
+
+If Instr(mystring,"media") Print "large!"
+```
 
 ### `Function Left$( str$,n )`
 
@@ -73,6 +94,12 @@ characters from the start of the String in a new String.
 <b>size</b> leftmost characers of <b>str</b>
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+Print Left("12345678",4)   ' prints 1234
+```
 
 ### `Function Right$( str$,n )`
 
@@ -88,6 +115,12 @@ characters from the end of the String.
 <b>size</b> rightmost characters of <b>str</b>
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+Print Right("12345678",4)   ' prints 5678
+```
 
 ### `Function LSet$( str$,n )`
 
@@ -97,6 +130,18 @@ Left justify string
 A string of length <b>n</b>, padded with spaces
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+Print LSet("12345678",3)
+Print "["+LSet("12345678",10)+"]"
+
+' ==============
+' Output
+' 123
+' [12345678  ]
+```
 
 ### `Function RSet$( str$,n )`
 
@@ -106,6 +151,18 @@ Right justify string
 A string of length <b>n</b>, padded with spaces
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+Print RSet("12345678",3)
+Print "["+RSet("12345678",10)+"]"
+
+' ==============
+' Output
+' 678
+' [  12345678]
+```
 
 ### `Function Replace$( str$,sub$,replaceWith$ )`
 
@@ -119,6 +176,17 @@ The Replace$ command replaces all instances of one string with another.
 A string with all instances of <b>sub</b>$ replaced by <b>replace</b>$
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+Local str:String = "This is a test of the Replace command."
+Print "Original: "+str
+
+str = Replace(str,"e","*")
+
+Print "Altered: "+str
+```
 
 ### `Function Trim$( str$ )`
 
@@ -137,6 +205,12 @@ Convert string to lowercase
 Lowercase equivalent of <b>str</b>
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+Print Lower("abcdEFGH")     ' prints abcdefgh
+```
 
 ### `Function Upper$( str$ )`
 
@@ -146,6 +220,12 @@ Convert string to uppercase
 Uppercase equivalent of <b>str</b>
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+Print Upper("Hello World") ' prints HELLO WORLD
+```
 
 ### `Function Hex$( val )`
 
@@ -155,6 +235,15 @@ Convert an integer value to a hexadecimal string
 The hexadecimal string representation of <b>val</b>
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+For Local t:Int=0 To 255
+	If Not(t Mod 16) Print
+	Print "decimal: "+RSet(t,3)+" | hex: "+Hex(t)
+Next
+```
 
 ### `Function Bin$( val )`
 
@@ -164,6 +253,16 @@ Convert an integer value to a binary string
 The binary string representation of <b>val</b>
 
 
+#### Example
+```blitzmax
+' Prints the binary representation of a number
+
+SuperStrict
+
+Print Bin(1)
+Print Bin(554)
+Print Bin(1 | 554) ' OR in action
+```
 
 ### `Function LongHex$( val:Long )`
 

+ 10 - 10
docs/api/brl/brl_threads.md

@@ -226,7 +226,7 @@ Next
 'Note: We don't really have to lock the mutex here, as there are no other threads running.
 'Still, it's a good habit to get into.
 LockMutex listMutex
-For Local t$=EachIn list
+For Local t:String = EachIn list
 	Print t
 Next
 UnlockMutex listMutex
@@ -270,38 +270,38 @@ A new semaphore object
 '
 SuperStrict
 
-'a simple queue
+' a simple queue
 Global queue:String[100],put:Int,get:Int
 
-'a counter semaphore
+' a counter semaphore
 Global counter:TSemaphore=CreateSemaphore( 0 )
 
 Function MyThread:Object( data:Object )
 
-	'process 100 items
+	' process 100 items
 	For Local item:Int = 1 To 100
 	
-		'add an item to the queue
+		' add an item to the queue
 		queue[put]="Item "+item
 		put:+1
 		
-		'increment semaphore count.
+		' increment semaphore count.
 		PostSemaphore counter
 	
 	Next
 		
 End Function
 
-'create worker thread
+' create worker thread
 Local thread:TThread=CreateThread( MyThread,Null )
 
-'receive 100 items
+' receive 100 items
 For Local i:Int = 1 To 100
 
-	'Wait for semaphore count to be non-0, then decrement.
+	' Wait for semaphore count to be non-0, then decrement.
 	WaitSemaphore counter
 	
-	'Get an item from the queue
+	' Get an item from the queue
 	Local item:String = queue[get]
 	get:+1
 	

+ 16 - 0
docs/api/brl/brl_timer.md

@@ -24,6 +24,22 @@ If <b>event</b> is Null, an event with an <b>id</b> equal to EVENT_TIMERTICK and
 A new timer object
 
 
+#### Example
+```blitzmax
+SuperStrict
+
+'Maximum allowable Timer is 16
+Global timers:TTimer[500]
+
+For Local n:Int = 0 Until 18
+	timers[n] = CreateTimer(1)
+	If timers[n] = Null
+		Print "Cannot create timer "+n
+	Else
+		Print "Successfully created timer "+n
+	EndIf
+Next
+```
 
 ### `Function TimerTicks:Int( timer:TTimer )`