Skip to content

Coslly/EasyGUI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🤖EasyGUI

A lightweight and high-performance GUI library based on Direct2D

Empower C++ beginners to build their own menus in no time.

😀Features

  • For C++ worker
  • Fast - Simple - Safety - Light
  • Style can be easily modified

👾Technical highlights

Some technical problems I encountered and their solutions during the development of EasyGUI

I believe there are always better ways to optimize this. If you have any ideas, inspirations, or improvements, feel free to open an Issue or start a discussion in the EasyGUI repository! - Coslly

Skill Explanation / Description Complexity
Block refresh delay Introduce a throttled/debounced redraw delay for each block to improve rendering performance without compromising user experience. ★★★☆☆
Memory resource management Optimize memory usage and performance through hash-based data structures and periodic garbage collection/resource release. ★★★★☆

🥰Showcase (Example)

image image

😧How to use it?

- Constitute

EasyGUI is a fast and lightweight GUI library written in C++. The core drawing library is used for original Direct2D (fast and lightweight) and is composed of the most basic key judgment system. Therefore the performance loss is negligible. Lightweight enough that a single header file is all you need to build a GUI.

Core file: EasyGUI_Direct2D.h

Example file: Main.cpp

- Initialization

//Initialize EasyGUI
EasyGUI_Direct2D::EasyGUI GUI_Variable = { "EasyGUI Test Windows", {590, 360} };

- Add controls

You need to add a control block. Then add controls inside the block.

//Variable
static bool UI_Checkbox = false;
static bool UI_Button = false;
while (true)
{
    GUI_Variable.Draw(0);//Begin Draw GUI

    GUI_Variable.GUI_BackGround();//BackGround

    static EasyGUI_Direct2D::EasyGUI_Block Block{};
    if (GUI_Variable.GUI_Block(Block, 30, 30, 400, 200, "Test Block"))//Block
    {
    GUI_Variable.GUI_Checkbox(Block, "Checkbox", UI_Checkbox);
    UI_Button = GUI_Variable.GUI_Button(Block, "Button");
    }
    GUI_Variable.Draw(1);//End Draw GUI

    Sleep(1);
}

- Overall Code (Example Code)

int main()
{
    EasyGUI_Direct2D::EasyGUI GUI_Variable = { "EasyGUI Test Windows", {500, 300} };

    //Variable
    static bool UI_Checkbox = false;
    static bool UI_Button = false;
    while (true)
    {
        GUI_Variable.Draw(0);//Begin Draw GUI

        GUI_Variable.GUI_BackGround();//BackGround

        static EasyGUI_Direct2D::EasyGUI_Block Block{};
        if (GUI_Variable.GUI_Block(Block, 30, 30, 400, 200, "Test Block"))//Block
        {
        GUI_Variable.GUI_Checkbox(Block, "Checkbox", UI_Checkbox);
        UI_Button = GUI_Variable.GUI_Button(Block, "Button");
        }
        GUI_Variable.Draw(1);//End Draw GUI
        //Sleep(1);//Do not need this
    }
}

- Finished Product

image

About

A lightweight and high-performance GUI library based on Direct2D

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages