Code Monkey home page Code Monkey logo

cimgui.jl-5d785b6c-b76f-510e-a07c-3070796c7e87's Introduction

CImGui

Build Status Build Status Codecov

This package provides a Julia language wrapper for cimgui: a thin c-api wrapper programmatically generated for the excellent C++ immediate mode gui Dear ImGui. Dear ImGui is mainly for creating content creation tools and visualization / debug tools. You could browse Gallery to get an idea of its use cases.

demo

Installation

pkg> add CImGui

Quick Start

  1. Run demo/demo.jl to test whether the default backend works on your machine.
  2. Run examples/demo.jl and browse demos in the examples folder to learn how to use the API.
  3. Read documentation or run ? CImGui.xxx to retrieve docs:
help?> CImGui.Begin
  Begin(name, p_open=C_NULL, flags=0) -> Bool

  Push window to the stack and start appending to it.

  Usage
  –––––––

    •    you may append multiple times to the same window during the same frame.

    •    passing p_open != C_NULL shows a window-closing widget in the upper-right corner of
        the window, which clicking will set the boolean to false when clicked.

    •    Begin return false to indicate the window is collapsed or fully clipped, so you may
        early out and omit submitting anything to the window.

  │ Note
  │
  │  Always call a matching End for each Begin call, regardless of its return value. This
  │  is due to legacy reason and is inconsistent with most other functions (such as
  │  BeginMenu/EndMenu, BeginPopup/EndPopup, etc.) where the EndXXX call should only be
  │  called if the corresponding BeginXXX function returned true.

Usage

The API provided in this package is as close as possible to the original C++ API. When translating C++ code to Julia, please follow the tips below:

  • Replace ImGui:: to CImGui.;
  • using LibCImGui to import all of the ImGuiXXX types into the current namespace;
  • Member function calling should be translated in Julia style: fonts.AddFont(cfg) => CImGui.AddFont(fonts, cfg);
  • Prefer to define colors as Vector{Cfloat} instead of CImGui.ImVec4;
  • CSyntax.jl provides two useful macros: @c for translating C's & operator on immutables and @cstatic-block for emulating C's static keyword;
  • pointer arithmetic: &A[n] should be translated to pointer(A) + n * sizeof(T) where n counts from 0.

As mentioned before, this package aims to provide the same user experience as the original C++ API, so any high-level abstraction should go into a more high-level package.

LibCImGui

LibCImGui is a thin wrapper over cimgui. It's one-to-one mapped to the original cimgui APIs. By using CImGui.LibCImGui, all of the ImGui-prefixed types, enums and ig-prefixed functions will be imported into the current namespace. It's mainly for people who prefer to use original cimgui's interface.

Backend

The default backend is based on ModernGL and GLFW which are stable and under actively maintained. Other popular backends like SFML and SDL could be added in the future if someone should invest time to make these packages work in post Julia 1.0 era.

License

Only the Julia code in this repo is released under MIT license. Other assets such as those fonts in the fonts folder are released under their own license.

cimgui.jl-5d785b6c-b76f-510e-a07c-3070796c7e87's People

Contributors

gnimuc avatar m-christian-l avatar

Watchers

James Cloos 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.