Struct texture::state::BasicState
[−]
[src]
pub struct BasicState { /* fields omitted */ }
Basic state structure
Includes hashmaps for frequently used types
It is recommended to build a custom state type rather than using this basic one.
Trait Implementations
impl BaseState for BasicState
[src]
fn new() -> BasicState
Examples
use texture::state::BaseState; use texture::state::BasicState; let mut state = BasicState::new();
fn clear(&mut self)
Simply removes all keys from the internal hashmaps
Examples
use texture::state::BaseState; use texture::state::BasicState; let mut state = BasicState::new(); // Do operations over state... // Clear state state.clear();
fn set_flag(&mut self, name: String, value: bool)
Examples
use texture::state::BaseState; use texture::state::BasicState; let mut state = BasicState::new(); // Set flag state.set_flag("in_start".to_string(), true); assert_eq!(state.get_flag("in_start".to_string()), true);
fn get_flag(&self, name: String) -> bool
Examples
use texture::state::BaseState; use texture::state::BasicState; let mut state = BasicState::new(); // Set flag state.set_flag("in_start".to_string(), true); assert_eq!(state.get_flag("in_start".to_string()), true); state.set_flag("in_start".to_string(), false); assert_eq!(state.get_flag("in_start".to_string()), false);
fn set_value(&mut self, name: String, value: i32)
Examples
use texture::state::BaseState; use texture::state::BasicState; let mut state = BasicState::new(); // Set flag state.set_value("time".to_string(), 850); assert_eq!(state.get_value("time".to_string()), 850);
fn get_value(&self, name: String) -> i32
Examples
use texture::state::BaseState; use texture::state::BasicState; let mut state = BasicState::new(); // Set flag state.set_value("time".to_string(), 850); assert_eq!(state.get_value("time".to_string()), 850); state.set_value("time".to_string(), 700); assert_eq!(state.get_value("time".to_string()), 700);