mirror of
https://github.com/Xevion/Pac-Man.git
synced 2025-12-06 21:15:48 -06:00
chore: remove unused functions, add 'web' task to Justfile
This commit is contained in:
4
Justfile
4
Justfile
@@ -38,3 +38,7 @@ coverage:
|
|||||||
samply:
|
samply:
|
||||||
cargo build --profile profile
|
cargo build --profile profile
|
||||||
samply record ./target/profile/pacman{{ binary_extension }}
|
samply record ./target/profile/pacman{{ binary_extension }}
|
||||||
|
|
||||||
|
# Build the project for Emscripten
|
||||||
|
web:
|
||||||
|
bun run web.build.ts
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//! Desktop platform implementation.
|
//! Desktop platform implementation.
|
||||||
|
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::time::{Duration, Instant};
|
use std::time::Duration;
|
||||||
|
|
||||||
use rand::rngs::ThreadRng;
|
use rand::rngs::ThreadRng;
|
||||||
|
|
||||||
@@ -17,10 +17,6 @@ pub fn sleep(duration: Duration, focused: bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_time() -> f64 {
|
|
||||||
Instant::now().elapsed().as_secs_f64()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn init_console() -> Result<(), PlatformError> {
|
pub fn init_console() -> Result<(), PlatformError> {
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
{
|
{
|
||||||
@@ -53,10 +49,6 @@ pub fn requires_console() -> bool {
|
|||||||
cfg!(windows)
|
cfg!(windows)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_canvas_size() -> Option<(u32, u32)> {
|
|
||||||
None // Desktop doesn't need this
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn get_asset_bytes(asset: Asset) -> Result<Cow<'static, [u8]>, AssetError> {
|
pub fn get_asset_bytes(asset: Asset) -> Result<Cow<'static, [u8]>, AssetError> {
|
||||||
match asset {
|
match asset {
|
||||||
Asset::Wav1 => Ok(Cow::Borrowed(include_bytes!("../../assets/game/sound/waka/1.ogg"))),
|
Asset::Wav1 => Ok(Cow::Borrowed(include_bytes!("../../assets/game/sound/waka/1.ogg"))),
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ use crate::error::{AssetError, PlatformError};
|
|||||||
use rand::{rngs::SmallRng, SeedableRng};
|
use rand::{rngs::SmallRng, SeedableRng};
|
||||||
|
|
||||||
// Emscripten FFI functions
|
// Emscripten FFI functions
|
||||||
|
#[allow(dead_code)]
|
||||||
extern "C" {
|
extern "C" {
|
||||||
fn emscripten_get_now() -> f64;
|
fn emscripten_get_now() -> f64;
|
||||||
fn emscripten_sleep(ms: u32);
|
fn emscripten_sleep(ms: u32);
|
||||||
@@ -20,10 +21,6 @@ pub fn sleep(duration: Duration, _focused: bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_time() -> f64 {
|
|
||||||
unsafe { emscripten_get_now() }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn init_console() -> Result<(), PlatformError> {
|
pub fn init_console() -> Result<(), PlatformError> {
|
||||||
Ok(()) // No-op for Emscripten
|
Ok(()) // No-op for Emscripten
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user