All Projects → flyover → Imgui Js

flyover / Imgui Js

Licence: mit
JavaScript bindings for Dear ImGui using Emscripten and TypeScript

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to Imgui Js

Imguizmo.quat
ImGui GIZMO widget - 3D object manipulator / orientator
Stars: ✭ 187 (-63.33%)
Mutual labels:  emscripten, imgui
Glchaos.p
3D GPUs Strange Attractors and Hypercomplex Fractals explorer - up to 256 Million particles in RealTime
Stars: ✭ 590 (+15.69%)
Mutual labels:  emscripten, imgui
Hello imgui
Hello, Dear ImGui: cross-platform Gui apps for Windows / Mac / Linux / iOS / Android / Emscripten with the simplicity of a "Hello World" app
Stars: ✭ 120 (-76.47%)
Mutual labels:  emscripten, imgui
roswasm suite
Libraries for compiling C++ ROS nodes to Webassembly using Emscripten
Stars: ✭ 62 (-87.84%)
Mutual labels:  imgui, emscripten
Imguifiledialog
File Dialog for ImGui : https://github.com/aiekick/ImGuiFileDialog
Stars: ✭ 398 (-21.96%)
Mutual labels:  emscripten, imgui
rotation master
Provide conversion between the major representations of 3D rotation and visualize the orientation of a rigid body
Stars: ✭ 157 (-69.22%)
Mutual labels:  imgui, emscripten
imgui
Dear ImGui Addons Branch = plain unmodified dear imgui plus some extra addon.
Stars: ✭ 348 (-31.76%)
Mutual labels:  imgui, emscripten
Ncine
A cross-platform 2D game engine
Stars: ✭ 372 (-27.06%)
Mutual labels:  emscripten, imgui
Glfm
OpenGL ES and input for iOS, tvOS, Android, and WebGL
Stars: ✭ 364 (-28.63%)
Mutual labels:  emscripten
Nuklear
A single-header ANSI C immediate mode cross-platform GUI library
Stars: ✭ 5,055 (+891.18%)
Mutual labels:  imgui
Viz.js
A hack to put Graphviz on the web.
Stars: ✭ 3,602 (+606.27%)
Mutual labels:  emscripten
Wac
WebAssembly interpreter in C
Stars: ✭ 372 (-27.06%)
Mutual labels:  emscripten
Webm.js
JavaScript WebM converter
Stars: ✭ 428 (-16.08%)
Mutual labels:  emscripten
Rbfx
Game engine with extensive C# support and WYSIWYG editor.
Stars: ✭ 356 (-30.2%)
Mutual labels:  imgui
Zep
Zep - An embeddable editor, with optional support for using vim keystrokes.
Stars: ✭ 477 (-6.47%)
Mutual labels:  imgui
Lumos
Cross-Platform C++ 2D/3D game engine
Stars: ✭ 343 (-32.75%)
Mutual labels:  imgui
Overload
3D Game engine with editor
Stars: ✭ 335 (-34.31%)
Mutual labels:  imgui
Imgui Go
Go wrapper library for "Dear ImGui" (https://github.com/ocornut/imgui)
Stars: ✭ 499 (-2.16%)
Mutual labels:  imgui
Brfv4 javascript examples
BRFv4 - HTML5/Javascript - examples project. Reference implementation for all other platform example packages.
Stars: ✭ 460 (-9.8%)
Mutual labels:  emscripten
Rustynes
👾 An NES emulator by Rust and WebAssembly
Stars: ✭ 399 (-21.76%)
Mutual labels:  emscripten

imgui-js

JavaScript bindings for Dear ImGui using Emscripten and TypeScript

Example

ImGui JavaScript+WebGL example

The original Dear ImGui demo code from imgui_demo.cpp has been ported to imgui_demo.ts. Also, the Memory Editor from the imgui_club project (imgui_memory_editor.h) has been ported to imgui_memory_editor.ts and added to the demo for browsing the Emscripten memory space.

ImGui JavaScript Sandbox

A CodePen using the Ace editor to live-edit a window.

ImGui JavaScript+Three.js example

A CodePen using Dear ImGui with Three.js.

Support

If you find this useful, please consider donating to this and the Dear ImGui project. I can also invoice for private support, custom development, etc.

PayPal donate button

Notes

All functions in the C++ ImGui namespace are exported at the top level of the module.

import * as ImGui from "imgui-js";

Individual exports can be imported as well.

import { ImVec2 } from "imgui-js";

In general, functions that take an address of a variable in C++ have been changed to take an access function in JavaScript. Calling the access function with no arguments returns the variable, calling with a value sets the variable.

type ImAccess<T> = (value?: T) => T;

let show: boolean = true;

const _show: ImAccess<boolean> = (_: boolean = show): boolean => show = _;

// get the value of show
console.log(_show()); // true

// set the value of show to false (also returns the updated value)
console.log(_show(false)); // false

In the following example, the address of show in the C++ code has been replaced with an inline arrow access function.

#include "imgui.h"
bool show = true;
void draw() {
    if (ImGui::Button("Toggle")) { show = !show; }
    if (show) {
        ImGui::Begin("My Window", &show, ImGuiWindowFlags_AlwaysAutoResize));
        ImGui::Text("Hello, World!");
        ImGui::End();
    }
}
import * as ImGui from "imgui-js";
let show: boolean = true;
function draw(): void {
    if (ImGui.Button("Toggle")) { show = !show; }
    if (show) {
        ImGui.Begin("My Window", (_ = show) => show = _, ImGui.WindowFlags.AlwaysAutoResize));
        ImGui.Text("Hello, World!");
        ImGui.End();
    }
}

Enumerations that begin with ImGui* are also exported with ImGui removed. So the following examples are equivalent.

import * as ImGui from "imgui-js";
const flags: ImGui.WindowFlags = ImGui.WindowFlags.AlwaysAutoResize;
import { ImGuiWindowFlags } from "imgui-js";
const flags: ImGuiWindowFlags = ImGuiWindowFlags.AlwaysAutoResize;

In order to minimize size of the output, the C++ library has been compiled with IMGUI_DISABLE_OBSOLETE_FUNCTIONS and IMGUI_DISABLE_DEMO_WINDOWS.

Building

  • git clone [email protected]:flyover/imgui-js.git
  • cd imgui-js
  • git submodule update --init --recursive
  • download and install Emscripten
  • npm install
  • make
  • make start-example-html

TODO

  • file I/O, imgui.ini, loading external fonts
  • implement ImGuiTextFilter (add support for JavaScript RegExp's)
  • implement ImGuiTextBuffer (simplify to array of strings)
  • fill in remainder of any missing API
  • automate the Emscripten install and environment setup in npm install

License

imgui-js is licensed under the MIT License, see LICENSE for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].