DEVELOPMENT ENVIRONMENT

~liljamo/deck-builder

7c1764c44b4a629ac3fe65a246e84a11cd6b4389 — Jonni Liljamo 1 year, 7 months ago 11a6eeb
feat(client): init rapier things, but leave for now
M Cargo.lock => Cargo.lock +252 -1
@@ 721,6 721,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c4b88451d4c5a353bff67dbaa937b6886efd26ae114769c17f2b35099c7a4de"

[[package]]
name = "bevy_rapier3d"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4bce8074f19467fd55ab172ae6c11fca3ca28f66804590ab10c930bd5e9cd24"
dependencies = [
 "bevy",
 "bitflags",
 "log",
 "nalgebra",
 "rapier3d",
]

[[package]]
name = "bevy_reflect"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 1287,6 1300,20 @@ dependencies = [
]

[[package]]
name = "crossbeam"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2801af0d36612ae591caa9568261fddce32ce6e08a7275ea334a06a4ad021a2c"
dependencies = [
 "cfg-if",
 "crossbeam-channel",
 "crossbeam-deque",
 "crossbeam-epoch",
 "crossbeam-queue",
 "crossbeam-utils",
]

[[package]]
name = "crossbeam-channel"
version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 1297,6 1324,40 @@ dependencies = [
]

[[package]]
name = "crossbeam-deque"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef"
dependencies = [
 "cfg-if",
 "crossbeam-epoch",
 "crossbeam-utils",
]

[[package]]
name = "crossbeam-epoch"
version = "0.9.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695"
dependencies = [
 "autocfg",
 "cfg-if",
 "crossbeam-utils",
 "memoffset 0.8.0",
 "scopeguard",
]

[[package]]
name = "crossbeam-queue"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add"
dependencies = [
 "cfg-if",
 "crossbeam-utils",
]

[[package]]
name = "crossbeam-utils"
version = "0.8.15"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 1432,6 1493,12 @@ dependencies = [
]

[[package]]
name = "either"
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"

