Ver código fonte

Updated Examples.

woollybah 6 anos atrás
pai
commit
edaf433bfd
53 arquivos alterados com 305 adições e 198 exclusões
  1. 3 1
      blitz.mod/doc/abs.bmx
  2. 23 21
      blitz.mod/doc/abstract.bmx
  3. 5 3
      blitz.mod/doc/acos.bmx
  4. 3 1
      blitz.mod/doc/and.bmx
  5. 4 3
      blitz.mod/doc/appargs.bmx
  6. 4 2
      blitz.mod/doc/appdir.bmx
  7. 3 1
      blitz.mod/doc/appfile.bmx
  8. 8 6
      blitz.mod/doc/array.bmx
  9. 3 1
      blitz.mod/doc/asc.bmx
  10. 5 3
      blitz.mod/doc/asin.bmx
  11. 3 1
      blitz.mod/doc/assert.bmx
  12. 5 3
      blitz.mod/doc/atan.bmx
  13. 14 12
      blitz.mod/doc/atan2.bmx
  14. 5 3
      blitz.mod/doc/byte.bmx
  15. 3 1
      blitz.mod/doc/case.bmx
  16. 9 6
      blitz.mod/doc/catch.bmx
  17. 5 3
      blitz.mod/doc/ceil.bmx
  18. 3 1
      blitz.mod/doc/chr.bmx
  19. 6 4
      blitz.mod/doc/const.bmx
  20. 3 1
      blitz.mod/doc/continue.bmx
  21. 5 3
      blitz.mod/doc/cos.bmx
  22. 9 7
      blitz.mod/doc/default.bmx
  23. 6 1
      blitz.mod/doc/defdata.bmx
  24. 2 0
      blitz.mod/doc/double.bmx
  25. 6 4
      blitz.mod/doc/eachin.bmx
  26. 3 2
      graphics.mod/doc/graphicsmodes.bmx
  27. 1 0
      graphics.mod/doc/setgraphicsdriver.bmx
  28. 3 2
      hook.mod/doc/addhook.bmx
  29. 9 7
      linkedlist.mod/doc/createlist.bmx
  30. 5 0
      max2d.mod/doc/cls.bmx
  31. 2 2
      max2d.mod/doc/collideimage.bmx
  32. 7 5
      max2d.mod/doc/createimage.bmx
  33. 4 2
      max2d.mod/doc/drawline.bmx
  34. 4 2
      max2d.mod/doc/drawoval.bmx
  35. 2 0
      max2d.mod/doc/drawpoly.bmx
  36. 4 1
      max2d.mod/doc/drawrect.bmx
  37. 8 6
      max2d.mod/doc/drawtext.bmx
  38. 5 3
      max2d.mod/doc/grabimage.bmx
  39. 2 0
      max2d.mod/doc/graphics.bmx
  40. 6 3
      max2d.mod/doc/plot.bmx
  41. 1 0
      polledinput.mod/doc/appterminate.bmx
  42. 2 0
      polledinput.mod/doc/keydown.bmx
  43. 8 6
      polledinput.mod/doc/keyhit.bmx
  44. 10 8
      polledinput.mod/doc/mousedown.bmx
  45. 10 8
      polledinput.mod/doc/mousehit.bmx
  46. 8 6
      polledinput.mod/doc/mousex.bmx
  47. 8 6
      polledinput.mod/doc/mousey.bmx
  48. 6 4
      polledinput.mod/doc/mousez.bmx
  49. 3 1
      polledinput.mod/doc/movemouse.bmx
  50. 12 6
      polledinput.mod/polledinput.bmx
  51. 0 1
      random.mod/doc/rnd.bmx
  52. 6 6
      random.mod/doc/rnddouble.bmx
  53. 21 19
      random.mod/doc/seedrnd.bmx

+ 3 - 1
blitz.mod/doc/abs.bmx

@@ -2,6 +2,8 @@ Rem
 Abs is a mathematical operator that performs the Absolute function.
 End Rem
 
-For f#=-1 To 1 Step 0.125
+SuperStrict
+
+For Local f:Float = -1 To 1 Step 0.125
 	Print "Abs "+f+"="+Abs f
 Next 

