Monkey
Store
Community
Apps
Contact
Login or Signup

iMonk Release 1

Monkey Programming Forums/iOS/iMonk Release 1

xzess(Posted 1+ years ago) 
Hello,

Some update of the native iMonk App which supports the imonk Module


iMonk is a module which adds some iOS features to Monkey.

you can grab it here (latest version 1.5, sorry description in this thread is outdated.. added native cocoa UI stuff, mapAPI, corelocation):
Http://www.tim-koepsel.info/imonk.zip

You'll need to use a custom target, so download
http://www.tim-koepsel.info/target_ios.zip

and extract it to the /monkeyhome/targets/ directory (please backup before!)




View current example how to combine xUI with imonk

imonk Wiki : http://www.tim-koepsel.info/imonk/
xui Wiki : http://www.tim-koepsel.info/xui/

**** iMONK Functions ****
Function UICreateMap(x1#,y1#,x2#,y2#,userlocation:Bool)
Function UICreateTextView(Text$,x1#,y1#, x2#, y2#)
Function UICreateNavigationBar(title$, x1#, y1#, x2#, y2#)
Function UICreateProgressBar(progress#,x1#,y1#,x2#,y2#)
Function UICreateWebView(Url$,x1#, y1#, x2#, y2#)
Function UICreateSwitch(checked:Bool, x1#, y1#, x2#, y2#)
Function UICreateLabel(text$,x1#, y1#, x2#, y2#)
Function UICreateActionSheet( Title$,CancelButtonText$, DestructiveButtonText$)
Function UICreateAlert( title$,message$,caption$ )
Function UICreateButton(text$,x1#,y1#,x2#,y2#)
Function UICreateTextField(placeholder$, x1#, y1#, x2#,y2#)
Function UICreateScrollView(ScrollViewWidth#,ScrollViewHeight#,ContentWidth#, ContentHeight#)
Function UIOpenEMail( address$,subject$,body$ )
Function UIOpenBrowser( URL$ )
Function Vibrate()
Function HTMLQuery( URL$ )
Function DebugLog( message$ )
Function SaveAppPreferences( key$,value$ )
Function LoadAppPreferences$( key$ )
Function GetBatteryStatus$()
Function GetITunesName$()
Function GetDate$()
Function GetDeviceType$()
Function GetSDKVersion$()
Function GetLocalisation$()
Function GetUID$()
********


Query a Website and receive as String:
- HTMLQuery( URL$ )

Add Message to Debug Log
- DebugLog( message$ )

Save your Data in App Registry:
- SaveAppPreferences( key$,value$ )

Load your Data from App Registry:
- LoadAppPreferences$( key$ )

Get Battery Status as String
- GetBatteryStatus$()

Get the ITunes Username of Device User:
- GetITunesName$()

Get the current System Device Date as String:
- GetDate$()

Get Device Type (IPod, IPhone, IPad) as String
- GetDeviceType$()

Get current SDK Version of Device
- GetSDKVersion$()

Get the Localisation (Country/Language) of the Device
- GetLocalisation$()

Add Message to default E-Mail Client
- UIEMail( address$,subject$,body$ )

Open default Browser and navigate to URL
- UIBrowser( URL$ )

Alert Messagebox:
- UIAlert( title$,message$,caption$ )

Vibrate Device (SDK 4 only):
- Vibrate()

Get unique Identity (Very useful if you don't want to get into a mess with different devices!)
- GetUID$()

Here is a screenshot of a example build which is included in iMonk.


Here is a quick example of iMonk which compiles fine with the latest monkey version:
Import imonk
Import mojo


Class imonkTest Extends App
	Field ITunesName:String
	Field BatterieStatus:String	
	Field GoogleQuery:String
	Field SystemDate:String
	Field DeviceType:String
	Field SDKVersion:String
	Field Localisation:String
	Field SaveDataTest:String
	
	Method OnCreate()
		SetUpdateRate(30)
		
		SaveAppPreferences("test","successful")

	End
	Method OnUpdate()
		VibrateTest()
		GetInfo()
	End
	Method OnRender()
		Cls
		DrawText("ITunes Name: " + ITunesName,0,0)
		DrawText("Battery: " + BatterieStatus,0,30)
		DrawText("System Date: " + SystemDate,0,60)
		DrawText("Saved Data: " + SaveDataTest,0,90)
		DrawText("Device Type: " + DeviceType,0,120)
		DrawText("SDK Version: " + SDKVersion,0,150)
		DrawText("Localisation: " + Localisation,0,180)
		DrawText("Google Query: " + GoogleQuery,0,230)
	End
	
	Method GetInfo()
		ITunesName = GetITunesName()
		BatterieStatus = GetBatteryStatus()
		GoogleQuery = HTMLQuery("http://www.google.com")
		SystemDate = GetDate()
		DeviceType = GetDeviceType()
		SDKVersion = GetSDKVersion()
		Localisation = GetLocalisation()
		SaveDataTest = LoadAppPreferences("test")
	End
	
	Method VibrateTest()
		If(TouchDown(0)=True)
			Vibrate()
			DebugLog("It shakes...")
		End
	End
	
End

Function Main()
	New imonkTest
End


Much more will follow soon!
If you want to help, just drop me a mail

Maybe Mark can add it to the module registry or include it in V42

If there are any problems/bugs etc please share here