mirror of
https://github.com/Xevion/Pac-Man.git
synced 2025-12-11 16:07:58 -06:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8f504d6c77 | ||
|
|
66499b6285 |
@@ -24,44 +24,6 @@ impl CommonPlatform for Platform {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn init_console(&self) -> Result<(), PlatformError> {
|
fn init_console(&self) -> Result<(), PlatformError> {
|
||||||
#[cfg(windows)]
|
|
||||||
{
|
|
||||||
unsafe {
|
|
||||||
use winapi::{
|
|
||||||
shared::ntdef::NULL,
|
|
||||||
um::{
|
|
||||||
fileapi::{CreateFileA, OPEN_EXISTING},
|
|
||||||
handleapi::INVALID_HANDLE_VALUE,
|
|
||||||
processenv::SetStdHandle,
|
|
||||||
winbase::{STD_ERROR_HANDLE, STD_OUTPUT_HANDLE},
|
|
||||||
wincon::{AttachConsole, GetConsoleWindow},
|
|
||||||
winnt::{FILE_SHARE_READ, FILE_SHARE_WRITE, GENERIC_READ, GENERIC_WRITE},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
if !std::ptr::eq(GetConsoleWindow(), std::ptr::null_mut()) {
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
|
|
||||||
if AttachConsole(winapi::um::wincon::ATTACH_PARENT_PROCESS) != 0 {
|
|
||||||
let handle = CreateFileA(
|
|
||||||
c"CONOUT$".as_ptr(),
|
|
||||||
GENERIC_READ | GENERIC_WRITE,
|
|
||||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
|
||||||
std::ptr::null_mut(),
|
|
||||||
OPEN_EXISTING,
|
|
||||||
0,
|
|
||||||
NULL,
|
|
||||||
);
|
|
||||||
|
|
||||||
if handle != INVALID_HANDLE_VALUE {
|
|
||||||
SetStdHandle(STD_OUTPUT_HANDLE, handle);
|
|
||||||
SetStdHandle(STD_ERROR_HANDLE, handle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -79,15 +79,19 @@ pub fn startup_stage_system(
|
|||||||
if let Some((from, to)) = startup.tick() {
|
if let Some((from, to)) = startup.tick() {
|
||||||
debug!("StartupSequence transition from {from:?} to {to:?}");
|
debug!("StartupSequence transition from {from:?} to {to:?}");
|
||||||
match (from, to) {
|
match (from, to) {
|
||||||
// (StartupSequence::TextOnly { .. }, StartupSequence::CharactersVisible { .. }) => {}
|
(StartupSequence::TextOnly { .. }, StartupSequence::CharactersVisible { .. }) => {
|
||||||
(StartupSequence::CharactersVisible { .. }, StartupSequence::GameActive) => {
|
// Unhide the player & ghosts
|
||||||
// Unfreeze and unhide the player & ghosts
|
|
||||||
for entity in player_query.iter_mut().chain(ghost_query.iter_mut()) {
|
for entity in player_query.iter_mut().chain(ghost_query.iter_mut()) {
|
||||||
commands.entity(entity).remove::<(Frozen, Hidden)>();
|
commands.entity(entity).remove::<Hidden>();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Unfreeze pellet blinking
|
(StartupSequence::CharactersVisible { .. }, StartupSequence::GameActive) => {
|
||||||
for entity in blinking_query.iter_mut() {
|
// Unfreeze the player & ghosts & pellet blinking
|
||||||
|
for entity in player_query
|
||||||
|
.iter_mut()
|
||||||
|
.chain(ghost_query.iter_mut())
|
||||||
|
.chain(blinking_query.iter_mut())
|
||||||
|
{
|
||||||
commands.entity(entity).remove::<Frozen>();
|
commands.entity(entity).remove::<Frozen>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user