Add Bevy basics

main
copygirl 2 days ago
parent f638218463
commit 55e4ee7b6b
  1. 4288
      Cargo.lock
  2. 2
      Cargo.toml
  3. 1
      client/Cargo.toml
  4. BIN
      client/assets/heck.png
  5. 30
      client/src/main.rs
  6. 1
      server/Cargo.toml
  7. 13
      server/src/main.rs

4288
Cargo.lock generated

File diff suppressed because it is too large Load Diff

@ -7,3 +7,5 @@ members = [
]
[workspace.dependencies]
# TODO: Disable default features and enable what's needed in specific crates.
bevy = "0.14.*"

@ -5,3 +5,4 @@ edition = "2021"
[dependencies]
common = { package = "gaemstone-common", path = "../common" }
bevy = { workspace = true }

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

@ -1,3 +1,29 @@
fn main() {
println!("Hello, client!");
use bevy::{prelude::*, window::WindowResolution};
fn main() -> AppExit {
App::new()
.add_plugins(DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window {
title: "gæmstone Client".into(),
// Steam Deck: DPI appears pretty high, causing everything to be scaled up.
// Setting scale factor override prevents this from happening.
resolution: WindowResolution::new(1280., 720.).with_scale_factor_override(1.0),
// WASM: Fit canvas to parent element, so `Window` resizes automatically.
fit_canvas_to_parent: true,
// WASM: Don't override default event handling like browser hotkeys while focused.
prevent_default_event_handling: false,
..default()
}),
..default()
}))
.add_systems(Startup, setup)
.run()
}
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
commands.spawn(Camera2dBundle::default());
commands.spawn(SpriteBundle {
texture: asset_server.load("heck.png"),
..default()
});
}

@ -5,3 +5,4 @@ edition = "2021"
[dependencies]
common = { package = "gaemstone-common", path = "../common" }
bevy = { workspace = true }

@ -1,3 +1,12 @@
fn main() {
println!("Hello, server!");
use bevy::{log::LogPlugin, prelude::*};
fn main() -> AppExit {
App::new()
.add_plugins((LogPlugin::default(), MinimalPlugins))
.add_systems(Startup, setup)
.run()
}
fn setup() {
info!("Hello from gæmstone server!");
}

Loading…
Cancel
Save