1
0
Fork 0
mirror of https://github.com/doukutsu-rs/doukutsu-rs synced 2024-11-25 15:03:34 +00:00

Let CI override version displayed in menu

This commit is contained in:
Alula 2020-12-06 16:41:12 +01:00
parent 5f259b572e
commit 203a4a1180
No known key found for this signature in database
GPG key ID: 3E00485503A1D8BA
4 changed files with 10 additions and 7 deletions

View file

@ -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

View file

@ -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)]

View file

@ -163,7 +163,6 @@ impl Game {
fn key_down_event(&mut self, key_code: KeyCode, _key_mod: KeyMods, repeat: bool) {
if repeat { return; }
// todo: proper keymaps?
let state = &mut self.state;
match key_code {
KeyCode::F7 => { state.set_speed(1.0) }

View file

@ -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)?;