Flake check ought to work now
This commit is contained in:
parent
e6cc53bd50
commit
952f201202
8
.gitignore
vendored
8
.gitignore
vendored
|
@ -1,9 +1,3 @@
|
||||||
/target
|
/target
|
||||||
/.direnv
|
/.direnv
|
||||||
|
/.pre-commit-config.yaml
|
||||||
|
|
||||||
# Added by cargo
|
|
||||||
#
|
|
||||||
# already existing elements were commented out
|
|
||||||
|
|
||||||
#/target
|
|
||||||
|
|
27
Cargo.lock
generated
27
Cargo.lock
generated
|
@ -614,6 +614,7 @@ dependencies = [
|
||||||
"bevy_render",
|
"bevy_render",
|
||||||
"bevy_scene",
|
"bevy_scene",
|
||||||
"bevy_sprite",
|
"bevy_sprite",
|
||||||
|
"bevy_state",
|
||||||
"bevy_tasks",
|
"bevy_tasks",
|
||||||
"bevy_text",
|
"bevy_text",
|
||||||
"bevy_time",
|
"bevy_time",
|
||||||
|
@ -844,6 +845,32 @@ dependencies = [
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bevy_state"
|
||||||
|
version = "0.14.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0959984092d56885fd3b320ea84fb816821bad6bfa3040b9d4ee850d3273233d"
|
||||||
|
dependencies = [
|
||||||
|
"bevy_app",
|
||||||
|
"bevy_ecs",
|
||||||
|
"bevy_hierarchy",
|
||||||
|
"bevy_reflect",
|
||||||
|
"bevy_state_macros",
|
||||||
|
"bevy_utils",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bevy_state_macros"
|
||||||
|
version = "0.14.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "887a98bfa268258377cd073f5bb839518d3a1cd6b96ed81418145485b69378e6"
|
||||||
|
dependencies = [
|
||||||
|
"bevy_macro_utils",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn 2.0.72",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bevy_tasks"
|
name = "bevy_tasks"
|
||||||
version = "0.14.0"
|
version = "0.14.0"
|
||||||
|
|
|
@ -8,6 +8,7 @@ bevy = { version = "0.14.0", default-features = false, features = [
|
||||||
"bevy_asset",
|
"bevy_asset",
|
||||||
"bevy_audio",
|
"bevy_audio",
|
||||||
"bevy_color",
|
"bevy_color",
|
||||||
|
"bevy_state",
|
||||||
"bevy_core_pipeline",
|
"bevy_core_pipeline",
|
||||||
"bevy_gizmos",
|
"bevy_gizmos",
|
||||||
"bevy_render",
|
"bevy_render",
|
||||||
|
|
49
flake.nix
49
flake.nix
|
@ -17,16 +17,26 @@
|
||||||
pkgsFor = system: (import nixpkgs {inherit system;}).extend overlays.default;
|
pkgsFor = system: (import nixpkgs {inherit system;}).extend overlays.default;
|
||||||
genPkgs = func: (forSystems (system: func (pkgsFor system)));
|
genPkgs = func: (forSystems (system: func (pkgsFor system)));
|
||||||
in {
|
in {
|
||||||
checks = genPkgs ({system, ...}: {
|
checks = genPkgs (pkgs: {
|
||||||
git-hooks = git-hooks.lib.${system}.run {
|
git-hooks = git-hooks.lib.${pkgs.system}.run {
|
||||||
src = ./.;
|
src = ./.;
|
||||||
hooks = {
|
hooks = {
|
||||||
alejandra.enable = true;
|
alejandra.enable = true;
|
||||||
cargo-check.enable = true;
|
# NOTE: These do not work well with `nix flake check` due to pure environments
|
||||||
clippy.enable = true;
|
# https://github.com/cachix/git-hooks.nix/issues/452
|
||||||
rustfmt.enable = true;
|
# cargo-check.enable = true;
|
||||||
|
# clippy = {
|
||||||
|
# enable = true;
|
||||||
|
# packageOverrides.cargo = pkgs.cargo;
|
||||||
|
# packageOverrides.clippy = pkgs.rustPackages.clippy;
|
||||||
|
# };
|
||||||
|
rustfmt = {
|
||||||
|
enable = true;
|
||||||
|
packageOverrides.rustfmt = pkgs.rustfmt;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
build = outputs.packages.${pkgs.system}.default;
|
||||||
});
|
});
|
||||||
|
|
||||||
packages = genPkgs (pkgs: {
|
packages = genPkgs (pkgs: {
|
||||||
|
@ -37,19 +47,15 @@
|
||||||
nativeBuildInputs = with pkgs; [
|
nativeBuildInputs = with pkgs; [
|
||||||
pkg-config
|
pkg-config
|
||||||
clang
|
clang
|
||||||
|
mold
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
cargo
|
clang
|
||||||
rustc
|
|
||||||
rustfmt
|
|
||||||
rustPackages.clippy
|
|
||||||
xorg.libX11
|
xorg.libX11
|
||||||
xorg.libXcursor
|
xorg.libXcursor
|
||||||
xorg.libXi
|
xorg.libXi
|
||||||
xorg.libXrandr
|
xorg.libXrandr
|
||||||
rust-analyzer
|
|
||||||
mold
|
|
||||||
udev
|
udev
|
||||||
alsa-lib
|
alsa-lib
|
||||||
vulkan-loader
|
vulkan-loader
|
||||||
|
@ -58,13 +64,32 @@
|
||||||
];
|
];
|
||||||
|
|
||||||
src = ./.;
|
src = ./.;
|
||||||
|
|
||||||
hash = pkgs.lib.fakeHash;
|
hash = pkgs.lib.fakeHash;
|
||||||
cargoHash = "sha256-W7VQlMktGsRPQL9VGVmxYV6C5u2eJ48S7eTpOM+3n8U=";
|
cargoHash = "sha256-x2St+At8n07ns354zORhb7NJfBQTav1beSyAnlJtak8=";
|
||||||
|
|
||||||
|
# a hack to avoid using mold as our linker when building with nix
|
||||||
|
postUnpack = ''
|
||||||
|
ls -la
|
||||||
|
rm -r ./*/.cargo
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
default = outputs.packages.${pkgs.system}.kodotag;
|
default = outputs.packages.${pkgs.system}.kodotag;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
devShells = genPkgs (pkgs: {
|
||||||
|
default = pkgs.mkShell {
|
||||||
|
inherit (self.checks.${pkgs.system}.git-hooks) shellHook;
|
||||||
|
inputsFrom = [outputs.packages.${pkgs.system}.default];
|
||||||
|
packages = with pkgs; [
|
||||||
|
rustPackages.clippy
|
||||||
|
rust-analyzer
|
||||||
|
rustfmt
|
||||||
|
];
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
overlays = {
|
overlays = {
|
||||||
default = final: prev: {};
|
default = final: prev: {};
|
||||||
};
|
};
|
||||||
|
|
|
@ -29,14 +29,14 @@ pub fn startup(
|
||||||
mut texture_atlases: ResMut<Assets<TextureAtlasLayout>>,
|
mut texture_atlases: ResMut<Assets<TextureAtlasLayout>>,
|
||||||
) {
|
) {
|
||||||
let player_atlas = TextureAtlasLayout::from_grid(
|
let player_atlas = TextureAtlasLayout::from_grid(
|
||||||
Vec2::new(32.0, 64.0),
|
UVec2::new(32, 64),
|
||||||
3,
|
3,
|
||||||
1,
|
1,
|
||||||
Some(Vec2 { x: 0., y: 0. }),
|
Some(UVec2 { x: 0, y: 0 }),
|
||||||
Some(Vec2 { x: 0., y: 0. }),
|
Some(UVec2 { x: 0, y: 0 }),
|
||||||
);
|
);
|
||||||
let statue_atlas =
|
let statue_atlas =
|
||||||
TextureAtlasLayout::from_grid(Vec2::new(40., 74.), 1, 1, None, Some(Vec2::new(443., 20.)));
|
TextureAtlasLayout::from_grid(UVec2::new(40, 74), 1, 1, None, Some(UVec2::new(443, 20)));
|
||||||
|
|
||||||
let player_atlas_handle = texture_atlases.add(player_atlas);
|
let player_atlas_handle = texture_atlases.add(player_atlas);
|
||||||
let statue_atlas_handle = texture_atlases.add(statue_atlas);
|
let statue_atlas_handle = texture_atlases.add(statue_atlas);
|
||||||
|
|
22
src/main.rs
22
src/main.rs
|
@ -85,13 +85,16 @@ fn main() {
|
||||||
.run_if(in_state(View::MainMenu)),
|
.run_if(in_state(View::MainMenu)),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.insert_resource(ClearColor(Color::rgb(0.3, 0.1, 0.5)))
|
.insert_resource(ClearColor(Color::srgb(0.3, 0.1, 0.5)));
|
||||||
.insert_resource(AmbientLight {
|
// NOTE: would need to add PBR feature I think?
|
||||||
color: Color::rgb(1., 1., 1.),
|
// Was intending to use this for day/night cycle type stuff a la V Rising?
|
||||||
brightness: 1.,
|
// app.insert_resource(AmbientLight {
|
||||||
});
|
// color: Color::srgb(1., 1., 1.),
|
||||||
|
// brightness: 1.,
|
||||||
|
// });
|
||||||
|
|
||||||
app.run()
|
let exit = app.run();
|
||||||
|
info!("Exit: {:#?}", exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn toggle_fullscreen(mut window: Mut<Window>) {
|
fn toggle_fullscreen(mut window: Mut<Window>) {
|
||||||
|
@ -120,12 +123,7 @@ fn startup(mut commands: Commands, assets: Res<assets::AssetLoader>) {
|
||||||
TextSection::from_style(TextStyle {
|
TextSection::from_style(TextStyle {
|
||||||
font: assets.fonts.iosevkalytemin.clone(),
|
font: assets.fonts.iosevkalytemin.clone(),
|
||||||
font_size: 60.,
|
font_size: 60.,
|
||||||
color: Color::Hsla {
|
color: Color::hsla(0.5, 0.5, 0.5, 0.5),
|
||||||
hue: 0.5,
|
|
||||||
saturation: 0.5,
|
|
||||||
lightness: 0.5,
|
|
||||||
alpha: 0.5,
|
|
||||||
},
|
|
||||||
}),
|
}),
|
||||||
])
|
])
|
||||||
.with_style(Style {
|
.with_style(Style {
|
||||||
|
|
|
@ -50,8 +50,8 @@ pub fn startup(mut commands: Commands, assets: Res<AssetLoader>) {
|
||||||
border: UiRect::all(Val::Px(20.)),
|
border: UiRect::all(Val::Px(20.)),
|
||||||
..default()
|
..default()
|
||||||
},
|
},
|
||||||
border_color: Color::GREEN.into(),
|
border_color: Color::srgb(0., 1., 0.).into(),
|
||||||
background_color: Color::rgb(0.4, 0.4, 1.).into(),
|
background_color: Color::srgb(0.4, 0.4, 1.).into(),
|
||||||
..default()
|
..default()
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -71,7 +71,7 @@ pub fn update(
|
||||||
for key in keyboard.get_just_pressed() {
|
for key in keyboard.get_just_pressed() {
|
||||||
match key {
|
match key {
|
||||||
KeyCode::Escape => {
|
KeyCode::Escape => {
|
||||||
app_exit_events.send(bevy::app::AppExit);
|
app_exit_events.send(AppExit::Success);
|
||||||
}
|
}
|
||||||
KeyCode::Enter => {
|
KeyCode::Enter => {
|
||||||
next_state.set(crate::View::InGame);
|
next_state.set(crate::View::InGame);
|
||||||
|
|
Loading…
Reference in a new issue