raylib-extras / rlimgui-cs Goto Github PK
View Code? Open in Web Editor NEWA Raylib-cs integration with DearImGui
License: zlib License
A Raylib-cs integration with DearImGui
License: zlib License
I believe the old EnableScissor(...) work more correctly than current one.
As you can see, the first screenshot is from commit 08a68d3c2d0ecac060c2a341232ddb901aecd4dc
the second one is from 6ed53c713c453c9398428154b993ef99b9145920
. It looks the old one works for me.
Currently I have daul monitor setup, both of them are 1080P and DPI is 125%.
Besides, I believe at line 446, it should be
io.AddKeyEvent(keyItr.Value, Raylib.IsKeyDown(keyItr.Key));
instead of current one. Current one will crash directly.
Running this wrapper on an M1 machine will result in no visible / cut off output.
This problem can be solved on M1's (.NET 6.0) commenting out:
EnableScissor
and Rlgl.rlDisableScissorTest()
in rlImGui.cs.
Hello,
First of all, thank you for the your great job. Your project has been very useful for me.
Now, going back to the matter, I have been testing your project and I found a weird behaviour of ImGui. When the window is place out side the screen on the left side, ImGui glitches. I have been checking your code but i dont find the issue. I have attached two videos showing the issue.
Any idea what it could be happening?
I am on macOS Sonoma 14.3.1 running on a M1 Max.
Test 1
Test 2
Unhandled exception. System.MissingMethodException: Method not found: 'ImGuiNET.RangePtrAccessor`1<ImGuiNET.ImDrawListPtr> ImGuiNET.ImDrawDataPtr.get_CmdListsRange()
'.
at rlImGui_cs.rlImGui.RenderData()
at rlImGui_cs.rlImGui.End()
at HelloWorld.Program.Main() in /Users/kyandesutter/development/formal-engine-rewrite/Program.cs:line 156
For me this line crashes because there is an 'index out of range exception'.
foreach (var keyItr in RaylibKeyMap)
io.KeysData[(int)keyItr.Value].Down = (byte)(Raylib.IsKeyDown(keyItr.Key) ? 1 : 0);
I figured that this is offset value is needed. It worked for me fine, text input is OK.
https://github.com/ocornut/imgui/blob/e265610a0c4143b9abc64c50a3950ddcd0243622/imgui.h#L1425
foreach (var keyItr in RaylibKeyMap)
io.KeysData[(int)(keyItr.Value - ImGuiKey.KeysData_OFFSET)].Down = (byte)(Raylib.IsKeyDown(keyItr.Key) ? 1 : 0);
I've been trying to get custom fonts working using rlImGui-cs for about 4 hours now - something that would take 20 seconds using C++ and ImGui - and I just can't figure it out.
I have tried:
None of these work. Do you have an functioning example of loading a custom font?
I am on Linux, so I don't know if this is a raylib, this libary, or if I am doing something wrong
SetTraceLogLevel(TraceLogLevel.Error);
SetConfigFlags(ConfigFlags.ResizableWindow);
InitWindow(400, 300, "Window");
rlImGui.Setup(true);
while (!WindowShouldClose()) {
BeginDrawing();
ClearBackground(Color.Black);
rlImGui.Begin();
//
bool open = true;
ImGuiWindowFlags flags =
ImGuiWindowFlags.NoDecoration |
ImGuiWindowFlags.AlwaysAutoResize |
ImGuiWindowFlags.NoSavedSettings |
ImGuiWindowFlags.NoFocusOnAppearing |
ImGuiWindowFlags.NoNav;
ImGui.SetNextWindowPos(Vector2.One * 10f);
flags |= ImGuiWindowFlags.NoMove;
ImGui.Begin("test", ref open, flags);
ImGui.Text("HERE");
ImGui.End();
//
rlImGui.End();
EndDrawing();
}
CloseWindow();
this doesn't load properly on github.
https://github.com/raylib-extras/rlImGui-cs/blob/main/rlImGui/IconsFontAwesome6.cs
This is the format I identified for loading and changing a font:
var fontPtr = ImGui.GetIO().Fonts.AddFontFromFileTTF(@"path/to/font.ttf", 48f);
rlImGui.ReloadFonts();
unsafe {
ImGui.GetIO().NativePtr->FontDefault = fontPtr.NativePtr;
}
Based on the Dear Imgui Demo
However, rlImGui-cs doesn't have the property setter on ImGuiIOPtr
Is there a cleaner way or can we add this to the README?
Hi, I'm using the latest versions of everything from nuget, these are the dependencies:
<ItemGroup>
<PackageReference Include="ImGui.NET" Version="1.90.0.1" />
<PackageReference Include="Raylib-cs" Version="5.0.0" />
<PackageReference Include="rlImgui-cs" Version="2.0.0" />
</ItemGroup>
When running the simple demo program from the repo, i get this error:
Unhandled exception. System.IndexOutOfRangeException: Index was outside the bounds of the array.
at ImGuiNET.RangeAccessor`1.get_Item(Int32 index)
at rlImGui_cs.rlImGui.FrameEvents()
at rlImGui_cs.rlImGui.Begin(Single dt)
at Program.Main() in Program.cs:line 29
I changed the version of ImGuiNET to 1.89.9.3 which nuget states as minimum required version and everything works.
Thanks a lot!
Problem:
When using rlImGui and using Raylib.MaximizeWindow();
and Raylib.ToggleFullscreen();
there are some text missing in imgui.
Setup:
rlImGui.Setup();
public override void Draw()
{
rlImGui.Begin();
ImGui.ShowDemoWindow();
rlImGui.End();
}
public override void Update()
{
if (Raylib.IsKeyPressed(KeyboardKey.KEY_F11))
{
Raylib.MaximizeWindow();
Raylib.ToggleFullscreen();
}
}
Showcase:
Note:
This does not happen when only using Raylib.ToggleFullscreen();
so it's an issue related when using fullscreen in a window that is maximized.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.