1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-29 04:40:03 -04:00

Rename to Emigui

This commit is contained in:
Emil Ernerfeldt
2019-01-12 23:07:30 +01:00
parent 1e8a4d3906
commit 8963a99a09
26 changed files with 281 additions and 249 deletions

View File

@@ -25,13 +25,13 @@
}
/**
* @param {string} arg0
* @returns {Painter}
* @returns {State}
*/
__exports.new_webgl_painter = function(arg0) {
__exports.new_webgl_gui = function(arg0) {
const ptr0 = passStringToWasm(arg0);
const len0 = WASM_VECTOR_LEN;
try {
return Painter.__wrap(wasm.new_webgl_painter(ptr0, len0));
return State.__wrap(wasm.new_webgl_gui(ptr0, len0));
} finally {
wasm.__wbindgen_free(ptr0, len0 * 1);
@@ -41,15 +41,15 @@
};
/**
* @param {Painter} arg0
* @param {State} arg0
* @param {string} arg1
* @returns {void}
*/
__exports.paint_webgl = function(arg0, arg1) {
__exports.run_gui = function(arg0, arg1) {
const ptr1 = passStringToWasm(arg1);
const len1 = WASM_VECTOR_LEN;
try {
return wasm.paint_webgl(arg0.ptr, ptr1, len1);
return wasm.run_gui(arg0.ptr, ptr1, len1);
} finally {
wasm.__wbindgen_free(ptr1, len1 * 1);
@@ -155,6 +155,14 @@ __exports.__widl_f_height_HTMLCanvasElement = function(arg0) {
return __widl_f_height_HTMLCanvasElement_target.call(getObject(arg0));
};
const __widl_f_now_Performance_target = typeof Performance === 'undefined' ? null : Performance.prototype.now || function() {
throw new Error(`wasm-bindgen: Performance.now does not exist`);
};
__exports.__widl_f_now_Performance = function(arg0) {
return __widl_f_now_Performance_target.call(getObject(arg0));
};
__exports.__widl_instanceof_WebGLRenderingContext = function(idx) {
return getObject(idx) instanceof WebGLRenderingContext ? 1 : 0;
};
@@ -441,6 +449,30 @@ __exports.__widl_f_vertex_attrib_pointer_with_i32_WebGLRenderingContext = functi
__widl_f_vertex_attrib_pointer_with_i32_WebGLRenderingContext_target.call(getObject(arg0), arg1, arg2, arg3, arg4 !== 0, arg5, arg6);
};
const __widl_f_viewport_WebGLRenderingContext_target = typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype.viewport || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.viewport does not exist`);
};
__exports.__widl_f_viewport_WebGLRenderingContext = function(arg0, arg1, arg2, arg3, arg4) {
__widl_f_viewport_WebGLRenderingContext_target.call(getObject(arg0), arg1, arg2, arg3, arg4);
};
const __widl_f_drawing_buffer_width_WebGLRenderingContext_target = GetOwnOrInheritedPropertyDescriptor(typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype, 'drawingBufferWidth').get || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.drawingBufferWidth does not exist`);
};
__exports.__widl_f_drawing_buffer_width_WebGLRenderingContext = function(arg0) {
return __widl_f_drawing_buffer_width_WebGLRenderingContext_target.call(getObject(arg0));
};
const __widl_f_drawing_buffer_height_WebGLRenderingContext_target = GetOwnOrInheritedPropertyDescriptor(typeof WebGLRenderingContext === 'undefined' ? null : WebGLRenderingContext.prototype, 'drawingBufferHeight').get || function() {
throw new Error(`wasm-bindgen: WebGLRenderingContext.drawingBufferHeight does not exist`);
};
__exports.__widl_f_drawing_buffer_height_WebGLRenderingContext = function(arg0) {
return __widl_f_drawing_buffer_height_WebGLRenderingContext_target.call(getObject(arg0));
};
__exports.__widl_instanceof_Window = function(idx) {
return getObject(idx) instanceof Window ? 1 : 0;
};
@@ -452,6 +484,13 @@ __exports.__widl_f_document_Window = function(arg0) {
};
__exports.__widl_f_performance_Window = function(arg0) {
const val = getObject(arg0).performance;
return isLikeNone(val) ? 0 : addHeapObject(val);
};
__exports.__wbg_new_c1b585153cd441ad = function(arg0) {
return addHeapObject(new Float32Array(getObject(arg0)));
};
@@ -508,16 +547,16 @@ __exports.__wbg_buffer_0413d5edaa0ff323 = function(arg0) {
return addHeapObject(getObject(arg0).buffer);
};
function freePainter(ptr) {
function freeState(ptr) {
wasm.__wbg_painter_free(ptr);
wasm.__wbg_state_free(ptr);
}
/**
*/
class Painter {
class State {
static __wrap(ptr) {
const obj = Object.create(Painter.prototype);
const obj = Object.create(State.prototype);
obj.ptr = ptr;
return obj;
@@ -526,11 +565,11 @@ class Painter {
free() {
const ptr = this.ptr;
this.ptr = 0;
freePainter(ptr);
freeState(ptr);
}
}
__exports.Painter = Painter;
__exports.State = State;
__exports.__wbindgen_object_clone_ref = function(idx) {
return addHeapObject(getObject(idx));
@@ -600,7 +639,7 @@ __exports.__wbindgen_throw = function(ptr, len) {
function init(path_or_module) {
let instantiation;
const imports = { './emgui_wasm': __exports };
const imports = { './emigui_wasm': __exports };
if (path_or_module instanceof WebAssembly.Module) {
instantiation = WebAssembly.instantiate(path_or_module, imports)
.then(instance => {

View File

@@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<head>
<title>Emgui A experiment in an Immediate Mode GUI written in Rust</title>
<title>Emigui A experiment in an Immediate Mode GUI written in Rust</title>
<style>
html {
/* Remove touch delay: */
@@ -35,7 +35,7 @@
delete WebAssembly.instantiateStreaming;
</script>
<!-- this is the JS generated by the `wasm-bindgen` CLI tool -->
<script src="emgui_wasm.js"></script>
<script src="emigui_wasm.js"></script>
<script>
// we'll defer our execution until the wasm is ready to go
function wasm_loaded() {
@@ -44,16 +44,16 @@
}
// here we tell bindgen the path to the wasm file so it can start
// initialization and return to us a promise when it's done
wasm_bindgen("./emgui_wasm_bg.wasm")
wasm_bindgen("./emigui_wasm_bg.wasm")
.then(wasm_loaded)["catch"](console.error);
// ----------------------------------------------------------------------------
var g_webgl_painter = null;
function paint_gui(canvas, input) {
if (g_webgl_painter === null) {
g_webgl_painter = wasm_bindgen.new_webgl_painter("canvas");
g_webgl_painter = wasm_bindgen.new_webgl_gui("canvas");
}
wasm_bindgen.paint_webgl(g_webgl_painter, JSON.stringify(input));
wasm_bindgen.run_gui(g_webgl_painter, JSON.stringify(input));
}
// ----------------------------------------------------------------------------
var g_mouse_pos = { x: -1000.0, y: -1000.0 };