Legacy GM Draw_sprite/text location on GUI surface / GUI Surface Dimensions windowed vs fullscreen

S

Sean Xavier Torrez

Guest
control object on create event:
Code:
music = true;
draw_set_font(fnt_options);
draw_set_halign(fa_left);
width = sprite_get_width(spr_tickbox)/2;
height = sprite_get_height(spr_tickbox)/2;
draw gui event:
Code:
draw_text(96,192,'Music');
draw_sprite(spr_tickbox,0,256,217);
if music == true {
draw_sprite(spr_tick,0,256,217);
}

if mouse_check_button_pressed(mb_left) {
if mouse_x > (256-width) && mouse_x < (256+width) && mouse_y > (217-height) && mouse_y < (217+height) {
music = !music;
if music == false {
audio_stop_sound(snd_background_music);
} else {
audio_play_sound(snd_background_music,0,true);
}
}
}

Where is text drawn from? (assuming from the origin (x(96),y(192))

Where is the sprite drawn from?
(including offset in sprite mask being center it should be drawn from the center I would assume at the origin (x'256',y'217')

If this is the case we should be able to assume the half of height/width in either direction should be where my 'tickbox' is drawn from the set x,y coords is the same mouse location when compiled/playing and it is not.

From what I can tell thus far, the main drawn sprite doesn't appear to be drawn to an exact position (using the room editor the actual location is correct but the sprite is placed relative to something else).
The above was determined to be changed by the GUI surface in windowed vs Fullscreen

Instead of assuming can I get the center location of the 'tickbox' sprite instance?

so,
adding
Code:
locx = (drawn 'tickbox' center x cord)
locy = (drawn 'tickbox' center y cord)

if locx-width < mouse_x < locx+width && locy-height < mouse_y < locy+height
...

I'm going to assume it has something to do with xscale and room size, but I would think the x,y coords in the room editor would directly correspond to drawn instance locations(and they don't appear to as the mouse_x/y do)

or the draw gui is an overlay surface with its own coords.

Also drawing to an exact location doesn't sound like a good idea due to varying screen resolutions, true or false?

Cheers,
 
Last edited by a moderator:
S

Sean Xavier Torrez

Guest
The problem is the exact location of drawing between fullscreen and windowed. Windowed location is correct whereas full-screen location is not.

How is this issue best resolved?

I would assume using the x scale property would help?
 
S

Sean Xavier Torrez

Guest
Seems to be the GUI overlay surface changes when in windowed or fullscreen.

I used draw instead of GUI draw and achieved the exact placement I was looking for, however, how can I set the GUI surface dimensions in fullscreen to match the GUI surface dimensions when in window mode?

Using display_set_gui_maximise perhaps?
 
Last edited by a moderator:
Top