Browse Source

Ted2 tweaks.

Mark Sibly 9 years ago
parent
commit
6ee583e5c2

+ 117 - 20
src/ted2/assets/about.html

@@ -1,17 +1,15 @@
 <!doctype html>
-
 <html>
-
 <head>
-
 <style>
 
 body{
 	background: #323232;
 	color: #fff;
-	font-size: 16px;
+	font-size: 18px;
 	margin: 8px;
 	padding: 0px;
+	line-height:20px;
 }
 
 a{
@@ -20,35 +18,138 @@ a{
 }
 
 h1{
-	font-size: 26px;
+	color: #eeee00;
+	font-size: 28px;
+	text-align: center;
+}
+
+h2{
+	color: #eeee00;
+	font-size: 24px;
 	text-align: center;
 }
 
 div.awesome{
-	color: #0f0;
+	color: #ddd;
+	font-size: 14px;
 }
 
-</style>
+a{
+	color: #44eeff;
+	text-decoration: none;
+	cursor: pointer;
+}
 
+a:hover{
+	color: #00ee00;
+}
+
+</style>
 </head>
 
 <body>
 
-<h1>Welcome to Monkey2!</h1>
+<h1>Monkey2 v1.0.5</h1>
+
+<p>Welcome to monkey2, a new, open source, user friendly, multi target programming language by Mark Sibly.
+
+<p>Work on monkey2 is on-going and there is still a lot left to add, but it should be in a mostly usable state.
+
+<p>Please post any bug reports to the monkey2 github repository:
+
+<p><a href="https://github.com/blitz-research/monkey2">https://github.com/blitz-research/monkey2</a>.
+
+<p>For monkey2 discussion and programming help, feel free to drop by the monkey2 forums:
+
+<p><a href="http://monkey2.monkey-x.com/forums">http://monkey2.monkey-x.com/forums</a>.
+
+
+<h2>Building Desktop apps</h2>
+
+<p>If you are reading this in Ted2 on a Windows machine, you should theoretically be able to build desktop apps with no extra hassle.
+
+<p>On Macos, it's a little bit trickier but not much. First, You will need to install xcode from the App Store. Once that's done, go into a shell
+and enter 'xcode-select --install' to install the 'xcode command line tools'. Note that if you are already using Blitzmax or Monkey1 on a Mac, you 
+many not have to do anything.
+
+<p>On Linux, you will need the standard set of development tools and libs such as g++, mesa-gl, a ton of X stuff etc. Sorry I can't be more specific
+here, but past attempts to produce a definitive list of 'what you need to code in linux' have proved fruitless - it changes from distro to distro
+and version to version.
+
+<p>Once you're ready to go, try clicking on the 'hello-world.monkey2' file in the 'Files' browser to the right, and then selecting 'Build and Run'
+from the 'Build' menu.
+
+<p>This will bring up a little 'Build Settings' dialog. Just click OK to use the defaults and build and run the app. If everything is working properly,
+a simple 'Hello World' window should appear.
+
+<p>Note that the build settings dialog will only appear automatically the first time you build an app for each target. After that, you can manually
+activate it by selecting 'Build Settings' from the 'Build' menu - not that it does a lot right now!
 
-<p>Monkey2 is an open-source, user-friendly, cross-platform programming language designed primarily for game programming.
+<p>There are a few more examples in the 'bananas' directory on the right - more coming!
 
-<p>All documentation is currently hosted online at <a href="http://monkey2.monkey-x.com">monkey2.monkey-x.com</a>.
 
-<p>Several sample monkey2 apps can be found in the 'bananas' directory of the monkey2 release.
+<h2>Building Emscripten apps</h2>
 
-<p>The monkey2 release includes a VERY simple IDE coded in pure monkey2 called 'Ted2'. Ted2 is not a fully fledged IDE (yet) but is intended to provide a 'works anywhere' IDE solution for using monkey2 on any platform you can get it building on.
+<p>To build emscripten apps, you will first need to install emscripten: 
 
-<p>Monkey2 is a crowd funded project. If you like what you see, please consider contributing to development either via paypal donation or by becoming a Patreon supporter.
+<p><a href="http://kripken.github.io/emscripten-site">http://kripken.github.io/emscripten-site</a>.
 
-<p>So a HUGE shout out to everyone who has contributed to Monkey2 to date! Monkey2 would not have been possible without your generosity - thank you very much!
+<p>(On MacOS, you may also need to modify your bin/env_macos.txt file to let monkey2 know where emscripten has been installed).
+
+<p>Once emscripten is installed, you will then need to 'rebuild modules' for the emscripten target. This involves selecting 'Rebuild Modules' 
+from the 'Build' menu, and then selecting 'Emscripten'. This will take a while, as monkey2 needs to rebuild ALL source code used behind the scenes.
+
+<p>Once done, you should be able to build emscripten apps. However, to also actually run them you will need to install the 'mserver' package:
+
+<p><a href="http://www.monkey-x.com/mak/devtools/mserver-v86c.zip">http://www.monkey-x.com/mak/devtools/mserver-v86c.zip</a>.
+
+<p>(On Macos and Linux, you may need to change file permissions to 'execute').
+
+<p>This needs to be unzipped into your monkey2 'devtools' directory. MServer is actually a mini 'http' server, and is necessary because emscripten apps 
+can't be run directly from the filesystem - they must always be run from a server.
+
+<p>Now, select the 'Emscripten' target from the 'Build Targets' menu and you should be able to build and run emscripten apps.
+
+
+<h2>Building Android apps</h2>
+
+<p>To build android apps, you will first need to install Android Studio:
+
+<p><a href="https://developer.android.com/studio/index.html">https://developer.android.com/studio/index.html</a>.
+
+<p>Once installed, make sure everything's working properly and that you can build and deploy android apps. The best way to do this is by building and
+deploying one of the simple 'template' apps in android studio.
+
+<p>Next, install the Android NDK (native development kit) via the SDK Manager->SDK Tools section.
+
+<p>Once android studio and the NDK are installed, you will then need to rebuild modules for android. Once this is done, you should (finally)
+be able to build android apps.
+
+<p>Android apps are produced in the form of android studio projects, and can be found in the '.products' directory next to your monkey2 source file.
+
+<p>Note that monkey2 only currently builds for 'armv7' hardware.
+
+
+<h2>Building iOS apps</h2>
+
+<p>Monkey2 iOS apps cannot currently be run on the simulator, so the first thing you will need is a real iOS device plus the necessary
+'code signing skills' to be able to actually deploy to it.
+
+<p>Apart from that, all you need to build for iOS is the latest version of xcode. Once you have xcode installed, you will to 'rebuild modules'
+for iOS after which you should be able to build iOS apps.
+
+<p>iOS apps are produced in the form of xcode projects, and can be found in the '.products' directory next to your monkey2 source file.
+
+<p>Note that monkey2 only currently builds for 'armv7' hardware.
+
+
+<h2>That's all Folks!</h2>
+
+<p>Monkey2 is a crowd funded project. If you like what you see, please consider contributing to development either via paypal donation or by becoming a 
+Patreon supporter.
+
+<p>Finally, a big shout out to everyone who has contributed to Monkey2 to date! Including...
 
-<h2>Current Contributors</h2>
 <div class="awesome">
 Shane Raffa,
 Danilo,
@@ -122,10 +223,6 @@ Graham,
 Hubert BAYRE,
 Jochen Heizmann,
 Boz	
-</div>
-
-<h3>All Contributors to date</h3>
-<div>
 Aroldo Carvalho,
 Mattias Hansson,
 Catalin Lucaciu,
@@ -231,7 +328,7 @@ abakobo,
 Kirsty,
 Benjamin Aregger,
 James Boyd,
-Simon Armstrong
+Simon Armstrong.
 </div>
 
 </body>

+ 94 - 57
src/ted2/buildactions.monkey2

@@ -104,29 +104,20 @@ Class BuildActions
 			_buildConfig="release"
 		End
 		_buildConfig="debug"
-		
+
 		group=New CheckGroup
+
 		_desktopTarget=New CheckButton( "Desktop",,group )
 		_desktopTarget.Layout="fill-x"
+		
 		_emscriptenTarget=New CheckButton( "Emscripten",,group )
 		_emscriptenTarget.Layout="fill-x"
+		
 		_androidTarget=New CheckButton( "Android",,group )
 		_androidTarget.Layout="fill-x"
+		
 		_iosTarget=New CheckButton( "iOS",,group )
 		_iosTarget.Layout="fill-x"
-		_desktopTarget.Clicked+=Lambda()
-			_buildTarget="desktop"
-		End
-		_emscriptenTarget.Clicked+=Lambda()
-			_buildTarget="emscripten"
-		End
-		_androidTarget.Clicked+=Lambda()
-			_buildTarget="android"
-		End
-		_iosTarget.Clicked+=Lambda()
-			_buildTarget="ios"
-		End
-		_buildTarget="desktop"
 		
 		targetMenu=New Menu( "Build Target..." )
 		targetMenu.AddView( _debugConfig )
@@ -136,7 +127,44 @@ Class BuildActions
 		targetMenu.AddView( _emscriptenTarget )
 		targetMenu.AddView( _androidTarget )
 		targetMenu.AddView( _iosTarget )
+		
+		'check valid targets...WIP...
+		
+		_validTargets=EnumValidTargets( _console )
+		
+		If _validTargets _buildTarget=_validTargets[0].ToLower()
+		
+		If _validTargets.Contains( "desktop" )
+			_desktopTarget.Clicked+=Lambda()
+				_buildTarget="desktop"
+			End
+		Else
+			_desktopTarget.Enabled=False
+		Endif
+		
+		If _validTargets.Contains( "emscripten" )
+			_emscriptenTarget.Clicked+=Lambda()
+				_buildTarget="emscripten"
+			End
+		Else
+			_emscriptenTarget.Enabled=False
+		Endif
+
+		If _validTargets.Contains( "android" )
+			_androidTarget.Clicked+=Lambda()
+				_buildTarget="android"
+			End
+		Else
+			_androidTarget.Enabled=False
+		Endif
 
+		If _validTargets.Contains( "ios" )
+			_iosTarget.Clicked+=Lambda()
+				_buildTarget="ios"
+			End
+		Else
+			_iosTarget.Enabled=False
+		Endif
 	End
 	
 	Method SaveState( jobj:JsonObject )
@@ -168,20 +196,27 @@ Class BuildActions
 		Endif
 		
 		If jobj.Contains( "buildTarget" )
-			_buildTarget=jobj["buildTarget"].ToString()
-			Select _buildTarget
-			Case "emscripten"
-				_emscriptenTarget.Checked=True
-			Case "android"
-				_androidTarget.Checked=True
-			Case "ios"
-				_iosTarget.Checked=True
-			Default
-				_desktopTarget.Checked=True
-				_buildTarget="desktop"
-			End
-		Endif
+					
+			local target:=jobj["buildTarget"].ToString()
+
+			If _validTargets.Contains( target )
+			
+				 _buildTarget=target
+				
+				Select _buildTarget
+				Case "desktop"
+					_desktopTarget.Checked=True
+				Case "emscripten"
+					_emscriptenTarget.Checked=True
+				Case "android"
+					_androidTarget.Checked=True
+				Case "ios"
+					_iosTarget.Checked=True
+				End
+			
+			Endif
 			
+		Endif
 	End
 	
 	Method Update()
@@ -191,7 +226,7 @@ Class BuildActions
 		Wend
 	
 		Local idle:=Not _console.Running
-		Local canbuild:=idle And BuildDoc()<>Null
+		Local canbuild:=idle And BuildDoc()<>Null And _buildTarget
 		
 		build.Enabled=canbuild
 		buildAndRun.Enabled=canbuild
@@ -215,7 +250,7 @@ Class BuildActions
 	
 	Field _buildConfig:String
 	Field _buildTarget:String
-
+	
 	Field _debugConfig:CheckButton
 	Field _releaseConfig:CheckButton
 	Field _desktopTarget:CheckButton
@@ -223,6 +258,7 @@ Class BuildActions
 	Field _androidTarget:CheckButton
 	Field _iosTarget:CheckButton
 	
+	Field _validTargets:StringStack
 	
 	Method BuildDoc:Monkey2Document()
 		
@@ -354,23 +390,30 @@ Class BuildActions
 	
 	Method BuildModules:Bool( clean:Bool )
 	
-		Local target:=""
-		
-		Local result:=False
-		
-'		Select TextDialog.Run( "Build Modules","Select target...",New String[]( "Desktop","Emscripten","Android","iOS","All!","Cancel" ),0,5 )
-		Select TextDialog.Run( "Build Modules","Select target...",New String[]( "Desktop","Emscripten","Android","iOS","Cancel" ),0,4 )
-		Case 0 target="desktop"
-			result=BuildModules( clean,"desktop" )
-		Case 1 target="emscripten"
-			result=BuildModules( clean,"emscripten" )
-		Case 2 target="android"
-			result=BuildModules( clean,"android" )
-		Case 3 target="ios"
-			result=BuildModules( clean,"ios" )
-		Case 4
+		Local targets:=New StringStack
+		
+		For Local target:=Eachin _validTargets
+			targets.Push( target="ios" ? "iOS" Else target.Capitalize() )
+		Next
+
+		targets.Push( "All!" )
+		targets.Push( "Cancel" )
+		
+		Local i:=TextDialog.Run( "Build Modules","Select target..",targets.ToArray(),0,targets.Length-1 )
+		
+		Local result:=True
+		
+		Select i
+		Case targets.Length-1	'Cancel
 			Return False
-'			result=BuildModules( clean,"desktop" ) And BuildModules( clean,"emscripten" ) And BuildModules( clean,"android" ) And BuildModules( clean,"ios" )
+		Case targets.Length-2	'All!
+			For Local i:=0 Until targets.Length-2
+				If BuildModules( clean,targets[i] ) Continue
+				result=False
+				Exit
+			Next
+		Default
+			result=BuildModules( clean,targets[i] )
 		End
 		
 		If result
@@ -420,20 +463,14 @@ Class BuildActions
 		
 		Select target
 		Case "desktop"
-			_debugView.DebugApp( exeFile,config )
-
-		Case "emscripten"	'cheese it for now...
 
-			Local mserver:=""
+			_debugView.DebugApp( exeFile,config )
 
-#if __HOSTOS__="windows"
-			mserver="~q"+RealPath( "devtools/MonkeyXFree86c/bin/mserver_winnt.exe" )+"~q"
-#else if __HOSTOS__="linux"
-			mserver="~q"+RealPath( "devtools/MonkeyXFree86c/bin/mserver_linux" )+"~q"
-#else if __HOSTOS__="macos"
-			mserver="open ~q"+RealPath( "devtools/MonkeyXFree86c/bin/mserver_macos.app" )+"~q --args"
-#endif
-			_console.Run( mserver+" ~q"+exeFile+"~q" )
+		Case "emscripten"
+		
+			Local mserver:=GetEnv( "MX2_MSERVER" )
+			If mserver _console.Run( mserver+" ~q"+exeFile+"~q" )
+		
 		End
 		
 		Return True

+ 9 - 1
src/ted2/editproductdialog.monkey2

@@ -176,10 +176,18 @@ Class ProductVar
 			If type.StartsWith( "options:" )
 
 				Local opts:=type.Slice( 8 ).Split( "|" )
+				
+				Local current:=0
+				For Local i:=0 Until opts.Length
+					If value<>opts[i] Continue
+					current=i
+					Exit
+				Next
 
-				Local view:=New OptionsField( opts )
+				Local view:=New OptionsField( opts,current )
 
 				view.CurrentChanged+=Lambda()
+
 					value=opts[view.Current]
 				End
 			

+ 4 - 0
src/ted2/fileactions.monkey2

@@ -58,6 +58,10 @@ Class FileActions
 		
 		quit=New Action( "Quit" )
 		quit.Triggered=OnQuit
+#if __HOSTOS__="macos"
+		quit.HotKey=Key.Q
+		quit.HotKeyModifiers=Modifier.Menu
+#endif		
 	End
 	
 	Method Update()

+ 3 - 0
src/ted2/mainwindow.monkey2

@@ -203,6 +203,9 @@ Class MainWindowInstance Extends Window
 		Plugin.CreatePlugins()
 
 		App.Idle+=OnAppIdle
+		
+		If GetFileType( "bin/ted2.state.json" )=FileType.None _helpActions.about.Trigger()
+		
 	End
 	
 	Method Terminate()

+ 13 - 3
src/ted2/ted2.monkey2

@@ -35,6 +35,8 @@
 #Import "buildproduct"
 #Import "editproductdialog"
 
+#Import "mx2ccenv"
+
 Namespace ted2
 
 Using std..
@@ -62,12 +64,20 @@ Function Main()
 	Local jobj:=JsonObject.Load( "bin/ted2.state.json" )
 	If Not jobj jobj=New JsonObject
 	
-	Local rect:=New Recti( 64,64,64+960,64+800 )
-	If jobj.Contains( "windowRect" ) rect=ToRecti( jobj["windowRect"] )
+	Local flags:=WindowFlags.Resizable
+	
+	Local rect:Recti
+	
+	If jobj.Contains( "windowRect" ) 
+		rect=ToRecti( jobj["windowRect"] )
+	Else
+		rect=New Recti( 0,0,1024,768 )
+		flags|=WindowFlags.Center
+	Endif
 	
 	New AppInstance
 	
-	New MainWindowInstance( "Ted2",rect,WindowFlags.Resizable,jobj )
+	New MainWindowInstance( "Ted2",rect,flags,jobj )
 	
 	App.Run()
 End