Forum Replies Created
-
AuthorPosts
-
- Is your Trigger() kind of CanExecute() equivalent?
- Inside of DisableAll / EnableAll you do double work – go through keys and then find by keys. But you can directly Eachin by values
Monkey12345Method DisableAll()For Local control := Eachin Controls.Valuescontrol.Enabled = FalseNextEndLocal Controls:Control[] ‘0 length controls
really! why it’s not a null object?! magic.
I suppose it’s incorrect to set screen mode inside of constuctor.
Better way to do it when window done with layout.
Monkey123456789101112131415161718192021Method New()Super.New( "My Window",1027,768,WindowFlags.Resizable )Layout="letterbox"EndMethod OnRender( canvas:Canvas ) OverrideApp.RequestRender()Global justStarted:=TrueIf justStartedjustStarted=FalseBeginFullscreen()'Return 'maybe better to skip this frame?EndifClearColor = Color.Blackcanvas.DrawText( "Hello World",Width/2,Height/2,.5,.5 )EndExamples?
C# 7.0: http://www.c-sharpcorner.com/article/working-with-value-tuple-in-c-sharp-7-0/
Swift: https://www.weheartswift.com/tuples-enums/
Kotlin (not a tuple, but..): http://kotlinlang.org/docs/reference/multi-declarations.html
(I like Kotlin lang, advice to take a look.)
What about don’t wrap returned type with any chars and use just a commas?
Monkey12345678Function NewGenFunc: Stack<View>,Int( source:Map<String,View> )Local stack:=New Stack<String>' do somethingLocal specialCount:=CalcCount( source )Return (stack,specialCount)EndA few words about my development.
Updated version numeration
Now I name current dev version with ‘a’ postfix (alpha) – like v2.7a.
And will remove postfix when ready to release.
Started to improving parser / completer
Now completion can understand namespaces!
Just type filesystem. (with dot) and see what happen. Namespaces are filtered by ‘using’ directives, to see filesystem you should to ‘using’ it (via Using std.. for example).
Also completion works inside of ‘Using root.sub1.sub2’ section.
In new version I pass into parser new data about document – docLineStr and docPosInLine. They help to understand where we are.
More improvements are coming.
Look at all new stuff in dev-branch.
Seems to be related to the error hilighting since it happens as soon as I hover the error red line in the document.
Fixed now.
No need to respond to this message, do anything you like.
Thanks.
Fix in completion
Current version (on itch.io) have bug – modules don’t parsed and you can see insufficient completion list.Now it fixed in repository.
Tuple types could be declared with brackets, eg: Local result:(Entity,bool), Function Find:(Object,bool)( blah:String ) etc.
It would be super-cool!
Ok, type conflicts with function types (I think) – perhaps <> instead, eg: Local x:<Int,Float>?
But < > are used for templates types, conflictable too.
I prefer ( ) because other langs use them.
I think when user uninstall app he expects data losing.
AFAIK private shared prefs also will be removed on app uninstall.
If you will store data in external storage – user can formatting sd-card and lose your data.
Need to use cloud-based storage like google-drive or play-services.
Similar feature is right inside of Ted2Go IDE – right click on project name and select menu item “Clean (delete .buildv)”.
It works if you have a .buildv right inside project folder. So you can’t clean modules inside of ‘monkey2’ project.
I can add recursive search if needed.
ok. how would this work for desktop?
Topic about mobile.
For desktop there are AppDir () AssetsDir () HomeDir ().
where are you getting InternalDir() from?
std.filesystem namespace.
Monkey12345678910111213141516171819202122232425262728293031#rem monkeydoc Gets the filesystem directory of the app's internal storage directory.Note that only the mobile targets have an internal directory. Other targets will return an empty string.The internal directory is where your app should create and manage app specific files such as game saves, preferences, items purchased and so on.@return The app's internal directory.#endFunction InternalDir:String()#If __TARGET__="android"Local env:=sdl2.Android_JNI_GetEnv()Local cls:=env.FindClass( "com/monkey2/lib/Monkey2FileSystem" )Local mth:=env.GetStaticMethodID( cls,"getInternalDir","()Ljava/lang/String;" )Local dir:=env.CallStaticStringMethod( cls,mth,Null )Return dir#Elseif __TARGET__="ios"local dir:=getInternalDir()Return dir#EndifReturn ""EndCool!
Some time ago I added issue on github about creating tuples with same name (like in c#):
- Tupple<T1,T2>
- Tupple<T1,T2,T3>
- Tupple<T1,T2,T3,T4>
We can’t do it in monkey – it produce duplicate identifier error . I don’t know is it good to be implemented in monkey2 language.
I’d be happy with Tupple2,3,4,… too.
Try to use that:
Monkey123456789101112Local dir:=InternalDir()+"mydata/"CreateDir( dir )Local file:=dir+"values.txt"SaveString( "hp=100~ndmg=13.5",file )Local s:=LoadString( file )If Not s Alert( "Can't read file! ") ; Return' ~n is \nLocal values:=s.Split( "~n" )For Local v:=Eachin valuesAlert( "pair: "+v )Next -
AuthorPosts