Browse Source

Updated docs + misc tweaks and fixes.

Mark Sibly 9 years ago
parent
commit
6af1a857c8

+ 2 - 2
modules/mojo/app/event.monkey2

@@ -45,7 +45,7 @@ Enum EventType
 	Eaten=$80000000
 	Eaten=$80000000
 End
 End
 
 
-#rem monkeydoc Event class
+#rem monkeydoc The Event class.
 #end
 #end
 Class Event Abstract
 Class Event Abstract
 
 
@@ -92,7 +92,7 @@ Class Event Abstract
 	End
 	End
 End
 End
 
 
-#rem monkeydoc The KeyEvent class
+#rem monkeydoc The KeyEvent class.
 #end
 #end
 Class KeyEvent Extends Event
 Class KeyEvent Extends Event
 
 

+ 2 - 0
modules/mojo/app/skin.monkey2

@@ -1,6 +1,8 @@
 
 
 Namespace mojo.app
 Namespace mojo.app
 
 
+#rem monkeydoc @hidden
+#end
 Class Skin
 Class Skin
 
 
 	Property Image:Image()
 	Property Image:Image()

+ 47 - 8
modules/mojo/app/style.monkey2

@@ -1,24 +1,32 @@
 
 
 Namespace mojo.app
 Namespace mojo.app
 
 
+#rem monkeydoc The Style class.
+#end
 Class Style
 Class Style
 
 
 	Method New()
 	Method New()
 		Init( "",Null,False )
 		Init( "",Null,False )
 	End
 	End
 	
 	
-	Method New( name:String )
-		Init( name,Null,False )
-	End
-	
 	Method New( style:Style )
 	Method New( style:Style )
 		Init( "",style,True )
 		Init( "",style,True )
 	End
 	End
 	
 	
+	#rem monkeydoc @hidden
+	#end
+	Method New( name:String )
+		Init( name,Null,False )
+	End
+	
+	#rem monkeydoc @hidden
+	#end
 	Method New( name:String,style:Style )
 	Method New( name:String,style:Style )
 		Init( name,style,True )
 		Init( name,style,True )
 	End
 	End
 	
 	
+	#rem monkeydoc @hidden
+	#end
 	Method AddState:Style( state:String,srcState:String="" )
 	Method AddState:Style( state:String,srcState:String="" )
 	
 	
 		Local style:=New Style
 		Local style:=New Style
@@ -30,6 +38,8 @@ Class Style
 		Return style
 		Return style
 	End
 	End
 	
 	
+	#rem monkeydoc @hidden
+	#end
 	Method GetState:Style( state:String )
 	Method GetState:Style( state:String )
 	
 	
 		Local style:=_states[state]
 		Local style:=_states[state]
@@ -38,68 +48,92 @@ Class Style
 		Return Self
 		Return Self
 	End
 	End
 
 
+	#rem monkeydoc Background color.
+	#end
 	Property BackgroundColor:Color()
 	Property BackgroundColor:Color()
 		Return _bgcolor
 		Return _bgcolor
 	Setter( backgroundColor:Color )
 	Setter( backgroundColor:Color )
 		_bgcolor=backgroundColor
 		_bgcolor=backgroundColor
 	End
 	End
 	
 	
+	#rem monkeydoc Padding rect.
+	#end
 	Property Padding:Recti()
 	Property Padding:Recti()
 		Return _padding
 		Return _padding
 	Setter( padding:Recti )
 	Setter( padding:Recti )
 		_padding=padding
 		_padding=padding
 	End
 	End
 	
 	
+	#rem monkeydoc @hidden
+	#end
 	Property Skin:Skin()
 	Property Skin:Skin()
 		Return _skin
 		Return _skin
 	Setter( skin:Skin )
 	Setter( skin:Skin )
 		_skin=skin
 		_skin=skin
 	End
 	End
 	
 	
+	#rem monkeydoc @hidden
+	#end
 	Property SkinColor:Color()
 	Property SkinColor:Color()
 		Return _skcolor
 		Return _skcolor
 	Setter( skinColor:Color )
 	Setter( skinColor:Color )
 		_skcolor=skinColor
 		_skcolor=skinColor
 	End
 	End
 		
 		
+	#rem monkeydoc Border rect.
+	#end
 	Property Border:Recti()
 	Property Border:Recti()
 		Return _border
 		Return _border
 	Setter( border:Recti )
 	Setter( border:Recti )
 		_border=border
 		_border=border
 	End
 	End
 	
 	
+	#rem monkeydoc Border color.
+	#End
 	Property BorderColor:Color()
 	Property BorderColor:Color()
 		Return _bdcolor
 		Return _bdcolor
 	Setter( borderColor:Color )
 	Setter( borderColor:Color )
 		_bdcolor=borderColor
 		_bdcolor=borderColor
 	End
 	End
-	
+
+	#rem monkeydoc Margin rect.
+	#end
 	Property Margin:Recti()
 	Property Margin:Recti()
 		Return _margin
 		Return _margin
 	Setter( margin:Recti )
 	Setter( margin:Recti )
 		_margin=margin
 		_margin=margin
 	End
 	End
 	
 	
+	#rem monkeydoc Default canvas color.
+	#end
 	Property DefaultColor:Color()
 	Property DefaultColor:Color()
 		Return _color
 		Return _color
 	Setter( color:Color )
 	Setter( color:Color )
 		_color=color
 		_color=color
 	End
 	End
-	
+
+	#rem monkeydoc Default canvas font.
+	#end	
 	Property DefaultFont:Font()
 	Property DefaultFont:Font()
 		Return _font
 		Return _font
 	Setter( font:Font )
 	Setter( font:Font )
 		_font=font
 		_font=font
 	End
 	End
 	
 	
+	#rem monkeydoc @hidden
+	#end
 	Method SetImage( name:String,image:Image )
 	Method SetImage( name:String,image:Image )
 		_images[name]=image
 		_images[name]=image
 	End
 	End
 	
 	
+	#rem monkeydoc @hidden
+	#end
 	Method GetImage:Image( name:String )
 	Method GetImage:Image( name:String )
 		Return _images[name]
 		Return _images[name]
 	End
 	End
 	
 	
+	#rem monkeydoc @hidden
+	#end
 	Property Bounds:Recti()
 	Property Bounds:Recti()
 		Local bounds:=Padding
 		Local bounds:=Padding
 		Local skin:=Skin
 		Local skin:=Skin
@@ -109,6 +143,8 @@ Class Style
 		Return bounds
 		Return bounds
 	End
 	End
 	
 	
+	#rem monkeydoc @hidden
+	#end
 	Method Render( canvas:Canvas,bounds:Recti )
 	Method Render( canvas:Canvas,bounds:Recti )
 	
 	
 		canvas.BlendMode=BlendMode.Alpha
 		canvas.BlendMode=BlendMode.Alpha
@@ -158,6 +194,8 @@ Class Style
 		
 		
 	End
 	End
 	
 	
+	#rem monkeydoc @hidden
+	#end
 	Function GetStyle:Style( name:String )
 	Function GetStyle:Style( name:String )
 	
 	
 		Local style:=_styles[name]
 		Local style:=_styles[name]
@@ -166,12 +204,13 @@ Class Style
 		Local i:=name.Find( ":" )
 		Local i:=name.Find( ":" )
 		If i<>-1 Return GetStyle( name.Slice( 0,i ) )
 		If i<>-1 Return GetStyle( name.Slice( 0,i ) )
 		
 		
+		If Not _defaultStyle _defaultStyle=New Style
 		Return _defaultStyle
 		Return _defaultStyle
 	End
 	End
 
 
 	Private
 	Private
 	
 	
-	Global _defaultStyle:=New Style
+	Global _defaultStyle:Style
 	Global _styles:=New StringMap<Style>
 	Global _styles:=New StringMap<Style>
 	
 	
 	Field _states:=New StringMap<Style>
 	Field _states:=New StringMap<Style>
@@ -181,7 +220,7 @@ Class Style
 	Field _skin:Skin
 	Field _skin:Skin
 	Field _skcolor:Color=Color.White
 	Field _skcolor:Color=Color.White
 	Field _border:Recti
 	Field _border:Recti
-	Field _bdcolor:Color=Color.Black
+	Field _bdcolor:Color=Color.None
 	Field _margin:Recti
 	Field _margin:Recti
 	Field _color:Color
 	Field _color:Color
 	Field _font:Font
 	Field _font:Font

+ 6 - 4
modules/mojo/app/view.monkey2

@@ -1,6 +1,8 @@
 
 
 Namespace mojo.app
 Namespace mojo.app
 
 
+#rem monkeydoc The View class.
+#end
 Class View
 Class View
 
 
 	Method New()
 	Method New()
@@ -8,7 +10,7 @@ Class View
 		_style=New Style
 		_style=New Style
 	End
 	End
 
 
-	#rem monkeydoc View visible flag.
+	#rem monkeydoc @hidden View visible flag.
 	
 	
 	Use [[ReallyVisible]] to test if the view is really visible.
 	Use [[ReallyVisible]] to test if the view is really visible.
 	
 	
@@ -23,7 +25,7 @@ Class View
 		_visible=visible
 		_visible=visible
 	End
 	End
 
 
-	#rem monkeydoc View visibility state.
+	#rem monkeydoc @hidden View visibility state.
 	
 	
 	True if the view's visibility flag is set AND all its parent visibility flags up to the root window are also set.
 	True if the view's visibility flag is set AND all its parent visibility flags up to the root window are also set.
 	
 	
@@ -33,7 +35,7 @@ Class View
 		Return _visible And (Not _parent Or _parent.ReallyVisible)
 		Return _visible And (Not _parent Or _parent.ReallyVisible)
 	End
 	End
 	
 	
-	#rem monkeydoc View enabled flag.
+	#rem monkeydoc @hidden View enabled flag.
 	
 	
 	Use [[ReallyEnabled]] to test if the view is really enabled.
 	Use [[ReallyEnabled]] to test if the view is really enabled.
 	
 	
@@ -50,7 +52,7 @@ Class View
 		InvalidateStyle()
 		InvalidateStyle()
 	End
 	End
 
 
-	#rem monkeydoc View enabled state.
+	#rem monkeydoc @hidden View enabled state.
 	
 	
 	True if the view's enabled flag is set AND all its parent enabled flags are set AND [[ReallyVisible]] is also true. 
 	True if the view's enabled flag is set AND all its parent enabled flags are set AND [[ReallyVisible]] is also true. 
 	
 	

+ 33 - 2
modules/mojo/audio/audio.monkey2

@@ -7,8 +7,12 @@ Global _alloced:Int[]
 
 
 Public
 Public
 
 
