Jump to content


Photo

Windows size


  • Please log in to reply
3 replies to this topic

#1 stoneyftw

stoneyftw

    GMC Member

  • GMC Member
  • 112 posts
  • Version:GM:Studio

Posted 03 May 2012 - 04:20 PM

I'm having a hard time finding something concrete in the forums on how to automatically scale things to the browser size for a GMHTML5 game.

What I have:
A background that is 1024x690 (~ full screen landscape iPad)

What I need it to do:
Display correctly on an iPad, and scale correctly on an iPhone. I want the phone to basically just shrink it down, and display the whole image on the main phone screen. I can't figure out how to do this for the life of me.
  • 0

#2 darkclower

darkclower

    GMC Member

  • New Member
  • 80 posts
  • Version:GM8

Posted 03 May 2012 - 04:45 PM

There are many ways of doing this, and the best is probably to shrink it with Photoshop or a similar program.

But you can also do this in code. You will do this by drawing the background with an object with this code.
draw_sprite_stretched(SPRITE,IMAGE,X,Y,WIDTH,HEIGHT);

Just replace width and height with the width and height you want (the iPhones resolution).

Good luck with your game. (:
  • 0

#3 stoneyftw

stoneyftw

    GMC Member

  • GMC Member
  • 112 posts
  • Version:GM:Studio

Posted 03 May 2012 - 05:02 PM

There are many ways of doing this, and the best is probably to shrink it with Photoshop or a similar program.

But you can also do this in code. You will do this by drawing the background with an object with this code.

draw_sprite_stretched(SPRITE,IMAGE,X,Y,WIDTH,HEIGHT);

Just replace width and height with the width and height you want (the iPhones resolution).

Good luck with your game. (:


So I am able to achieve the effect I want by using views, however, the function os_device returns the wrong devices... for instance, os_device = ios_device_ipad when running on my iphone, and os_device = ios_device_iphone_retina when running on my ipad.

Anyone ever seen that?

Edited by stoneyftw, 03 May 2012 - 06:13 PM.

  • 0

#4 darkclower

darkclower

    GMC Member

  • New Member
  • 80 posts
  • Version:GM8

Posted 04 May 2012 - 07:14 AM


There are many ways of doing this, and the best is probably to shrink it with Photoshop or a similar program.

But you can also do this in code. You will do this by drawing the background with an object with this code.

draw_sprite_stretched(SPRITE,IMAGE,X,Y,WIDTH,HEIGHT);

Just replace width and height with the width and height you want (the iPhones resolution).

Good luck with your game. (:


So I am able to achieve the effect I want by using views, however, the function os_device returns the wrong devices... for instance, os_device = ios_device_ipad when running on my iphone, and os_device = ios_device_iphone_retina when running on my ipad.

Anyone ever seen that?

Greetings.

According to another post, you should do something like this.
if (YoYo_GetPlatform() & os_ios && YoYo_GetDevice() & device_ios_ipad)

I hope this helps! (:
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users