diff --git a/.vscode/settings.json b/.vscode/settings.json index a2d525d..8397364 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,8 @@ { "cSpell.words": [ + "clippy", "raylib", "renderable" - ] + ], + "rust-analyzer.checkOnSave.command": "clippy" } diff --git a/game/Cargo.toml b/game/Cargo.toml index 13f4dd3..d47f64a 100644 --- a/game/Cargo.toml +++ b/game/Cargo.toml @@ -25,6 +25,7 @@ sentry = "0.23" [dev-dependencies] puffin_viewer = "0.6" + [profile.release] lto = true codegen-units = 1 diff --git a/game/assets/configs/application.json b/game/assets/configs/application.json index 5b3d2f9..f69c9c0 100644 --- a/game/assets/configs/application.json +++ b/game/assets/configs/application.json @@ -1,14 +1,5 @@ { "name": "Unnamed game", - "authors": [ - { - "name": "Evan Pratten", - "url": "https://va3zza.com", - "roles": [ - "Team Lead", - "Developer" - ] - } - ], + "base_window_size": [1080, 720], "sentry_dsn": "https://d5d94e75f08841388287fa0c23606ac7@o398481.ingest.sentry.io/5985679" } diff --git a/game/src/lib.rs b/game/src/lib.rs index 935e84a..0066170 100644 --- a/game/src/lib.rs +++ b/game/src/lib.rs @@ -1,3 +1,4 @@ +#![feature(plugin)] #![feature(derive_default_enum)] #![deny(unsafe_code)] #![warn( @@ -136,7 +137,10 @@ pub async fn game_begin(game_config: &GameConfig) -> Result<(), Box Result<(), Box, + // pub authors: Vec, + pub base_window_size: (i32, i32), pub sentry_dsn: String } diff --git a/game/src/utilities/render_layer.rs b/game/src/utilities/render_layer.rs index 98bed02..141c6fa 100644 --- a/game/src/utilities/render_layer.rs +++ b/game/src/utilities/render_layer.rs @@ -1,8 +1,7 @@ -use raylib::{RaylibHandle, prelude::{RaylibDrawHandle, RaylibMode2D}}; +use raylib::{prelude::RaylibMode2D, RaylibHandle}; use crate::utilities::non_ref_raylib::HackedRaylibHandle; - pub trait FrameUpdate { fn update(&mut self, raylib: &RaylibHandle, delta_seconds: f32); } @@ -12,5 +11,5 @@ pub trait ScreenSpaceRender { } pub trait WorldSpaceRender { - fn render_world_space(&self, raylib: &mut RaylibMode2D); + fn render_world_space(&self, raylib: &mut RaylibMode2D<'_, HackedRaylibHandle>); } diff --git a/game/src/utilities/shaders/shader.rs b/game/src/utilities/shaders/shader.rs index d7d7e51..4555702 100644 --- a/game/src/utilities/shaders/shader.rs +++ b/game/src/utilities/shaders/shader.rs @@ -19,11 +19,11 @@ use crate::utilities::non_ref_raylib::HackedRaylibHandle; #[derive(Debug, Error)] pub enum ShaderError { #[error(transparent)] - UtfConversionError(#[from] FromUtf8Error), + UtfConversion(#[from] FromUtf8Error), #[error(transparent)] - ShaderVarNameNulError(#[from] std::ffi::NulError), + ShaderVarNameNul(#[from] std::ffi::NulError), #[error("Shader variable name not valid: {0}")] - ShaderVarNameError(String), + ShaderVarName(String), } /// Utility wrapper around shader FFI @@ -53,14 +53,14 @@ impl ShaderWrapper { match vertex_shader_code { Some(result) => match result { Ok(code) => Some(code), - Err(err) => return Err(ShaderError::UtfConversionError(err)), + Err(err) => return Err(ShaderError::UtfConversion(err)), }, None => None, }, match fragment_shader_code { Some(result) => match result { Ok(code) => Some(code), - Err(err) => return Err(ShaderError::UtfConversionError(err)), + Err(err) => return Err(ShaderError::UtfConversion(err)), }, None => None, }, @@ -123,7 +123,7 @@ impl ShaderWrapper { self.shader.set_shader_value(*ptr, value); Ok(()) } else { - Err(ShaderError::ShaderVarNameError(name.to_string())) + Err(ShaderError::ShaderVarName(name.to_string())) } } } @@ -135,9 +135,9 @@ fn load_shader_from_heap( vs: Option, fs: Option, ) -> Shader { - let vs_code = vs.unwrap_or(String::new()); + let vs_code = vs.unwrap_or_default(); let vs_code_str = vs_code.as_str(); - let fs_code = fs.unwrap_or(String::new()); + let fs_code = fs.unwrap_or_default(); let fs_code_str = fs_code.as_str(); handle.load_shader_code( thread,