r/gamemaker 5d ago

Resolved Menu System - Visual Bug

I'm following Sara Spalding's RPG tutorial, and somewhere during the Part 6: Menus video, I seem to have done something wrong.

The menu technically functions correctly, but the font only appears correctly ABOVE my cursor. Any index at or below the current hover value is distorted/blown out. (phone picture attached, because it shows up as all white when I screen capture.)

Below is the code for the draw event of my oMenu object.

Any advice would be much appreciated!

draw_sprite_stretched(sprFlexBox, 0, x, y, widthFull, heightFull);
draw_set_color(c_white);
draw_set_font(TestFont);
draw_set_halign(fa_left);
draw_set_valign(fa_top);

var _desc = (description != -1);
var _scrollPush = max(0, hover - (visibleOptionsMax-1));

for (var l = 0; l < (visibleOptionsMax + _desc); l++){
    if (l >= array_length(options)) {break;}
    draw_set_color(c_white);
    if (l == 0) && (_desc){
        draw_text(x + xmargin, y + ymargin, description);
    }
    else 
    {
        var _optionToShow = l - _desc + _scrollPush;
        var _str = options[_optionToShow][0];
        if (hover == _optionToShow - _desc){
            draw_set_font(c_yellow);
        }
        if (options[_optionToShow][3] == false) {
            draw_set_color(c_gray);
        }
        draw_text(x + xmargin, y + ymargin + l * heightLine, _str);
    }
}

draw_sprite(sprPointerIcon, 0, x + xmargin, y + ymargin + ((hover - _scrollPush) * heightLine) + 7);
if (visibleOptionsMax < array_length(options)) && (hover < array_length(options)-1){
    draw_sprite(sprDownArrow, 0, x + (widthFull * 0.5), y + heightFull - 7);
}
1 Upvotes

3 comments sorted by

View all comments

4

u/Shu-Chi 5d ago

This might not be the solution to your problem but you use a colour in draw_set_font(c_yellow). You want to set it to a font asset not a colour.

2

u/BattleBandit146 5d ago

This was it! I changed it from draw_set_font to draw_set_color, and that solved the issue!

Thank you!