GithubHelp home page GithubHelp logo

7thfactor / horus_ui Goto Github PK

View Code? Open in Web Editor NEW
141.0 12.0 13.0 75.8 MB

HorusUI Immediate Mode Graphical User Interface

License: MIT License

Shell 0.56% Batchfile 0.02% C++ 10.25% Lua 0.51% Makefile 0.56% Python 0.11% Raku 0.11% Perl 0.67% HTML 7.25% C 79.57% CMake 0.33% Gnuplot 0.01% CSS 0.06%
imgui docking-framework gui ui widget-toolkit widgets user-interface

horus_ui's Introduction

HUI Logo

Immediate Mode Graphical User Interface for Tools

HUI

OVERVIEW

The HorusUI library allows you to quickly develop GUIs for your applications by leveraging the ease of use provided by immediate mode GUI concepts. No need to design your GUI layout and writing many lines of boilerplate GUI preparation, imgui takes care of layouting and making sure every widget you add to the system has an unique ID, gets drawn and responds to events. Ideally you should be familiar with https://en.wikipedia.org/wiki/Immediate_Mode_GUI. There are other imgui libs out there, dear-imgui which is more like a debug GUI and Nuklear which resembles HorusUI. HorusUI was specifically designed to create game editor tools or similar types of applications.

NOTE: The library is still work in progress, changes will occur until stabilization

For direct support: [email protected]

If you want to help with the development, donations are welcomed:

Donations on Patreon:
Patreon

Donations on PayPal:
PayPal

QUICK SAMPLE (C++)

HUI

    auto huiCtx = hui::createContext(hui::GraphicsApi::OpenGL);
    auto wnd = hui::createWindow("Sample", 1000, 800);
    hui::setWindow(wnd);
    auto theme = hui::loadTheme("../themes/default.theme");
    hui::setTheme(theme);

    auto largeFnt = hui::getFont(theme, "title");

    while (true)
    {
        hui::processEvents();
        hui::setWindow(hui::getMainWindow());
        hui::beginWindow(hui::getMainWindow());

        // user drawing code
        glClearColor(0, .3, .2, 1);
        glClear(GL_COLOR_BUFFER_BIT);

	// horus ui
        hui::beginFrame();
        hui::Rect panelRect = { 50, 50, 350, 500 };
        hui::beginContainer(panelRect);
        hui::WidgetElementInfo elemInfo;
        hui::getThemeWidgetElementInfo(hui::WidgetElementId::PopupBody, hui::WidgetStateType::Normal, elemInfo);
        hui::setBackColor(hui::Color::white);
        hui::drawBorderedImage(elemInfo.image, elemInfo.border, panelRect);
        hui::pushPadding(15);
        hui::gap(15);
        hui::labelCustomFont("Information", largeFnt);
        hui::button("Activate shields");
        static bool chk1, chk2, chk3;
        hui::beginTwoColumns();
        chk1 = hui::check("Option 1", chk1);
        chk2 = hui::check("Option 2", chk2);
        hui::nextColumn();
        chk3 = hui::check("Option 3", chk3);
        hui::pushTint(hui::Color::cyan);
        hui::button("Browse...");
        hui::popTint();
        hui::endColumns();
        static float val;
        hui::sliderFloat(0, 100, val);
        static char txt[2000];
        hui::textInput(txt, 2000, hui::TextInputValueMode::Any, "Write something here");
        hui::space();

        static f32 scrollPos = 0;
        hui::beginScrollView(200, scrollPos);
        hui::multilineLabel("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur?", hui::HAlignType::Left);
        hui::line();
        hui::button("I AGREE");
        scrollPos = hui::endScrollView();

        if (hui::button("Exit"))
            hui::quitApplication();

        hui::popPadding();
        hui::endContainer();
        hui::endFrame();
        hui::endWindow();
        hui::presentWindow(hui::getMainWindow());

        if (hui::wantsToQuit() || hui::mustQuit())
            break;
    }

    hui::shutdown();

PREREQUISITES

Windows: Microsoft Visual Studio 2017

Linux: g++

GTK3 dev, needed for the nativefiledialog lib, use: sudo apt-get install libgtk-3-dev

GLU/GLUT dev, needed by GLEW, use: sudo apt-get install libglu1-mesa-dev freeglut3-dev mesa-common-dev

BUILDING

Windows:

  • Execute: generate.bat
  • Open and compile: build_vs2017/horus.sln
  • Run generated files from ./bin folder

