chrisdill / raylib-cs

C# bindings for raylib, a simple and easy-to-use library to learn videogames programming
http://www.raylib.com/
zlib License
824 stars 73 forks source link

Keymapping does not work anymore in 6.1.1? #259

Closed CodingMadness closed 3 months ago

CodingMadness commented 3 months ago

Before submitting a new issue, please verify and check:

Issue description

Briefly describe the issue you are experiencing (or the feature you want to see added to Raylib-cs). Tell us what you were trying to do and what happened instead. You can also ask questions on the raylib discord server.

I want to understand how to fix this code, I had b4 Raylib_cs 4.5 in use and that here worked: grafik

Environment

Provide your Platform, Operating System, OpenGL version, GPU, Raylib-cs version, Raylib version (if applicable), and details of where or how you experienced the issue. Raylib_cs 6.1.1, windows 11 x64 23H2

Issue screenshot

If possible, provide a screenshot that illustrates the issue. Usually an image is better than a thousand words.

Code example

Provide minimal reproduction code to test the issue. Please, format the code properly and try to keep it as simple as possible, just focusing on the experienced issue.

The code below worked in raylib_cs 4.5

`

    private static void EndInitImGui()
    {
        SetupMouseCursors();
        ImGui.SetCurrentContext(ImGuiContext);            
        var io = ImGui.GetIO();
        io.Fonts.AddFontDefault();
        io.KeyMap[(int)ImGuiKey.Tab] = (int)KeyboardKey.Tab;
        io.KeyMap[(int)ImGuiKey.LeftArrow] = (int)KeyboardKey.Left;
        io.KeyMap[(int)ImGuiKey.RightArrow] = (int)KeyboardKey.Right;
        io.KeyMap[(int)ImGuiKey.UpArrow] = (int)KeyboardKey.Up;
        io.KeyMap[(int)ImGuiKey.DownArrow] = (int)KeyboardKey.Down;
        io.KeyMap[(int)ImGuiKey.PageUp] = (int)KeyboardKey.PageUp;
        io.KeyMap[(int)ImGuiKey.PageDown] = (int)KeyboardKey.PageDown;
        io.KeyMap[(int)ImGuiKey.Home] = (int)KeyboardKey.Home;
        io.KeyMap[(int)ImGuiKey.End] = (int)KeyboardKey.End;
        io.KeyMap[(int)ImGuiKey.Delete] = (int)KeyboardKey.Delete;
        io.KeyMap[(int)ImGuiKey.Backspace] = (int)KeyboardKey.Backspace;
        io.KeyMap[(int)ImGuiKey.Enter] = (int)KeyboardKey.Enter;
        io.KeyMap[(int)ImGuiKey.Escape] = (int)KeyboardKey.Escape;
        io.KeyMap[(int)ImGuiKey.Space] = (int)KeyboardKey.Space;
        io.KeyMap[(int)ImGuiKey.A] = (int)KeyboardKey.A;
        io.KeyMap[(int)ImGuiKey.C] = (int)KeyboardKey.C;
        io.KeyMap[(int)ImGuiKey.V] = (int)KeyboardKey.V;
        io.KeyMap[(int)ImGuiKey.X] = (int)KeyboardKey.X;
        io.KeyMap[(int)ImGuiKey.Y] = (int)KeyboardKey.Y;
        io.KeyMap[(int)ImGuiKey.Z] = (int)KeyboardKey.Z;

        ReloadFonts();
    }

`

lukaspirkl commented 3 months ago

What error is reported in the build output log?

CodingMadness commented 3 months ago

What error is reported in the build output log?

RlImGui.cs(102, 16): [CS1061] “ImGuiIOPtr” does not contain a definition for “KeyMap”, and no accessible KeyMap extension method could be found that accepts an initial argument of type “ImGuiIOPtr” (possibly missing a using directive or assembly reference).

CodingMadness commented 3 months ago

i get like 23 of this same error over and over ( could not copy the entire full log but its really always the same) before "KeyMap" was a valid member of "io" and you could map inside the "Rlgl.cs"

CodingMadness commented 3 months ago

I am stupid, I thought this was somehow a part of raylib_cs but its from "rlImgui_cs".... my appologize!

lukaspirkl commented 3 months ago

It was removed from ImGUI 1.90. image

CodingMadness commented 3 months ago

I added the recent nuget package "rlImgui.cs" and all works now, I had a copy of that class my self back then so it was sort of a manual keep-alive of that rlimgui setup but thats gone now :-)