Diddy virtual Resolution! Example?

Monkey Forums/Monkey Programming/Diddy virtual Resolution! Example?

Amon(Posted 2012) [#1]
Can someone who is more experienced with Diddy post an example of how to setup and use the virtual resolution commands?

ta!


therevills(Posted 2012) [#2]
There is an example within Diddy and the Spacebugs also uses the VR.

http://code.google.com/p/diddy/source/browse/trunk/examples/VirtualRes/virtual.monkey


Amon(Posted 2012) [#3]
Thanks!


Amon(Posted 2012) [#4]
Completely failed!

Say for instance I want to target the resolution for my Samsung Galaxy S2; what then do I do to alter the resolution and graphics to scale for tablets or Desktops?

Should I target for bigger screen devices first then scale appropriately for smaller screen?

If so how?

I noob.....therefore I am!


Paul - Taiphoz(Posted 2012) [#5]
I have a few questions about this as well, given that the virtual res will scale rendered stuff, how would this then affect things like positioning and collisions.

if for example I am using basic rectsoverlap to check if my mouse is clicking in a box how would I adjust this to work at a variable resolution or is that some how handled by diddy.


therevills(Posted 2012) [#6]
@Amon - sorry for the late reply, I didnt see this post until Taiphoz bumped it. To answer your question: Its up to you. ;)

You set the screen size by: SetScreenSize(480, 320)
Then on any target no matter the size of the target's resolution it will be re-sized to fit the screen.

@Taiphoz - the beauty of the VR stuff is that it doesnt affect the internal coordinates. Normally you would need to "help" the mouse position, but on how Diddy is coded you dont need to worry about it. Go check out SpaceBugs and mess with the VR in that to get an idea on how it works.


Paul - Taiphoz(Posted 2012) [#7]
Thanks therevills, when I get a sec to look at those examples will they show me how to adjust the mousex() touchx() joyx() etc so that it takes into account the screens resolution ?

if so sweet, will check it in the morning when I have the time.


Samah(Posted 2012) [#8]
Just reference game.mouseX and game.mouseY rather than calling MouseX() and MouseY(). Those variables get updated every loop to take into account the virtual resolution.


Paul - Taiphoz(Posted 2012) [#9]
Samah , any chance you could add support for TouchX,Y as well.

I checked the mouse stuff, works a treat , I assume adding touch support would be easy bud id rather not fork or alter didy in favour of it being officially supported.

Also possibly consider Joy support as well


therevills(Posted 2012) [#10]
I thought MouseX,Y mapped to TouchX,Y anyway?

Why would JoyX,Y need adding, since the Joy(pad) doesnt depend on the screen coordinates?


Paul - Taiphoz(Posted 2012) [#11]
Yeah.. I tried just plugging this into my game and it failed, I assume the scale stuff only works on game.image and not monkey native images?

I ask because my game uses an atlas which isnt supported by diddy as I recall so I have a mix of images I use via diddy and then images I just draw and use normally, namely ones coming out of my atlas via grabimage.


therevills(Posted 2012) [#12]
Sorry, what have you tried plugging into your game?

The "scale stuff" affects the entire viewport so it will work on everything.


Paul - Taiphoz(Posted 2012) [#13]
Yeah what happened was the view port changed size, but the actual images didnt, so when I tried it on my menu screen I had half my screen size and the ui stayed at full size with only half the ui visible.

so it didnt scale at all.


therevills(Posted 2012) [#14]
Heres a quick example, which uses GameImages, Images and Sprites:


All 3 "types" of images scale fine...

How are you drawing your UI?