Worlds / viewports / coordinate systems etc

Monkey Forums/Monkey Beginners/Worlds / viewports / coordinate systems etc

Top(Posted 2015) [#1]
Some of the past development tools I have worked with allow you to define a "world" which you can populate with graphics and then you can place a "viewport" into the world somewhere on screen. Just curious if monkey has a similar system integrated and, if so, a keyword or two to get me started.

Also, how do I get the starting size of the canvas in pixels? Seems like a good thing to know.

Thanks,

Tim


MikeHart(Posted 2015) [#2]
So, I take it you didn't study the docs, or?

Use DeviceHeight() and DeviceWidth() for the dimensions.

The rest is not supported by mojo but you can easily run your own system. The Autofit example can give you a little head start if you have no clue about how to start your own system.


Top(Posted 2015) [#3]
Appreciate it.

I probably have 26+ hours in instructional videos, tutorials, and some reading spread over 3 or 4 weeks. There is a chance that DeviceHeight()/Width() were mentioned, but it didn't make the trip to long-term memory and the documentation doesn't give up it's treasures without a lot of work.


Samah(Posted 2015) [#4]
Hi Top, welcome to the forums! :)
The primary goal of Monkey/Mojo is to provide an update/render main loop and easy access to the device's graphics, input, and audio systems.
What you're suggesting is generally called a scenegraph and is not a core component of Monkey X; you would need to roll your own or use a 3rd party one.
I believe IgnitionX supplies one, and Diddy "kind of" has one, but it's time-based and made for storyboarding. I'm not sure about the other major frameworks.


Top(Posted 2015) [#5]
Samah -

Thanks for the welcome!

I saw that IgnitionX had scenes, but I was trying to avoid adding the module since I am being careful about download sizes in what will be a purely html5 project. I did not think that monkey had something similar, but I am new enough that I'd rather ask than later discover that I had overlooked some remarkably easy to use function.

Tim


MikeHart(Posted 2015) [#6]
To implement a viewport system is very easy. You render your objects with a offset which is basically your viewports coordinates. To avoid performance drops, don't draw objects that are outside the viewport. Monkey does not take care off that for you. My framework does these things for you too, but as you said, you wanna go on your own. This way you know what your code is doing, which is a good thing.


Playniax(Posted 2015) [#7]
Hi Top, welcome!

The primary goal of Monkey/Mojo is to provide an update/render main loop and easy access to the device's graphics, input, and audio systems.
What you're suggesting is generally called a scenegraph and is not a core component of Monkey X; you would need to roll your own or use a 3rd party one.
I believe IgnitionX supplies one, and Diddy "kind of" has one, but it's time-based and made for storyboarding.


Samah is right. Ignition X provides a scenegraph. The way it works is, you setup a playfield, attach layers and sprites (if needed) and the framework renders and updates them for you. You can also very easily detach them. The Ignition X scenegraph is very advanced. It has cameras, can zoom, rotate, support tiles, collisions, etc. Sprites can be grouped and groups can be rotated. Ignition X only supports Mojo 1. For Mojo 2 there is Pyro. Now it is important to understand Monkey/Mojo and know your way around it before looking at a scenegraph. You can be perfectly happy writing your own and don't need a third party addon. In case you need to cut corners you can start looking at a third party frameworks. But again, learning monkey/mojo first is important since Ignition X heavily depends on Monkey/Mojo.