-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This reverts commit f59193d.
- Loading branch information
Showing
13 changed files
with
113 additions
and
549 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,17 @@ | ||
#![allow(clippy::type_complexity)] | ||
|
||
mod actions; | ||
mod audio; | ||
mod loading; | ||
mod menu; | ||
mod player; | ||
|
||
use crate::actions::ActionsPlugin; | ||
use crate::audio::InternalAudioPlugin; | ||
use crate::loading::LoadingPlugin; | ||
use crate::menu::MenuPlugin; | ||
use crate::player::PlayerPlugin; | ||
|
||
use bevy::app::App; | ||
#[cfg(debug_assertions)] | ||
use bevy::diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}; | ||
use bevy::prelude::*; | ||
|
||
// This example game uses States to separate logic | ||
// See https://bevy-cheatbook.github.io/programming/states.html | ||
// Or https://github.com/bevyengine/bevy/blob/main/examples/ecs/state.rs | ||
#[derive(States, Default, Clone, Eq, PartialEq, Debug, Hash)] | ||
enum GameState { | ||
// During the loading State the LoadingPlugin will load our assets | ||
#[default] | ||
Loading, | ||
// During this State the actual game logic is executed | ||
Playing, | ||
// Here the menu is drawn and waiting for player interaction | ||
Menu, | ||
} | ||
mod performance_matrix; | ||
mod systems; | ||
|
||
pub struct GamePlugin; | ||
pub struct SokobanPlugin; | ||
|
||
impl Plugin for GamePlugin { | ||
impl Plugin for SokobanPlugin { | ||
fn build(&self, app: &mut App) { | ||
app.init_state::<GameState>().add_plugins(( | ||
LoadingPlugin, | ||
MenuPlugin, | ||
ActionsPlugin, | ||
InternalAudioPlugin, | ||
PlayerPlugin, | ||
)); | ||
// app.add_plugins(DefaultPlugins); | ||
|
||
// #[cfg(debug_assertions)] | ||
// app.add_plugins(performance_matrix::PerformanceMatrixPlugin); | ||
|
||
#[cfg(debug_assertions)] | ||
{ | ||
app.add_plugins((FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin::default())); | ||
} | ||
// app.add_systems(Startup, (systems::window::setup, systems::camera::setup)); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,19 @@ | ||
// disable console on windows for release builds | ||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] | ||
|
||
use bevy::asset::AssetMetaCheck; | ||
use bevy::prelude::*; | ||
use bevy::window::PrimaryWindow; | ||
use bevy::winit::WinitWindows; | ||
use bevy::DefaultPlugins; | ||
use bevy_game::GamePlugin; // ToDo: Replace bevy_game with your new crate name. | ||
use std::io::Cursor; | ||
use winit::window::Icon; | ||
use soukoban_rs::SokobanPlugin; | ||
|
||
fn main() { | ||
App::new() | ||
.insert_resource(Msaa::Off) | ||
.insert_resource(AssetMetaCheck::Never) | ||
.insert_resource(ClearColor(Color::rgb(0.4, 0.4, 0.4))) | ||
.add_plugins(DefaultPlugins.set(WindowPlugin { | ||
primary_window: Some(Window { | ||
title: "Bevy game".to_string(), // ToDo | ||
// Bind to canvas included in `index.html` | ||
canvas: Some("#bevy".to_owned()), | ||
// Tells wasm not to override default event handling, like F5 and Ctrl+R | ||
prevent_default_event_handling: false, | ||
.add_plugins(( | ||
DefaultPlugins.set(WindowPlugin { | ||
primary_window: Some(Window { | ||
title: "Sokoban".to_string(), | ||
canvas: Some("#bevy".to_owned()), | ||
prevent_default_event_handling: false, | ||
..default() | ||
}), | ||
..default() | ||
}), | ||
..default() | ||
})) | ||
.add_plugins(GamePlugin) | ||
.add_systems(Startup, set_window_icon) | ||
// SokobanPlugin, | ||
)) | ||
.run(); | ||
} | ||
|
||
// Sets the icon on windows and X11 | ||
fn set_window_icon( | ||
windows: NonSend<WinitWindows>, | ||
primary_window: Query<Entity, With<PrimaryWindow>>, | ||
) { | ||
let primary_entity = primary_window.single(); | ||
let Some(primary) = windows.get_window(primary_entity) else { | ||
return; | ||
}; | ||
let icon_buf = Cursor::new(include_bytes!( | ||
"../build/macos/AppIcon.iconset/icon_256x256.png" | ||
)); | ||
if let Ok(image) = image::load(icon_buf, image::ImageFormat::Png) { | ||
let image = image.into_rgba8(); | ||
let (width, height) = image.dimensions(); | ||
let rgba = image.into_raw(); | ||
let icon = Icon::from_rgba(rgba, width, height).unwrap(); | ||
primary.set_window_icon(Some(icon)); | ||
}; | ||
} |
Oops, something went wrong.