Mark Sibly 7 éve
szülő
commit
4431f5b35c

+ 18 - 20
modules/mojo/app/app.monkey2

@@ -18,7 +18,7 @@ Global App:AppInstance
 
 Contains information describing a display mode.
 
-See [[AppInstance.DisplayMode]] for more information.
+See [[AppInstance.DesktopMode]] for more information.
 
 #end
 Struct DisplayMode
@@ -29,6 +29,7 @@ Struct DisplayMode
 	Field hertz:Int
 	
 	Operator To:String()
+	
 		Return "DisplayMode("+width+","+height+","+depth+","+hertz+")"
 	End
 	
@@ -40,6 +41,17 @@ The AppInstance class is mainly reponsible for running the app 'event loop', but
 
 A global instance of the AppInstance class is stored in the [[App]] global variable, so you can use any member of the AppInstance simply by prefixing it with 'App.', eg: App.MilliSecs
 
+There are a number of config settings that can be used to control app behaviour. See [[std:std.filesystem.SetConfig|SetConfig]] for more information about config settings.
+
+| Config setting		  			| Possible values					| Default value
+|:----------------------------------|:----------------------------------|:-------------
+| "MOJO\_OPENGL\_PROFILE"			| "es", "compatibility" or "core" 	| "compatibility" on macos and linux, "es" on all other targets. Uses 'Angle' for es support on windows.
+| "MOJO\_OPENGL\_VERSION\_MAJOR"	| Open gl major version				| 2
+| "MOJO\_OPENGL\_VERSION\_MINOR"	| Open gl minor version				| 0
+| "MOJO\_COLOR\_BUFFER\_BITS"		| Minimum color bit depth			| 8
+| "MOJO\_DEPTH\_BUFFER\_BITS"		| Minimum depth buffer bit depth	| 0
+| "MOJO\_STENCIL\_BUFFER\_BITS"		| Minimum stencil buffer bit depth	| 0
+
 #end
 Class AppInstance
 	
@@ -88,23 +100,11 @@ Class AppInstance
 	#end
 	Field SdlEventFilter:Void( event:SDL_Event Ptr )
 
-	#rem monkeydoc Create a new app instance.
+	#rem monkeydoc Creates a new app instance.
 	
-	The following environment variables can be set prior to constructing a new AppInstance:
+	Creates a new AppInstance objects and initializes the global [[App]] variable with it.
 	
-	MOJO\_OPENGL\_PROFILE : Should be set to one of "es", "compatibility" or "core". Defaults to "compatibility" on macos and linux, "es" on all other targets. Uses 'Angle' for es support on windows.
-
-	MOJO\_OPENGL\_VERSION\_MAJOR : defaults to "2".
-
-	MOJO\_OPENGL\_VERSION\_MINOR : defaults to "1".
-
-	MOJO\_COLOR\_BUFFER\_BITS : Minimum depth buffer bit depth. defaults to "8".
-	
-	MOJO\_DEPTH\_BUFFER\_BITS : Minimum depth buffer bit depth. defaults to "0".
-
-	MOJO\_STENCIL\_BUFFER\_BITS : Minimum stencil buffer bit depth. defaults to "0".
-	
-	Environment variables may be set using the [[std::std.filesystem.SetEnv|SetEnv]] function.
+	A runtime error will occur if more than 1 AppInstance is created.
 	
 	#end
 	Method New()
@@ -112,16 +112,14 @@ Class AppInstance
 		App=Self
 		
 		SDL_Init( SDL_INIT_VIDEO|SDL_INIT_JOYSTICK|SDL_INIT_GAMECONTROLLER )
+
+		libc.atexit( SDL_Quit )
 		
 		SDL_SetHint( "SDL_MOUSE_FOCUS_CLICKTHROUGH","1" )
 
 		SDL_FlushEvents( SDL_JOYDEVICEADDED,SDL_JOYDEVICEADDED )
 		SDL_FlushEvents( SDL_CONTROLLERDEVICEADDED,SDL_CONTROLLERDEVICEADDED )
 		
-		'possible fix for linux crashing at exit (can't reproduce myself).
-		'		
-		libc.atexit( SDL_Quit )
-		
 		AppInit()
 		
 		Keyboard.Init()

+ 12 - 3
modules/mojo/graphics/texture.monkey2

@@ -153,11 +153,12 @@ Public
 |:--------------|:-----------
 | WrapS			| Wrap S texture coordinates
 | WrapT			| Wrap T texture coordinates
-| WrapST		| Enable WrapS and WrapT.
+| WrapST		| Wrap bot S and T coordinates
 | Filter		| Enable magnification filtering
 | Mipmap		| Enable minification mipmapping, and minification filtering if Filter enabled.
-| FilterMipmap	| Enable Filter and Mipmap.
-| Dynamic		| Texture is frequently updated. This flag should be set if the texture contents are regularly updated and don't need to be preserved.
+| FilterMipmap	| Enable both filterin and mipmapping.
+| Dynamic		| The texture contents are regularly updated and don't need to be preserved.
+| Cubemap		| The texture is a cubmap.
 #end
 Enum TextureFlags
 	None=			$0000
@@ -185,9 +186,17 @@ Enum CubeFace
 End
 
 #rem monkeydoc The Texture class.
+
+The "MOJO_TEXTURE_MAX_ANISOTROPY" config setting control the max anisotropy of mipmapped textures.
+
 #end
 Class Texture Extends Resource
 	
+	#rem monkeydoc Creates a new texture.
+	
+	The "MOJO_TEXTURE_MAX_ANISOTROPY" config setting control the max anisotropy of mipmapped textures.
+
+	#end
 	Method New( width:Int,height:Int,format:PixelFormat,flags:TextureFlags )
 		
 		Init( width,height,format,flags,Null )

+ 18 - 4
modules/mojo3d/render/renderer.monkey2

@@ -1,9 +1,19 @@
 
 Namespace mojo3d
 
+#rem monkeydoc The mojo3d Renderer class.
+
+A renderer is an object that renders scenes. There is normally only ever one renderer created and it is created for you automatically when required so you don't normally need to worry about renderers at all.
+
+When a new renderer is created, the config setting `MOJO3D\_RENDERER` can be used to control the type of renderer created. Use "deferred" to create a deferred renderer and "foward" to create a forward renderer. See [[std:std.filesystem.SetConfig|SetConfig]] for more information about config settings. By default, a deferred renderer is created for desktop and web targets and a forward renderer for mobile targets.
+
+#end
 Class Renderer
 
-	#rem monkeydoc Creates a new renderer
+	#rem monkeydoc Creates a new renderer.
+
+When a new renderer is created, the config setting `MOJO3D\_RENDERER` can be used to control the type of renderer created. Use "deferred" to create a deferred renderer and "foward" to create a forward renderer. See [[std:std.filesystem.SetConfig|SetConfig]] for more information about config settings. By default, a deferred renderer is created for desktop and web targets and a forward renderer for mobile targets.
+	
 	#end
 	Method New()
 		
@@ -12,18 +22,22 @@ Class Renderer
 		_direct=False
 		_deferred=False
 		
-		Select GetConfig( "MOJO3D_RENDERER" )
+		Local cfg:=GetConfig( "MOJO3D_RENDERER" )
+		
+		Select cfg
 		Case "deferred"
 			_deferred=True
 		Case "forward"
 			_deferred=False
-		Default
-			
+		Case ""
 #If __DESKTOP_TARGET__ Or __WEB_TARGET__
 			_deferred=True
 #else
 			_deferred=False
 #endif
+		Default
+			RuntimeError( "Unrecognized MOJO3D_RENDERER config setting value '"+cfg+"'" )
+		
 		End
 		
 		Print "GL_VERSION="+opengl.glGetString( opengl.GL_VERSION )

+ 1 - 0
modules/monkey/newdocs/articles/articles.md

@@ -9,3 +9,4 @@ This section contains a number of articles and tutorials.
 @import lambda-functions.md
 @import namespaces-and-using.md
 @import multifile-projects.md
