Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jstzwj committed Dec 5, 2018
1 parent 52a9adc commit d9e4319
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
libc = "0.2.9"
imgui-sys = "0.0.21"

[target.wasm32-unknown-unknown.dependencies]
stdweb = { version = "0.4.10", optional = true }
Expand Down
41 changes: 41 additions & 0 deletions src/imgui_stdweb.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@


#[derive(Debug, Clone)]
pub struct ImguiIO{
}

#[derive(Debug, Clone)]
pub struct ImDrawList{
draw_list:stdweb::Value
}

impl ImDrawList{
pub fn vtx_buffer(&self) -> &stdweb::Value{
self.draw_list.VtxBuffer
}

pub fn idx_buffer(&self) -> &stdweb::Value{
self.draw_list.IdxBuffer
}

pub fn flags(&self) -> &stdweb::Value{
self.draw_list.Flags
}

pub fn iterate_draw_lists(&self){

}
}

#[derive(Debug, Clone)]
pub struct Imgui{
Expand Down Expand Up @@ -36,4 +62,19 @@ impl Imgui{
};
ret
}

pub fn style_colors_dark(&self){
let module = &self.module;
js! {
return @{module}.StyleColorsDark();
};
}

#[allow(non_snake_case)]
pub fn IM_ASSERT(&self, cond:bool){
let module = &self.module;
js! {
@{module}.IM_ASSERT(@{cond});
};
}
}
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#[cfg(all(target_arch = "wasm32"))]
extern crate stdweb;

#[cfg(not(target_arch = "wasm32"))]
extern crate imgui_sys;

#[cfg(all(target_arch = "wasm32"))]
pub mod imgui_stdweb;
Expand Down

0 comments on commit d9e4319

Please sign in to comment.