About Monkey 2 › Forums › Monkey 2 Development › How API-stable is Monkey2
This topic contains 2 replies, has 2 voices, and was last updated by
theuserbl 5 months, 2 weeks ago.
-
AuthorPosts
-
November 4, 2018 at 9:40 pm #15559
How API-stable is Monkey2 for the future?
What I mean is:
At first exists BlitzBasic,BlitzPlus,Blitz3D.
Then comes the platformindependent BlitzMax.
Then comes Monkey, which supportes besides the native desktop platforms HTML5, Android, etc.
And now we have Monkey2. Which have what advantages over the first Monkey?
And for every new Programming language / dialect it have to be new written (or ported over ?) the libraries for GUI, 2D, 3D, etc.So, how API stable is Monkey2?
Or will be soon created a Monkey3?At the moment Monkey2 looks a lot of different to the C-like languages and to VisualBasic.
I know ANSI-C, Java, QBasic, VisualBasic and so on. And Monkey 2 looks a lot of different.What is needed for the IDE I have written in the Ted2Go Issue-section:
https://github.com/engor/Ted2Go/issues/158
https://github.com/engor/Ted2Go/issues/159At first I am looking, how a XML to Monkey-converter would be looking like.
XHTML123<Control type="Window" name="myWindow"><Control type="Bytton" name="MyButton" text="My Button" /></Control>would be look like
Monkey1234567891011121314151617181920#Import "<std>"#Import "<mojo>"#Import "<mojox>"Using std..Using mojo..Using mojox..Class MyWindow Extends WindowMethod New()Local MyButton := New PushButton("My Button")ContentView = MyButtonEndEndFunction Main()New AppInstanceNew MyWindowApp.Run()EndInteresting that there don’t exista a
Monkey1Add(MyButton)or
Monkey1this.Add(MyButton)but there exists a
Monkey1AddChildView(MyButton)without effect.
and what is the “this” (in Java) or “Me” (in VisualBasic) in Monkey 2 ?And how can I set the size of the window? And how can I make it resizable?
Greetings
theuserblNovember 5, 2018 at 10:27 am #15560Or will be soon created a Monkey3?
Mark Sibly (the creator) has stated that he will not create a Monkey3 and will stick with Monkey2.
The biggest problem now is Apple deprecating OpenGL. But porting mojo to vulkan is on the todo list so there’s hope!Which have what advantages over the first Monkey?
Mark has moved to monkey2 mainly to avoid the hassle of a multi language transcompiler (Monkey1 was transpiling to javascript,c++ & java). It meant a lot of work for each language change. Monkey2 is only transpiling to c++, using the JNI for Android and emscriptem for javascript. So changes are mostly made once for all.
Monkey2 thus has more advanced programming features available such as firstclass functions, mutlithread, incremental garbage collector, class extensions, lambdas, etc..
It is a bit stricter with types too, which helps seeking compilation errors.
If you want fast html5 developpement you might prefer Monkey1 as it has a very fast javascript transcompiler and outputs very nice html5/javascript code.What is needed for the IDE I have written in the Ted2Go Issue-section:
https://github.com/engor/Ted2Go/issues/158
https://github.com/engor/Ted2Go/issues/159Monkey2 is clearly lacking of a good beginner tutorial. You can find a lot of simple examples on pakz’s examples pack but there is no real tutorial beginning from 0.
A GUI editor would be awesome!
and what is the “this” (in Java) or “Me” (in VisualBasic) in Monkey 2 ?
Self
You can call a field/method inside a class without Self if there is no ambiguity.
And how can I set the size of the window? And how can I make it resizable?
To make it resizable use the WindowFlags.Resizable when calling New. To set the initial size, do it via New too. (as shown in the example below)
Here is a short example taken from modules/mojox/test folder. It’s the folder where you’ll find simple examples for mojox. Slightly modified to show window size when clicking. You might be confused by the Lambda, it’s just like a function, you could declare the action in a function or method.
Note that mojox is not that easy to get compared to mojo. And if you plan to make a game it is not really advised to use mojox, you should prefer a custom GUI system like the one offered in pyro for example. mojox has been created to create Ted2 initially and only a few people really use mojox, to write their own editors.Monkey12345678910111213141516171819202122232425262728293031323334353637383940#import "<std>"#import "<mojo>"#import "<mojox>"Using std..Using mojo..Using mojox..Class MyWindow Extends WindowField n:=0Method New()Super.New( "Button Demo",640,480,WindowFlags.Resizable )Local label:=New Label( "Idle" )Local button:=New Button( "Click ME!" )button.Clicked=Lambda()n+=1label.Text="Clicked #"+n+" window size:"+Width+","+HeightEndLocal dockingView:=New DockingViewdockingView.AddView( label,"top" )dockingView.ContentView=buttonContentView=dockingViewEndEndFunction Main()New AppInstanceNew MyWindowApp.Run()EndNovember 5, 2018 at 12:00 pm #15561Thanks for your help.
I think Monkey2 is for beginners, so it needs an easy start for beginners.
I have in the meantime looked at the calculator example, but your example is a lot easier.
I have a little bit played with it.A xml description file could look like
XHTML1234567<Control type="Window" name="MyWindow" width="640" heigh="480"><Property name="WindowFlags" value="Resizable" /><Control type="DockingView" name="dockingView"><Control type="Label" name="label" text="Idle"/><Control type="Button" name="button" text="Click ME!"/></Control></Control>That could be used as intermediate langaue for an GUI-designer. Or as additional language like Microsoft doing it with XAML for its WindowsPresentationFoundation.
This XML-code is only a how it could look like, but currently ignored the
dockingView=New DockingView
dockingView.AddView( label,”top” )
dockingView.ContentView=buttonThat xml-file should then generate automatically (or compiled to) the file ButtonDemo_ui.monkey2
Monkey123456789101112131415161718192021222324252627282930313233343536#import "<std>"#import "<mojo>"#import "<mojox>"Using std..Using mojo..Using mojox..Class MyWindow_ui Extends WindowField label:LabelField button:ButtonField dockingView:DockingViewMethod New()Super.New( "Button Demo",640,480,WindowFlags.Resizable )label=New Label( "Idle" )button=New Button( "Click ME!" )button.Clicked=Lambda()button_Clicked()EnddockingView=New DockingViewdockingView.AddView( label,"top" )dockingView.ContentView=buttonContentView=dockingViewEndMethod button_Clicked() VirtualEndEndAnd the written code would then be in the file ButtonDemo.monkey2
Monkey123456789101112131415161718#import "ButtonDemo_ui"Class MyWindow Extends MyWindow_uiField n:=0Method button_Clicked() Overriden+=1label.Text="Clicked #"+n+" window size:"+Width+","+HeightEndEndFunction Main()New AppInstanceNew MyWindowApp.Run()EndGreetings
theuserbl -
AuthorPosts
You must be logged in to reply to this topic.