Socket
Socket
Sign inDemoInstall

github.com/inkyblackness/imgui-go

Package Overview
Dependencies
1
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    github.com/inkyblackness/imgui-go

Package imgui contains all the functions to create an immediate mode graphical user interface based on Dear ImGui. For integration, please refer to the dedicated repository https://github.com/inkyblackness/imgui-go-examples , which contains ported examples of the C++ version, available to Go. The exported functions and constants are named closely to that of the wrapped library. If a function has optional parameters, it will be available in two versions: A verbose one, which has all optional parameters listed, and a terse one, with only the mandatory parameters in its signature. The verbose variant will have the suffix V in its name. For example, there are and The terse variant will list the default parameters it uses to call the verbose variant. There are several types which are based on uintptr. These are references to the wrapped instances in C++. You will always get to such a reference via some function - you never "instantiate" such an instance on your own.


Version published

Readme

Source

Dear ImGui for Go

Go Doc Go Report Card GolangCI

This library is a Go wrapper for Dear ImGui.

This wrapper started as a special-purpose wrapper for use within InkyBlackness. However, it is self-contained and can be used for other purposes as well.

This wrapper is

  • hand-crafted, for Go
  • documented
  • versioned
  • with ported examples in a separate repository (see below)

Screenshot from example

API naming

Names of types and functions follow closely those of Dear ImGui.

For functions that have optional parameters, the following schema is applied:

  • There is the "verbose" variant, followed by the letter V, such as ButtonV(id string, size Vec2) bool
  • Next to it there is the "idiomatic" variant, without any optional parameter, such as Button(id string) bool.
  • The idiomatic variant calls the verbose variant with the default values for the optional parameters. Functions that don't have optional parameters don't come in a verbose variant.

The Dear ImGui functions IO() and Style() have been renamed to be CurrentIO() and CurrentStyle(). This was done because their returned types have the same name, causing a name clash. With the Current prefix, they also better describe what they return.

API philosophy

This library does not intend to export all the functions of the wrapped ImGui. The following filter applies as a rule of thumb:

  • Functions marked as "obsolete" are not available. (The corresponding C code isn't even compiled - disabled by define)
  • "Shortcut" Functions, which combine language features and/or other ImGui functions, are not available. Prime example are the Text*() functions for instance: Text formatting should be done with fmt.Sprintf(), and style formatting with the corresponding Push/Pop functions.
  • Functions that are not needed by InkyBlackness are ignored. This doesn't mean that they can't be in the wrapper, they are simply not a priority. Feel free to propose an implementation or make a pull request, respecting the previous points :)

Version philosophy

This library does not mirror the versions of the wrapped ImGui. The semantic versioning of this wrapper is defined as:

  • Major changes: (Breaking) changes in API or behaviour. Typically done through changes in ImGui.
  • Minor changes: Extensions in API. Typically done through small version increments of ImGui and/or exposing further features in a compatible way.
  • Patch changes: Bug fixes - either in the wrapper or the wrapped ImGui, given that the API & behaviour remains the same.

At the moment, this library uses version 1.67 of ImGui.

Examples

A separate repository was created to host ported examples and reference implementations. See repository inkyblackness/imgui-go-examples.

It contains reference implementations for libraries such as GLFW3 and SDL2, using OpenGL.

The screenshot above was created with such an example.

Alternatives

Before this project was created, the following alternatives were considered - and ignored:

  • kdrag0n/go-imgui. Reasons for dismissal at time of decision:
    • Auto-generated bloat, which doesn't help
    • Was using old API (1.5x)
    • Did not compile (Issues 1 and 3)
    • Project appeared to be abandoned
  • Extrawurst/cimgui. Reasons for dismissal at time of decision:
    • Was using old API (1.5x), 1.6x was attempted
    • Apparently semi-exposed the C++ API, especially through the structures
    • Adding this adds another dependency

License

The project is available under the terms of the New BSD License (see LICENSE file). The licenses of included sources are stored in the _licenses folder.

FAQs

Last updated on 25 Dec 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc