Christopher Alexander
Member
Hi!
So I'm making a mobile game and have prototyped it for Windows and it works exactly as intended. Now, to prep it for mobiles (android) I've been implementing virtual_key_add() to use as taps on the screen. It seems to work fine except for the coordinates. I'm adding the virtual keys in the Draw GUI event as I read that in the documentation, but it gets messed up when I try to define the key areas using camera_get_view_height() and ..._width.
I know the coordinates, or rather size of stuff, isn't the same in the Draw GUI event as in the Draw event. So how do I get this to work:
Right now "deci_height*4" is like almost the full height of my screen. Which variables should I use to get my intended result and how do I get them?
So I'm making a mobile game and have prototyped it for Windows and it works exactly as intended. Now, to prep it for mobiles (android) I've been implementing virtual_key_add() to use as taps on the screen. It seems to work fine except for the coordinates. I'm adding the virtual keys in the Draw GUI event as I read that in the documentation, but it gets messed up when I try to define the key areas using camera_get_view_height() and ..._width.
I know the coordinates, or rather size of stuff, isn't the same in the Draw GUI event as in the Draw event. So how do I get this to work:
Code:
deci_height = camera_get_view_height(view_camera[0])/10;
half_width = camera_get_view_width(view_camera[0])/2;
full_width = camera_get_view_width(view_camera[0]);
virtual_key_add(0, deci_height*6, half_width, deci_height*3, vk_left);
virtual_key_add(half_width, deci_height*6, half_width, deci_height*3, vk_right);
virtual_key_add(0, deci_height*4, full_width, deci_height*2, vk_up);
virtual_key_add(0, deci_height*9, full_width, deci_height, vk_down);
virtual_key_add(0, 0, full_width, deci_height*4, vk_escape);