Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CORE/Text] Text not upscaling good when the viewport gets updated #15

Open
OkiStuff opened this issue Aug 15, 2021 · 5 comments
Open
Labels
good first issue Good for newcomers hacktoberfest help wanted Extra attention is needed

Comments

@OkiStuff
Copy link
Contributor

Font not upscaling good when the viewport gets updated
It gets kinda stretched and it is all pixelated and a little burly

screenshot:
image

code:
Game Loop

    int w,h;
    while (keep_applet(window.window_handle))
    {
        update_viewport(&window, w,h);
       /* INPUT CODE HERE */

        begin_drawing();
            if (!scene) mainmenu.draw();
            else scene1.draw();
        end_drawing(&window);
}

mainmenu draw:

static void _main_menu_draw()
{
    clear_screen(BLACK);
    title_draw();

    draw_text(roboto_light, "press", 50, 150, 20, WHITE);
    draw_text(roboto_bold, "[space]", 100, 150, 20, WHITE);
}
@OkiStuff OkiStuff added good first issue Good for newcomers help wanted Extra attention is needed labels Aug 15, 2021
@abdothegreat
Copy link
Contributor

I think you should write this issue on the glfw github and show the muzzle source code for draw_text and update_viewport.

@user062
Copy link

user062 commented Oct 6, 2021

Hi, i want to work on this issue, but i never used muzzle before, and I'm not very proficient in C, what do you think?

Thanks.

@OkiStuff
Copy link
Contributor Author

OkiStuff commented Oct 6, 2021

@user062 sure try it out! I wasn't that good in C when I started learning OpenGL. Fork the repo and see what you can do to help! If you want to ask questions and get help you can join the discord server (it's linked in the readme)

@OkiStuff
Copy link
Contributor Author

OkiStuff commented Jul 8, 2022

Found a fix! Simply just check if the window sized has changed and then reload the font

before loop:
vec2 old_window_size = (vec2){applet.width, applet.height};

during loop:
if (applet.width != old_window_size.x || applet.height != old_window_size.y)
{
     old_window_size = (vec2){applet.width, applet.height};
     font = load_font(...);
}

@OkiStuff OkiStuff closed this as completed Jul 8, 2022
@OkiStuff OkiStuff reopened this Jan 18, 2023
@OkiStuff
Copy link
Contributor Author

Reopened because I don't really like this solution. Any body got any other fixes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers hacktoberfest help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants