A binding and backend of ImGui to make it render and work correctly with the raylib framework/Library. This is C++ but links with raylib.
#c++ #cpp #raylib #wrapper #binding #imgui #gamedev #ui #gui #dear-imgui #library
|
3 ani în urmă | |
---|---|---|
examples | 3 ani în urmă | |
extras | 3 ani în urmă | |
imgui @ dde31030e9 | 3 ani în urmă | |
raylib @ 8d6f9b3baa | 3 ani în urmă | |
.gitignore | 3 ani în urmă | |
.gitmodules | 3 ani în urmă | |
LICENSE | 3 ani în urmă | |
README.md | 3 ani în urmă | |
premake-2019.bat | 3 ani în urmă | |
premake5.lua | 3 ani în urmă | |
rlImGui.cpp | 3 ani în urmă | |
rlImGui.h | 3 ani în urmă | |
rlImGuiColors.h | 3 ani în urmă |
A Raylib integration with DearImGui
rlImgui provides a backend for Dear ImGui using Raylib.
Using rlImGui in your code is very easy. Once you have included the library, or source files for rlImGui and ImGui in your project, simply do the following.
#include "rlImGui.h" // include the API header
// before your game loop
rlImGuiSetup(true); // sets up ImGui with ether a dark or light default theme
// inside your game loop, between BeginDrawing() and EndDrawing()
rlImGuiBegin(); // starts the ImGui content mode. Make all ImGui calls after this
rlImGuiEnd(); // ends the ImGui content mode. Make all ImGui calls before this
// after your game loop is over, before you close the window
rlImGuiShutdown(); // cleans up ImGui
There are two example programs in the examples folder.
This is the most simple use of ImGui in raylib, it just shows the ImGui demo window.
This is a more complex example of ImGui, showing how to use raylib 2d and 3d cameras to draw into ImGui windows using render textures.
This file has a converter to change Raylib colors into ImGui Colors
The extras folder has files to help add icon fonts into ImGui. Functions to load the font and #defines for the font glyps are included in each header.
This is a header in the extras folder to add icons from Font Awesome into ImGui. https://fontawesome.com/ Simply call the add function to include the fonts in ImGui
rlImGuiAddFontAwesomeIconFonts(12);
This is a header in the extras folder to add icons from Fork Awesome into ImGui. https://forkaweso.me/Fork-Awesome/ Simply call the add function to include the fonts in ImGui
rlImGuiAddForkAwesomeIconFonts(12);
Raylib textures can be drawn in ImGui using the following functions
void rlImGuiImage(const Texture *image);
void rlImGuiImageSize(const Texture *image, int width, int height);
void rlImGuiImageRect(const Texture* image, int destWidth, int destHeight, Rectangle sourceRect);
ImGui is a C++ library, so rlImGui uses C++ to create the backend and integration with Raylib. The rlImGui.h API only uses features that are common to C and C++, so rlImGui can be built as a static library and used by pure C code. Users of ImGui who wish to use pure C must use an ImGui wrapper, such as [https://github.com/cimgui/cimgui].