mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-12-22 20:08:20 -06:00
use windows subsystem attach console on release builds
This commit is contained in:
parent
6354d8bab4
commit
4e357af959
|
@ -19,3 +19,6 @@ nohash-hasher = "0.2.0"
|
|||
anyhow = "1.0"
|
||||
flume = "0.10"
|
||||
gilrs = { version = "0.10", default_features = false, features = ["xinput"] }
|
||||
|
||||
[target.'cfg(target_os = "windows")'.dependencies]
|
||||
winapi = { version = "0.3" }
|
||||
|
|
|
@ -13,7 +13,7 @@ pub fn update_controllers() -> Workload {
|
|||
).into_workload()
|
||||
}
|
||||
|
||||
const MAX_PITCH: f32 = PI/2. - 0.025;
|
||||
const MAX_PITCH: f32 = PI/2. - 0.05;
|
||||
|
||||
fn update_look(
|
||||
controllers: View<FlyController>,
|
||||
|
|
|
@ -5,10 +5,8 @@ use log::Level;
|
|||
use std::io::Write;
|
||||
|
||||
pub fn init() {
|
||||
let mut env = Env::default();
|
||||
if cfg!(debug_assertions) {
|
||||
env = env.filter_or("RUST_LOG", "trace,gilrs=warn,rusty_xinput=warn");
|
||||
}
|
||||
let env = Env::default()
|
||||
.filter_or("RUST_LOG", "trace,gilrs=warn,rusty_xinput=warn");
|
||||
Builder::from_env(env)
|
||||
.format(|buf, record| {
|
||||
let mut level_style = buf.style();
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
// allowed because systems often need a lot of arguments
|
||||
#![allow(clippy::too_many_arguments)]
|
||||
#![cfg_attr(
|
||||
all(windows, not(debug_assertions)),
|
||||
windows_subsystem = "windows"
|
||||
)]
|
||||
#![allow(clippy::too_many_arguments)] // allowed because systems often need a lot of arguments
|
||||
|
||||
use shipyard::{
|
||||
World, Workload, IntoWorkload,
|
||||
|
@ -127,7 +130,16 @@ fn after_frame_end() -> Workload {
|
|||
).into_workload()
|
||||
}
|
||||
|
||||
#[cfg(all(windows, not(debug_assertions)))]
|
||||
fn attach_console() {
|
||||
use winapi::um::wincon::{AttachConsole, ATTACH_PARENT_PROCESS};
|
||||
unsafe { AttachConsole(ATTACH_PARENT_PROCESS); }
|
||||
}
|
||||
|
||||
fn main() {
|
||||
//Attach console on release builds on windows
|
||||
#[cfg(all(windows, not(debug_assertions)))] attach_console();
|
||||
|
||||
//Init env_logger
|
||||
logging::init();
|
||||
|
||||
|
|
Loading…
Reference in a new issue