Skip to content

Commit

Permalink
refact(examples): minor update old imgui demo
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Aug 15, 2020
1 parent b2f87de commit 64527b3
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions examples/imgui/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@ import { timedResult } from "@thi.ng/bench";
import { line, normalizedPath, pathFromSvg } from "@thi.ng/geom";
import { canvas } from "@thi.ng/hdom-canvas";
import { DOWNLOAD, RESTART } from "@thi.ng/hiccup-carbon-icons";
import { gridLayout, GridLayout, layoutBox } from "@thi.ng/layout";
import { clamp, PI } from "@thi.ng/math";
import { setInManyUnsafe } from "@thi.ng/paths";
import { gestureStream } from "@thi.ng/rstream-gestures";
import { float } from "@thi.ng/strings";
import { comp, iterator, map, mapcat, step } from "@thi.ng/transducers";
import { updateDOM } from "@thi.ng/transducers-hdom";
import { sma } from "@thi.ng/transducers-stats";
import { add2, hash, min2, setC2, Vec, vecOf, ZERO2 } from "@thi.ng/vectors";
import {
buttonH,
buttonV,
Expand All @@ -36,6 +27,9 @@ import {
toggle,
xyPad,
} from "@thi.ng/imgui";
import { gridLayout, GridLayout, layoutBox } from "@thi.ng/layout";
import { clamp, PI } from "@thi.ng/math";
import { setInManyUnsafe } from "@thi.ng/paths";
import {
fromAtom,
fromDOMEvent,
Expand All @@ -44,6 +38,12 @@ import {
sidechainPartition,
sync,
} from "@thi.ng/rstream";
import { gestureStream } from "@thi.ng/rstream-gestures";
import { float } from "@thi.ng/strings";
import { comp, iterator, map, mapcat, step } from "@thi.ng/transducers";
import { updateDOM } from "@thi.ng/transducers-hdom";
import { sma } from "@thi.ng/transducers-stats";
import { add2, hash, min2, setC2, Vec, vecOf, ZERO2 } from "@thi.ng/vectors";

// define theme colors in RGBA format for future compatibility with
// WebGL backend
Expand Down Expand Up @@ -97,9 +97,23 @@ const mkIcon = (icon: any[]) => [
const ICON1 = mkIcon(DOWNLOAD);
const ICON2 = mkIcon(RESTART);

interface AppState {
uiVisible: boolean;
uiMode: number;
theme: number;
radius: number;
gridW: number;
rgb: number[];
pos: Vec;
txt: string;
toggles: boolean[];
flags: boolean[];
radio: number;
}

// main immutable app state wrapper (with time travel)
const DB = new History(
new Atom({
new Atom<AppState>({
uiVisible: true,
uiMode: 0,
theme: 0,
Expand Down

0 comments on commit 64527b3

Please sign in to comment.