Git Product home page Git Product logo

Comments (6)

asdqwe avatar asdqwe commented on August 16, 2024

Hello,

If you mean directly from raylib, then I don't think so. I believe the input queue itself is managed by GLFW and just polled by raylib (reference). You could try:

  1. including GLFW/glfw3.h and calling glfwPollEvents() after sleep(), maybe that could work to empty the queue;
  2. or calling raylib's PollInputEvents() after sleep(), but it definitely wasn't designed for that;
  3. or try PLATFORM_DESKTOP_SDL.

Best regards.

from raylib.

CrackedPixel avatar CrackedPixel commented on August 16, 2024

Since the issue is in GLFW (the ticket you linked) we have to wait for them to fix it or use a different raylib core such as RGFW or SDL

from raylib.

rongcuid avatar rongcuid commented on August 16, 2024

I was thinking if raylib can call something right before initialize or terminate. Unfortunately I don't know enough about mac os to tell if it can be hacked around in raylib or not.

from raylib.

raysan5 avatar raysan5 commented on August 16, 2024

I'm afraid this issue is out-of-scope of raylib but on its underlying library GLFW, anything added in raylib side would be just a patch to circunvent GLFW issue.

from raylib.

raysolva avatar raysolva commented on August 16, 2024

Since the issue is in GLFW (the ticket you linked) we have to wait for them to fix it or use a different raylib core such as RGFW or SDL.

I had no success with changing raylib core to RGFW, but have tried RSGL alone, which uses RGFW. Unfortunately, it seems like there is the same issue. After closing a window, it hangs, freezes, and shows not desirable behavior.

If somebody interested, here is the code to reproduce the problem (based on RSGL/examples/basics/text.c):

#include <stdio.h>
#define RSGL_IMPLEMENTATION
#include "RSGL.h"

int window_drawer__custom(void);

int main()
{
    window_drawer__custom();
    char input = '0';
    while(input!='q')
    {
        input = getchar();
        if ( (input != '\n') && input != EOF) { printf("input: %c\n", input); }
    }
    printf("finished. \n");
    return 0;
}

int window_drawer__custom(void) {
    RSGL_window* win = RSGL_createWindow("window 1", (RSGL_rect){500, 500, 500, 500}, RSGL_CENTER);

    RSGL_setFont(RSGL_loadFont("Super Easy.ttf"));
    
    for (;;) {
        RSGL_window_checkEvent(win);

        if (win->event.type == RGFW_quit)
            break;

        RSGL_drawText("Text example\nnewlines too", RSGL_CIRCLE(200, 200, 20), RSGL_RGB(255, 0, 0));
        RSGL_window_clear(win, RSGL_RGB(255, 255, 255));
    }
    
    // RSGL_window_close(win);
    // RGFW_window_close(win);
    printf("\nRSGL window_drawer__custom : done \n");
    
    return 0;
    }

(font is inside the RSGL/examples folder)

When // RSGL_window_close(win); or // RGFW_window_close(win); is uncommented, then window is normally closed, but application just finishes at that point, without going back to main().
While it stays commented, control goes back to main() from the function, but window stays hanging.

So, switching to RSGL did not solve the problem, and I suppose raylib with RGFW under the hood won't do it either.

Don't know where to share that, hope it will save some time for somebody.

from raylib.

ColleagueRiley avatar ColleagueRiley commented on August 16, 2024

@raysolva Could you move the issue to the RGFW repo?

from raylib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.