[[package]]
name = "emath"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 2122,6 2189,7 @@ dependencies = [
 "bevy",
 "bevy_editor_pls",
 "bevy_egui",
 "bevy_rapier3d",
 "chrono",
 "chrono-humanize",
 "fastrand",


@@ 2155,6 2223,12 @@ dependencies = [
]

[[package]]
name = "libm"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb"

[[package]]
name = "link-cplusplus"
version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 2207,6 2281,16 @@ dependencies = [
]

[[package]]
name = "matrixmultiply"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "090126dc04f95dc0d1c1c91f61bdd474b3930ca064c1edc8a849da2c6cbe1e77"
dependencies = [
 "autocfg",
 "rawpointer",
]

[[package]]
name = "memchr"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 2222,6 2306,15 @@ dependencies = [
]

[[package]]
name = "memoffset"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1"
dependencies = [
 "autocfg",
]

[[package]]
name = "metal"
version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 2295,6 2388,34 @@ dependencies = [
]

[[package]]
name = "nalgebra"
version = "0.32.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d68d47bba83f9e2006d117a9a33af1524e655516b8919caac694427a6fb1e511"
dependencies = [
 "approx",
 "glam 0.23.0",
 "matrixmultiply",
 "nalgebra-macros",
 "num-complex",
 "num-rational",
 "num-traits",
 "simba",
 "typenum",
]

[[package]]
name = "nalgebra-macros"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d232c68884c0c99810a5a4d333ef7e47689cfd0edc85efc9e54e1e6bf5212766"
dependencies = [
 "proc-macro2",
 "quote",
 "syn 1.0.109",
]

[[package]]
name = "native-tls"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 2350,7 2471,7 @@ dependencies = [
 "bitflags",
 "cfg-if",
 "libc",
 "memoffset",
 "memoffset 0.6.5",
]

[[package]]


@@ 2379,6 2500,26 @@ dependencies = [
]

[[package]]
name = "num-complex"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02e0d21255c828d6f128a1e41534206671e8c3ea0c62f32291e808dc82cff17d"
dependencies = [
 "num-traits",
]

[[package]]
name = "num-derive"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d"
dependencies = [
 "proc-macro2",
 "quote",
 "syn 1.0.109",
]

[[package]]
name = "num-integer"
version = "0.1.45"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 2406,6 2547,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
dependencies = [
 "autocfg",
 "libm",
]

[[package]]


@@ 2574,6 2716,12 @@ dependencies = [
]

[[package]]
name = "optional"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "978aa494585d3ca4ad74929863093e87cac9790d81fe7aba2b3dc2890643a0fc"

[[package]]
name = "orbclient"
version = "0.3.44"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 2630,6 2778,27 @@ dependencies = [
]

[[package]]
name = "parry3d"
version = "0.13.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d527d9e8d203c55e5d25811d6c65e120b577985cb9b64f00fdb9aaf8c3d80ea"
dependencies = [
 "approx",
 "arrayvec",
 "bitflags",
 "downcast-rs",
 "either",
 "nalgebra",
 "num-derive",
 "num-traits",
 "rustc-hash",
 "simba",
 "slab",
 "smallvec",
 "spade",
]

[[package]]
name = "paste"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 2744,12 2913,38 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8a99fddc9f0ba0a85884b8d14e3592853e787d581ca1816c91349b10e4eeab"

[[package]]
name = "rapier3d"
version = "0.17.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62a8a0bd9d3135f7b4eb45d0796540e7bab47b6b7c974f90567ccc5a0454f42b"
dependencies = [
 "approx",
 "arrayvec",
 "bit-vec",
 "bitflags",
 "crossbeam",
 "downcast-rs",
 "nalgebra",
 "num-derive",
 "num-traits",
 "parry3d",
 "rustc-hash",
 "simba",
]

[[package]]
name = "raw-window-handle"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9"

[[package]]
name = "rawpointer"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"

[[package]]
name = "rectangle-pack"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 2856,6 3051,12 @@ dependencies = [
]

[[package]]
name = "robust"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5864e7ef1a6b7bcf1d6ca3f655e65e724ed3b52546a0d0a663c991522f552ea"

[[package]]
name = "ron"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 2899,6 3100,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041"

[[package]]
name = "safe_arch"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "794821e4ccb0d9f979512f9c1973480123f9bd62a90d74ab0f9426fcf8f4a529"
dependencies = [
 "bytemuck",
]

[[package]]
name = "same-file"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 3015,6 3225,19 @@ dependencies = [
]

[[package]]
name = "simba"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "061507c94fc6ab4ba1c9a0305018408e312e17c041eb63bef8aa726fa33aceae"
dependencies = [
 "approx",
 "num-complex",
 "num-traits",
 "paste",
 "wide",
]

[[package]]
name = "simd-adler32"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 3058,6 3281,18 @@ dependencies = [
]

[[package]]
name = "spade"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88e65803986868d2372c582007c39ba89936a36ea5f236bf7a7728dc258f04f9"
dependencies = [
 "num-traits",
 "optional",
 "robust",
 "smallvec",
]

[[package]]
name = "spin_sleep"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 3380,6 3615,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0609f771ad9c6155384897e1df4d948e692667cc0588548b68eb44d052b27633"

[[package]]
name = "typenum"
version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"

[[package]]
name = "unicode-bidi"
version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 3700,6 3941,16 @@ dependencies = [
]

[[package]]
name = "wide"
version = "0.7.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b689b6c49d6549434bf944e6b0f39238cf63693cb7a147e9d887507fffa3b223"
dependencies = [
 "bytemuck",
 "safe_arch",
]

[[package]]
name = "widestring"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"

M client/Cargo.toml => client/Cargo.toml +6 -0
@@ 44,6 44,12 @@ features = [
    "x11",
]

[dependencies.bevy_rapier3d]
version = "0.21.0"
features = [
    "debug-render-3d",
]

[dependencies.bevy_egui]
version = "0.20.2"
default-features = false

M client/src/main.rs => client/src/main.rs +6 -2
@@ 8,6 8,7 @@

use api::user::User;
use bevy::prelude::*;
use bevy_rapier3d::prelude::*;
use bevy_editor_pls::EditorPlugin;
use bevy_egui::EguiPlugin;



@@ 36,9 37,12 @@ fn main() {
        ..Default::default()
    }));

    app.add_plugin(RapierPhysicsPlugin::<NoUserData>::default());

    info!("laurelin client initializing");

    // dev
    app.add_plugin(RapierDebugRenderPlugin::default());
    app.add_plugin(EditorPlugin::new());
    app.insert_resource(editor_controls());



