Gamebot
Member
The problem I'm having is that there is an uneven space in between the first two items within my menu. I just created a generic one to see how it would draw. I tried drawing to the aspect ratio in width and height, x 16 and x 9. I even went as far as changing the font size to an aspect size. Same results always closer then the rest. See here:
I have a new computer perhaps it's because of an aspect ratio issue. Normally it's a 1600 x 900 at 16:9. However my Windows display, cameras/views, and aspect ratio are all calculated. My room is 3000 x 3000 and as shown my windows display 1280 x 720 matches my cameras and views display at 1280 x 720.
MACROS SCRIPT:
SCR_ASPECT
obj_menu
Create:
Draw:
obj_camera
Create:
Alarm[0]:
End Step:
Room Start:
Draw:
Any insight is appreciated. Thanks.
I have a new computer perhaps it's because of an aspect ratio issue. Normally it's a 1600 x 900 at 16:9. However my Windows display, cameras/views, and aspect ratio are all calculated. My room is 3000 x 3000 and as shown my windows display 1280 x 720 matches my cameras and views display at 1280 x 720.
MACROS SCRIPT:
Code:
#macro diswid display_get_width()
#macro dishei display_get_height()
#macro aspect scr_aspect()
SCR_ASPECT
Code:
/*
About this script:
Aspect ratio is how many pixels in width per pixels in height.
A 16:9 ratio means for every 16 pixels in width that are drawn
there will always be 9 pixels in height drawn.
Due to rounding errors we change to a string and format places using the string_format function.
First we get our aspect ratio: diswid/dihei = "1.78"
Then loop and divide to find which two numbers = "1.78"
Those two numbers is our aspect ratio.
*/
var asp, i, j, temp, out;
asp = string_format(diswid/dishei, 1, 2);
temp = 0;
out = "";
for ( i = 1; i < 25; i++) {
for ( j = 1; j < 25; j++) {
temp = string_format(j/i, 1, 2);
if (temp = asp) {
out = string(j) + ":" + string(i)
}
}
}
return out;
obj_menu
Create:
Code:
[ "Menu", "Edit", "Find", "Exit" ];
arrlen = array_length_1d(menu);
Code:
draw_set_font(fnt_menu);
for ( i = 0; i < arrlen; i++) {
var entry = menu[i];
draw_text(x + (i * 64), y, entry);
}
obj_camera
Create:
Code:
// Set window size and functions
window_set_fullscreen(false);
window_set_size(diswid, dishei);
window_set_caption("Awesome Game");
// Center window. Needs one step after window set functions
alarm[0] = 1;
// Resize drawing surface to our screen size
surface_resize(application_surface, diswid, dishei);
Code:
window_center();
Code:
camera_set_view_size(view_camera[0], diswid, dishei);
Code:
view_enabled = true;
view_visible[0] = true;
Code:
draw_text(32, 32, "RES: " + string( diswid ) + " x " + string ( dishei ))
draw_text(32, 64, "ASP: " + string( aspect) );