+ 23 - 21
blitz.mod/doc/abstract.bmx

@@ -8,18 +8,20 @@ create a TShape but anything extending a TShape must implement a Draw()
 method.
 End Rem
 
+SuperStrict
+
 Type TShape
-	Field	xpos,ypos
+	Field xpos:Int,ypos:Int
 	Method Draw() Abstract
 End Type
 
-Type TCircle extends TShape
-	Field	radius
+Type TCircle Extends TShape
+	Field radius:Int
 	
-	Function Create:TCircle(x,y,r)
-		local c:TCircle=new TCircle
+	Function Create:TCircle(x:Int,y:Int,r:Int)
+		Local c:TCircle = New TCircle
 		c.xpos=x;c.ypos=y;c.radius=r
-		return c
+		Return c
 	End Function
 	
 	Method Draw()
@@ -27,13 +29,13 @@ Type TCircle extends TShape
 	End Method
 End Type
 
-Type TRect extends TShape
-	Field	width,height
+Type TRect Extends TShape
+	Field width:Int,height:Int
 	
-	Function Create:TRect(x,y,w,h)
-		local r:TRect=new TRect
+	Function Create:TRect(x:Int,y:Int,w:Int,h:Int)
+		Local r:TRect = New TRect
 		r.xpos=x;r.ypos=y;r.width=w;r.height=h
-		return r
+		Return r
 	End Function
 	
 	Method Draw()
@@ -41,20 +43,20 @@ Type TRect extends TShape
 	End Method
 End Type
 
-local 	shapelist:TShape[4]
-local	shape:TShape
+Local shapelist:TShape[4]
+Local shape:TShape
 
 shapelist[0]=TCircle.Create(200,50,50)
 shapelist[1]=TRect.Create(300,50,40,40)
 shapelist[2]=TCircle.Create(400,50,50)
 shapelist[3]=TRect.Create(200,180,250,20)
 
-graphics 640,480
-while not keyhit(KEY_ESCAPE)
-	cls
-	for shape=eachin shapelist
+Graphics 640,480
+While Not KeyHit(KEY_ESCAPE)
+	Cls
+	For shape=EachIn shapelist
 		shape.draw
-	next
-	flip
-wend
-end
+	Next
+	Flip
+Wend
+End

+ 5 - 3
blitz.mod/doc/acos.bmx

@@ -2,6 +2,8 @@ Rem
 Inverse Cosine of x
 End Rem
 
-for d!=-1.0 to 1.0 step 0.125
-	print "ACos("+d+")="+ACos(d)
-next
+SuperStrict
+
+For Local d:Double = -1.0 To 1.0 Step 0.125
+	Print "ACos("+d+")="+ACos(d)
+Next

+ 3 - 1
blitz.mod/doc/and.bmx

@@ -2,6 +2,8 @@ Rem
 And is a boolean operator that performs the AND function.
 End Rem
 
-For i=1 To 10
+SuperStrict
+
+For Local i:Int = 1 To 10
 	If i>3 And i<6 Print "!" Else Print i
 Next

+ 4 - 3
blitz.mod/doc/appargs.bmx

@@ -1,9 +1,10 @@
 ' appargs.bmx
 ' print the command line arguments passed to the program at runtime
 
+SuperStrict
+
 Print "Number of arguments = "+AppArgs.length
 
-For a$=EachIn AppArgs
-Print a$
+For Local a:String = EachIn AppArgs
+	Print a
 Next
-

+ 4 - 2
blitz.mod/doc/appdir.bmx

@@ -1,8 +1,10 @@
 ' appdir.bmx
 ' requests the user to select a file from the application's directory
 
-Print "Application Directory="+AppDir$
+SuperStrict
 
-file$=RequestFile("Select File to Open","",False,AppDir$)
+Print "Application Directory="+AppDir
+
+Local file:String = RequestFile("Select File to Open","",False,AppDir)
 
 Print "file selected was :"+file

+ 3 - 1
blitz.mod/doc/appfile.bmx

@@ -1,3 +1,5 @@
 ' appfile.bmx
 
-Print "This program's executable is located at "+AppFile$
+SuperStrict
+
+Print "This program's executable is located at "+AppFile

+ 8 - 6
blitz.mod/doc/array.bmx

@@ -3,11 +3,13 @@ The Array command creates a BlitzMax array, a container type containing a sequen
 of a specified primitive or custom &Type.
 End Rem
 
-Local a[]
-Local b#[]
-Local c[][]
+SuperStrict
 
-a=Array[20]		'an integer array with 20 elements
-b=Array#[10]	'a floating point array of 10 elements
+Local a:Int[]
+Local b:Float[]
+Local c:Int[][]
 
-print len b
+a=New Int[20]		'an integer array with 20 elements
+b=New Float[10]	'a floating point array of 10 elements
+
+Print Len b

+ 3 - 1
blitz.mod/doc/asc.bmx

@@ -2,5 +2,7 @@ Rem
 Asc returns the unicode value of the first character of a string.
 End Rem
 
-print Asc("A")	'65
+SuperStrict
+
+Print Asc("A")	'65
 Print "A"[0]	'65 - equivalent index style implementation

+ 5 - 3
blitz.mod/doc/asin.bmx

@@ -2,6 +2,8 @@ Rem
 Inverse Sine of x
 End Rem
 
-for d!=-1.0 to 1.0 step 0.125
-	print "ASin("+d+")="+ASin(d)
-next
+SuperStrict
+
+For Local d:Double = -1.0 To 1.0 Step 0.125
+	Print "ASin("+d+")="+ASin(d)
+Next

+ 3 - 1
blitz.mod/doc/assert.bmx

@@ -2,5 +2,7 @@ Rem
 Assert generates a BlitzMax runtime error if the specified condition is false.
 End Rem
 
-a=LoadImage("nonexistant image file")
+SuperStrict
+
+Local a:TImage = LoadImage("nonexistant image file")
 Assert a,"Image Failed to Load"

+ 5 - 3
blitz.mod/doc/atan.bmx

@@ -2,6 +2,8 @@ Rem
 ATan returns the Inverse Tangent of x
 End Rem
 
-for d!=-1.0 to 1.0 step 0.125
-	print "ATan("+d+")="+ATan(d)
-next
+SuperStrict
+
+For Local d:Double = -1.0 To 1.0 Step 0.125
+	Print "ATan("+d+")="+ATan(d)
+Next

+ 14 - 12
blitz.mod/doc/atan2.bmx

@@ -2,16 +2,18 @@ Rem
 ATan2 returns the Inverse Tangent of two variables
 End Rem
 
-function Angle!(x0!,y0!,x1!,y1!)
-	return ATan2(y1-y0,x1-x0)
-end function
+SuperStrict
 
-graphics 640,480
-while not keyhit(KEY_ESCAPE)
-	cls
-	x#=mousex()
-	y#=mousey()
-	drawline 320,240,x,y
-	drawtext "Angle="+Angle(320,240,x,y),20,20
-	flip
-wend
+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

+ 5 - 3
blitz.mod/doc/byte.bmx

@@ -2,8 +2,10 @@ Rem
 Byte is an unsigned 8 bit integer BlitzMax primitive type.
 End Rem
 
-Local a:byte
+SuperStrict
 
-a=512;print "a="+a	'prints 0
-a=-1;print "a="+a	'prints 255
+Local a:Byte
+
+a=512;Print "a="+a	'prints 0
+a=-1;Print "a="+a	'prints 255
 

+ 3 - 1
blitz.mod/doc/case.bmx

@@ -3,7 +3,9 @@
 ' Case performs a comparison with the preceeding value(s) and that
 ' listed in the enclosing Select statement:
 
-a=Int( Input("Enter a number between 1 and 5 ") )
+SuperStrict
+
+Local a:Int=Int( Input("Enter a number between 1 and 5 ") )
 
 Select a
 	Case 1 Print "You think small"

+ 9 - 6
blitz.mod/doc/catch.bmx

@@ -2,12 +2,15 @@ Rem
 Catch defines an exception handler following a Try..EndTry Block.
 End Rem
 
+SuperStrict
+
+Local a:Int
 Try
-	repeat
+	Repeat
 		a:+1
