Skip to content

Commit 2e8abdd

Browse files
committed
Merge branch 'main' of https://github.com/geode-sdk/cli into main
2 parents a2a01b7 + 7f91bee commit 2e8abdd

File tree

5 files changed

+31
-7
lines changed

5 files changed

+31
-7
lines changed

src/sdk.rs

+5
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,11 @@ fn set_sdk_env(path: &Path) -> bool {
162162
}
163163
}
164164

165+
#[cfg(target_os = "linux")] {
166+
warn!("set_sdk_env is uninmplemented on linux");
167+
env_success = false;
168+
}
169+
165170
#[cfg(target_os = "macos")] {
166171
env_success = launchctl::set_sdk_env(path.to_str().unwrap());
167172
}

src/util/bmfont.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ fn gen_outline<T: DistanceStorage>(sdf: SignedDistanceField<T>, size: f32) -> im
7373
}*/
7474

7575
fn generate_char(
76-
_font: &BitmapFont,
76+
font: &BitmapFont,
7777
metrics: fontdue::Metrics,
7878
data: Vec<u8>,
7979
) -> Option<RgbaImage> {
@@ -104,7 +104,7 @@ fn generate_char(
104104
let height = metrics.height as u32;
105105

106106
Some(RgbaImage::from_fn(width, height, |x, y| {
107-
Rgba::<u8>([255, 255, 255, data[(x + width * y) as usize]])
107+
Rgba::<u8>([font.color[0], font.color[1], font.color[2], data[(x + width * y) as usize]])
108108
}))
109109
}
110110

src/util/config.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,15 @@ impl OldConfig {
8787
pub fn geode_root() -> PathBuf {
8888
// get data dir per-platform
8989
let data_dir: PathBuf;
90-
#[cfg(windows)]
90+
#[cfg(any(windows, target_os = "linux"))]
9191
{
9292
data_dir = dirs::data_local_dir().unwrap().join("Geode");
9393
};
9494
#[cfg(target_os = "macos")]
9595
{
9696
data_dir = PathBuf::from("/Users/Shared/Geode");
9797
};
98-
#[cfg(not(any(windows, target_os = "macos")))]
98+
#[cfg(not(any(windows, target_os = "macos", target_os = "linux")))]
9999
{
100100
use std::compile_error;
101101
compile_error!("implement root directory");
@@ -144,7 +144,7 @@ impl Config {
144144
pub fn new() -> Config {
145145
if !geode_root().exists() {
146146
warn!("It seems you don't have Geode installed. Some operations will not work");
147-
info!("You can setup Geode using `geode config setup`");
147+
warn!("You can setup Geode using `geode config setup`");
148148

149149
return Config {
150150
current_profile: None,
@@ -189,7 +189,7 @@ impl Config {
189189

190190
if output.profiles.is_empty() {
191191
warn!("No Geode profiles found! Some operations will be unavailable.");
192-
info!("Setup Geode using `geode config setup`");
192+
warn!("Setup Geode using `geode config setup`");
193193
} else if output.get_profile(&output.current_profile).is_none() {
194194
output.current_profile = Some(output.profiles[0].borrow().name.clone());
195195
}

src/util/logging.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ macro_rules! fatal {
2929
macro_rules! warn {
3030
($x:expr $(, $more:expr)*) => {{
3131
use ::colored::Colorize;
32-
println!("{}{}", "| Warn | ".bright_yellow(), format!($x, $($more),*));
32+
eprintln!("{}{}", "| Warn | ".bright_yellow(), format!($x, $($more),*));
3333
}}
3434
}
3535

src/util/mod_file.rs

+19
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub struct BitmapFont {
1212
pub charset: Option<String>,
1313
pub size: u32,
1414
pub outline: u32,
15+
pub color: [u8; 3],
1516
}
1617

1718
pub struct ModResources {
@@ -145,6 +146,7 @@ fn get_mod_resources(root: &Value, root_path: &Path) -> ModResources {
145146
charset: None,
146147
size: 0,
147148
outline: 0,
149+
color: [255, 255, 255],
148150
};
149151

150152
// Iterate font attributes
@@ -178,6 +180,23 @@ fn get_mod_resources(root: &Value, root_path: &Path) -> ModResources {
178180
)) as u32;
179181
}
180182

183+
"color" => {
184+
let color = value
185+
.as_str()
186+
.nice_unwrap(format!("{}.color: Expected string", info_name));
187+
188+
let col = u32::from_str_radix(color, 16).nice_unwrap(format!(
189+
"{}.color: Expected hexadecimal color",
190+
info_name
191+
));
192+
193+
font.color = [
194+
((col >> 16) & 0xFF) as u8,
195+
((col >> 8) & 0xFF) as u8,
196+
(col & 0xFF) as u8,
197+
];
198+
}
199+
181200
"charset" => {
182201
font.charset = Some(
183202
value

0 commit comments

Comments
 (0)