Skip to content

Commit

Permalink
0.2.0 good enough
Browse files Browse the repository at this point in the history
  • Loading branch information
TeamDman committed Jan 9, 2024
1 parent a2600ef commit 9a3af2c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 23 deletions.
48 changes: 28 additions & 20 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,33 +1,41 @@
extern crate embed_resource;
use std::env;
use std::fs;
use std::path::Path;
use std::process::Command;

fn main() {
let target = std::env::var("TARGET").unwrap();
// Get the crate version
let version = env::var("CARGO_PKG_VERSION").unwrap();
// set the CURSOR_HERO_VERSION environment variable
println!("cargo:rustc-env=CURSOR_HERO_VERSION={}", version);

let target = env::var("TARGET").unwrap();
if target.contains("windows") {
embed_resource::compile("icon.rc");
}

// // Get the crate version
// let version = env::var("CARGO_PKG_VERSION").unwrap();

// // Define the original and new binary names
// let original_binary_name = "cursor_hero"; // Replace with your binary name
// let new_binary_name = format!("{}-{}", original_binary_name, version);
// Check if it is a release build
// let profile = env::var("PROFILE").unwrap();
// if profile == "release" {
// // Define the original and new binary names
// let original_binary_name = "cursor_hero"; // Replace with your binary name
// let new_binary_name = format!("{}_v{}.exe", original_binary_name, version);

// // Set the output directory (where Cargo puts the compiled binaries)
// let out_dir = env::var("OUT_DIR").unwrap();
// let target_dir = Path::new(&out_dir).parent().unwrap().parent().unwrap().parent().unwrap();
// // Set the output directory (where Cargo puts the compiled binaries)
// let out_dir = env::var("OUT_DIR").unwrap();
// let target_dir = Path::new(&out_dir)
// .parent()
// .unwrap()
// .parent()
// .unwrap()
// .parent()
// .unwrap();

// // Construct the paths to the original and new binaries
// let original_binary_path = target_dir.join(original_binary_name);
// let new_binary_path = target_dir.join(new_binary_name);
// // Construct the paths to the original and new binaries
// let original_binary_path = target_dir.join(original_binary_name).with_extension("exe");
// let new_binary_path = target_dir.join(new_binary_name).with_extension("exe");

// // Rename the binary
// Command::new("mv")
// .arg(original_binary_path)
// .arg(new_binary_path)
// .status()
// .unwrap();
// // Copy the binary
// fs::copy(&original_binary_path, &new_binary_path).expect("Failed to copy the file");
// }
}
2 changes: 1 addition & 1 deletion crates/ui/src/about_text_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ impl Plugin for AboutTextPlugin {
fn spawn_text(mut commands: Commands, asset_server: Res<AssetServer>) {
commands.spawn((
TextBundle::from_section(
format!("Cursor Hero v{}\nby @TeamDman", env!("CARGO_PKG_VERSION")),
format!("Cursor Hero v0.2.0\nby @TeamDman"),
TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 16.0,
Expand Down
8 changes: 6 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,20 @@ fn main() {
primary_window: Some(Window {
transparent: true,
title: format!("Cursor Hero v{}", env!("CARGO_PKG_VERSION")),
#[cfg(debug_assertions)]
resolution: (
// %BEGIN_RESOLUTION%
948.0, 778.0, // %END_RESOLUTION%
1936.0, 1056.0,
// %END_RESOLUTION%
)
.into(),
resizable: true,
#[cfg(debug_assertions)]
position: WindowPosition::At(
(
// %BEGIN_POSITION%
745, 259, // %END_POSITION%
-8, -8,
// %END_POSITION%
)
.into(),
),
Expand Down

0 comments on commit 9a3af2c

Please sign in to comment.