+

+ 1 - 0
modules/monkey/newdocs/mx2cc.md

@@ -28,3 +28,4 @@ Valid options are:
 * `target=`_target_ - set target to `desktop` (the default) or `windows`, `macos`, `linux`, `emscripten`, `wasm`, `android`, `ios`. `desktop` is an alias for current host.
 * `config=`_config_ - set config to `debug` (the default) or `release`.
 * `apptype=`_apptype_ set apptype to `gui` (the default) or `console`.
+

+ 1 - 1
modules/std/collections/container.monkey2

@@ -1,7 +1,7 @@
 
 Namespace std.collections
 
-#rem monkeydoc The IContainer interface is a 'dummy' interface that container classes should implement for compatibility with [[Eachin]] loops.
+#rem monkeydoc The IContainer interface is a 'dummy' interface that container classes should implement for compatibility with Eachin loops.
 
 IContainer does not actually declare any members, but a class that implements IContainer should implement the follow methods:
 

+ 3 - 3
modules/std/collections/deque.monkey2

@@ -17,9 +17,9 @@ Alias StringDeque:Deque<String>
 
 A deque is a 'double ended queue' (usually pronounced 'deck').
 
-You can efficiently add items to either end of a deque using [[Deque.AddFirst]] and [[Deque.AddLast]], and remove items using [[RemoveFirst]] and [[RemoveLast]].
+You can efficiently add items to either end of a deque using [[AddFirst]] and [[AddLast]], and remove items using [[RemoveFirst]] and [[RemoveLast]].
 
-Deques implement the [[IContainer]] interface so can be used with [[Eachin]] loops.
+Deques implement the [[IContainer]] interface so can be used with Eachin loops.
 
 Note that you should NOT modify a deque while iterating through it with an eachin loop. Doing so while cause a 'concurrent deque modification' runtime error in debug mode. Please see [[IContainer]] for more information.
 
@@ -175,7 +175,7 @@ Class Deque<T> Implements IContainer<T>
 	
 	#rem monkeydoc Gets an iterator for visiting deque values.
 	
-	Returns an iterator suitable for use with [[Eachin]], or for manual iteration.
+	Returns an iterator suitable for use with Eachin, or for manual iteration.
 	
 	@return A deque iterator.
 	

+ 3 - 3
modules/std/collections/list.monkey2

@@ -21,7 +21,7 @@ A linked list works by connecting elements together with 'next' and 'previous' r
 
 This connection between elements is achieved using separate Node objects (there is one per element) which contain references to the next and previous nodes in the list, as well as the actual object managed by the node.
 
-Lists implements the [[IContainer]] interface so can be used with [[Eachin]] loops.
+Lists implements the [[IContainer]] interface so can be used with Eachin loops.
 
 #end
 Class List<T> Implements IContainer<T>
@@ -308,7 +308,7 @@ Class List<T> Implements IContainer<T>
 	
 	#rem monkeydoc Gets an iterator for visiting list values.
 	
-	Returns an iterator suitable for use with [[Eachin]], or for manual iteration.
+	Returns an iterator suitable for use with Eachin, or for manual iteration.
 	
 	@return A list iterator.
 	
@@ -319,7 +319,7 @@ Class List<T> Implements IContainer<T>
 
 	#rem monkeydoc Gets an iterator for visiting list values in reverse order.
 	
-	Returns an iterator suitable for use with [[Eachin]], or for manual iteration.
+	Returns an iterator suitable for use with Eachin, or for manual iteration.
 	
 	@return A backwards list iterator.
 	

+ 3 - 3
modules/std/collections/stack.monkey2

@@ -19,7 +19,7 @@ A stack is an 'array like' container that grows dynamically as necessary.
 
 It is very cheap to add values to the end of a stack, but insertion or removal of values requires higher indexed values to be 'shifted' up or down so is slower.
 
-Stacks implement the [[IContainer]] interface so can be used with [[Eachin]] loops.
+Stacks implement the [[IContainer]] interface so can be used with Eachin loops.
 
 #end
 Class Stack<T> Implements IContainer<T>
