-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|533|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
SoCoder -> Snippet Home -> Misc


 
Jayenkai
Created : 30 October 2014
 
System : Cross Platform
Language : Monkey

Monkey Framework - HTML Layout



I've been using this for a while, but thought it might be useful to others.
You'll find the canvas on the upper left, and a selection of different screen resolutions on the right. Clicking them will change the res of the canvas, and .. hopefully.. your game will scale accordingly, depending on how well you've coded your game.

To use, simply replace MonkeyGame.html with this.


 

Comments


Thursday, 30 October 2014, 08:12
steve_ancell
The method I coded below works well for x, y, and size scaling, seems OK with HTML5, Flash and Android targets. Might also try you method at some point as I'm not sure how mine works on other devices like Apple, Mac, etc...



Thursday, 30 October 2014, 08:19
Jayenkai
Yeah, mine's the same idea. I also work out the "closest to 1:1" ratio, and rescale either the screen width or height, accordingly, then a fuckton of multiplications to scale everything..

It buggers up the concept of "per screen" gaming, but if you're playing in a scrolling arena, you're fine.
Thursday, 30 October 2014, 08:35
steve_ancell
The way I do it is like running the actual game on an imaginary surface, based on the actual gamesize without scaling, none of the collisions or virtual positioning is applied directly to the physical screen.

I use the code above purely for putting everything on the actual screen, based on where everything is in memory. I also used the same method on Mutant Monty.

I hope what I just explained above is simple enough for any noobs to understand, I'm better at doing rather than explaining if you get my meaning.