You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed during some testing that if a panic (via panic!, todo!, etc) occurred, inside a running Controller, then mouse inputs are being read by the terminal after the controller exits. While a panic is obviously not expected behaviour, having a side effect that renders a terminal unusable on most/all modern computers is undesirable.
MVE:
use termgame::{SimpleEvent,Controller,Game,GameEvent,GameSettings,StyledCharacter, run_game,KeyCode};use std::error::Error;use std::time::Duration;structMyGame{}implControllerforMyGame{fnon_start(&mutself,game:&mutGame){}fnon_event(&mutself,game:&mutGame,event:GameEvent){match event.into(){SimpleEvent::Just(KeyCode::Char(ch)) => {
game.set_screen_char(1,1,Some(StyledCharacter::new(ch)))},
_ => {}}}fnon_tick(&mutself,_game:&mutGame){panic!("This shouldn't break terminals!")}}fnmain() -> Result<(),Box<dynError>>{letmut controller = MyGame{};run_game(&mut controller,GameSettings::new()// The below are the defaults, but shown so you can edit them..tick_duration(Duration::from_millis(50)).quit_event(Some(SimpleEvent::WithControl(KeyCode::Char('c')).into())))?;println!("Game Ended!");Ok(())}
The text was updated successfully, but these errors were encountered:
I noticed during some testing that if a panic (via
panic!
,todo!
, etc) occurred, inside a running Controller, then mouse inputs are being read by the terminal after the controller exits. While a panic is obviously not expected behaviour, having a side effect that renders a terminal unusable on most/all modern computers is undesirable.MVE:
The text was updated successfully, but these errors were encountered: