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
|
||||
/.direnv
|
||||
|
||||
|
||||
# Added by cargo
|
||||
#
|
||||
# already existing elements were commented out
|
||||
|
||||
#/target
|
||||
/.pre-commit-config.yaml
|
||||
|
|
27
Cargo.lock
generated
27
Cargo.lock
generated
|
@ -614,6 +614,7 @@ dependencies = [
|
|||
"bevy_render",
|
||||
"bevy_scene",
|
||||
"bevy_sprite",
|
||||
"bevy_state",
|
||||
"bevy_tasks",
|
||||
"bevy_text",
|
||||
"bevy_time",
|
||||
|
@ -844,6 +845,32 @@ dependencies = [
|
|||
"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]]
|
||||
name = "bevy_tasks"
|
||||
version = "0.14.0"
|
||||
|
|
|
@ -8,6 +8,7 @@ bevy = { version = "0.14.0", default-features = false, features = [
|
|||
"bevy_asset",
|
||||
"bevy_audio",
|
||||
"bevy_color",
|
||||
"bevy_state",
|
||||
"bevy_core_pipeline",
|
||||
"bevy_gizmos",
|
||||
"bevy_render",
|
||||
|
|
49
flake.nix
49
flake.nix
|
@ -17,16 +17,26 @@
|
|||
pkgsFor = system: (import nixpkgs {inherit system;}).extend overlays.default;
|
||||
genPkgs = func: (forSystems (system: func (pkgsFor system)));
|
||||
in {
|
||||
checks = genPkgs ({system, ...}: {
|
||||
git-hooks = git-hooks.lib.${system}.run {
|
||||
checks = genPkgs (pkgs: {
|
||||
git-hooks = git-hooks.lib.${pkgs.system}.run {
|
||||
src = ./.;
|
||||
hooks = {
|
||||
alejandra.enable = true;
|
||||
cargo-check.enable = true;
|
||||
clippy.enable = true;
|
||||
rustfmt.enable = true;
|
||||
# NOTE: These do not work well with `nix flake check` due to pure environments
|
||||
# https://github.com/cachix/git-hooks.nix/issues/452
|
||||
# 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: {
|
||||
|
@ -37,19 +47,15 @@
|
|||
nativeBuildInputs = with pkgs; [
|
||||
pkg-config
|
||||
clang
|
||||
mold
|
||||
];
|
||||
|
||||
buildInputs = with pkgs; [
|
||||
cargo
|
||||
rustc
|
||||
rustfmt
|
||||
rustPackages.clippy
|
||||
clang
|
||||
xorg.libX11
|
||||
xorg.libXcursor
|
||||
xorg.libXi
|
||||
xorg.libXrandr
|
||||
rust-analyzer
|
||||
mold
|
||||
udev
|
||||
alsa-lib
|
||||
vulkan-loader
|
||||
|
@ -58,13 +64,32 @@
|
|||
];
|
||||
|
||||
src = ./.;
|
||||
|
||||
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;
|
||||
});
|
||||
|
||||
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 = {
|
||||
default = final: prev: {};
|
||||
};
|
||||
|
|
|
@ -29,14 +29,14 @@ pub fn startup(
|
|||
mut texture_atlases: ResMut<Assets<TextureAtlasLayout>>,
|
||||
) {
|
||||
let player_atlas = TextureAtlasLayout::from_grid(
|
||||
Vec2::new(32.0, 64.0),
|
||||
UVec2::new(32, 64),
|
||||
3,
|
||||
1,
|
||||
Some(Vec2 { x: 0., y: 0. }),
|
||||
Some(Vec2 { x: 0., y: 0. }),
|
||||
Some(UVec2 { x: 0, y: 0 }),
|
||||
Some(UVec2 { x: 0, y: 0 }),
|
||||
);
|
||||
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 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)),
|
||||
),
|
||||
)
|
||||
.insert_resource(ClearColor(Color::rgb(0.3, 0.1, 0.5)))
|
||||
.insert_resource(AmbientLight {
|
||||
color: Color::rgb(1., 1., 1.),
|
||||
brightness: 1.,
|
||||
});
|
||||
.insert_resource(ClearColor(Color::srgb(0.3, 0.1, 0.5)));
|
||||
// NOTE: would need to add PBR feature I think?
|
||||
// Was intending to use this for day/night cycle type stuff a la V Rising?
|
||||
// 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>) {
|
||||
|
@ -120,12 +123,7 @@ fn startup(mut commands: Commands, assets: Res<assets::AssetLoader>) {
|
|||
TextSection::from_style(TextStyle {
|
||||
font: assets.fonts.iosevkalytemin.clone(),
|
||||
font_size: 60.,
|
||||
color: Color::Hsla {
|
||||
hue: 0.5,
|
||||
saturation: 0.5,
|
||||
lightness: 0.5,
|
||||
alpha: 0.5,
|
||||
},
|
||||
color: Color::hsla(0.5, 0.5, 0.5, 0.5),
|
||||
}),
|
||||
])
|
||||
.with_style(Style {
|
||||
|
|
|
@ -50,8 +50,8 @@ pub fn startup(mut commands: Commands, assets: Res<AssetLoader>) {
|
|||
border: UiRect::all(Val::Px(20.)),
|
||||
..default()
|
||||
},
|
||||
border_color: Color::GREEN.into(),
|
||||
background_color: Color::rgb(0.4, 0.4, 1.).into(),
|
||||
border_color: Color::srgb(0., 1., 0.).into(),
|
||||
background_color: Color::srgb(0.4, 0.4, 1.).into(),
|
||||
..default()
|
||||
});
|
||||
});
|
||||
|
@ -71,7 +71,7 @@ pub fn update(
|
|||
for key in keyboard.get_just_pressed() {
|
||||
match key {
|
||||
KeyCode::Escape => {
|
||||
app_exit_events.send(bevy::app::AppExit);
|
||||
app_exit_events.send(AppExit::Success);
|
||||
}
|
||||
KeyCode::Enter => {
|
||||
next_state.set(crate::View::InGame);
|
||||
|
|
Loading…
Reference in a new issue