Forum Replies Created
-
AuthorPosts
-
I’ve added check for file existing in dev.
So, waiting your game or app.
There are some changes in dev branch:
- ! Added “Generate class” dialog – fast new-file-with-class creation is here!
- you can jump between fields by Tab / Shift+Tab
-
- w/o completion for types yet
- ! Added clickable errors list in build console – you can easily jump to errors now (semi-WIP state).
- New toolbar icons – more consistent, maybe blue color isn’t good, I don’t know.
- Added right-click menu for code editor – there are only cut/copy/paste this time.
- Added word-wrap mode for output console – on/off by toggle button.
- Now closing related docs when close project.
- Fixed “Find text” bug (have no results for non case sensitive mode, wow).
- Fixed restoring of project tree expanding (when create or delete files).
Thumb up!
Are you sure calling remove on the iterator is safe?
I know that other langs deny iterator changes, but I just tried it in monkey-x and it works.
In monkey2 don’t work but we have iterator.Erase() here.
For MonkeyX you can use List<T> container and call its Remove() method like this:
Monkey12345678910111213141516171819202122232425262728293031Import mojoFunction Main()Local list:=New List<GameObject>list.AddLast(New GameObject("one",True))list.AddLast(New GameObject("two"))list.AddLast(New GameObject("three"))list.AddLast(New GameObject("four",True))' filteringFor Local obj:=Eachin listIf obj.dead Then list.Remove(obj)NextFor Local obj:=Eachin listPrint "obj: "+obj.nameNextEndClass GameObjectField dead:BoolField name:StringMethod New(name:String,dead:Bool=False)Self.name=nameSelf.dead=deadEndEndIn Monkey2 we can write more powerfull code – because we can pass functions as parameters of other functions.
And we can write generic function to remove items by filter for any instance type.
Monkey1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556Function RemoveInList<T>:Int( list:List<T>,filteringFunc:Bool(T) )Local count:=0Local it:=list.All()While Not it.AtEndIf filteringFunc( it.Current )it.Erase()count+=1Elseit.Bump()EndifWendReturn countEnd......Local list:=New List<Int>For Local i:=0 Until 20list.Add(i)NextLocal filter1:=Lambda:Bool(val:Int)Return (val Mod 4) = 0EndLocal filter2:=Lambda:Bool(val:Int)Return val>10 And val<14EndRemoveInList( list,filter1 )For Local i:=Eachin listPrint iNextRemoveInList( list,filter2 ) 'just pass other filter funcFor Local i:=Eachin listPrint iNextLocal list2:=New StringList( New String[]("one","two","three") )Local filter3:=Lambda:Bool(val:String)Return val.Length<4End' now use it for stringsRemoveInList( list2,filter3 )For Local i:=Eachin list2Print iNextOne bad thing here – we can’t write the only universal function for all containers (list, stack, map, etc…) because of language limitation:
Finally, IContainer is not a ‘real’ interface because Monkey2 does not yet support generic interface methods. This feature is planned for a future version of monkey2.
There is an article how to build .apk from command line – just setup .bat file and use it in a one click.
https://www.apriorit.com/dev-blog/233-how-to-build-apk-file-from-command-line
Nice!
Looks cool, I’m envious.
If there is finite number of data types to create then you can write data parser w/o reflection.
Your own declarative lang
that will use needed internal functions.
Monkey12345CreatePlayer 10,0,0Loop 10CreateEnemy Rand(20),Rand(20),Rand(20)End...Each string token produce its action – CreatePlayer return instance of Player and set coord for him and so on.
Cool! )
Thanks!
Completion feature is in dev state, undone yet.
You can rotate images by canvas.DrawImage( image:Image,tx:Float,ty:Float,rz:Float ) where rz is rotation angle.
Also you need to use image.Handle property to setup rotation anchor for image.
For detection images by click you can use polygon / rect function like that or even chipmunk physics collider (I want to use it for complex shapes, but didn’t try yet).
I think, you can’t just write new source code and dynamically load it via reflection – recompile code is required.
If your plugins will use standard lang features, then you can (probably) use it like lua-scripts works.
This time reflection doesn’t work with generic types (core vec2/3/4 and rect are generic).
Mark said improving reflection is one of near goal.
- ! Added “Generate class” dialog – fast new-file-with-class creation is here!
-
AuthorPosts


