ImTui: Immediate Mode Text-based User Interface C++ Library

Overview

imtui

Actions Status ImTui v1.0.4 badge Dear ImGui version badge

ImTui is an immediate mode text-based user interface library. Supports 256 ANSI colors and mouse/keyboard input.

imtui-sample

hnterm2

imtui-tables

wtf-tui-demo

image

image

Live demo in the browser

Even though this library is supposed to be used in the terminal, for convenience here is an Emscripten build to demonstrate what it looks like, by simulating a console in the browser:

Note: the demos work best with Chrome

Details

This library is 99.9% based on the popular Dear ImGui library. ImTui simply provides an ncurses interface in order to draw and interact with widgets in the terminal. The entire Dear ImGui interface is available out-of-the-box.

For basic usage of ImTui, check one of the available samples:

Building

ImTui depends only on libncurses

Linux and Mac:

git clone https://github.com/ggerganov/imtui --recursive
cd imtui
mkdir build && cd build
cmake ..
make

./bin/imtui-example-ncurses0

Windows:

Partial Windows support is currently available using MSYS2 + MinGW + PDCurses:

# install required packages in an MSYS2 terminal:
pacman -S git cmake make mingw-w64-x86_64-dlfcn mingw-w64-x86_64-gcc mingw-w64-x86_64-pdcurses mingw-w64-x86_64-curl

# build
git clone https://github.com/ggerganov/imtui --recursive
cd imtui
mkdir build && cd build
cmake ..
make

./bin/hnterm.exe

For more information, checkout the following discussion: #19

Emscripten:

git clone https://github.com/ggerganov/imtui --recursive
cd imtui
mkdir build && cd build
emconfigure cmake ..
make
Comments
  • Cursor position desync after moving a window

    Cursor position desync after moving a window

    After moving a window, the cursor selects buttons slightly higher then were the cursor is drawn. I'm talking about moving an ImTui window, not the whole browser window. Having the issue on Firefox 71.0 (64-bit).

    bug 
    opened by FrankvdStam 10
  • Missing ImGui Tables demo

    Missing ImGui Tables demo

    Currently, Imtui seems to support Imgui v1.81 whose demo has a bunch of table related stuff, which Imtui seems to be missing.

    ImGui Demo v1.81 (has lots of table related demo items):

    image

    ImTui (master) (ncurses_demo) (doesn't have majority of table related items):

    image

    enhancement 
    opened by dufferzafar 5
  • ncurses example is not working (cannot click on things)

    ncurses example is not working (cannot click on things)

    I'm unable to click on anything in ncurses example. It just selects text (even title says that, it changes from <path_to_exe> to Select <path_to_exe>). Right-click or pressing some key resets select mode, but there is no way for me to make example application work unfortunately.

    I'm compiling with MSYS2 64-bit with MinGW-w64 64-bit compiler on Windows 10. I had issue with compilation as mentioned in issue #1, maybe it is relevant to this problem in some way.

    help wanted 
    opened by WSSDude 5
  • No display on tmux

    No display on tmux

    It might be more like an issue of tmux. Both hnterm and imtui-example-ncurses0 worked well in my terminal, but when I run them using tmux, I didn't see anything.

    That happened on macOS Catalina with any kind of terminal. I used default .tmux.conf.

    bug 
    opened by toyboot4e 4
  • It would be so nice

    It would be so nice

    If we could say farewell to the 70's. Why we are still fixated to the idea that everything is a tty and we need to use ANSI escape codes to hack around the fact the 70's is over and you don't have a line-printer in your living room? Why nobody (literally, nobody) attempts to make any real changes, like you know, to create hi-res modern command-line (ow, you can't fallback then to runlevel1 to run our superduper (TM) program! You would actively exclude users!!!! NONONO). This is all bullsit, to ride on the existing terminal, and you know what, the silly thing is even the terminal emulators doing things differently, so at the end of the day libs like this and the retarded ncurses will be full of hack and cases and still it will provide some features which won't be supported by all term emulators. But noooooo, we can't do anything new, we have to sit in this swamp created by made-up scientists in the 70's, not because they were evil or something, but because they were employed by telecommunication. But no, linux, unis, bsd, mac and everybody thinks nooo, U CANT TOUCH THIS!! You know what? I would like to beat everybody up who is responsible for the sorry state of the modern personal computing, and for the available operating systems. There was nice ideas, but NOOOO, we had to settle down with the worst possible option. unix, were we bolt and glue layers above layers and above layer.

    Fck you for continuing this. But really. Fuck you! Your are ALSO the reason why we can't have nice things.

    Now go and close this ticket without spending any minute to think about why the "Beat up a programmer, he will know why he got it" movement exist and why they beat up programmers.

    So again: fuck you.

    opened by extrowerk 3
  • Linking problem with ImTui

    Linking problem with ImTui

    Hello,

    I am currently trying to include ImTui to my current console project. I followed instructions and it seems there is some linking problems (probably trivial, I am not too familiar with c/c++ world). I am using CMake and linked all ImTui .a files, I also have ncurses linked to my project. Result when I try to build and run my project:

    /usr/bin/ld: /home/shardine/projects/neonlit/client/../lib/libimtui-ncurses.a(imtui-impl-ncurses.cpp.o): in function `ImTui_ImplNcurses_Init(bool, float, float)':
    imtui-impl-ncurses.cpp:(.text+0xd2): undefined reference to `initscr'
    /usr/bin/ld: imtui-impl-ncurses.cpp:(.text+0xd7): undefined reference to `use_default_colors'
    /usr/bin/ld: imtui-impl-ncurses.cpp:(.text+0xdc): undefined reference to `start_color'
    /usr/bin/ld: imtui-impl-ncurses.cpp:(.text+0xe1): undefined reference to `cbreak'
    /usr/bin/ld: imtui-impl-ncurses.cpp:(.text+0xe6): undefined reference to `noecho'
    /usr/bin/ld: imtui-impl-ncurses.cpp:(.text+0xed): undefined reference to `curs_set'
    /usr/bin/ld: imtui-impl-ncurses.cpp:(.text+0xf4): undefined reference to `stdscr'
    /usr/bin/ld: imtui-impl-ncurses.cpp:(.text+0xfe): undefined reference to `nodelay'
    /usr/bin/ld: imtui-impl-ncurses.cpp:(.text+0x105): undefined reference to `stdscr'
    /usr/bin/ld: imtui-impl-ncurses.cpp:(.text+0x10c): undefined reference to `wtimeout'
    /usr/bin/ld: imtui-impl-ncurses.cpp:(.text+0x116): undefined reference to `set_escdelay'
    /usr/bin/ld: imtui-impl-ncurses.cpp:(.text+0x11d): undefined reference to `stdscr'
    /usr/bin/ld: imtui-impl-ncurses.cpp:(.text+0x127): undefined reference to `keypad'
    /usr/bin/ld: imtui-impl-ncurses.cpp:(.text+0x25b): undefined reference to `stdscr'
    /usr/bin/ld: imtui-impl-ncurses.cpp:(.text+0x313): undefined reference to `mouseinterval'
    /usr/bin/ld: imtui-impl-ncurses.cpp:(.text+0x31f): undefined reference to `mousemask'
    

    so all the link problems seems to be with ncurses. Do you know what I am doing wrong here?

    Best regards.

    build problem 
    opened by SeveriSuominen 3
  • Experiencing slow framerate

    Experiencing slow framerate

    [MSVC 15 2017 Win32], Windows 10 Command Prompt, using PDCurses I had to fiddle a bit to make it work ( tweaking small things in the CMakeLists.txt to link PDCurses properly ). Then, even in release build, the refresh is very slow in the imtui-example-ncurses0 demo executable. I experience approximately 10fps, even the Web Assembly demo is faster and more responsive. It looks like it is spending a lot of time in ImTui_ImplNcurses_NewFrame > wgetch > sleep. Disabling the std::this_thread::sleep_for did not help either. I can provide more information if needed.

    bug 
    opened by Clement-Praxinos 3
  • Unnecesarily restrict C++ standard on CMake

    Unnecesarily restrict C++ standard on CMake

    The CMakeLists file sets C++17 as the necessary C++ standard to compile imtui (https://github.com/ggerganov/imtui/blob/418552cbd35a2b468bcac5026903a0b7d3997815/CMakeLists.txt#L85) but the project compiles and runs correctly on C++11 (tested with gcc 4.8.5 on rhel7).

    Is there a real need for that?

    opened by JoseTomasTocino 3
  • Moving outside popup menu title does not close menu

    Moving outside popup menu title does not close menu

    Repro:

    • Open https://imtui.ggerganov.com/
    • Open subsection "Popups & Modal windows"
    • Open subsection "Popups"
    • Click "File"
    • Move cursor down from "(dummy menu)" past "Save As.." to "Options"
    • Move cursor one entry down

    Expected:

    "Options" menu closes

    Actual:

    "Options" menu stays open

    Unrelated, it would appear as though there is a small rendering issue with the menu itself (screenshot attached) Screenshot from 2019-12-27 11-02-39

    bug 
    opened by tekknolagi 3
  • Help using imtui in personal project

    Help using imtui in personal project

    First of all apologies for this newbie question, but I am struggling with too many things at the same time: imtui, c++, cmakefiles, static vs dynamic libraries, etc. so I am not sure where the error may be, or whether my approach may not be the better one.

    Let me try to break out my problem in parts to make it easier for you to understand and advice

    First of all, what I actually want to do I want to create a dummy hello-world imtui example from scratch, and build it in my own ~/projects/imtui-hello folder, with as minimal cmake/dependencies as possible. This is, ideally I'd like to have a hello-imtui.cpp file so I can do something like g++ -Wall [-I SOME_INCLUDE -DSOME_OPTION -SOMETHING_ELSE] ./imtui.cpp.

    Can I do a simple build like that or do I actually need to use a CMakeFileLists.txt? Do I need to have the imgui forked dependency cloned on my hello-world folder (i.e. as in imtui/third-party/imgui? What if I install (make install) the (forked) imgui on its own to my system so I do not need to have a cloned imgui for each dummy folder I want to experiment with?

    Now, I know there is an examples/ncurses0 but I want to do something much more minimal (dummy box with "hello world" text) than this. Additionally, I am also totally getting lost with the amount of CMake stuff that I do not know how to "re-use" it for this bare minimum experimentation folder

    What I have done I've properly build imtui, and ran the examples that are generated on bin folder. I have also installed imtui by issuing a make install. This is, imtui is working and, in theory, properly installed.

    I am on Fedora 35 if that's of any help


    Again, apologies if I am missing something basic here...

    question build problem 
    opened by kiteloopdesign 2
  • cmake error linux

    cmake error linux

    `-- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE
    -- Found CURL: /usr/lib64/libcurl.so (found version "7.69.1")
    -- Configuring done CMake Error at third-party/CMakeLists.txt:15 (add_library): Cannot find source file:

    imgui/imgui/imgui.cpp
    

    Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx

    CMake Error at third-party/CMakeLists.txt:15 (add_library): No SOURCES given to target: imgui-for-imtui

    CMake Generate step failed. Build files cannot be regenerated correctly.`

    build problem 
    opened by 0xtrzy 2
  • The first row is missing at the table demo Vertical scrolling, with clipping"">

    The first row is missing at the table demo "Tables & Columns > Vertical scrolling, with clipping"

    It seems that the table demo ("Tables & Columns > Vertical scrolling, with clipping") has bug, the first row is missing when you scroll down

    Safari/605.1.15

    image

    MacOS Terminal/2.12.7

    image

    bug 
    opened by miles170 0
  • VSlider knob clips at top and often also at the bottom

    VSlider knob clips at top and often also at the bottom

    This is visible in the imtui online demo (so it should be easy to see): if you go under Widgets / Vertical Sliders the sliders have knobs that are 2 rows tall, except when at the very top they are being rendered as one row tall... but clearly with the space where the second row would be being rendered, so it isn't like it is somehow off the top of the slider or anything. Some of the sliders (the ones towards the left) are exhibiting the same behavior at the bottom.

    opened by saurik 1
  • No output in tmux / screen

    No output in tmux / screen

    Using imtui from within a tmux session, I get a completely blank screen. Looking in the debugger, the render loop does appear to be running, but nothing is visible. I believe tmux uses the alternate screen itself, so maybe we're toggling out of that mode and sending output to the wrong place? I also tested from screen and see the same behaviour, so I don't think it's a bug in tmux.

    opened by davidchisnall 2
  • Upstreaming plans?

    Upstreaming plans?

    Do you have plans to upstream your changes to Dear ImGui? I would like to be able to dynamically choose between a TUI and a GUI (ideally even a remote web GUI) in a single binary but that requires a single version of Dear ImGui that I can use and have different code paths to enable backend-specific configurations within my tool.

    question 
    opened by davidchisnall 2
  • Navigation borders are huge and confusing

    Navigation borders are huge and confusing

    When keyboard navigation is enabled, the borders around the selected control are drawn two characters wide, with one character of space between them and the selected control. This is huge in general and in things like combo boxes is incredibly confusing.

    This can be fixed by patching ImGui::RenderNavHighlight method to disable both of the if (flags & ... blocks. It would be nice if the back end had some mechanism for telling Dear ImGui not to render these borders.

    bug 
    opened by davidchisnall 3
  • Mouse movement does not work under ncurses-6.2

    Mouse movement does not work under ncurses-6.2

    terminal emulator : windows terminal preview 1.12.2931.0 ncurses : 6.2

    Cannot receive mouse movement events

    Mouse movement works under ncurses-5.x, but not reporting mouse movements after columns 94

    opened by hardboydu 0
Releases(v1.0.5)
Immediate mode 3D gizmo for scene editing and other controls based on Dear Imgui

ImGuizmo Latest stable tagged version is 1.83. Current master version is 1.84 WIP. What started with the gizmo is now a collection of dear imgui widge

Cedric Guillemet 2.3k Dec 27, 2022
A single-header ANSI C immediate mode cross-platform GUI library

Nuklear This is a minimal-state, immediate-mode graphical user interface toolkit written in ANSI C and licensed under public domain. It was designed a

Immediate Mode UIs, Nuklear, etc. 6.7k Dec 24, 2022
raygui is a simple and easy-to-use immediate-mode-gui library.

raygui is a simple and easy-to-use immediate-mode-gui library.

Ray 2k Dec 30, 2022
A tiny, portable, immediate-mode UI library written in ANSI C

A tiny, portable, immediate-mode UI library written in ANSI C Features Tiny: around 1100 sloc of ANSI C Works within a fixed-sized memory region: no a

null 2.5k Jan 6, 2023
The HorusUI library allows you to quickly develop GUIs for your applications by leveraging the ease of use provided by immediate mode GUI concepts.

Immediate Mode Graphical User Interface for Tools OVERVIEW The HorusUI library allows you to quickly develop GUIs for your applications by leveraging

null 133 Dec 12, 2022
FlatUI is a immediate mode C++ GUI library for games and graphical applications.

FlatUI is a immediate mode C++ GUI library for games and graphical applications. Go to our landing page to browse our documentation.

Google 610 Dec 23, 2022
This is a collection of widgets and utilities for the immediate mode GUI (imgui) that I am developing for the critic2 GUI

ImGui Goodies This is a collection of widgets and utilities for the immediate mode GUI (imgui) that I am developing for the critic2 GUI. Currently, th

null 95 Nov 19, 2022
This is a thin c-api wrapper programmatically generated for the excellent C++ immediate mode gui Dear ImGui.

cimgui This is a thin c-api wrapper programmatically generated for the excellent C++ immediate mode gui Dear ImGui. All imgui.h functions are programm

Victor Bombi 22 Jul 5, 2021
Library for writing text-based user interfaces

Termbox for RT-Thread 中文说明文档 This repository forks from nullgemm/termbox_next Getting started Termbox's interface only consists of 12 functions: tb_in

Meco Jianting Man 5 May 25, 2022
RmlUi - The HTML/CSS User Interface library evolved

RmlUi - The HTML/CSS User Interface Library Evolved RmlUi - now with added boosters taking control of the rocket, targeting your games and application

Michael R. P. Ragazzon 1.6k Jan 7, 2023
GPU Accelerated C++ User Interface, with WYSIWYG developing tools, XML supports, built-in data binding and MVVM features.

GacUI GPU Accelerated C++ User Interface, with WYSIWYG developing tools, XML supports, built-in data binding and MVVM features. Read the LICENSE first

Vczh Libraries 2.1k Jan 7, 2023
Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies

Dear ImGui (This library is available under a free and permissive license, but needs financial support to sustain its continued improvements. In addit

omar 44.5k Jan 7, 2023
ROS_Melodic_Qt_GUI_Template is a Graphical User Interface programmed with Qt framework.

This is a GUI template for ros to control your robot and read data from sensors.

null 28 Nov 15, 2022
AnUI is a powerful Graphical User Interface framework made for people that actually care about design!

What's AuUI ** Project is not finished ** AuUI, an abbreviation for "Actual Understandable User Interface" is a graphical user interface framework to

Goat 4 Jun 17, 2022
A simple/fast stacking box layout library. It's useful for calculating layouts for things like 2D user interfaces.

A simple/fast stacking box layout library. It's useful for calculating layouts for things like 2D user interfaces. It compiles as C99 or C++. It's tested with gcc (mingw64), VS2015, and clang/LLVM. You only need one file to use it in your own project: layout.h.

Andrew Richards 713 Dec 28, 2022
A small C library for building user interfaces with C, XML and CSS

LCUI A small C library for building user interfaces with C, XML and CSS. Table of contents Table of contents Introduction Features Screenshots Related

Liu 3.9k Dec 27, 2022
Fast UI Draw is a library that provides a higher performance Canvas interface.

Fast UI Draw is a library that provides a higher performance Canvas interface. It is designed so that it always draws using a GPU.

Intel Corporation 595 Dec 9, 2022
AirPods desktop user experience enhancement program

AirPodsDesktop AirPods desktop user experience enhancement program

Sprite 381 Jan 5, 2023
Arcan is a powerful development framework for creating virtually anything from user interfaces

Arcan is a powerful development framework for creating virtually anything from user interfaces for specialized embedded applications all the way to full-blown standalone desktop environments.

Bjorn Stahl 1.3k Dec 26, 2022