@@ -225,7 +225,7 @@ Class Stack<T> Implements IContainer<T>
 
 	#rem monkeydoc Gets an iterator for visiting stack values.
 	
-	Returns an iterator suitable for use with [[Eachin]], or for manual iteration.
+	Returns an iterator suitable for use with Eachin, or for manual iteration.
 	
 	@return A stack iterator.
 	
@@ -236,7 +236,7 @@ Class Stack<T> Implements IContainer<T>
 	
 	#rem monkeydoc Gets an iterator for visiting stack values in reverse order.
 	
-	Returns an iterator suitable for use with [[Eachin]], or for manual iteration.
+	Returns an iterator suitable for use with Eachin, or for manual iteration.
 
 	@return A backwards stack iterator.
 		

+ 12 - 13
modules/std/filesystem/filesystem.monkey2

@@ -191,19 +191,18 @@ End
 
 #rem monkeydoc Sets a global config setting.
 
-Currently known built-in config settings:
-
-| Name									| More information
-|:--------------------------------------|:----------------
-| "MOJO\_OPENGL\_PROFILE"				| [[mojo:mojo.app.AppInstance.New|AppInstance.New]]
-| "MOJO\_OPENGL\_VERSION\_MAJOR"		| [[mojo:mojo.app.AppInstance.New|AppInstance.New]]
-| "MOJO\_OPENGL\_VERSION\_MINOR"		| [[mojo:mojo.app.AppInstance.New|AppInstance.New]]
-| "MOJO\_COLOR\_BUFFER\_BITS"			| [[mojo:mojo.app.AppInstance.New|AppInstance.New]]
-| "MOJO\_DEPTH\_BUFFER\_BITS"			| [[mojo:mojo.app.AppInstance.New|AppInstance.New]]
-| "MOJO\_STENCIL\_BUFFER\_BITS"			| [[mojo:mojo.app.AppInstance.New|AppInstance.New]]
-| "MOJO\_TEXTURE\_MAX\_ANISOTROPY"		| [[mojo:mojo.graphics.Texture.New|Texture.New]]
-| "MOJO3D\_DEFAULT\_RENDERER"			| [[mojo3d:mojo3d.Renderer.GetCurrent|Renderer.GetCurrent]]
-| "MOJO3D\_FORWARD\_RENDERER\_DIRECT"	| [[mojo3d:mojo3d.ForwardRenderer.New|ForwardRenderer.New]]
+Currently recognized built-in config settings:
+
+| Name								| More information
+|:----------------------------------|:----------------
+| "MOJO\_OPENGL\_PROFILE"			| [[mojo:mojo.app.AppInstance|mojo.AppInstance]]
+| "MOJO\_OPENGL\_VERSION\_MAJOR"	| [[mojo:mojo.app.AppInstance|mojo.AppInstance]]
+| "MOJO\_OPENGL\_VERSION\_MINOR"	| [[mojo:mojo.app.AppInstance|mojo.AppInstance]]
+| "MOJO\_COLOR\_BUFFER\_BITS"		| [[mojo:mojo.app.AppInstance|mojo.AppInstance]]
+| "MOJO\_DEPTH\_BUFFER\_BITS"		| [[mojo:mojo.app.AppInstance|mojo.AppInstance]]
+| "MOJO\_STENCIL\_BUFFER\_BITS"		| [[mojo:mojo.app.AppInstance|mojo.AppInstance]]
+| "MOJO\_TEXTURE\_MAX\_ANISOTROPY"	| [[mojo:mojo.graphics.Texture|mojo.Texture]]
+| "MOJO3D\_RENDERER"				| [[mojo3d:mojo3d.Renderer|mojo3d.Renderer]]
 
 See also: [[GetConfig]].
 

+ 1 - 1
scripts/makedocs.bat

@@ -1,5 +1,5 @@
 
 echo off
 
-..\bin\mx2cc_windows makedocs
+..\bin\mx2cc_windows makedocs %*
 if %errorlevel% neq 0 exit /b %errorlevel%