浏览代码

Some docs.

Mark Sibly 7 年之前
父节点
当前提交
4def71f45c
共有 2 个文件被更改,包括 53 次插入2 次删除
  1. 52 1
      modules/mojo/newdocs/graphics.md
  2. 1 1
      modules/monkey/newdocs/language/arrays.md

+ 52 - 1
modules/mojo/newdocs/graphics.md

@@ -45,7 +45,58 @@ An image can be loaded from a file using the [[Image.Load]] function or construc
 You can also render to an image using a canvas object.
 
 
-@#### Lighting
+@#### Fullscreen mode
+
+To render fullscreen, you must place your apps main window into fullscreen mode. Use [[Window.BeginFullscreen]] to enter fullscreen mode and [[Window.EndFullscreen]] to leave fullscreen mode.
+
+
+@#### Virtual resolution
+
+You can also render at a fixed virtual (or 'logical') resolution, and allow mojo to scale up rendering operations to the actual resolution.
+
+To do this, you need to change the window's [[View.Layout|layout mode]] to 'letterbox' and override the window's [[View.OnMeasure|OnMeasure]] method. For example:
+
+```
+#Import "<mojo>"
+
+Using std..
+Using mojo..
+
+Class MyWindow Extends Window
+
+	'The resolution we want to use
+	Const VirtualResolution:=New Vec2i( 256,128 )
+
+	Method New( title:String="Simple mojo app",width:Int=640,height:Int=480,flags:WindowFlags=Null )
+
+		Super.New( title,width,height,flags )
+		
+		Layout="letterbox"
+	End
+
+	Method OnRender( canvas:Canvas ) Override
+	
+		App.RequestRender()
+	
+		canvas.DrawText( "Chunky graphics!",Width/2,Height/2,.5,.5 )
+	End
+	
+	Method OnMeasure:Vec2i() Override
+		
+		Return VirtualResolution
+	End
+	
+End
+
+Function Main()
+	New AppInstance
+	New MyWindow
+	App.Run()
+End
+```
+
+
+@#### 2D Lighting
 
 A canvas also supports 2d lighting with bumpmapping and specular effects.
 

+ 1 - 1
modules/monkey/newdocs/language/arrays.md

@@ -3,7 +3,7 @@
 
 ### Arrays
 
-An array is a linear sequence of values that can be addressed using one or more integer indices.
+An array is a linear sequence of values that can be addressed using one or more integer indices. Arrays are '0 based' in monkey2, meaning the first element in an array is at index 0, the second is at index 1, the third is at index 2 and so on.
 
 Each array has an associated element type. That is, the type of the values actually stored in the array. An array's element type is a purely static property. It is only known at compile time so arrays cannot be 'cast' to different array types at runtime.