/// <summary> /// Construct a state, giving it its scale, UI colors, and background colors. /// </summary> /// <param name="_draw">The color to draw the UI.</param> /// <param name="_bg">The color to draw the background.</param> /// <param name="_scale">The scale to draw the items in this state.</param> public State(StateType type, Color _draw, Color _bg, float _scale = 1.0f) { this.stateInfo = StateInfo.GetStateInfo(type); this.colorset = new ColorSet(_draw, null, null, null, _bg); this.entities = new List <Entity>(); this.buttons = new List <Button>(); this.scheme = new ControlScheme(); this._debug = false; SetScale(_scale); BindKeys(); }
/// <summary> /// Construct a state, giving it its scale, UI colors, and background colors. /// </summary> /// <param name="set">The colors to to use for this state.</param> /// <param name="_scale">The scale to draw the items in this state.</param> public State(StateType type, ColorSet set, float _scale = 1.0f) { this.stateInfo = StateInfo.GetStateInfo(type); this.colorset = new ColorSet(); this.colorset.AssignColors(set, ColorType.Draw, ColorType.Other); // Only get these colors from the pre-existing colorset. this.entities = new List <Entity>(); this.buttons = new List <Button>(); this.scheme = new ControlScheme(); this._debug = false; SetScale(_scale); BindKeys(); }
/// <summary> /// Using a control scheme and a command, this checks to see if any of the given keys associated with the command has just been released. /// </summary> /// <param name="schema">Schema to get information from.</param> /// <param name="command">Command to get key association for.</param> /// <returns>Returns true if any key has just been released.</returns> public static bool IsKeyReleased(ControlScheme schema, Commands command) { List <Keys> keys; if (schema.GetCommandKeys(command, out keys)) { foreach (Keys key in keys) { if (IsKeyReleased(key)) { return(true); } } } return(false); }
/// <summary> /// Initialization method. The GraphicsDeviceManager is private in the main game object, so this is passed in through the initialization method. /// </summary> /// <param name="_main">The main instance of the game.</param> /// <param name="_graphics">The current instance of the GraphicsDeviceManager for the game.</param> public static void Initialize(Game1 _main, GraphicsDeviceManager _graphics) { Main = _main; Graphics = _graphics; Content = _main.Content; UpdateScreen(800, 600); fonts = new Dictionary <FontIDs, SpriteFont>(); textures = new Dictionary <TextureIDs, Texture2D>(); StateManager.Initialize(); InputManager.Initialize(); keyListener = new ControlScheme(); scale = 1.0f; _initialized = true; }