A (very) simple notification wrapper for Dear ImGui

Overview

imgui-notify

Is a header-only wrapper made to create notifications with Dear ImGui. As I couldn't find any library for this I just decided to create my own. We will use Font Awesome 5 for icons.

forthebadge forthebadge

Usage

#include "notify.h"

// Initialisation, once at the beggining of your code, usually after ImGui_ImplDX12_Init()
notify::init();

// Add a new toast
if (ImGui::Button("success!"))
{
    notify::insert({ toast_type::toast_type_success, 3000, "Hello World! This is a success! %s", "We can also format here:)" });
}

if (ImGui::Button("warning!"))
{
    notify::insert({ toast_type::toast_type_warning, 3000, "Hello World! This is a warning!" });
}

if (ImGui::Button("error!"))
{
    notify::insert({ toast_type::toast_type_error, 3000, "Hello World! This is an error!" });
}

if (ImGui::Button("info!"))
{
    notify::insert({ toast_type::toast_type_info, 3000, "Hello World! This is an info!" });
}

if (ImGui::Button("info!"))
{
    notify::insert({ toast_type::toast_type_info, 3000, "Hello World! This is an info! Yes I also support multiline text! 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" });
}

// Render toasts, at the end of your rendering
notify::render();

TODO

Add a fade in and out movement...

Result

Image from Gyazo

License

MIT license

You might also like...
Very fast C++ .PNG writer for 24/32bpp images.

fpng Very fast C++ .PNG writer for 24/32bpp images. fpng.cpp was written to see just how fast you can write .PNG's without sacrificing too much compre

Simpler ImGui Backend Implementation for VulkanHpp.
Simpler ImGui Backend Implementation for VulkanHpp.

ImGui-VulkanHpp Simpler ImGui Backend Implementation for VulkanHpp.

ZT is a zig-contained library that automatically compiles+links ImGui, OpenGL, and GLFW into typed packages.
ZT is a zig-contained library that automatically compiles+links ImGui, OpenGL, and GLFW into typed packages.

ZT is a zig-contained library that automatically compiles+links ImGui, OpenGL, and GLFW into typed packages. By zig contained I mean that ZT is intend

ImTricks is a collection of useful functions for expanding / improving the functionality of the ImGui.

ImTricks ImTricks is a collection of useful functions for expanding / improving the functionality of the ImGui. At the moment it has in itself: Functi

A ImGui Application with Multi Viewports and Docking using D3D11
A ImGui Application with Multi Viewports and Docking using D3D11

ImGui-Application Informations A ImGui Application with Multi Viewports and Docking using D3D11 Build You need the DirectX SDK, here the Download link

Expose the ImGui framework to clasp

Expose the ImGui framework to clasp Installing in the clasp source tree cd clasp/extensions git clone https://github.com/clasp-developers/imgui-clasp

Growtopia android modmenu with ImGui
Growtopia android modmenu with ImGui

Growtopia Android ImGUI Growtopia android modmenu with ImGUI. Features Built with ImGUI. Coming Soon None Requirements The following dependencies are

Partial source of the ImGui interfaces used in the Rocket League version of CodeRed.
Partial source of the ImGui interfaces used in the Rocket League version of CodeRed.

CodeRed-ImGui Raw source of the ImGui interfaces used in the Rocket League version of CodeRed. About This repo is just part of the ImGui source used i

Sample project to use ImGui + GLFW + OpenGL3