Linux:

  • Execute: sh ./generate.sh to generate makefiles
  • Execute: sh ./build.sh to compile and generate the lib and executables for the examples
  • Run generated files from the ./bin folder

FEATURES

  • Immediate mode GUI, imgui (no state kept per widget, user provides the state)
  • Docking OS native windows and tab panes system
  • UTF8 text support
  • It can redraw the UI only when needed, useful for non-gaming applications where continuous rendering not needed
  • DPI aware, scaling of the whole UI elements, useful for high DPI screens
  • Fully customizable through themes specified in a JSON file with 9-cell resizable elements and PNG images
  • Widgets can have multiple full styles in the same theme (example: different button shapes/skins)
  • Dynamic font atlas for unlimited unicode glyphs and font sizes
  • Widgets: text input (with hint text), tooltip, box, popup, messagebox, progress, button, icon button, dropdown, menu, context menu, tab, panel, radio, check, slider, toolbar etc.
  • MegaWidgets: color picker, XYZ/XY editor, object reference editor (with dragdrop support)
  • Widgets color tinting override
  • Virtual list view support (huge number of items)
  • Automatic vertical layouting of widgets (no need to position them by hand)
  • Multi-column layout with custom sizes (preferred, fill, max size, percentage based or pixel based)
  • Padding (left-right) and vertical spacing for widgets
  • Native Open/Save/Pick folder dialogs API
  • Inter-widget drag and drop
  • OS file/text drag and drop
  • Currently using OpenGL and SDL as backends for rendering and window/input
  • Customizable render/input backends
  • Custom user widgets API
  • 2D primitive drawing, lines, polylines, hermite splines, elipses, rectangles, with thickness
  • User viewport widget (rendering your scene/document view with the current rendering API)
  • Custom mouse cursor API
  • Clipboard API
  • Single header API
  • C-like API

ROADMAP

  • Undo/Redo system
  • Keyboard shortcuts system
  • OSX proper support
  • Vulkan rendering backend
  • Better unicode input (show IME suggestion box for Chinese etc.)
  • DPI theme elements based on current UI scale, choose the proper element bitmap size
  • Multiline text input editor with highlighting, advanced text operations
  • Hyperlink widget
  • Rich text widget (multi-font family, style and size, multi-color, insert images and hyperlinks)
  • Customizable Object Inspector
  • Customizable Node Editor

horus_ui's People

Contributors

benishor avatar nekitu avatar tekgoblin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

horus_ui's Issues

generate.sh error

2024-03-08_09-59

Trying to build on arch linux, after running sh ./setup.sh, when running sh ./generate.sh I am seeing this error

DX11 support

DX11 requires every window to have it's own swap chain. #10 may not the right place for it. We could convert windows to handles (unsigned int) and store windows in the context along side driver specific info like the swapchains that could also use this handle to lookup the swapchain of that window. In sdl2_input_provider.h we could also replace the sdlOpenGLCtx with a struct that would contain all the driver specific info and pass that off to the driver to allow specific info like this to be stored/managed. Reusing makecurrent would be able to handle setting the swapchain correctly for both drivers this way as well. You can assign this one to me if you like since I'm already working that out. Right now it's working but only for the main window and I added a global disable for detaching windows atm. We could also just allow a Window struct to store specific data like this and forget a handle, the driver would know it's data stored in the window itself. I would rather go that route. Any thoughts?

Scrollbars never get released

Steps to reproduce the issue:

  • run without_docking
  • press the left mouse button on the scrollbar in order to drag it
  • release the left mouse button and see how it continues to act as if it is pressed

Expected behavior:

  • scrolling should stop once the left mouse button is released

Linking with SFML fails on linux

Linking custom_render_and_input fails on linux. This is what we get:

/usr/bin/x86_64-linux-gnu-ld: ../3rdparty/sfml/linux/lib/libsfml-window-s.a(JoystickManager.cpp.o): relocation R_X86_64_32S against symbol `_ZNSbIjSt11char_traitsIjESaIjEE4_Rep20_S_empty_rep_storageE' can not be used when making a PIE object; recompile with -fPIC

Fix it.

Improve error handling

Add or improve error handling related to theme resources loading. Try to define a consistent error handling policy and apply it throughout the API where it makes sense.

DPI Awareness for fonts

Two windows might live on different displays, so the fonts need to have dynamic pixel perfect scaling. No SDF fonts used for now, try to generate fonts for all current displays, if they differ in size/DPI. Try also SDF gen tho, if it's fast enough to gen now.

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.