-Global Audio:=New AudioDevice
+#rem monkeydoc Global instance of the AudioDevice class.
+#end
+Const Audio:=New AudioDevice
 
 
+#rem monkeydoc The AudioDevice class.
+#end
 Class AudioDevice
 Class AudioDevice
 
 
 	'***** Internal *****
 	'***** Internal *****
@@ -31,8 +35,12 @@ Class AudioDevice
 	
 	
 End
 End
 
 
+#rem monkeydoc The Sound class.
+#end
 Class Sound
 Class Sound
 
 
+	#rem monkeydoc Plays a sound.
+	#end
 	Method Play:Channel( loops:Int=0 )
 	Method Play:Channel( loops:Int=0 )
 
 
 		Local channel:=New Channel
 		Local channel:=New Channel
@@ -41,6 +49,8 @@ Class Sound
 		Return channel
 		Return channel
 	End
 	End
 
 
+	#rem monkeydoc Loads a sound.
+	#end
 	Function Load:Sound( path:String )
 	Function Load:Sound( path:String )
 	
 	
 		Local data:=DataBuffer.Load( path )
 		Local data:=DataBuffer.Load( path )
@@ -63,16 +73,27 @@ Class Sound
 	
 	
 End
 End
 
 
+#rem monkeydoc The Channel class.
+#end
 Class Channel
 Class Channel
 
 
+	#rem monkeydoc Creates a new channel.
+	#end
 	Method New()
 	Method New()
 	End
 	End
 
 
+	#rem monkeydoc True if this channel is playing audio.
+	
+	If the channel is playing audio but is in the paused state, this property will still return true.
+
+	#end
 	Property Playing:Bool()
 	Property Playing:Bool()
 		If Invalid Return False
 		If Invalid Return False
 		Return Mix_Playing( _id & 31 )
 		Return Mix_Playing( _id & 31 )
 	End
 	End
 	
 	
+	#rem monkeydoc Channel volume in the range 0 to 1.
+	#end
 	Property Volume:Float()
 	Property Volume:Float()
 		If Invalid Return 0
 		If Invalid Return 0
 		Return _volume
 		Return _volume
@@ -81,17 +102,23 @@ Class Channel
 		_volume=Clamp( volume,0.0,1.0 )
 		_volume=Clamp( volume,0.0,1.0 )
 		Mix_Volume( _id & 31,_volume*128 )
 		Mix_Volume( _id & 31,_volume*128 )
 	End
 	End
-	
+
+	#rem monkeydoc Channel playback rate.
+	#end	
 	Property Rate:Float()
 	Property Rate:Float()
 		Return 1
 		Return 1
 	Setter( rate:Float )
 	Setter( rate:Float )
 	End
 	End
 	
 	
+	#rem monkeydoc Channel pan in the range -1 to 1.
+	#end
 	Property Pan:Float()
 	Property Pan:Float()
 		Return 0
 		Return 0
 	Setter( pan:Float )
 	Setter( pan:Float )
 	End
 	End
 	
 	
+	#rem monkeydoc Channel paused state.
+	#end
 	Property Paused:Bool()
 	Property Paused:Bool()
 		If Invalid Return False
 		If Invalid Return False
 		Return Mix_Paused( _id & 31 )
 		Return Mix_Paused( _id & 31 )
@@ -100,6 +127,8 @@ Class Channel
 		Mix_Pause( _id & 31 )
 		Mix_Pause( _id & 31 )
 	End
 	End
 	
 	
+	#rem monkeydoc Plays a sound through the channel.
+	#end
 	Method Play:Bool( sound:Sound,loops:Int=0 )
 	Method Play:Bool( sound:Sound,loops:Int=0 )
 	
 	
 		Local id:=_id & 31
 		Local id:=_id & 31
@@ -116,6 +145,8 @@ Class Channel
 		Return True
 		Return True
 	End
 	End
 	
 	
+	#rem monkeydoc Stops the channel.
+	#end
 	Method Stop()
 	Method Stop()
 		If Invalid Return
 		If Invalid Return
 		Mix_HaltChannel( _id )
 		Mix_HaltChannel( _id )

+ 38 - 2
modules/mojo/graphics/font.monkey2

@@ -2,13 +2,18 @@
 Namespace mojo.graphics
 Namespace mojo.graphics
 
 
 #rem monkeydoc The Glyph struct.
 #rem monkeydoc The Glyph struct.
+
+Glyph are used to store the individual character data for fonts.
+
 #end
 #end
 Struct Glyph
 Struct Glyph
 
 
 	Field rect:Recti
 	Field rect:Recti
 	Field offset:Vec2f
 	Field offset:Vec2f
 	Field advance:Float
 	Field advance:Float
-	
+
+	#rem monkeydoc Creates a new glyph.
+	#end
 	Method New( rect:Recti,offset:Vec2f,advance:Float )
 	Method New( rect:Recti,offset:Vec2f,advance:Float )
 		Self.rect=rect
 		Self.rect=rect
 		Self.offset=offset
 		Self.offset=offset
@@ -18,9 +23,26 @@ Struct Glyph
 End
 End
 
 
 #rem monkeydoc The Font class.
 #rem monkeydoc The Font class.
+
+Mojo fonts use an image atlas system for storing font data.
+
+The glyph struct is used to store the location, size and advance for individual characters within a font.
+All character image data for a font must A font must occupy a single image, 
+
 #end
 #end
 Class Font
 Class Font
 
 