About just a sample project to use ImGui ( https://github.com/ocornut/imgui ) Note Windows 11 Visual Studio 2019 + cmake-gui WSL2 on Windows 11 apt in

Comments
  • NOTIFY_FORMAT doesn't compile

    NOTIFY_FORMAT doesn't compile

    i.e.

    imgui_notify.h:205:83: error: expected expression
        ImGuiToast(ImGuiToastType type, const char* format, ...) : ImGuiToast(type) { NOTIFY_FORMAT(this->set_content, format); }
    
    imgui_notify.h:23:120: note: expanded from macro 'NOTIFY_FORMAT'
    #define NOTIFY_FORMAT(fn, format, ...)  if (format) { va_list args; va_start(args, format); fn(format, args, __VA_ARGS__); va_end(args); }
    

    That's what my clangd 14.0.0 says image

    Clangd config: -Wno-unused-variable,-Wno-infinite-recursion,-Werror=implicit-function-declaration,-Wshadow,-Wno-shadow-field-in-constructor-modified,-Wno-shadow-ivar,-Wuninitialized,-Wunused-label,-Wunused-lambda-capture, ,--target=aarch64

    opened by caxapexac 4
  • GetMainViewport not defined

    GetMainViewport not defined

    GetMainViewport seems to be undefined, couldn't figure out why. Could it be an issue with my ImGUI version? I'm using v1.69.

    const auto vp_size = GetMainViewport()->Size;

    opened by sxck1337 1
  • sprintf_s in code

    sprintf_s in code

    line about 260-270

    char window_name[50];
    sprintf_s(window_name, "##TOAST%d", i);
    

    I'd suggest to replace it with ImFormat cuz not everyone has sprintf_s function

    opened by caxapexac 1
  • Icons aren't working

    Icons aren't working

    Hey, I followed your instructions and everything works fine except the Icons. I tried it with different fonts, but instead of an Icon it shows a colored Question mark "?". The font applys tho as the text changes the font style based on the Font that I use.

    I use the following code after the Init:

    writefont = io.Fonts->AddFontFromMemoryCompressedTTF(Font_Font_data, Font_Font_size, 16.f); ImFontConfig font_cfg; font_cfg.FontDataOwnedByAtlas = false; io.Fonts->AddFontFromMemoryCompressedTTF(Font_Font_data, Font_Font_size, 16.f, &font_cfg); ImGui::MergeIconsWithLatestFont(16.f, false);

    To use the font I do:

    ImGui::PushFont(writefont); //apply font ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 5.f); ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(43.f / 255.f, 43.f / 255.f, 43.f / 255.f, 255.f / 255.f)); ImGui::RenderNotifications(); ImGui::PopStyleVar(1); ImGui::PopStyleColor(1); ImGui::PopFont();

    opened by Baseult 0
Owner
Patrick
French student, learning reverse engineering and ASP.NET but mainly programing in C and C++.
Patrick
A file dialog library for Dear ImGui

ImFileDialog A simple file dialog library for Dear ImGui. This library supports favorites, actual Windows icons, image previews, zooming in, etc... DI

dfranx 398 Jan 3, 2023
dear imgui + glfw framework

ImFrame ImFrame is a lightweight framework designed to provide you with a window and graphical backend for the Dear ImGui library. Unlike more traditi

null 62 Dec 25, 2022
Markdown renderer for Dear ImGui using MD4C parser

imgui_md Markdown renderer for Dear ImGui using MD4C parser. C++11 or above imgui_md currently supports the following markdown functionality: Wrapped

Dmitry Mekhontsev 74 Dec 27, 2022
Example program for integrating Dear ImGui and GLFW into Source's App System

This is an example program for integrating Dear ImGui and GLFW into Source's app system, the same thing Source's tools use. Feel free to do with this

null 9 Apr 16, 2022
X11 + GLFW + Dear ImGUI Overlay

Dear ImGUI Overlay X11 + GLFW + Dear ImGUI Overlay made by rdbo Based on https://github.com/rdbo/glfw-overlay How to use? In main.c, there is a window

Rdbo 6 Dec 25, 2022
Minimal example of prototyping CLAP audio plugins using Dear ImGui as the user interface.

clap-imgui Minimal example of prototyping CLAP audio plugins using Dear ImGui as the user interface. This is intended as an example of presenting a UI

schwa 52 Dec 19, 2022
ImGuiFileDialog is a file selection dialog built for (and using only) Dear ImGui

ImGuiFileDialog Purpose ImGuiFileDialog is a file selection dialog built for (and using only) Dear ImGui. My primary goal was to have a custom pane wi

Aiekick 790 Jan 4, 2023
o/ ImGui Builder is a graphical framework for assembling imgui codes in your interface easily

IMGUI BUILDER The project consists a gui editor of the Imgui framework EDITOR Menu Export 1 - Export cpp file 2 - Cpp file Credits Credits for Shadowy

Code Building 405 Dec 20, 2022
A cross-platform wrapper for using SDL2 with ImGui

ImSDL2 ImSDL2 is an open source "wrapper" of imgui backends available for SDL2. It aims to provide a backend-independent yet simple interface for inte

terens 5 Feb 2, 2022
A simple API wrapper that generates images & facts of any animal

animality.h A simple API wrapper that generates images & facts of any animal Required dependencies: libcurl for sending HTTPS requests. pthreads for t

animality 5 Nov 10, 2022