diff --git a/.appveyor.yml b/.appveyor.yml index 07f36cf..0bb3b58 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -35,6 +35,7 @@ cache: # - cargo test --verbose --all --no-fail-fast build_script: + - set DRS_BUILD_VERSION_OVERRIDE=%APPVEYOR_BUILD_VERSION% - cargo build --release --bin doukutsu-rs - mkdir release - copy target\release\doukutsu-rs.exe release diff --git a/Cargo.toml b/Cargo.toml index e527a52..3a81602 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [package] -authors = ["Alula "] +authors = ["Alula"] edition = "2018" name = "doukutsu-rs" version = "0.1.0" diff --git a/src/common.rs b/src/common.rs index a5e017d..9cbae05 100644 --- a/src/common.rs +++ b/src/common.rs @@ -1,19 +1,23 @@ use std::cmp::Ordering; use std::fmt; -use ggez::GameError; -use ggez::GameError::InvalidValue; +use lazy_static::lazy_static; use num_traits::{AsPrimitive, Num}; use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; use serde::de::{SeqAccess, Visitor}; use serde::ser::SerializeTupleStruct; use crate::bitfield; -use crate::macros::fmt::Formatter; /// Multiply cave story degrees (0-255, which corresponds to 0°-360°) with this to get /// respective value in radians. pub const CDEG_RAD: f64 = std::f64::consts::PI / 128.0; +lazy_static! { + pub static ref VERSION_BANNER: String = { + let version = option_env!("DRS_BUILD_VERSION_OVERRIDE").unwrap_or(env!("CARGO_PKG_VERSION")); + format!("doukutsu-rs {}", version) + }; +} bitfield! { #[derive(Clone, Copy)] diff --git a/src/scene/title_scene.rs b/src/scene/title_scene.rs index 999c826..e64123b 100644 --- a/src/scene/title_scene.rs +++ b/src/scene/title_scene.rs @@ -1,7 +1,7 @@ use ggez::{Context, GameResult, graphics}; use ggez::graphics::Color; -use crate::common::Rect; +use crate::common::{Rect, VERSION_BANNER}; use crate::menu::{Menu, MenuEntry, MenuSelectionResult}; use crate::scene::Scene; use crate::shared_game_state::{SharedGameState, TimingMode}; @@ -75,7 +75,6 @@ impl TitleScene { } } -static ENGINE_VERSION: &str = "doukutsu-rs 0.1.0"; // asset copyright for freeware version static COPYRIGHT_PIXEL: &str = "2004.12 Studio Pixel"; // asset copyright for Nicalis @@ -235,7 +234,7 @@ impl Scene for TitleScene { batch.draw(ctx)?; } - self.draw_text_centered(ENGINE_VERSION, state.canvas_size.1 - 15.0, state, ctx)?; + self.draw_text_centered(VERSION_BANNER.as_str(), state.canvas_size.1 - 15.0, state, ctx)?; if state.constants.is_switch { self.draw_text_centered(COPYRIGHT_NICALIS_SWITCH, state.canvas_size.1 - 30.0, state, ctx)?;