+	#rem monkeydoc Creates a new font.
+
+	@param image The image atlas.
+
+	@param height The height of the font in pixels.
+
+	@param firstChar The first character contained in the font.
+
+	@param glyphs An array of glyph structs describing the characters in the font.
+
+	#end
 	Method New( image:Image,height:Float,firstChar:Int,glyphs:Glyph[] )
 	Method New( image:Image,height:Float,firstChar:Int,glyphs:Glyph[] )
 		_image=image
 		_image=image
 		_height=height
 		_height=height
@@ -28,21 +50,29 @@ Class Font
 		_glyphs=glyphs
 		_glyphs=glyphs
 	End
 	End
 	
 	
+	#rem monkeydoc The font image atlas.
+	#end
 	Property Image:Image()
 	Property Image:Image()
 	
 	
 		Return _image
 		Return _image
 	End
 	End
 	
 	
+	#rem monkeydoc The font height in pixels.
+	#end
 	Property Height:Float()
 	Property Height:Float()
 	
 	
 		Return _height
 		Return _height
 	End
 	End
 	
 	
+	#rem monkeydoc The first character contained in the font.
+	#end
 	Property FirstChar:Int()
 	Property FirstChar:Int()
 	
 	
 		Return _firstChar
 		Return _firstChar
 	End
 	End
 	
 	
+	#rem monkeydoc The number of characters in the font.
+	#end
 	Property NumChars:Int()
 	Property NumChars:Int()
 	
 	
 		Return _glyphs.Length
 		Return _glyphs.Length
@@ -55,11 +85,15 @@ Class Font
 		Return _glyphs
 		Return _glyphs
 	End
 	End
 	
 	
+	#rem monkeydoc Gets a glyph from the font.
+	#end
 	Method GetGlyph:Glyph( char:Int )
 	Method GetGlyph:Glyph( char:Int )
 		If char>=_firstChar And char<_firstChar+_glyphs.Length Return _glyphs[ char-_firstChar ]
 		If char>=_firstChar And char<_firstChar+_glyphs.Length Return _glyphs[ char-_firstChar ]
 		Return _glyphs[0]
 		Return _glyphs[0]
 	End
 	End
 	
 	
+	#rem monkedoc Measures the width of some text when rendered by the font.
+	#end
 	Method TextWidth:Float( text:String )
 	Method TextWidth:Float( text:String )
 		Local w:=0.0
 		Local w:=0.0
 		For Local char:=Eachin text
 		For Local char:=Eachin text
@@ -84,7 +118,9 @@ Class Font
 	End
 	End
 
 
 	'Make this ALWAYS work!	
 	'Make this ALWAYS work!	
-	Function Load:Font( path:String,height:Float,textureFlags:TextureFlags=TextureFlags.Filter|TextureFlags.Mipmap,shader:Shader=Null )
+	#rem monkeydoc Loads a font from a ttf file.
+	#end
+	Function Load:Font( path:String,height:Float,textureFlags:TextureFlags=Null,shader:Shader=Null )
 	
 	
 		If Not shader shader=Shader.GetShader( "font" )
 		If Not shader shader=Shader.GetShader( "font" )
 		
 		

+ 115 - 1
modules/mojo/graphics/image.monkey2

@@ -2,6 +2,11 @@
 Namespace mojo.graphics
 Namespace mojo.graphics
 
 
 #rem monkeydoc The Image class.
 #rem monkeydoc The Image class.
+
+An image is a rectangular array of pixels that can be drawn using one of the [[Canvas.DrawImage]] methods.
+
+You can load an image from a file using the [[Load]].
+
 #end
 #end
 Class Image
 Class Image
 
 
@@ -9,6 +14,80 @@ Class Image
 	#end
 	#end
 	Field OnDiscarded:Void()
 	Field OnDiscarded:Void()
 
 
