Struct curses_game_wrapper::GameSetting
[−]
[src]
pub struct GameSetting<'a> { /* fields omitted */ }
Game process builder, providing control over how a new process should be spawned.
Like std::process::Command
, A default configuration can be
generated using Gamesetting::new(command name) and other settings
can be added by builder methods.
Example
extern crate curses_game_wrapper as cgw; use cgw::{Reactor, ActionResult, AsciiChar, GameSetting, Severity}; use std::time::Duration; fn main() { let loopnum = 50; let gs = GameSetting::new("rogue") .env("ROGUEUSER", "EmptyAI") .lines(24) .columns(80) .debug_file("debug.txt") .max_loop(loopnum + 1) .draw_on(Duration::from_millis(200)); let game = gs.build(); }
Methods
impl<'a> GameSetting<'a>
[src]
fn new(command_name: &str) -> Self
[src]
Build GameSetting object with command name(like rogue
).
fn columns(self, u: usize) -> Self
[src]
Set screen width of curses widow
fn lines(self, u: usize) -> Self
[src]
Set screen height of curses window
fn arg(self, s: &'a str) -> Self
[src]
Add command line argument
fn env(self, s: &'a str, t: &'a str) -> Self
[src]
Set environmental variable
fn args<I>(self, i: I) -> Self where
I: IntoIterator<Item = &'a str>,
[src]
I: IntoIterator<Item = &'a str>,
Set multiple command line arguments
fn envs<I>(self, i: I) -> Self where
I: IntoIterator<Item = (&'a str, &'a str)>,
[src]
I: IntoIterator<Item = (&'a str, &'a str)>,
Set multiple environmental variables
fn draw_on(self, d: Duration) -> Self
[src]
Draw game on terminal(Default: off). You hanve to set duration of drawing.
fn debug_file(self, s: &str) -> Self
[src]
You can set debug file of this crate. This is mainly for developper of this crate:)
fn debug_level(self, s: Severity) -> Self
[src]
You can set debug level of this crate. This is mainly for developper of this crate:)
fn timeout(self, d: Duration) -> Self
[src]
You can set timeout to game output. It's setted to 0.1s by default.
fn max_loop(self, t: usize) -> Self
[src]
You can set max_loop of game. It's setted to 100 by default.
fn build(self) -> GameEnv
[src]
Consume game setting and build GameEnv
Trait Implementations
impl<'a> Clone for GameSetting<'a>
[src]
fn clone(&self) -> GameSetting<'a>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more