• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - Code Camera Issues [SOLVED]

Ax209

Member
Hi everyone. I'm sure this is really simple to most of you but I just can't wrap my head around some of the new stuff. I'm sure it's there but I'm struggling to find it.

So I have a game, with a camera of 600 x 400. Now, I wanted to double the size on the screen, make it look more pixellated, so I made the viewport 1200 x 800.

Much like GMS 1.x this works lovely. However I've run into a hickup when placing buttons. Normally I'd go for the following...

x = view_xview+view_hview-64.

This would ensure that the buttons would always be at the right of the screen, with always the same space towards the edge of the window, regardless of how I changed the resolution. Now, I've been playing with some new functions. Such as the camera_get_view_width/height and view_get_hport. The problem with these functions is that they consistently return the length of the window and not the length in the room itself. So instead of returning 600, they give me 1200 and my button is nowhere to be seen.

I can think of ways to work around this, even with a changing resolution, if I set everything up well enough in advance, but if there's a built-in-function then i'd rather use that.

Cheers in advance.
 

Ax209

Member
Okay okay I've finally got it.

So, one of the arguments is a number of the port/camera. For example...

camera_get_view_width(0)

This would return the port on screen as I simply put a "0" in. However if I modify that like so...

camera_get_view_width(view_camera[0])

It takes forces it to use the camera size instead of the port size.

:)
 
Last edited:
Top