Giter Site home page Giter Site logo

imgui-command-palette's Introduction

ImGui Command Palette

screenshot1

About

This library implements a Sublime Text or VSCode style command palette in ImGui. It is provided in the form of a window that you can choose to open/close based on condition (for example, when user pressed the shortcut Ctrl+Shift+P).

Features

  • Minimum C++ 11
  • Dynamic registration and unregistration of commands
  • Subcommands (prompting a new set of options after user selected a top-level command)
  • Fuzzy search of commands and subcommands
    • Highlighting of matched characters
      • Option: setting custom font
      • Option: setting custom text color

Planned Features

  • Support for std::string_view
  • Support for function pointers instead of std::function
  • Visualization of previously entered options (example: Sublime Merge)
  • Highlighting of matched characters using underline
  • Command history
  • Reducing the minimum required C++ version

Usage

Simply drop all .h and .cpp files in the project root folder to your buildsystem. Minimum of C++11 is required. No external dependencies except Dear ImGui are required.

See the examples for how to use the APIs.

Examples

The examples/ folder is organized in the following way:

  • The src/ and fonts/ folders contains source code and assets for the example app. If you want to hack away, the relevant code are all here!
  • The app-*/ folders each provide a separate way to build the project. Choose one that works the best for you -- they should all produce the same result.
    • app-vcpkg/ provides CMake + vcpkg build scripts
      $ pwd
      <project folder>/examples/app-vcpkg
      $ mkdir build
      $ cd build
      $ cmake .. -GNinja -DCMAKE_TOOLCHAIN_FILE="/path/to/your-vcpkg/scripts/buildsystem/vcpkg.cmake"
      $ ninja
    • app-manual/ provides CMake + system deps + file drop in
      • Ensure glfw3 is installed as a system package, available for CMakle find_package
      • Download the following files from https://github.com/ocornut/imgui and drop them in app-manual/
        • Every .h and .cpp in the root dir (that is, imgui itself)
        • backends/imgui_impl_glfw.h
        • backends/imgui_impl_glfw.cpp
        • backends/imgui_impl_opengl3.h
        • backends/imgui_impl_opengl3.cpp
        • backends/imgui_impl_opengl3_loader.h
      $ pwd
      <project folder>/examples/app-manual
      $ mkdir build
      $ cd build
      $ cmake .. -GNinja
      $ ninja

Once you have it built, run the examples with working directory = examples/. This is needed because the app uses relative paths to locate fonts. That is, if the build had produced examples/app-vcpkg/build/imcmd-demo.exe for example, you should run it as:

$ pwd
<project folder>/examples
$ ./app-vcpkg/build/build/imcmd-demo.exe โŽ

imgui-command-palette's People

Contributors

hnosmium0001 avatar pthom avatar root3287 avatar royawesome 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

imgui-command-palette's Issues

Build error

Im getting the following errors when i try to build, (i havent even included the header in my main file yet)

/Users/-/Developer/enigma/external/imgui/imgui_internal.h:101:2: error: Please '#define IMGUI_DEFINE_MATH_OPERATORS' _BEFORE_ including imgui.h!
#error Please '#define IMGUI_DEFINE_MATH_OPERATORS' _BEFORE_ including imgui.h!
 ^
/Users/-/Developer/enigma/external/imgui_command_palette/imcmd_command_palette.cpp:631:34: error: invalid operands to binary expression ('ImVec2' and 'ImVec2')
            window->DC.CursorPos + ImGui::CalcItemSize(size, 0.0f, 0.0f),
            ~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
make[2]: *** [CMakeFiles/enigma.dir/external/imgui_command_palette/imcmd_command_palette.cpp.o] Error 1
make[1]: *** [CMakeFiles/enigma.dir/all] Error 2

I moved the #define to be before the imgui.h but it still doesn't work. Any idea on how i can fix this?

Images

This is a issue used to host media files for various docs in the repo.

Suggestion: Specify in readme's build instructions for the example app that conan v2 is not supported

I was referring to this repository to implement a similar UI feature myself, and wanted to build the example app to refer to its behavior. I ended up on a whole adventure trying to build the example app, which was finally resolved by giving up trying to build with conan v2 and installing conan 1.61.0 instead. For anyone else who ends up wanting to build the example app who was not previously familiar with conan, it may save them quite a bit of time if this was stated in the build instructions.

Does not build, calculation of width deprecated.

To compile in the latest build of ImGui (or anything past about 2021), line 535 of imcmd_command_palette.cpp has to be changed to float width = ImGui::GetWindowContentRegionMax().x - ImGui::GetWindowContentRegionMin().x;

Annoucing Dear ImGui Bundle including imgui-command-palette and many others; with support for C++, Python and emscripten

I'm happy to announce the first public release of Dear ImGui Bundle. Dear ImGui Bundle is a bundle for Dear ImGui, including many powerful libraries from its ecosystem. It enables to easily create ImGui applications in C++ and Python, under Windows, macOS, Linux, emscripten. It is aimed at application developers, researchers, and beginner developers who want to quickly get started.

imgui-command-palette is a included in the widgets provided with it.

@hnOsmium0001 : sorry to hijack the issues list for this, and feel to close this issue; as this is just for your information. I informed @ocornut yesterday, and I plan to communicate about it in the ImGui gallery in the next hours.

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.