-		print a
-		if a>20 throw "chunks"
-	forever
-Catch a$
-	print "caught exception "+a$
+		Print a
+		If a>20 Throw "chunks"
+	Forever
+Catch e:String
+	Print "caught exception "+e
 EndTry

+ 5 - 3
blitz.mod/doc/ceil.bmx

@@ -2,6 +2,8 @@ Rem
 Ceil(x#) returns the smallest integral value not less than x
 End Rem
 
-for i#=-1 to 1 step .2
-	print "Ceil("+i+")="+Ceil(i)
-next
+SuperStrict
+
+For Local i:Float = -1 To 1 Step .2
+	Print "Ceil("+i+")="+Ceil(i)
+Next

+ 3 - 1
blitz.mod/doc/chr.bmx

@@ -2,4 +2,6 @@ Rem
 Chr returns a String of length 1 containing the unicode character of the value.
 End Rem
 
-print Chr(65)	'A
+SuperStrict
+
+Print Chr(65)	'A

+ 6 - 4
blitz.mod/doc/const.bmx

@@ -2,9 +2,11 @@ Rem
 Const defines the preceeding variable declaration as constant.
 End Rem
 
-Const ON=TRUE
-Const OFF=FALSE
+SuperStrict
 
-Const TWOPI#=2*PI
+Const ON:Int=True
+Const OFF:Int=False
 
-print TWOPI
+Const TWOPI:Float=2*Pi
+
+Print TWOPI

+ 3 - 1
blitz.mod/doc/continue.bmx

@@ -2,7 +2,9 @@ Rem
 Continue causes program flow to return to the start of the enclosing While, Repeat or For program loop
 End Rem
 
-For i=1 To 20
+SuperStrict
+
+For Local i:Int = 1 To 20
 	If i Mod 2 Continue
 	Print i
 Next

+ 5 - 3
blitz.mod/doc/cos.bmx

@@ -2,6 +2,8 @@ Rem
 Cosine of x
 End Rem
 
-for d=0 to 360 step 45
-	print "Cos("+d+")="+cos(d)
-next
+SuperStrict
+
+For Local d:Int = 0 To 360 Step 45
+	Print "Cos("+d+")="+Cos(d)
+Next

+ 9 - 7
blitz.mod/doc/default.bmx

@@ -2,12 +2,14 @@ Rem
 Default is used in a Select block to mark a code section that is executed if all prior Case statements fail.
 End Rem
 
-a$=Input("What is your favorite color?")
-a$=lower(a$)	'make sure the answer is lower case
+SuperStrict
 
-Select a$
-	case "yellow" Print "You a bright and breezy"
-	case "blue" Print "You are a typical boy"
-	case "pink" Print "You are a typical girl"
-	default Print "You are quite unique!"
+Local a:String = Input("What is your favorite color?")
+a=Lower(a)	'make sure the answer is lower case
+
+Select a
+	Case "yellow" Print "You a bright and breezy"
+	Case "blue" Print "You are a typical boy"
+	Case "pink" Print "You are a typical girl"
+	Default Print "You are quite unique!"
 End Select

+ 6 - 1
blitz.mod/doc/defdata.bmx

@@ -1,6 +1,11 @@
 ' defdata.bmx
 
-ReadData name$
+SuperStrict
+
+Local name:String
+Local age:Int, skill:Int
+
+ReadData name
 ReadData age,skill
 
 Print "name="+name+" age="+age+" skill="+skill

+ 2 - 0
blitz.mod/doc/double.bmx

@@ -2,6 +2,8 @@ Rem
 Double is a 64 bit floating point BlitzMax primitive type.
 End Rem
 
+SuperStrict
+
 Local speedoflight:Double
 Local distance:Double
 Local seconds:Double

+ 6 - 4
blitz.mod/doc/eachin.bmx

@@ -2,8 +2,10 @@ Rem
 Specifies a BlitzMax collection type whose values are assigned sequentially to the For iterator.
 End Rem
 
-Local a[]=[0,5,12,13,20]
+SuperStrict
 
-for b=eachin a
-	print b
-next
+Local a:Int[]=[0,5,12,13,20]
+
+For Local b:Int = EachIn a
+	Print b
+Next

+ 3 - 2
graphics.mod/doc/graphicsmodes.bmx

@@ -1,8 +1,9 @@
+SuperStrict
 
 Print "Available graphics modes:"
 
-For mode:TGraphicsMode=EachIn GraphicsModes()
+For Local Mode:TGraphicsMode=EachIn GraphicsModes()
 
-	Print mode.width+","+mode.height+","+mode.depth+","+mode.hertz
+	Print Mode.width+","+Mode.height+","+Mode.depth+","+Mode.hertz
 
 Next

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

@@ -1,3 +1,4 @@
+SuperStrict
 
 SetGraphicsDriver GLMax2DDriver()
 

+ 3 - 2
hook.mod/doc/addhook.bmx

@@ -1,7 +1,8 @@
+SuperStrict
 
 'This function will be automagically called every Flip
-Function MyHook:Object( id,data:Object,context:Object )
-	Global count
+Function MyHook:Object( id:Int,data:Object,context:Object )
+	Global count:Int
 	
 	count:+1
 	If count Mod 10=0 Print "Flips="+count

+ 9 - 7
linkedlist.mod/doc/createlist.bmx

@@ -1,17 +1,19 @@
 ' createlist.bmx
 
+SuperStrict
+
 ' create a list to hold some objects
 
-list:TList=createlist()
+Local list:TList=CreateList()
 
 ' add some string objects to the list
 
-listaddlast list,"one"
-listaddlast list,"two"
-listaddlast list,"three"
+ListAddLast list,"one"
+ListAddLast list,"two"
+ListAddLast list,"three"
 
 ' enumerate all the strings in the list
 
-for a$=eachin list
-	print a$
-next
+For Local a:String = EachIn list
+	Print a
+Next

+ 5 - 0
max2d.mod/doc/cls.bmx

@@ -4,8 +4,13 @@
 ' remove the call to cls to illustrate the
 ' need for clearing the screen every frame
 
+SuperStrict
+
 Graphics 640,480
 SetOrigin 320,240
+
+Local frame:Float
+
 While Not KeyHit(KEY_ESCAPE)
 	Cls 
 	SetRotation frame

+ 2 - 2
max2d.mod/doc/collideimage.bmx

@@ -1,6 +1,6 @@
-Strict
+SuperStrict
 
-Local rot,x,y
+Local rot:Int,x:Int,y:Int
 
 Graphics 640,480
 

+ 7 - 5
max2d.mod/doc/createimage.bmx

@@ -2,13 +2,15 @@
 
 ' creates a 256x1 image with a black to blue color gradient
 
-Const ALPHABITS=$ff000000
+SuperStrict
 
-Graphics 640,480,32
+Const ALPHABITS:Int=$ff000000
 
-image=CreateImage(256,1)
-map=LockImage(image)
-For i=0 To 255
+Graphics 640,480,0
+
+Local image:TImage = CreateImage(256,1)
+Local map:TPixmap = LockImage(image)
+For Local i:Int = 0 To 255
 	WritePixel(map,i,0,ALPHABITS|i)
 Next
 UnlockImage(image)

+ 4 - 2
max2d.mod/doc/drawline.bmx

@@ -2,14 +2,16 @@
 
 ' draws a cross hair at the mouse position using DrawLine
 
+SuperStrict
+
 Graphics 640,480
 
 HideMouse 
 
 While Not KeyHit(KEY_ESCAPE)
 	Cls
-	x=MouseX()
-	y=MouseY()
+	Local x:Int = MouseX()
+	Local y:Int = MouseY()
 	DrawLine 320,240,x,y
 	DrawLine x-2,y,x-10,y
 	DrawLine x+2,y,x+10,y

+ 4 - 2
max2d.mod/doc/drawoval.bmx

@@ -3,6 +3,8 @@
 ' draws a pair of eyes using 4 DrawOval commands, 2 white, 2 blue
 ' positions the blue ovals so the eyes track the mouse
 
+SuperStrict
+
 Graphics 640,480
 While Not KeyHit(KEY_ESCAPE)
 	Cls
@@ -10,8 +12,8 @@ While Not KeyHit(KEY_ESCAPE)
 	DrawOval 0,0,320,200
 	DrawOval 320,0,320,200
 	SetColor 0,0,255
-	x=(MouseX()-320)/10
-	y=(MouseY()-240)/10
+	Local x:Int = (MouseX()-320)/10
+	Local y:Int = (MouseY()-240)/10
 	DrawOval 220-32+x,100+y,64,40
 	DrawOval 420-32+x,100+y,64,40
 	Flip

+ 2 - 0
max2d.mod/doc/drawpoly.bmx

@@ -5,6 +5,8 @@
 ' floats listed as 3 pairs of x,y
 ' coordinates
 
+SuperStrict
+
 Local tri#[]=[0.0,0.0,100.0,100.0,0.0,100.0]
 
 Graphics 640,480

+ 4 - 1
max2d.mod/doc/drawrect.bmx

@@ -6,15 +6,18 @@
 ' uses the frame variable to cycle through the values 0..9 for
 ' an animation effect between frames 
 
+SuperStrict
+
 Graphics 640,480
 
 SetBlend ALPHABLEND
 SetAlpha 0.2
 
+Local t:Int
 While Not KeyHit(KEY_ESCAPE)
 	Cls
 	DrawText "DrawRect Example",0,0
-	For r=t To t+500 Step 10
+	For Local r:Int = t To t+500 Step 10
 		SetRotation r
 		SetScale r/5,r/5
 		DrawRect r,r,2,2

+ 8 - 6
max2d.mod/doc/drawtext.bmx

@@ -2,20 +2,22 @@
 
 ' scrolls a large text string across the screen by decrementing the tickerx variable
 
+SuperStrict
+
 Graphics 640,480
 
-Local tickerx#=640
+Local tickerx:Int = 640
 
-text$="Yo to all the Apple, Windows and Linux BlitzMax programmers in the house! "
-text:+"Game development is the most fun, most advanced and definitely most cool "
-text:+"software programming there is!"
+Local Text:String = "Yo to all the Apple, Windows and Linux BlitzMax programmers in the house! "
+Text:+"Game development is the most fun, most advanced and definitely most cool "
+Text:+"software programming there is!"
 
 While Not KeyHit(KEY_ESCAPE)
 	Cls
 	DrawText "Scrolling Text Demo",0,0
-	DrawText text,tickerx#,400
+	DrawText Text,tickerx#,400
 	tickerx=tickerx-1
-	If tickerx<-TextWidth(text) tickerx=640
+	If tickerx<-TextWidth(Text) tickerx=640
 	Flip	
 Wend
 

+ 5 - 3
max2d.mod/doc/grabimage.bmx

@@ -6,6 +6,8 @@
 ' created for the grabbed where any pixels unset on the backbuffer
 ' become transparent in the grabbed image
 
+SuperStrict
+
 Graphics 640,480
 
 Cls
@@ -14,12 +16,12 @@ DrawLine 0,0,32,32
 DrawLine 32,0,0,32
 DrawOval 0,0,32,32
 
-Local image=CreateImage(640,480,1,DYNAMICIMAGE|MASKEDIMAGE)
+Local image:TImage = CreateImage(640,480,1,DYNAMICIMAGE|MASKEDIMAGE)
 GrabImage image,0,0
 
 Cls
-For i=1 To 100
-	DrawImage image,Rnd(640),Rnd(480)
+For Local i:Int = 1 To 100
+	DrawImage image,Float(Rnd(640)),Float(Rnd(480))
 Next
 Flip
 

+ 2 - 0
max2d.mod/doc/graphics.bmx

@@ -2,6 +2,8 @@
 
 ' demonstrates a fullscreen graphics display
 
+SuperStrict
+
 Graphics 640,480
 
 DrawText "Press any key to exit",0,0

+ 6 - 3
max2d.mod/doc/plot.bmx

@@ -3,13 +3,16 @@
 ' plots a cosine graph
 ' scrolls along the graph using an incrementing frame variable 
 
+SuperStrict
+
 Graphics 640,480
 
+Local frame:Int
 While Not KeyHit(KEY_ESCAPE)
 	Cls
-	For x=0 To 640
-		theta=x+frame
-		y=240-Cos(theta)*240
+	For Local x:Int = 0 To 640
+		Local theta:Int = x + frame
+		Local y:Int = 240-Cos(theta)*240
 		Plot x,y
 	Next
 	frame=frame+1

+ 1 - 0
polledinput.mod/doc/appterminate.bmx

@@ -1,3 +1,4 @@
+SuperStrict
 
 Graphics 640,480,0
 

+ 2 - 0
polledinput.mod/doc/keydown.bmx

@@ -5,6 +5,8 @@
 ' and exits when it detects the ESCAPE key has
 ' been pressed
 
+SuperStrict
+
 Graphics 640,480
 While Not KeyHit(KEY_ESCAPE)
 	Cls

+ 8 - 6
polledinput.mod/doc/keyhit.bmx

@@ -5,9 +5,11 @@
 ' and exits when it detects the ESCAPE key has
 ' been pressed
 
-graphics 640,480
-while not keyhit(KEY_ESCAPE)
-	cls
-	if keyhit(KEY_SPACE) drawoval 0,0,640,480
-	flip
-wend
+SuperStrict
+
+Graphics 640,480
+While Not KeyHit(KEY_ESCAPE)
+	Cls
+	If KeyHit(KEY_SPACE) DrawOval 0,0,640,480
+	Flip
+Wend

+ 10 - 8
polledinput.mod/doc/mousedown.bmx

@@ -1,11 +1,13 @@
 ' mousedown.bmx
 
-graphics 640,480
+SuperStrict
 
-while not keyhit(KEY_ESCAPE)
-	cls
-	if mousedown(1) drawrect 0,0,200,200
-	if mousedown(2) drawrect 200,0,200,200
-	if mousedown(3) drawrect 400,0,200,200
-	flip
-wend
+Graphics 640,480
+
+While Not KeyHit(KEY_ESCAPE)
+	Cls
+	If MouseDown(1) DrawRect 0,0,200,200
+	If MouseDown(2) DrawRect 200,0,200,200
+	If MouseDown(3) DrawRect 400,0,200,200
+	Flip
+Wend

+ 10 - 8
polledinput.mod/doc/mousehit.bmx

@@ -1,11 +1,13 @@
 ' mousehit.bmx
 
-graphics 640,480
+SuperStrict
 
-while not keyhit(KEY_ESCAPE)
-	cls
-	if mousehit(1) drawrect 0,0,200,200
-	if mousehit(2) drawrect 200,0,200,200
-	if mousehit(3) drawrect 400,0,200,200
-	flip
-wend
+Graphics 640,480
+
+While Not KeyHit(KEY_ESCAPE)
+	Cls
+	If MouseHit(1) DrawRect 0,0,200,200
+	If MouseHit(2) DrawRect 200,0,200,200
+	If MouseHit(3) DrawRect 400,0,200,200
+	Flip
+Wend

+ 8 - 6
polledinput.mod/doc/mousex.bmx

@@ -2,9 +2,11 @@
 
 ' the following tracks the position of the mouse
 
-graphics 640,480
-while not keyhit(KEY_ESCAPE)
-	cls
-	drawoval mousex()-10,mousey()-10,20,20
-	flip
-wend
+SuperStrict
+
+Graphics 640,480
+While Not KeyHit(KEY_ESCAPE)
+	Cls
+	DrawOval MouseX()-10,MouseY()-10,20,20
+	Flip
+Wend

+ 8 - 6
polledinput.mod/doc/mousey.bmx

@@ -2,9 +2,11 @@
 
 ' the following tracks the position of the mouse
 
-graphics 640,480
-while not keyhit(KEY_ESCAPE)
-	cls
-	drawrect mousex()-10,mousey()-10,20,20
-	flip
-wend
+SuperStrict
+
+Graphics 640,480
+While Not KeyHit(KEY_ESCAPE)
+	Cls
+	DrawRect MouseX()-10,MouseY()-10,20,20
+	Flip
+Wend

+ 6 - 4
polledinput.mod/doc/mousez.bmx

@@ -2,9 +2,11 @@
 
 ' prints mousez() the mousewheel position
 
+SuperStrict
+
 Graphics 640,480
-While Not keyhit(KEY_ESCAPE)
-	cls
-	drawtext "MouseZ()="+MouseZ(),0,0
-	flip
+While Not KeyHit(KEY_ESCAPE)
+	Cls
+	DrawText "MouseZ()="+MouseZ(),0,0
+	Flip
 Wend

+ 3 - 1
polledinput.mod/doc/movemouse.bmx

@@ -4,7 +4,9 @@
 ' by locking the mouse to the center of the screen and reporting
 ' MouseXSpeed and MouseYSpeed variables 
 
-Global MouseXSpeed,MouseYSpeed
+SuperStrict
+
+Global MouseXSpeed:Int,MouseYSpeed:Int
 
 Function SampleMouse()
 	MouseXSpeed=MouseX()-320

+ 12 - 6
polledinput.mod/polledinput.bmx

@@ -73,7 +73,7 @@ Function Hook:Object( id,data:Object,context:Object )
 		FlushMouse
 		suspended=True
 	Case EVENT_APPRESUME
-		FlushKeys
+		FlushKeys(False)
 		FlushMouse
 		suspended=False
 	Case EVENT_APPTERMINATE
@@ -183,14 +183,20 @@ about:
 #FlushKeys resets the state of all keys to 'off', and resets the character queue
 used by #GetChar.
 End Rem
-Function FlushKeys()
+Function FlushKeys(resetStates:Int = True)
 	PollSystem
 	charGet=0
 	charPut=0
-	For Local i=0 Until 256
-		keyStates[i]=0
-		keyHits[i]=0
-	Next
+	If resetStates Then
+		For Local i=0 Until 256
+			keyStates[i]=0
+			keyHits[i]=0
+		Next
+	Else
+		For Local i=0 Until 256
+			keyHits[i]=0
+		Next
+	End If
 End Function
 
 Rem

+ 0 - 1
random.mod/doc/rnd.bmx

@@ -19,4 +19,3 @@ Print "Estimated area = " + ( 4.0 * Double(inpoints)/Double(totalpoints) )
 Print
 Print "    Exact area = " + Pi     '  4 * Pi/4, compare with estimate
 
-End

+ 6 - 6
random.mod/doc/rnddouble.bmx

@@ -3,23 +3,23 @@
 ' Player 1 hits 30% of the time, player 2 hits 40%.
 ' What is the probability that player 1 wins?
 
-Function winner()   ' play game once, return winner 1 or 2
+SuperStrict
+
+Function winner:Int()   ' play game once, return winner 1 or 2
     Repeat
         If RndDouble() < 0.3 Then Return 1
         If RndDouble() < 0.4 Then Return 2
     Forever
 End Function
 
-Local count[3]
+Local count:Int[3]
 
-trials = 1000000
+Local trials:Int = 1000000
 
-For n = 1 to trials
+For Local n:Int = 1 To trials
     count[ winner() ] :+ 1
 Next
 
 Print "Estimated probability = " + ( Double( count[1] ) / Double( trials ) )
 Print
 Print "    Exact probability = " + ( 15.0 / 29.0 )
-
-Input ; End

+ 21 - 19
random.mod/doc/seedrnd.bmx

@@ -1,20 +1,22 @@
 ' RndSeed.bmx and SeedRnd.bmx ( one example for both )
-' Get/Set random number seed.
-
-SeedRnd MilliSecs()
-
-seed=RndSeed()
-
-Print "Initial seed="+seed
-
-For k=1 To 10
-Print Rand(10)
-Next
-
-Print "Restoring seed"
-
-SeedRnd seed
-
-For k=1 To 10
-Print Rand(10)
-Next
+' Get/Set random number seed.
+
+SuperStrict
+
+SeedRnd MilliSecs()
+
+Local seed:Int = RndSeed()
+
+Print "Initial seed="+seed
+
+For Local k:Int = 1 To 10
+Print Rand(10)
+Next
+
+Print "Restoring seed"
+
+SeedRnd seed
+
+For Local k:Int = 1 To 10
+Print Rand(10)
+Next