summaryrefslogtreecommitdiff
path: root/crates/client/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/client/src')
-rw-r--r--crates/client/src/client.rs (renamed from crates/client/src/common/client.rs)10
-rw-r--r--crates/client/src/client/assets.rs (renamed from crates/client/src/common/client/assets.rs)0
-rw-r--r--crates/client/src/client/assets/audio/test.wav (renamed from crates/client/src/common/client/assets/audio/test.wav)bin924 -> 924 bytes
-rw-r--r--crates/client/src/client/assets/meshes/square.obj (renamed from crates/client/src/common/client/assets/meshes/square.obj)0
-rw-r--r--crates/client/src/client/assets/shaders/flat/frag.glsl (renamed from crates/client/src/common/client/assets/shaders/flat/frag.glsl)0
-rw-r--r--crates/client/src/client/assets/shaders/flat/vert.glsl (renamed from crates/client/src/common/client/assets/shaders/flat/vert.glsl)0
-rw-r--r--crates/client/src/client/assets/textures/test.png (renamed from crates/client/src/common/client/assets/textures/test.png)bin714 -> 714 bytes
-rw-r--r--crates/client/src/common.rs8
-rw-r--r--crates/client/src/helpers.js13
-rw-r--r--crates/client/src/lib.rs6
-rw-r--r--crates/client/src/main.rs42
11 files changed, 8 insertions, 71 deletions
diff --git a/crates/client/src/common/client.rs b/crates/client/src/client.rs
index 69ac6b3..713d022 100644
--- a/crates/client/src/common/client.rs
+++ b/crates/client/src/client.rs
@@ -9,7 +9,7 @@ pub struct Game {
}
impl Game {
- pub async fn new(ctx: &context::Context) -> Self {
+ pub fn new(ctx: &context::Context) -> Self {
Self {
assets: assets::Assets::new(ctx),
}
@@ -25,10 +25,10 @@ impl teleia::state::Game for Game {
fn finish_title(&mut self, _st: &mut state::State) {}
fn mouse_press(&mut self, _ctx: &context::Context, _st: &mut state::State) {}
fn mouse_move(&mut self, _ctx: &context::Context, _st: &mut state::State, _x: i32, _y: i32) {}
- fn update(&mut self, ctx: &context::Context, _st: &mut state::State) -> Option<()> {
- Some(())
+ fn update(&mut self, ctx: &context::Context, _st: &mut state::State) -> Erm<()> {
+ Ok(())
}
- fn render(&mut self, ctx: &context::Context, st: &mut state::State) -> Option<()> {
+ fn render(&mut self, ctx: &context::Context, st: &mut state::State) -> Erm<()> {
ctx.clear();
self.assets.font.render_text(
ctx,
@@ -43,6 +43,6 @@ impl teleia::state::Game for Game {
&glam::Vec2::new(16.0, 16.0),
);
self.assets.mesh_square.render(ctx);
- Some(())
+ Ok(())
}
}
diff --git a/crates/client/src/common/client/assets.rs b/crates/client/src/client/assets.rs
index 742f9ea..742f9ea 100644
--- a/crates/client/src/common/client/assets.rs
+++ b/crates/client/src/client/assets.rs
diff --git a/crates/client/src/common/client/assets/audio/test.wav b/crates/client/src/client/assets/audio/test.wav
index 0eabe85..0eabe85 100644
--- a/crates/client/src/common/client/assets/audio/test.wav
+++ b/crates/client/src/client/assets/audio/test.wav
Binary files differ
diff --git a/crates/client/src/common/client/assets/meshes/square.obj b/crates/client/src/client/assets/meshes/square.obj
index 7328a6c..7328a6c 100644
--- a/crates/client/src/common/client/assets/meshes/square.obj
+++ b/crates/client/src/client/assets/meshes/square.obj
diff --git a/crates/client/src/common/client/assets/shaders/flat/frag.glsl b/crates/client/src/client/assets/shaders/flat/frag.glsl
index 7006a2b..7006a2b 100644
--- a/crates/client/src/common/client/assets/shaders/flat/frag.glsl
+++ b/crates/client/src/client/assets/shaders/flat/frag.glsl
diff --git a/crates/client/src/common/client/assets/shaders/flat/vert.glsl b/crates/client/src/client/assets/shaders/flat/vert.glsl
index e324f7e..e324f7e 100644
--- a/crates/client/src/common/client/assets/shaders/flat/vert.glsl
+++ b/crates/client/src/client/assets/shaders/flat/vert.glsl
diff --git a/crates/client/src/common/client/assets/textures/test.png b/crates/client/src/client/assets/textures/test.png
index 1f1edca..1f1edca 100644
--- a/crates/client/src/common/client/assets/textures/test.png
+++ b/crates/client/src/client/assets/textures/test.png
Binary files differ
diff --git a/crates/client/src/common.rs b/crates/client/src/common.rs
deleted file mode 100644
index 3599211..0000000
--- a/crates/client/src/common.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-#[cfg(target_arch = "wasm32")]
-pub mod client;
-
-#[cfg(not(target_arch = "wasm32"))]
-pub mod overlay;
-
-#[cfg(not(target_arch = "wasm32"))]
-pub mod server;
diff --git a/crates/client/src/helpers.js b/crates/client/src/helpers.js
deleted file mode 100644
index 20b86f4..0000000
--- a/crates/client/src/helpers.js
+++ /dev/null
@@ -1,13 +0,0 @@
-let resized = false;
-
-export async function js_track_resized_setup() {
- window.addEventListener("resize", () => {
- resized = true;
- });
-};
-
-export function js_poll_resized() {
- let ret = resized;
- resized = false;
- return ret;
-}
diff --git a/crates/client/src/lib.rs b/crates/client/src/lib.rs
index 3298f07..d928d0e 100644
--- a/crates/client/src/lib.rs
+++ b/crates/client/src/lib.rs
@@ -1,10 +1,10 @@
-mod common;
+mod client;
#[cfg(target_arch = "wasm32")]
use wasm_bindgen::prelude::*;
#[cfg(target_arch = "wasm32")]
#[wasm_bindgen]
-pub async fn main_js() {
- teleia::run(240, 160, common::client::Game::new).await;
+pub fn main_js() {
+ teleia::run(240, 160, teleia::Options::empty(), client::Game::new);
}
diff --git a/crates/client/src/main.rs b/crates/client/src/main.rs
deleted file mode 100644
index af8e753..0000000
--- a/crates/client/src/main.rs
+++ /dev/null
@@ -1,42 +0,0 @@
-mod common;
-
-#[cfg(not(target_arch = "wasm32"))]
-use clap::{command, Command};
-
-#[cfg(target_arch = "wasm32")]
-pub fn main() {} // dummy main, real wasm32 main is lib::main_js
-
-#[cfg(not(target_arch = "wasm32"))]
-#[tokio::main]
-pub async fn main() {
- let matches = command!()
- .propagate_version(true)
- .subcommand_required(true)
- .arg_required_else_help(true)
- .subcommand(
- Command::new("overlay")
- .about("Run the LCOLONQ model renderer in a full-screen transparent overlay")
- )
- .subcommand(
- Command::new("terminal")
- .about("Run the LCOLONQ model renderer in a terminal")
- )
- .subcommand(
- Command::new("server")
- .about("Run the LCOLONQ online websocket server")
- )
- .get_matches();
- match matches.subcommand() {
- Some(("overlay", _cm)) => {
- teleia::run("LCOLONQ", 1920, 1080, teleia::Options::OVERLAY, common::overlay::Overlay::overlay).await;
- },
- Some(("terminal", _cm)) => {
- teleia::run("LCOLONQ", 1920, 1080, teleia::Options::HIDDEN, common::overlay::Overlay::terminal).await;
- },
- Some(("server", _cm)) => {
- env_logger::Builder::new().filter(None, log::LevelFilter::Info).init();
- log::info!("starting LCOLONQ server...");
- },
- _ => unreachable!("no subcommand"),
- }
-}