• 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.

Windows Font gets messed up when resizing game window

TheSnidr

Heavy metal viking dentist
GMC Elder
I made this script for resizing the game window:
Code:
/// @description window_resize()
var w = window_get_width();
var h = window_get_height();
if w != surface_get_width(application_surface) or h != surface_get_height(application_surface)
{
    surface_resize(application_surface, w, h);
    display_set_gui_size(w, h);
    view_set_wport(0, w);
    view_set_hport(0, h);
}
However, the font goes from drawing like this:

To this:

Everything else draws like normal. What's causing this and how can I fix it?

EDIT:
Looking at it again, it seems to affect everything in the GUI layer somehow.
 
Last edited:

The-any-Key

Member
It's basic pixel problem.
Draw 1 pixel in pos 1,1 when the port is 1.5 the original.
You need to keep the port x2 or x3...
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
In GMS1 this was usually solved by calling d3d_set_projection_ortho with the desired window size. Not sure what the current state is.
 

Mike

nobody important
GMC Elder
If its in the GUI layer, that should be handled for you..... If your doing your own matrices, then your on your own :)
 

TheSnidr

Heavy metal viking dentist
GMC Elder
If its in the GUI layer, that should be handled for you..... If your doing your own matrices, then your on your own :)
I don't use my own matrices in the GUI layer, I just use the draw commands in the Draw GUI event.
 

DukeSoft

Member
Now that I look at the screenshot again, it doesn't look like the pixels are missing, but it looks like the bounding box of the font is being sized down, cutting off the right bit of the font.. I can't really think of anything thats doing this :/

EDIT: Maybe post your font configuration here? Maybe some bits of the actual drawing of the font?
 

TheSnidr

Heavy metal viking dentist
GMC Elder
Now that I look at the screenshot again, it doesn't look like the pixels are missing, but it looks like the bounding box of the font is being sized down, cutting off the right bit of the font.. I can't really think of anything thats doing this :/
That really describes it well! The size of the pixels doesn't change, but the bounding box of the letters seems to shrink while the letters themselves stay the same size!
Weird. Any suggestions on what's causing this, @Mike?

Here's the Draw GUI event in its entirety:
Code:
//Turn off 3D
gpu_set_zwriteenable(false);
gpu_set_ztestenable(false);
gpu_set_cullmode(cull_noculling);

//Draw borders around the 3D views
draw_set_color(c_white);
draw_rectangle(borderX, borderY, borderX + editWidth, borderY + editHeight, true);
draw_rectangle(borderX + editWidth, borderY, borderX + editWidth * 2, borderY + editHeight, true);
draw_rectangle(borderX, borderY + editHeight, borderX + editWidth, borderY + editHeight * 2, true);
draw_rectangle(borderX + editWidth, borderY + editHeight, borderX + editWidth * 2, borderY + editHeight * 2, true);

//Draw the dimension indicators
draw_sprite(sDimensions, 0, borderX + 8, borderY + 8);
draw_sprite(sDimensions, 1, borderX + 8, borderY + editHeight * 2 - 72);
draw_sprite(sDimensions, 2, borderX + editWidth + 8, borderY + editHeight * 2 - 72);

//Draw buttons
draw_set_font(font_0);
draw_set_halign(fa_left);
draw_set_valign(fa_middle);
with oButton
{
    var ind = 0;
    if id == buttonTool[selectedTool]{ind = 1;}
    str = text;
    for (var i = 0; i < other.toolNum; i ++){if id == buttonTool[i]{str = text + " (" + string(i+1) + ")";}}
    draw_sprite(sprite_index, ind, x, y);
    draw_text(x + 1, y + 8, str);
}

//Reenable 3D
gpu_set_zwriteenable(true);
gpu_set_ztestenable(true);
gpu_set_cullmode(cull_clockwise);
 
Last edited:

TheSnidr

Heavy metal viking dentist
GMC Elder
Bump :)
@Mike, you mentioned it should be handled by the GUI layer, but it doesn't seem to do it correctly. Any idea what might cause the letters to be clipped?
 

Mike

nobody important
GMC Elder
Not a clue off hand, file a bug and a simple example and we'll take a look.... If you have access to a Mac, does it do it there too?
 
Top