Skip to content

Commit

Permalink
chore(deps): update crate pixel-game-lib to 0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
tversteeg committed Nov 20, 2023
1 parent ce76bde commit b4026cd
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ rotsprite = "0.1"
vek = "0.16"
assets_manager = { version = "0.10", features = ["embedded", "hot-reloading", "toml", "png"], default-features = false }
serde = "1"
itertools = "0.11"
itertools = "0.12"
parry2d-f64 = { version = "0.13", features = ["simd-stable"] }
hecs = { version = "0.10", features = ["macros"] }
bvh-arena = "1"
Expand All @@ -34,8 +34,7 @@ bitvec = "1"
line_drawing = "1"
drawille = { version = "0.3", optional = true }
spiral = "0.2"
pixel-game-lib = "0.3"
winit_input_helper = "0.14"
pixel-game-lib = "0.4"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
fastrand = "2"
Expand Down
15 changes: 7 additions & 8 deletions src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ use pixel_game_lib::{
rigidbody::{RigidBodyBuilder, RigidBodyHandle},
Physics,
},
window::Key,
window::{Input, KeyCode},
};
use serde::Deserialize;
use vek::{Extent2, Vec2};
use winit_input_helper::WinitInputHelper;

use crate::{
camera::Camera, graphics::Color, object::ObjectSettings, projectile::Projectile,
Expand Down Expand Up @@ -134,7 +133,7 @@ impl DebugDraw {
/// Update the debug state.
pub fn update(
&mut self,
input: &WinitInputHelper,
input: &Input,
mouse: Option<Vec2<f64>>,
physics: &mut Physics,
projectiles: &mut Vec<Projectile>,
Expand All @@ -144,22 +143,22 @@ impl DebugDraw {
) {
puffin::profile_function!();

if input.key_released(Key::X) {
if input.key_released(KeyCode::KeyX) {
self.screen = self.screen.next();
}
if input.key_released(Key::R) {
if input.key_released(KeyCode::KeyR) {
self.show_rotations = !self.show_rotations;
}
if input.key_released(Key::C) {
if input.key_released(KeyCode::KeyC) {
self.show_collisions = !self.show_collisions;
}
if input.key_released(Key::O) {
if input.key_released(KeyCode::KeyO) {
self.show_colliders = !self.show_colliders;
}

if let Some(mouse) = mouse {
if self.screen == DebugScreen::SpawnCubes {
if input.key_held(Key::Space) {
if input.key_held(KeyCode::Space) {
self.physics.step(dt, &crate::settings().physics);
}

Expand Down
4 changes: 2 additions & 2 deletions src/game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ use assets_manager::{loader::TomlLoader, Asset};
use pixel_game_lib::{
canvas::Canvas,
physics::{Physics, PhysicsSettings},
window::Input,
};
use serde::Deserialize;
use vek::Vec2;
use winit_input_helper::WinitInputHelper;

#[cfg(feature = "debug")]
use crate::debug::{DebugDraw, DebugSettings};
Expand Down Expand Up @@ -88,7 +88,7 @@ impl GameState {
}

/// Update a frame and handle user input.
pub fn update(&mut self, input: &WinitInputHelper, mouse: Option<Vec2<i32>>, dt: f64) {
pub fn update(&mut self, input: &Input, mouse: Option<Vec2<i32>>, dt: f64) {
let settings = crate::settings();

// Move the camera based on the mouse position
Expand Down
1 change: 1 addition & 0 deletions src/gen/bitmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ mod tests {

use super::Bitmap;

#[cfg(feature = "debug")]
#[test]
fn shrink_with_padding() {
// 4x4 image filled with ones
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use assets_manager::{AssetGuard, Compound};
use font::Font;
use game::{GameState, Settings};
use miette::Result;
use pixel_game_lib::window::{Key, WindowConfig};
use pixel_game_lib::window::{KeyCode, WindowConfig};
use sprite::{RotatableSprite, Sprite};
use vek::{Extent2, Vec2};

Expand Down Expand Up @@ -109,7 +109,7 @@ fn main() -> Result<()> {
puffin::GlobalProfiler::lock().new_frame();

// Exit when escape is pressed
input.key_pressed(Key::Escape)
input.key_pressed(KeyCode::Escape)
},
|g, canvas, frame_time| {
{
Expand Down

0 comments on commit b4026cd

Please sign in to comment.