Forum Replies Created
-
AuthorPosts
-
Nice wasm players should emerge at some point, if wasm has some success. All the crossplaform work would be done by the player’s devs at that point. The fact that you have to reload each time is a big problem, but can be avoided.
I’ll probably still go on the native way for some time anyway. I love mx2 because I can use any C libs and almost any C++ libs. And that’s where open source is the most accessible.I can’t tell prizes:
Vulkan (and moltenVK)
Timers over 44100HzYes you are supposed to post issues on github. That’s the way things work nowadays. And ask it gently too. Mark works on M2 during weekends and has already fixed things during his break.
You should have been aware that M2 is still considered WIP, and that it is not a product with instant upgrates to new OSes requirements. You can’t blame Mark on that.
Changing the android API to 28 should be easy by just changing it in M2 setup (I don’t remember the filename)
As for iOS this shouldn’t be too hard either as opengl is still accepted.
As said previously, if you need it and can’t do it, you have to post issue on github. If do it please make a pull request after you made it.I suppose you know that Mark has taken a Monkey2 “Hollyday” as he just began a new full time job.
The July update came with multithreads, that could clearly be why you prefer the June release. Multithread is still “hyper experimental” (Mark’s words) and you can revert to single thread in the env_yourOS.txt File. Have you tried it? Does it help?
Could you give some values with the bunnymark bannana, it would help quantifying the problem. I haven’t moved to mojave as I know it will f*** up half of my apps.
Mark tried something with multithreads to get better timers but aborted it because it was too hard on mac for the moment. Knowing there is the opengl applecalispe and that mojoave is once again doing lot of stuff completely differently, and the fact that Mark is not really working on Monkey2, we’ll probably have to wait some time before having these issues fixed unless we work on mojo ourselves.
Unfortunately on my iphone6s it’s only moving front-back in reverse but no left-right.
On my Acer Jade s56 it’s only moving front-back, no left-right.November 6, 2018 at 8:17 am in reply to: [mojox] How to set the position of the Window and an Dialog? #15563The Window is your app window. It’s coordinates would be how it appear in the OS screen. Is it what you want to define? I dont’t think it is implemented in mojo/mojox. The Windows just center themselves in the OS screen. With mojox you’ll use Views
You can find small examples in modules/mojox/tests
And here is some forum discussions that could help you.
Unfortunately mojox really lacks of documentation. There was a bit more at a time but it disapeared from the docs!
The mojox module.
The mojox module provides a simple but highly customizable gui system, built on top of mojo. Mojox also uses ‘auto-layout’ as much as possible, so you don’t generally have to provide location/size of widgets, and can easily change fonts, skins etc without having to manually ‘re-layout’ your gui.
Much of the core functionality of mojox is actually implemented in the mojo module by the AppInstance and View classes. The View class is the base class of all ‘widgets’ in mojo/mojox (including the mojo Window class), and mojox really just provides a set of useful view subclasses that provide buttons, text views, dialogs etc.
Views are stored in a simple ‘tree’ structure, where each view has an optional parent, and 0 or more children.
View styleEach view also has a ‘style’, which may be shared with other views of a similar type. A view’s style contains information that affects its layout and rendering including:
Padding, Border and Margin rects. These behave much like the identically name ‘css’ styling properties in that they provide a nested set of rects that surrounds the view contents. Note that the ‘min’ and ‘max’ values for these rects should typically be negative, eg: to add a 4 pixel padding border to a view, use something like view.Style.Padding=New Recti( -4,-4,4,4 ).
BackgroundColor and BorderColor. Set alpha to 0 to prevent backgound or border from being rendered.
Skin and SkinColor. A style can have an optional ‘9 patch’ skin that is drawn outside of padding but inside the
border and margin areas. If present, a skin actually provides another rect that goes around the padding rect.
Font and TextColor. These are for any text drawn in the view.
IconColor. This is for an any icons drawn in the view.
When a view is measured (see below), the padding, skin, border and margin rects are ‘added’ to the content rect (as returned by OnMeasure) to produce a final ‘bounding’ rect. This is the rect that is used to actually layout a view within its frame.
Attachments:
Or 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()EndThanks for sharing!
Man, there really is something you don’t get with this community and the development of monkey 2. If you need a large community to feel good I advise you use unity or unreal engine. They have the two widest community arround. Godot has a mid sized one and has much less premade resources. Next version 3.2 should include vulcan which is cool.
I’m not really into 3D but…
You can find samples in the “banana” folder. There you have “toy-plane” sample which is the only 3d banana.
You can also go to Files>Templates>simple mojo3D App to see a simplest 3D App code
The other samples are in the “test” folder of each module. For example in modules/mojo3d/test or module/mojo3d-loader/testThere are also .mojo3d scene files in the root directory but I never tried to open or create one so I can’t really help here.
Someone has made a small game called “BUST” this should be in the projects section of this forum.
Thanks for the info. I should read VERSION!
Having finer grained timers would be awesome, especially for sound treatment as it has a much higher refresh rate than video. Too bad Apple is making things so complex with their constant new system surprises.
Here is a running example with c++ code included. I’m not using any const stuff here, which could bring (a lot of?) trouble.
!!! the C++ code is awful and WILL leak. Do not use it for serious work.
It shows the use of CString thru the C++ constructor and also a direct modification of the char* field
.monkey2
Monkey12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849#Import "<std>"#Import "<libc>"#Import "CStringStruct.h"#Import "CStringStruct.cpp"Using std..Using libc..ExternStruct SomestructField someName:char_t PtrMethod New(name:CString)Method New()Method Destroy() Extension="delete"Method SetName(name:CString)Method GetName:char_t Ptr()EndPublicFunction Main()Print "monkey2 extern test"Print ""Local stru:Somestructstru=New Somestruct ("John")Print String.FromCString(stru.GetName())Print String.FromCString(stru.someName)Local newName:="Chuck"Local mydata:=New DataBuffer( newName.CStringLength+1 )newName.ToCString( mydata.Data,mydata.Length )stru.someName=Cast <char_t Ptr> (mydata.Data) 'leaking memory here tooPrint String.FromCString(stru.GetName())End.h
C++1234567891011121314151617181920212223#ifndef CSTRINGSTRUCT_H#define CSTRINGSTRUCT_Hstruct Somestruct{public:char* someName;Somestruct(char* name);Somestruct();~Somestruct(); // destructorvoid SetName(char* name);char* GetName();};#endif.cpp
C++12345678910111213141516171819202122232425262728293031#include "CStringStruct.h"#include <iostream>// constructorSomestruct::Somestruct(char* name){SetName(name);}Somestruct::Somestruct(){char* name="unnamed";SetName(name);}Somestruct::~Somestruct(){// clean your memory}// member functionvoid Somestruct::SetName(char* name){someName = new char[ sizeof(name) + 1 ] ;strcpy( someName, name ) ;}char* Somestruct::GetName(){return this->someName;}Attachments:
When installing mx2 on linux I chmod the mx2 folder before rebuildall2go.sh to avoid that kind of problem.
CString is a convenience type to be used for external funcs/methods arguments. It will convert your string to a valid external CString automaticaly while passing it!
If you really need to manipulate a CString inside Monkey2, you can do it with libc.char_t Ptr, and String.ToCString or String.FromCString. But you’ll be playing with a pure C style Ptr and can crash your app if you are not managing your memory correctly.
-
AuthorPosts
