https://github.com/blajanclaudiu/age
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (8.3%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: blajanclaudiu
- License: mit
- Language: TypeScript
- Default Branch: main
- Size: 1.27 MB
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 8
- Releases: 0
Metadata Files
README.md
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 (imguimemoryeditor.h) has been ported to imguimemoryeditor.ts and added to the demo for browsing the Emscripten memory space.
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.
Notes
All functions in the C++ ImGui namespace are exported at the top level of the module.
typescript
import * as ImGui from "imgui-js";
Individual exports can be imported as well.
typescript
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.
```typescript
type ImAccess
let show: boolean = true;
const show: ImAccess
// 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.
```c++
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(); } } ```
typescript
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.
typescript
import * as ImGui from "imgui-js";
const flags: ImGui.WindowFlags = ImGui.WindowFlags.AlwaysAutoResize;
typescript
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 git@github.com:flyover/imgui-js.gitcd imgui-jsgit submodule update --init --recursive- download and install Emscripten
npm installmakemake 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.
Owner
- Login: blajanclaudiu
- Kind: user
- Repositories: 1
- Profile: https://github.com/blajanclaudiu
GitHub Events
Total
- Issues event: 3
- Watch event: 1
- Pull request event: 5
- Create event: 7
Last Year
- Issues event: 3
- Watch event: 1
- Pull request event: 5
- Create event: 7
Dependencies
- @flyover/system git+https://github.com/flyover/system.ts.git development
- @rollup/plugin-alias ^3.1.1 development
- @rollup/plugin-commonjs ^17.1.0 development
- http-server ^0.12.3 development
- node-fetch ^2.6.0 development
- rollup ^2.41.2 development
- rollup-plugin-node-builtins ^2.1.2 development
- rollup-plugin-typescript2 ^0.30.0 development
- typescript ^4.2.3 development
- @types/emscripten ^1.39.4
- @types/node ^14.14.34
