GithubHelp home page GithubHelp logo

easyimgui's Introduction

EasyImGui


Use ImGui with Winforms / .NET Framework.
๐Ÿ’  Please leave a Star to the repository โœ… if you liked it. โœจ

  • Install via NuGet Package :
    dotnet add package EasyImGui --version 1.0.4.1
    

Example Projects

Sample Description
BF4 External Battlefield 4 Simple External Cheat. It works Offline (Campaign) and Online.
EasyColorPicker A color picker made with EasyImGui
EasyImGui.Samples Examples in C# and VB

Features

EasyImGui allows you to Create your GUI with ImGui, without having to configure anything, you don't need any additional knowledge.

You just need to install EasyImGui from NuGet and that's it! .

Note:

EasyImGui uses DearImGuiSharp, so any question related to ImGui should be asked in its official Reposttory: https://github.com/Sewer56/DearImguiSharp

If within your ImGui code you launch controls that block the Main UI, such as OpenFileDialog or MessageBox.Show, it will cause your application to fail, this is easy to solve, Simply do everything Asynchronously, Without Dialogs ".ShowDialog()"

Example

DX9 Overlay + Imgui Window.

  
Overlay OverlayWindow = new Overlay() { EnableDrag = false, ResizableBorders = true, NoActiveWindow = true, ShowInTaskbar = true, AutoPresentParams = false };
              
OverlayWindow.presentParams = new SharpDX.Direct3D9.PresentParameters()
{
 Windowed = true,
 SwapEffect = SharpDX.Direct3D9.SwapEffect.Discard,
 BackBufferFormat = SharpDX.Direct3D9.Format.A8R8G8B8,
 MultiSampleType = SharpDX.Direct3D9.MultisampleType.None,
 MultiSampleQuality = 0
};

 //SingleImguiWindow.ImGuiWindowFlagsEx = DearImguiSharp.ImGuiWindowFlags.NoTitleBar;
 OverlayWindow.OnImGuiReady += (object sender, bool Status) =>
 {

     if (Status)
     {
         OverlayWindow.Imgui.ConfigContex += delegate {

             //DearImguiSharp.ImGui.StyleColorsLight(null);

             var style = ImGui.GetStyle();

             ImVec4[] styleColors = style.Colors;
             styleColors[(int)ImGuiCol.CheckMark].W = 1.0f;
             styleColors[(int)ImGuiCol.CheckMark].X = 1.0f;
             styleColors[(int)ImGuiCol.CheckMark].Y = 1.0f;
             styleColors[(int)ImGuiCol.CheckMark].Z = 1.0f;

             styleColors[(int)ImGuiCol.FrameBg].W = 0.0f;
             styleColors[(int)ImGuiCol.FrameBg].X = 0.0f;
             styleColors[(int)ImGuiCol.FrameBg].Y = 0.0f;
             styleColors[(int)ImGuiCol.FrameBg].Z = 0.0f;

             style.WindowRounding = 5.0f;
             style.FrameRounding = 5.0f;
             style.FrameBorderSize = 1.0f;



             //OverlayWindow.Imgui.IO.ConfigFlags |= (int)ImGuiConfigFlags.ViewportsEnable;

             return true;
         };


         bool DrawImguiMenu = true;

         SharpDX.Direct3D9.Device device = OverlayWindow.D3DDevice;

         OverlayWindow.Imgui.Render += delegate {


             if (DrawImguiMenu == false) { OverlayWindow.Close();  return true; }

             if (OverlayWindow.Imgui.Imgui_Ini == true && OverlayWindow.Imgui.IO != null)
             {

                 // Overlay Dragger
                 bool IsFocusOnMainImguiWindow = (Form.ActiveForm == OverlayWindow); // Old : DearImguiSharp.ImGui.IsWindowFocused((int)DearImguiSharp.ImGuiFocusedFlags.RootWindow);
                 if (IsFocusOnMainImguiWindow == true) { InputHook.Universal(OverlayWindow.Imgui.IO); }
                 OverlayWindow.EnableDrag = (DearImguiSharp.ImGui.IsAnyItemActive() == true) ? false : IsFocusOnMainImguiWindow;

                 DearImguiSharp.ImGui.SetNextWindowPos(new ImVec2 { X = 0, Y = 0 }, 0, new ImVec2 { X = 0, Y = 0 });
                 DearImguiSharp.ImGui.SetNextWindowSize(new ImVec2() { X = OverlayWindow.ClientSize.Width , Y = OverlayWindow.ClientSize.Height  }, 0);

                 DearImguiSharp.ImGui.Begin(OverlayWindow.Text, ref DrawImguiMenu, 0); // (int)ImGuiWindowFlags.NoResize | (int)ImGuiWindowFlags.NoMove | (int)ImGuiWindowFlags.NoCollapse | (int)ImGuiWindowFlags.NoBringToFrontOnFocus

                 if (DearImguiSharp.ImGui.Button("Message", new DearImguiSharp.ImVec2() { X = OverlayWindow.ClientSize.Width - 15, Y = 20 }))
                 {
                     Task.Run(() =>
                     {
                         MessageBox.Show("Hello World!");
                     });
                 }

                 if (DearImguiSharp.ImGui.Button("Exit", new DearImguiSharp.ImVec2() { X = OverlayWindow.ClientSize.Width - 15, Y = 20 }))
                     OverlayWindow.Close();

             }

             return true;
         };

     }
 };

 try { Application.Run(OverlayWindow); } catch { Environment.Exit(0); }
          

-----------------------------------------------------

Preview

Captura de pantalla 2024-01-16 194047

Captura de pantalla 2024-01-16 194153

image

Credits

Sewer56 : For DearImguiSharp library.

Veldrid Discord Server : Thanks to the community for the help, especially to zaafar and his ClickableTransparentOverlay project .

License

MIT License

Copyright (c) 2019-2023 DestroyerDarkNess

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

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.