Skip to content

Commit

Permalink
patch c# for double precision
Browse files Browse the repository at this point in the history
  • Loading branch information
pkdawson committed Aug 10, 2024
1 parent a4bc7a1 commit 1de992b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion addons/imgui-godot/ImGuiGodot/Internal/Input.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ private void UpdateMouse(ImGuiIOPtr io)
// scrolling works better if we allow no more than one event per frame
if (_mouseWheel != Vector2.Zero)
{
io.AddMouseWheelEvent(_mouseWheel.X, _mouseWheel.Y);
#pragma warning disable IDE0004 // Remove Unnecessary Cast
io.AddMouseWheelEvent((float)_mouseWheel.X, (float)_mouseWheel.Y);
#pragma warning restore IDE0004 // Remove Unnecessary Cast
_mouseWheel = Vector2.Zero;
}

Expand Down
4 changes: 3 additions & 1 deletion addons/imgui-godot/ImGuiGodot/Internal/InputLocal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ public override bool ProcessInput(InputEvent evt)
{
var io = ImGui.GetIO();
var mousePos = mm.Position;
io.AddMousePosEvent(mousePos.X, mousePos.Y);
#pragma warning disable IDE0004 // Remove Unnecessary Cast
io.AddMousePosEvent((float)mousePos.X, (float)mousePos.Y);
#pragma warning restore IDE0004 // Remove Unnecessary Cast
mm.Dispose();
return io.WantCaptureMouse;
}
Expand Down
4 changes: 3 additions & 1 deletion addons/imgui-godot/ImGuiGodot/Widgets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ private static (Vector2 uv0, Vector2 uv1) GetAtlasUVs(AtlasTexture tex)
Godot.Vector2 atlasSize = tex.Atlas.GetSize();
Godot.Vector2 guv0 = tex.Region.Position / atlasSize;
Godot.Vector2 guv1 = tex.Region.End / atlasSize;
return (new(guv0.X, guv0.Y), new(guv1.X, guv1.Y));
#pragma warning disable IDE0004 // Remove Unnecessary Cast
return (new((float)guv0.X, (float)guv0.Y), new((float)guv1.X, (float)guv1.Y));
#pragma warning restore IDE0004 // Remove Unnecessary Cast
}
}
#endif

0 comments on commit 1de992b

Please sign in to comment.