@@ 83,8 87,8 @@ struct PlayerCamera;
fn setup(mut commands: Commands) {
    commands.spawn(Camera3dBundle {
        transform: Transform {
            translation: Vec3::new(0.0, -1.5, 8.0),
            rotation: Quat::from_rotation_x(0.2),
            translation: Vec3::new(0., 8., 8.),
            rotation: Quat::from_rotation_x(-0.5),
            ..Default::default()
        },
        ..Default::default()

A client/src/plugins/game/card/mod.rs => client/src/plugins/game/card/mod.rs +67 -0
@@ 0,0 1,67 @@
/*
 * This file is part of laurelin_client
 * Copyright (C) 2023 Jonni Liljamo <jonni@liljamo.com>
 *
 * Licensed under GPL-3.0-only.
 * See LICENSE for licensing information.
 */

use bevy::prelude::*;
use bevy_rapier3d::prelude::*;

use crate::game_status::Card;

pub struct CardPlugin;

impl Plugin for CardPlugin {
    fn build(&self, app: &mut App) {
        
    }
}

#[derive(Component)]
pub struct VisualCard {
    pub card: Card,
}

impl VisualCard {
    pub const WIDTH: f32 = 0.35;
}

impl Default for VisualCard {
    fn default() -> Self {
        Self {
            card: Card {
                name: "".to_string(),
                short_details: vec![],
                long_details: vec![],
                cost: 0,
                actions: vec![]
            }
        }
    }
}

#[derive(Bundle)]
pub struct VisualCardBundle {
    pub visual_card: VisualCard,
    pub transform: Transform,
    pub global_transform: GlobalTransform,
    pub collider: Collider,
    pub rigid_body: RigidBody,
}

impl Default for VisualCardBundle {
    fn default() -> Self {
        Self {
            visual_card: VisualCard::default(),
            transform: Transform {
                rotation: Quat::from_euler(EulerRot::XYZ, -90., 0., 0.),
                ..Default::default()
            },
            global_transform: GlobalTransform::default(),
            collider: Collider::cuboid(VisualCard::WIDTH, VisualCard::WIDTH * 1.75, 0.01),
            rigid_body: RigidBody::Dynamic,
        }
    }
}

M client/src/plugins/game/mod.rs => client/src/plugins/game/mod.rs +19 -0
@@ 7,12 7,16 @@
 */

use bevy::prelude::*;
use bevy_rapier3d::prelude::*;

use crate::{api::game::Game, Global, AppState, game_status::GameStatus};

use self::card::VisualCardBundle;

use super::GameDetailsCallEvent;

mod ui;
mod card;

pub struct GamePlugin;



@@ 44,10 48,25 @@ impl Default for GameData {
}

fn game_setup(
    mut commands: Commands,
    mut details_ev_w: EventWriter<GameDetailsCallEvent>,
    global: Res<Global>,
) {
    details_ev_w.send(GameDetailsCallEvent {
        game_id: global.cur_game_id.clone(),
    });

    // create the playing surface
    commands
        .spawn(Collider::cuboid(20., 0.5, 20.))
        .insert(TransformBundle::from(Transform::from_xyz(0., 0., 0.)));

    commands.spawn(VisualCardBundle {
        transform: Transform {
                translation: Vec3 { x: 0., y: 3., z: 0. },
                rotation: Quat::from_euler(EulerRot::XYZ, -90., 0., 0.),
                ..Default::default()
            },
        ..Default::default()
    });
}