Git Product home page Git Product logo

imgui-knobs's Introduction

ImGui Knobs

This is a port/adaptation of imgui-rs-knobs, for C++.

image

Usage

Add imgui-knobs.cpp and imgui-knobs.h to your project and include imgui-knobs.h in some source file.

static float value = 0;

if (ImGuiKnobs::Knob("Volume", &value, -6.0f, 6.0f, 0.1f, "%.1fdB", ImGuiKnobVariant_Tick)) {
    // value was changed
}

Draw knobs using either Knob or KnobInt. The API is:

bool ImGuiKnobs::Knob(label, *value, min, max, [speed, format, variant, size, flags, steps])
bool ImGuiKnobs::KnobInt(label, *value, min, max, [speed, format, variant, size, flags, steps])

Variants

variant determines the visual look of the knob. Available variants are: ImGuiKnobVariant_Tick, ImGuiKnobVariant_Dot, ImGuiKnobVariant_Wiper, ImGuiKnobVariant_WiperOnly, ImGuiKnobVariant_WiperDot, ImGuiKnobVariant_Stepped, ImGuiKnobVariant_Space.

Flags

  • ImGuiKnobFlags_NoTitle: Hide the top title.
  • ImGuiKnobFlags_NoInput: Hide the bottom drag input.
  • ImGuiKnobFlags_ValueTooltip: Show a tooltip with the current value on hover.
  • ImGuiKnobFlags_DragHorizontal: Use horizontal dragging (default is vertical).

Size

You can specify a size given as the width of the knob (will be scaled according to ImGui's FontGlobalScale). Default (0) will use 4x line height.

Steps

Steps determines the number of steps draw, it is only used for the ImGuiKnobVariant_Stepped variant.

imgui-knobs's People

Contributors

altschuler avatar nitz avatar madman10k avatar leonsal avatar

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.