+	#rem monkeydoc Creates a new image.
+	
+	New( pixmap,... ) allows you to create a new image from an existing pixmap.
+	
+	New( width,height,... ) allows you to create a new image that can be rendered to using a canvas. For images that will be frequently updated, use `TextureFlags.Filter|TextureFlags.Dynamic' for the best performance.
+	
+	New( image,rect,... ) allows you to create an image from within an 'atlas' image.
+	
+	@example
+	
+	Namespace myapp
+	
+	#Import "<std>"
+	#Import "<mojo>"
+	
+	Using std..
+	Using mojo..
+	
+	Class MyWindow Extends Window
+	
+		Field image1:Image
+		Field image2:Image
+		Field image3:Image
+			
+		Method New()
+	
+			'Create an image from a pixmap
+			Local pixmap:=New Pixmap( 16,16 )
+			pixmap.Clear( Color.Red )
+			image1=New Image( pixmap )
+			
+			'Create an image and render something to it
+			image2=New Image( 16,16 )
+			Local icanvas:=New Canvas( image2 )
+			icanvas.Color=Color.Yellow
+			icanvas.DrawRect( 0,0,8,8 )
+			icanvas.DrawRect( 8,8,8,8 )
+			icanvas.Color=Color.LightGrey
+			icanvas.DrawRect( 8,0,8,8 )
+			icanvas.DrawRect( 0,8,8,8 )
+			icanvas.Flush() 'Important!
+			
+			'Create a image from an atlas image
+			image3=New Image( image2,New Recti( 4,4,12,12 ) )
+			
+		End
+	
+		Method OnRender( canvas:Canvas ) Override
+		
+			canvas.DrawText( "Image1",0,0 )
+			canvas.DrawImage( image1,0,16 )
+			
+			canvas.DrawText( "Image2",0,40 )
+			canvas.DrawImage( image2,0,56 )
+	
+			canvas.DrawText( "Image3",0,80 )
+			canvas.DrawImage( image3,0,96 )
+			
+		End
+		
+	End
+	
+	Function Main()
+	
+		New AppInstance
+		
+		New MyWindow
+		
+		App.Run()
+	End
+	
+	@end
+	
+	#end
 	Method New( pixmap:Pixmap,textureFlags:TextureFlags=TextureFlags.Filter|TextureFlags.Mipmap,shader:Shader=Null )
 	Method New( pixmap:Pixmap,textureFlags:TextureFlags=TextureFlags.Filter|TextureFlags.Mipmap,shader:Shader=Null )
 	
 	
 		Local texture:=New Texture( pixmap,textureFlags )
 		Local texture:=New Texture( pixmap,textureFlags )
@@ -31,6 +110,7 @@ Class Image
 		OnDiscarded+=Lambda()
 		OnDiscarded+=Lambda()
 			texture.Discard()
 			texture.Discard()
 		End
 		End
+
 	End
 	End
 	
 	
 	Method New( image:Image,rect:Recti )
 	Method New( image:Image,rect:Recti )
@@ -66,21 +146,32 @@ Class Image
 		Return _texture
 		Return _texture
 	End
 	End
 	
 	
+	#rem monkeydoc @hidden The image's rect within its texture.
+	#endif
 	Property Rect:Recti()
 	Property Rect:Recti()
 	
 	
 		Return _rect
 		Return _rect
 	End
 	End
 	
 	
+	#rem monkeydoc The width of the image's rect within its texture.
+	#end
 	Property Width:Int()
 	Property Width:Int()
 	
 	
 		Return _rect.Width
 		Return _rect.Width
 	End
 	End
 	
 	
+	#rem monkeydoc The height of the image's rect within its texture.
+	#end
 	Property Height:Int()
 	Property Height:Int()
 	
 	
 		Return _rect.Height
 		Return _rect.Height
 	End
 	End
 
 
+	#rem monkeydoc The image handle.
+	
+	Image handle values are fractional, where 0,0 is the top-left of the image and 1,1 is the bottom-right.
+
+	#end
 	Property Handle:Vec2f()
 	Property Handle:Vec2f()
 	
 	
 		Return _handle
 		Return _handle
@@ -91,7 +182,14 @@ Class Image
 		
 		
 		UpdateVertices()
 		UpdateVertices()
 	End
 	End
+
+	#rem monkeydoc The image scale.
+	
+	The scale property provides a simple way to 'pre-scale' an image.
 	
 	
+	Scaling an image this way is faster than using one of the 'scale' parameters of [[Canvas.DrawImage]].
+	
+	#end
 	Property Scale:Vec2f()
 	Property Scale:Vec2f()
 	
 	
 		Return _scale
 		Return _scale
@@ -103,11 +201,25 @@ Class Image
 		UpdateVertices()
 		UpdateVertices()
 	End
 	End
 	
 	
+	#rem monkeydoc The image bounds.
+	
+	The bounds rect represents the actual image vertices used when the image is drawn.
+	
+	Image bounds are affected by [[Scale]] and [[Handle]], and can be used for simple collision detection.
+	
+	#end
 	Property Bounds:Rectf()
 	Property Bounds:Rectf()
 	
 	
 		Return _vertices
 		Return _vertices
 	End
 	End
 
 
+	#rem monkeydoc Image radius.
+	
+	The radius property returns the radius of the [[Bounds]] rect.
+	
+	Image bounds are affected by [[Scale]] and [[Handle]], and can be used for simple collision detection.
+	
+	#end
 	Property Radius:Float()
 	Property Radius:Float()
 	
 	
 		Return _radius
 		Return _radius
@@ -127,7 +239,7 @@ Class Image
 		Return _texCoords
 		Return _texCoords
 	End
 	End
 	
 	
-	#rem monkeydoc Release the image and any resource it uses.
+	#rem monkeydoc Releases the image and any resource it uses.
 	#end
 	#end
 	Method Discard()
 	Method Discard()
 		If _discarded Return
 		If _discarded Return
@@ -135,6 +247,8 @@ Class Image
 		OnDiscarded()
 		OnDiscarded()
 	End
 	End
 	
 	
+	#rem monkeydoc Loads an image from a file.
+	#end
 	Function Load:Image( path:String,textureFlags:TextureFlags=TextureFlags.Filter|TextureFlags.Mipmap,shader:Shader=Null )
 	Function Load:Image( path:String,textureFlags:TextureFlags=TextureFlags.Filter|TextureFlags.Mipmap,shader:Shader=Null )
 	
 	
 		Local diffuse:=mojo.graphics.Texture.Load( path,textureFlags )
 		Local diffuse:=mojo.graphics.Texture.Load( path,textureFlags )

+ 2 - 0
modules/mojo/graphics/material.monkey2

@@ -1,6 +1,8 @@
 
 
 Namespace mojo.graphics
 Namespace mojo.graphics
 
 
+#rem monkeydoc @hidden
+#end
 Class Material
 Class Material
 
 
 	Method New( shader:Shader )
 	Method New( shader:Shader )

+ 2 - 0
modules/mojo/graphics/shader.monkey2

@@ -268,6 +268,8 @@ Class ParamBuffer
 	Field _params:=New ShaderParam[32]
 	Field _params:=New ShaderParam[32]
 End
 End
 
 
+#rem monkeydoc @hidden
+#end
 Class Shader
 Class Shader
 
 
 	Method New( sourceCode:String )
 	Method New( sourceCode:String )

+ 4 - 2
modules/mojo/graphics/texture.monkey2

@@ -6,8 +6,8 @@ Namespace mojo.graphics
 | TextureFlags	| Description
 | TextureFlags	| Description
 |:--------------|:-----------
 |:--------------|:-----------
 | Filter		| Enable filtering. When the texture is magnified, texel colors are interpolated giving a smooth/blurred result.
 | Filter		| Enable filtering. When the texture is magnified, texel colors are interpolated giving a smooth/blurred result.
-| Mipmap		| Enable mipmapping. When the texture is minified, automcatically generated 'mipmaps' are used.
-| Dynamic		| Texture is frequently updated.
+| Mipmap		| Enable mipmapping. When the texture is minified, automatically pre-generated 'mipmaps' are used to give a smoother result.
+| Dynamic		| Texture is frequently updated. This flag should be set if the texture contents are regularly updated and don't need to be preserved.
 
 
 #end
 #end
 Enum TextureFlags
 Enum TextureFlags
@@ -20,6 +20,8 @@ Enum TextureFlags
 	Dynamic=		$1000
 	Dynamic=		$1000
 End
 End
 
 
+#rem monkeydoc @hidden
+#end
 Class Texture
 Class Texture
 
 
 	#rem monkeydoc @hidden
 	#rem monkeydoc @hidden

+ 34 - 2
modules/mojo/input/joystick.monkey2

@@ -1,7 +1,7 @@
 
 
 Namespace mojo.input
 Namespace mojo.input
 
 
-#rem monkeydoc
+#rem monkeydoc Joystick hat directions.
 
 
 | JoystickHat value	| 
 | JoystickHat value	| 
 |:------------------|
 |:------------------|
@@ -28,51 +28,76 @@ Enum JoystickHat	'SDL values...
 	LeftDown=Left|Down
 	LeftDown=Left|Down
 End
 End
 
 
+#rem monkeydoc The JoystickDevice class.
+#end
 Class JoystickDevice Extends InputDevice
 Class JoystickDevice Extends InputDevice
 
 
+	#rem monkeydoc @hidden
+	#end	
 	Property Name:String()
 	Property Name:String()
 		Return _name
 		Return _name
 	End
 	End
 	
 	
+	#rem monkeydoc @hidden
+	#end	
 	Property GUID:String()
 	Property GUID:String()
 		Return _guid
 		Return _guid
 	End
 	End
 
 
+	#rem monkeydoc The number of axes supported by the joystick.
+	#end	
 	Property NumAxes:Int()
 	Property NumAxes:Int()
 		Return _numAxes
 		Return _numAxes
 	End
 	End
+
 	
 	
+	#rem monkeydoc The number of balls upported by the joystick.
+	#end	
 	Property NumBalls:Int()
 	Property NumBalls:Int()
 		Return _numBalls
 		Return _numBalls
 	End
 	End
 	
 	
+	#rem monkeydoc The number of buttons supported by the joystick.
+	#end	
 	Property NumButtons:Int()
 	Property NumButtons:Int()
 		Return _numButtons
 		Return _numButtons
 	End
 	End
 	
 	
+	#rem monkeydoc The number of hats supported by the joystick.
+	#end	
 	Property NumHats:Int()
 	Property NumHats:Int()
 		Return _numHats
 		Return _numHats
 	End
 	End
 	
 	
+	#rem monkeydoc Gets joystick axis value in the range -1 to 1.
+	#end	
 	Method GetAxis:Float( axis:Int )
 	Method GetAxis:Float( axis:Int )
 		Return (Float(SDL_JoystickGetAxis( _joystick,axis ))+32768)/32767.5-1
 		Return (Float(SDL_JoystickGetAxis( _joystick,axis ))+32768)/32767.5-1
 	End
 	End
 	
 	
+	#rem monkeydoc Gets joystick ball value.
+	#end	
 	Method GetBall:Vec2i( ball:Int )
 	Method GetBall:Vec2i( ball:Int )
 		Local x:Int,y:Int
 		Local x:Int,y:Int
 		SDL_JoystickGetBall( _joystick,ball,Varptr x,Varptr y )
 		SDL_JoystickGetBall( _joystick,ball,Varptr x,Varptr y )
 		Return New Vec2i( x,y )
 		Return New Vec2i( x,y )
 	End
 	End
 
 
+	#rem monkeydoc Gets joystick hat value.
+	#end	
 	Method GetHat:JoystickHat( hat:Int )
 	Method GetHat:JoystickHat( hat:Int )
 		Return Cast<JoystickHat>( SDL_JoystickGetHat( _joystick,hat ) )
 		Return Cast<JoystickHat>( SDL_JoystickGetHat( _joystick,hat ) )
 	End
 	End
 
 
+	#rem monkeydoc Check up/down state of a button.
+	#end
 	Method ButtonDown:Bool( button:Int )
 	Method ButtonDown:Bool( button:Int )
 		Return SDL_JoystickGetButton( _joystick,button )
 		Return SDL_JoystickGetButton( _joystick,button )
 	End
 	End
 	
 	
-	Method ButtonHit:Bool( button:Int )
+	#rem monkeydoc Checks is a button has been pressed.
+	#end
+	Method ButtonPressed:Bool( button:Int )
 		If ButtonDown( button )
 		If ButtonDown( button )
 			If _hits[button] Return False
 			If _hits[button] Return False
 			_hits[button]=True
 			_hits[button]=True
@@ -82,6 +107,8 @@ Class JoystickDevice Extends InputDevice
 		Return False
 		Return False
 	End
 	End
 	
 	
+	#rem monkeydoc Gets the number of joysticks attached.
+	#end
 	Function NumJoysticks:Int()
 	Function NumJoysticks:Int()
 		Return Min( SDL_NumJoysticks(),8 )
 		Return Min( SDL_NumJoysticks(),8 )
 	End
 	End
@@ -92,6 +119,11 @@ Class JoystickDevice Extends InputDevice
 		SDL_JoystickUpdate()
 		SDL_JoystickUpdate()
 	End
 	End
 	
 	
+	#rem monkeydoc Opens a joystick device.
+	
+	@param index Joystick index.
+
+	#end
 	Function Open:JoystickDevice( index:Int )
 	Function Open:JoystickDevice( index:Int )
 		Assert( index>=0 And index<8 )
 		Assert( index>=0 And index<8 )
 		Local joystick:=_joysticks[index]
 		Local joystick:=_joysticks[index]

+ 4 - 5
modules/mojo/input/keyboard.monkey2

@@ -16,12 +16,12 @@ Global bbKeyInfos:bbKeyInfo Ptr
 
 
 Public
 Public
 
 
-#rem monkeydoc Application keyboard device instance.
+#rem monkeydoc Global instance of the KeyboardDevice class.
 
 
 #end
 #end
 Const Keyboard:=New KeyboardDevice
 Const Keyboard:=New KeyboardDevice
 
 
-#rem monkeydoc The KeyboardDevice singleton class.
+#rem monkeydoc The KeyboardDevice class.
 
 
 All method that take a `key` parameter can also be used with 'raw' keys.
 All method that take a `key` parameter can also be used with 'raw' keys.
 
 
@@ -169,7 +169,7 @@ Class KeyboardDevice Extends InputDevice
 	#rem monkeydoc @hidden
 	#rem monkeydoc @hidden
 	#end
 	#end
 	Method KeyCodeToKey:Key( keyCode:Int )
 	Method KeyCodeToKey:Key( keyCode:Int )
-		If (keyCode & $40000000) keyCode=(keyCode & ~$40000000)-$39+$80
+		If (keyCode & $40000000) keyCode=(keyCode & ~$40000000)+$80
 		Return Cast<Key>( keyCode )
 		Return Cast<Key>( keyCode )
 	End
 	End
 	
 	
@@ -205,7 +205,6 @@ Class KeyboardDevice Extends InputDevice
 #Endif
 #Endif
 			_scan2key[_key2scan[key]]=scanCode
 			_scan2key[_key2scan[key]]=scanCode
 			
 			
-			
 			p=p+1
 			p=p+1
 		Wend
 		Wend
 		
 		
@@ -242,7 +241,7 @@ Class KeyboardDevice Extends InputDevice
 		Case SDL_KEYDOWN
 		Case SDL_KEYDOWN
 		
 		
 			Local kevent:=Cast<SDL_KeyboardEvent Ptr>( event )
 			Local kevent:=Cast<SDL_KeyboardEvent Ptr>( event )
-		
+			
 			_matrix[kevent->keysym.scancode]=True
 			_matrix[kevent->keysym.scancode]=True
 			
 			
 			Select kevent->keysym.sym
 			Select kevent->keysym.sym

+ 2 - 2
modules/mojo/input/keycodes.monkey2

@@ -119,14 +119,14 @@ Enum Key
 	A=97,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z
 	A=97,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z
 	KeyDelete=127
 	KeyDelete=127
 	
 	
-	CapsLock=128,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12
+	CapsLock=185,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12
 	PrintScreen,ScrollLock,Pause,Insert,Home,PageUp,nop,KeyEnd,PageDown
 	PrintScreen,ScrollLock,Pause,Insert,Home,PageUp,nop,KeyEnd,PageDown
 	Right,Left,Down,Up
 	Right,Left,Down,Up
 	KeypadNumLock,KeypadDivide,KeypadMultiply,KeypadMinus,KeypadPlus,KeypadEnter
 	KeypadNumLock,KeypadDivide,KeypadMultiply,KeypadMinus,KeypadPlus,KeypadEnter
 	Keypad1,Keypad2,Keypad3,Keypad4,Keypad5,Keypad6,Keypad7,Keypad8,Keypad9,Keypad0
 	Keypad1,Keypad2,Keypad3,Keypad4,Keypad5,Keypad6,Keypad7,Keypad8,Keypad9,Keypad0
 	KeypadPeriod
 	KeypadPeriod
 	
 	
-	LeftControl=295,LeftShift,LeftAlt,LeftGui,RightControl,RightShift,RightAlt,RightGui
+	LeftControl=185+167,LeftShift,LeftAlt,LeftGui,RightControl,RightShift,RightAlt,RightGui
 	
 	
 	Raw=$10000
 	Raw=$10000
 	
 	

+ 36 - 16
modules/mojo/input/mouse.monkey2

@@ -1,7 +1,7 @@
 
 
 Namespace mojo.input
 Namespace mojo.input
 
 
-#rem monkeydoc Application mouse device instance.
+#rem monkeydoc Global instance of the MouseDevice class.
 #end
 #end
 Const Mouse:=New MouseDevice
 Const Mouse:=New MouseDevice
 
 
@@ -21,9 +21,9 @@ Enum MouseButton
 	Right=3
 	Right=3
 End
 End
 
 
-#rem monkeydoc The MouseDevice singleton class.
+#rem monkeydoc The MouseDevice class.
 
 
-To access the mouse device, use the [[Mouse]] constant.
+To access the mouse device, use the global [[Mouse]] constant.
 
 
 The mouse device should only used after a new [[app.AppInstance]] is created.
 The mouse device should only used after a new [[app.AppInstance]] is created.
 
 
@@ -39,6 +39,8 @@ Class MouseDevice Extends InputDevice
 		Next
 		Next
 	End
 	End
 	
 	
+	#rem monkeydoc Pointer visiblity state.
+	#end
 	Property PointerVisible:Bool()
 	Property PointerVisible:Bool()
 	
 	
 		Return SDL_ShowCursor( -1 )=SDL_ENABLE
 		Return SDL_ShowCursor( -1 )=SDL_ENABLE
@@ -49,23 +51,42 @@ Class MouseDevice Extends InputDevice
 	
 	
 	End
 	End
 	
 	
+	#rem monkeydoc X coordinate of the mouse location.
+	#end
 	Property X:Int()
 	Property X:Int()
 		Return Location.x
 		Return Location.x
 	End
 	End
 	
 	
+	#rem monkeydoc Y coordinate of the mouse location.
+	#end
 	Property Y:Int()
 	Property Y:Int()
 		Return Location.y
 		Return Location.y
 	End
 	End
 
 
+	#rem monkeydoc The mouse location.
+	#end
 	Property Location:Vec2i()
 	Property Location:Vec2i()
 		Return _location
 		Return _location
 	End
 	End
 	
 	
+	#rem monkeydoc Checks the current up/down state of a mouse button.
+	
+	Returns true if `button` is currently held down.
+	
+	@param button Button to checl.
+	#end
 	Method ButtonDown:Bool( button:MouseButton )
 	Method ButtonDown:Bool( button:MouseButton )
 		DebugAssert( button>=0 And button<4,"Mouse buttton out of range" )
 		DebugAssert( button>=0 And button<4,"Mouse buttton out of range" )
 		Return _buttons[button]
 		Return _buttons[button]
 	End
 	End
 
 
+	#rem monkeydoc Checks if a mouse button was pressed.
+	
+	Returns true if `button` was pressed since the last call to ButtonPressed with the same button.
+
+	@param button Button to check.
+	
+	#end
 	Method ButtonPressed:Bool( button:MouseButton )
 	Method ButtonPressed:Bool( button:MouseButton )
 		DebugAssert( button>=0 And button<4,"Mouse buttton out of range" )
 		DebugAssert( button>=0 And button<4,"Mouse buttton out of range" )
 		If _buttons[button]
 		If _buttons[button]
@@ -77,6 +98,13 @@ Class MouseDevice Extends InputDevice
 		Return False
 		Return False
 	End
 	End
 	
 	
+	#rem monkeydoc Checks if a mouse button was released.
+	
+	Returns true if `button` was released since the last call to ButtonReleased with the same button.
+	
+	@param button Button to check.
+	
+	#end
 	Method ButtonReleased:Bool( button:MouseButton )
 	Method ButtonReleased:Bool( button:MouseButton )
 		DebugAssert( button>=0 And button<4,"Mouse buttton out of range" )
 		DebugAssert( button>=0 And button<4,"Mouse buttton out of range" )
 		If Not _buttons[button]
 		If Not _buttons[button]
@@ -88,24 +116,16 @@ Class MouseDevice Extends InputDevice
 		Return False
 		Return False
 	End
 	End
 	
 	
+	#rem monkeydoc @hidden
+	#end
 	Method ButtonHit:Bool( button:MouseButton )
 	Method ButtonHit:Bool( button:MouseButton )
 		Return ButtonPressed( button )
 		Return ButtonPressed( button )
 	End
 	End
-	
-	#rem monkeydoc @hidden
-	#end	
-	'Method GetButton:Bool( index:Int ) Override
-	'	Return ButtonDown( Cast<MouseButton>( index ) )
-	'End
-	
-	#rem monkeydoc @hidden
-	#end	
-	'Method GetPointer:Vec2i( index:Int ) Override
-	'	Return Location
-	'End
-	
+
 	'***** Internal *****
 	'***** Internal *****
 
 
+	#rem monkeydoc @hidden
+	#end
 	Method Init()
 	Method Init()
 		If _init Return
 		If _init Return
 		App.Idle+=Poll
 		App.Idle+=Poll

+ 1 - 3
modules/std/graphics/pixmaploader.monkey2

@@ -1,13 +1,11 @@
 
 
 Namespace std.graphics
 Namespace std.graphics
 
 
-#Import "<stb-image>"
+Private
 
 
 Using stb.image
 Using stb.image
 Using std.stream
 Using std.stream
 
 
-Private
-
 Struct stbi_user
 Struct stbi_user
 	Field stream:Stream
 	Field stream:Stream
 End
 End