christianhaitian / arkos

Another rockchip Operating System
MIT License
1.48k stars 84 forks source link

Löve 2D is not working #1180

Open dov opened 4 days ago

dov commented 4 days ago

Describe the Issue (If applicable)

I'd like to use the Löve 2D game engine on my R36S, but it fails to run.

How can the issue be reproduced? (If applicable)

sudo apt-get install love
mkdir -p ~/tmp/hello-love
cd ~/tmp/hello-love
echo -e 'function love.draw()\n    love.graphics.print("Hello, World!", 640, 480)\nend' > main.lua
love .

This fails with the error:

Unable to create OpenGL window
This program requires a graphics card and video drivers which support OpenGL 2.1 or OpenGL ES 2.

SDL window creation error: Could not create EGL window surface

However, compiling and running the following c-program shows that the version of OpenGL is sufficient:

/* sdl_glinfo.c */
#include <SDL2/SDL.h>
#include <SDL2/SDL_opengles2.h>
#include <stdio.h>

int main(int argc, char* argv[]) {
    if (SDL_Init(SDL_INIT_VIDEO) < 0) {
        printf("Unable to initialize SDL: %s\n", SDL_GetError());
        return 1;
    }

    SDL_Window* window = SDL_CreateWindow("OpenGL ES Info",
                                          SDL_WINDOWPOS_UNDEFINED,
                                          SDL_WINDOWPOS_UNDEFINED,
                                          640, 480,
                                          SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN);
    if (!window) {
        printf("Unable to create window: %s\n", SDL_GetError());
        SDL_Quit();
        return 1;
    }

    SDL_GLContext context = SDL_GL_CreateContext(window);
    if (!context) {
        printf("Unable to create OpenGL context: %s\n", SDL_GetError());
        SDL_DestroyWindow(window);
        SDL_Quit();
        return 1;
    }

    const char* version = (const char*)glGetString(GL_VERSION);
    printf("OpenGL ES version: %s\n", version);

    SDL_GL_DeleteContext(context);
    SDL_DestroyWindow(window);
    SDL_Quit();
    return 0;
}

Compile with:

gcc -o sdl_glinfo sdl_glinfo.c -lSDL2 -lGLESv2

The output of the above program is:

OpenGL ES version: OpenGL ES 3.2 v1.r13p0-01rel0.8747d14aec16ec21ac2b2da252c4ec5f

What device are you using? (Only the Gameforce Chi, RK2020, OGA 1.0, OGA 1.1, RG351MP, RG351V, RGB10, R35s, RG353V/VS, RG353M, RG503, RGB30, and RK2023 units are officially supported)

R36S

What version of ArkOS are you on?

07312024

Anything else you'd like to include that may help to review this issue or feature request?

I'm currently trying to recompile love to see if I can get it to run.

christianhaitian commented 4 days ago

While I don't support the R36s, the community build hosted by AeolusX is what you probably want, Love 2D is already included in ArkOS version 10/29/2022 or newer, however, it's the 11.4 version and it has control issues that need to be figured out.

dov commented 3 days ago

Thanks. I'll check it out.

Meanwhile I managed to compile the HEAD version of love on the R36S. There were only a small number of patches needed.

My branch is in https://github.com/dov/love/tree/r36s .

However, I could net get the joysticks to work in the sample programs. I'll have a look at it.

christianhaitian commented 3 days ago

awesome. Hopefully you figure out something.

dov commented 3 days ago

The joysticks are actually working. Love is simply doing a straight translation of the joysticks events from SDL. See the joystick event and axis table at my R36S programming description page at:

https://github.com/dov/r36s-programming/#mapping-of-the-r36s-controls

Perhaps it would make sense to configure Love to map e.g. the D-Pad to keyboard Up,Down,Left,Right events, etc?

In any case, Love is curently useless in ArkOS in its current state. Would you accept a pull request with my patches?