Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ Cargo.lock
# End of https://www.toptal.com/developers/gitignore/api/rust,visualstudiocode

### =========
assets/font.ttf
karthograph_client/assets/font.ttf
31 changes: 31 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug executable 'karthograph'",
"cargo": {
"args": [
"build",
"--bin=karthograph",
"--package=karthograph"
],
"filter": {
"name": "karthograph",
"kind": "bin"
}
},
"args": [],
"env": {
"LD_LIBRARY_PATH": "${env:LD_LIBRARY_PATH}:${workspaceFolder}/target/debug/deps/:${env:HOME}/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib",
"CARGO_MANIFEST_DIR": "${workspaceFolder}"
},
"cwd": "${workspaceFolder}/../..",
"relativePathBase": "${workspaceFolder}/../.."
},
]
}
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"cSpell.words": [
"coord",
"despawn"
]
}
50 changes: 50 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "cargo",
"command": "build",
"problemMatcher": [
"$rustc"
],
"group": "build",
"label": "rust: cargo build"
},
{
"type": "cargo",
"command": "run",
"problemMatcher": [
"$rustc"
],
"group": "build",
"label": "rust: cargo run"
},
{
"type": "cargo",
"command": "check",
"problemMatcher": [
"$rustc"
],
"group": "build",
"label": "rust: cargo check"
},
{
"type": "cargo",
"command": "clippy",
"problemMatcher": [
"$rustc"
],
"group": "build",
"label": "rust: cargo clippy"
},
{
"type": "cargo",
"command": "fmt",
"problemMatcher": [
"$rustc"
],
"group": "build",
"label": "rust: cargo fmt"
}
]
}
18 changes: 2 additions & 16 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,2 @@
[package]
name = "karthograph"
version = "0.1.0"
authors = ["KuSpa <wil.friedemann@gmail.com>"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bevy = { version = "0.5.0", features = ["dynamic"] }
anyhow = "1.0"
rand = "0.8.0"
ron = "0.6.2"
serde = {version = "1", features = ["derive"]}
derive_deref= "1.1.1"
itertools = "0.10.1"
[workspace]
members = ["karthograph_client", "karthograph_server", "karthograph_core"]
22 changes: 22 additions & 0 deletions karthograph_client/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Add the contents of this file to `config.toml` to enable "fast build" configuration. Please read the notes below.

# NOTE: For maximum performance, build using a nightly compiler
# If you are using rust stable, remove the "-Zshare-generics=y" below.

[target.x86_64-unknown-linux-gnu]
linker = "/usr/bin/clang"
rustflags = ["-Clink-arg=-fuse-ld=lld", "-Zshare-generics=y"]

# NOTE: you must manually install https://github.com/michaeleisel/zld on mac. you can easily do this with the "brew" package manager:
# `brew install michaeleisel/zld/zld`
[target.x86_64-apple-darwin]
rustflags = ["-C", "link-arg=-fuse-ld=/usr/local/bin/zld", "-Zshare-generics=y"]

[target.x86_64-pc-windows-msvc]
linker = "rust-lld.exe"
rustflags = ["-Zshare-generics=y"]

# Optional: Uncommenting the following improves compile times, but reduces the amount of debug info to 'line number tables only'
# In most cases the gains are negligible, but if you are on macos and have slow compile times you should see significant gains.
#[profile.dev]
#debug = 1
10 changes: 10 additions & 0 deletions karthograph_client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "karthograph_client"
version = "0.1.0"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bevy = { version = "0.5.0", features = ["dynamic"] }
karthograph_core = {path = "../karthograph_core"}
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
44 changes: 2 additions & 42 deletions src/main.rs → karthograph_client/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,34 +1,8 @@
use asset_management::{check_readiness, init_assets, AssetManager};
use bevy::prelude::*;
use bevy::render::camera::WindowOrigin;
use card::{click_card, RuinIndicator};
use card_pile::*;
use grid::*;
use mouse::*;
use objective::GameObjectives;
use seasons::{advance_season, score_season, Season};
use shape::*;
use std::usize;
use ui::{setup_objective_ui, setup_ui};

mod asset_management;
mod card;
mod card_pile;
mod grid;
mod mouse;
mod objective;
mod seasons;
mod shape;
mod ui;
mod util;

pub const SPRITE_SIZE: f32 = 75.;
pub const GRID_SIZE: usize = 11;
//x=y offset
pub const GRID_OFFSET: f32 = SPRITE_SIZE;
use karthograph_core::*;

fn main() {
App::build()
App::build()
.insert_resource(AssetManager::default())
.add_event::<NewCard>()
.insert_resource(GameObjectives::default())
Expand Down Expand Up @@ -77,17 +51,3 @@ fn main() {
)*/
.run();
}

fn init_camera(mut com: Commands) {
let mut bundle = OrthographicCameraBundle::new_2d();
bundle.orthographic_projection.window_origin = WindowOrigin::BottomLeft;
com.spawn_bundle(bundle);
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum GameState {
Loading,
SeasonState,
SeasonScoreState,
End,
}
22 changes: 22 additions & 0 deletions karthograph_core/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Add the contents of this file to `config.toml` to enable "fast build" configuration. Please read the notes below.

# NOTE: For maximum performance, build using a nightly compiler
# If you are using rust stable, remove the "-Zshare-generics=y" below.

[target.x86_64-unknown-linux-gnu]
linker = "/usr/bin/clang"
rustflags = ["-Clink-arg=-fuse-ld=lld", "-Zshare-generics=y"]

# NOTE: you must manually install https://github.com/michaeleisel/zld on mac. you can easily do this with the "brew" package manager:
# `brew install michaeleisel/zld/zld`
[target.x86_64-apple-darwin]
rustflags = ["-C", "link-arg=-fuse-ld=/usr/local/bin/zld", "-Zshare-generics=y"]

[target.x86_64-pc-windows-msvc]
linker = "rust-lld.exe"
rustflags = ["-Zshare-generics=y"]

# Optional: Uncommenting the following improves compile times, but reduces the amount of debug info to 'line number tables only'
# In most cases the gains are negligible, but if you are on macos and have slow compile times you should see significant gains.
#[profile.dev]
#debug = 1
15 changes: 15 additions & 0 deletions karthograph_core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "karthograph_core"
version = "0.1.0"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bevy = { version = "0.5.0", features = ["dynamic"] }
anyhow = "1.0"
rand = "0.8.0"
ron = "0.6.2"
serde = {version = "1", features = ["derive"]}
derive_deref= "1.1.1"
itertools = "0.10.1"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
40 changes: 40 additions & 0 deletions karthograph_core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
pub use asset_management::{check_readiness, init_assets, AssetManager};
pub use card::{click_card, RuinIndicator};
pub use card_pile::*;
pub use grid::*;
pub use mouse::*;
pub use objective::GameObjectives;
pub use seasons::{advance_season, score_season, Season};
pub use shape::*;
pub use ui::{setup_objective_ui, setup_ui};
use bevy::{prelude::*, render::camera::WindowOrigin};

mod asset_management;
mod card;
mod card_pile;
mod grid;
mod mouse;
mod objective;
mod seasons;
mod shape;
mod ui;
mod util;

pub const SPRITE_SIZE: f32 = 75.;
pub const GRID_SIZE: usize = 11;
//x=y offset
pub const GRID_OFFSET: f32 = SPRITE_SIZE;

pub fn init_camera(mut com: Commands) {
let mut bundle = OrthographicCameraBundle::new_2d();
bundle.orthographic_projection.window_origin = WindowOrigin::BottomLeft;
com.spawn_bundle(bundle);
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum GameState {
Loading,
SeasonState,
SeasonScoreState,
End,
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
22 changes: 22 additions & 0 deletions karthograph_server/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Add the contents of this file to `config.toml` to enable "fast build" configuration. Please read the notes below.

# NOTE: For maximum performance, build using a nightly compiler
# If you are using rust stable, remove the "-Zshare-generics=y" below.

[target.x86_64-unknown-linux-gnu]
linker = "/usr/bin/clang"
rustflags = ["-Clink-arg=-fuse-ld=lld", "-Zshare-generics=y"]

# NOTE: you must manually install https://github.com/michaeleisel/zld on mac. you can easily do this with the "brew" package manager:
# `brew install michaeleisel/zld/zld`
[target.x86_64-apple-darwin]
rustflags = ["-C", "link-arg=-fuse-ld=/usr/local/bin/zld", "-Zshare-generics=y"]

[target.x86_64-pc-windows-msvc]
linker = "rust-lld.exe"
rustflags = ["-Zshare-generics=y"]

# Optional: Uncommenting the following improves compile times, but reduces the amount of debug info to 'line number tables only'
# In most cases the gains are negligible, but if you are on macos and have slow compile times you should see significant gains.
#[profile.dev]
#debug = 1
11 changes: 11 additions & 0 deletions karthograph_server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "karthograph_server"
version = "0.1.0"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bevy = { version = "0.5.0", features = ["dynamic"] }
bevy_spicy_networking = "0.6.0"
karthograph_core = {path = "../karthograph_core"}
17 changes: 17 additions & 0 deletions karthograph_server/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use std::time::Duration;

use bevy::{app::ScheduleRunnerSettings, prelude::*};
use bevy_spicy_networking::ServerPlugin;
use karthograph_core::*;

fn main() {
let mut app = App::build();
app.insert_resource(ScheduleRunnerSettings::run_loop(Duration::from_millis(
1000 / 30,
)))
.add_plugins(MinimalPlugins)
.add_plugin(ServerPlugin::default());
//shared::server_register_network_messages(&mut app);

app.run();
}