Forum Replies Created
-
AuthorPosts
-
There’s no file filter yet, but you can import directories ‘to’ directories, eg:
#Import “assets/images/@/images”
The trailing ‘/’ after ‘assets/images’ means ‘import all assets in assets/images dir’.
The ‘@/images’ specifies a dest dir in output assets storage, so you can access files here with “asset::images/blah”
Windows XP is not ‘officially’ supported sorry.
It may or may not be theoretically possible to get monkey2 going on Windows XP (and if you or someone else can get it going, I’m happy to add the fixes to the repos) but I wont be attempting this myself.
Have a look in the modules/mojox/tests directory for some fairly useful how-to mojox examples.
… if only there was a wiki for all this stuff…
This is fundamental stuff that *should* be in the language reference, not a wiki.
It’s my fault it isn’t of course, and I’ll be spending some time soon updating the docs.
Working fine here – output file are in blah.products/Emscripten. Are you using the latest version of mx2?
Not sure what’s up because emscripten shouldn’t be generating an html page at all – that needs to be copied in by mx2.
I’ve added a ‘repeating:bool=False’ param to KeyPressed (and KeyHit) now in develop branch.
It looks like Keyboard.KeyHit has auto-repeat, at least on MacOS.
IMO, it shouldn’t and this MAY be a new thing.
I’d like to fix this but am worried people are writing GUIs and depend on this behaviour – is this correct?
Perhaps KeyHit (and KeyPressed!) could look like: KeyHit( key:Key,repat:Bool=False )
I’m planning on building something from scratch (although Urho3d looks mighty fine at a quick glance – never heard of that!).
Native file format will probably be ‘gltf’, and I’d also like to implement the ‘assimp’ library as an optional module for model loading.
Bullet physics will likely be ‘built in’.
32bit/64bit is really down to the compiler env. This is an easy choice on macos/linux as 64bit is so common now it’s a no-brainer.
However it’s a bit trickier on Windows as it *still* supports 32bit – yes, even in 2017 – and I am guessing many of the new surface devices use 32bit windows (my several-years-old tablet does) so if you want your stuff to really run ‘everywhere’, 32bit is still the safest way to go on Windows.
64bit for windows will happen eventually, but it’ll likely be a completely separate target and, unless you’re doing something that requires vast amounts of memory, I’d recommend not using it as you’ll only be limiting your potential audience.
No, but I don’t really like the idea for a number of reasons: I don’t like using new keywords unless absolutely necessary and IMO casting should be a bit ugly anyway, as it can be a sign you’re doing something slightly dodgy.
Also, I’m not a huge a fan of offering multiple ways to do the same thing unless it clearly achieves something. If Cast<>() can ‘do it all’ why confuse things?
You don’t mention the platform, but I’m guessing Linux?
I’m gonna be taking a look at linux windows sizing issues this week sometimes, as it also affects the IDE.
When overriding a method, yes, you need to call Super.Blah or it’ll never be called.
When writing a constructor, you can user Super.New(…) to explicitly call a super class constructor, in which case the call to Super.New must be the first statement in the constructor.
If your constructor does not call Super.New(…) the super class must have a ‘default’ constructor – ie: a constructor with no params – and this will be called for you before your constructor runs. Note that a default ‘NOP’ constructor will be automatically generated for any class with NO constructors.
In monkey2, you can also use Self.New instead of Super.New at the start of a constructor. This will call a constructor in the same class instead of a super class constructor. A constructor can only call Self.New or Super.New but not both.
I think monkey2 needs a ‘log’ system…will look into it soon.
On macos, I think if you install emscripten to ~/emsdk, it should all ‘just work’ as this is where env_macos.txt expects to find it. Note that emscripten also requires python2, but apple did something to PATH in El Capitan that stopped it finding python2 via emscripten’s interrnal PATH. To get around this, I had to add this to bin/env_macos.txt – make sure you have it too (you should have so I’m guessing the problem is not that):
PATH=/usr/local/bin:${PATH}
In general, I don’t want to get too caught up with being responsible for the installation of (non-desktop) SDKs. I mean, feel free to ask and discuss here, but also be ready to do some googling etc if I/we can’t help or you could be waiting forever! This is esp. true of emscripten which is kind of ‘bleeding edge’ and is a pretty big/complex project. If you go for 3rd party help though, you might want to try and get an mx2-less hello_world.cpp working first (see download page I think) – if you can do that but mx2cc still doesn’t work, then it *is* my problem!
I’ve found the emscripten google group to be a good place to get help with installation and building emscripten from source. And the authors post there too, so if you discover an installer bug it can get fixed in the release!
Arrays types are, like objects, reference types so are never ‘value copied’.
Mojox is missing an image view – here’s a quick replacement for now:
Monkey1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768#Import "<std>"#Import "<mojo>"#Import "<mojox>"#Import "planet.png" 'NOTE: From shoot-out banana.Using std..Using mojo..Using mojox..Class ImageView Extends ViewMethod New( image:Image=Null )Layout="float"Image=imageEndProperty Image:Image()Return _imageSetter( image:Image )_image=imageEndProtectedMethod OnMeasure:Vec2i() OverrideReturn _image ? _image.Rect.Size Else New Vec2i( 16 )EndMethod OnRender( canvas:Canvas ) OverrideIf _image canvas.DrawImage( _image,0,0 )EndPrivateField _image:ImageEndClass MyWindow Extends WindowField _scrollView:ScrollViewField _imageView:ImageViewMethod New()Super.New( "Simple Mojo Gui App",640,480,WindowFlags.Resizable )_scrollView=New ScrollView_imageView=New ImageView_scrollView.ContentView=_imageViewContentView=_scrollView_imageView.Image=Image.Load( "asset::planet.png" )EndEndFunction Main()New AppInstanceNew MyWindowApp.Run()EndYou currently need to create a ‘fiber’ inside event handlers if you are writing blocking code, as event handlers run on the main thread and you can’t block the main thread or the entire app will halt.
In this case, something like this should work:
Monkey1234567891011121314151617181920212223242526272829303132333435363738#Import "<std>"#Import "<mojo>"#Import "<mojox>"Using std..Using mojo..Using mojox..Class MyWindow Extends WindowField amount:IntMethod New()Super.New( "Simple Mojo Gui App",640,480,WindowFlags.Resizable )EndMethod OnMouseEvent(event: MouseEvent) OverrideSelect event.TypeCase EventType.MouseDownSelect event.ButtonCase MouseButton.RightNew Fiber( Lambda()amount=RequestInt("Anzahl:", "", amount, 1, 0, 99)End )EndEndEndEndFunction Main()New AppInstanceNew MyWindowApp.Run()End -
AuthorPosts