public void Load(string TexName, Vector2 FrameSize, int MaxFrames, int MsPerFrame) { this.FrameSize = FrameSize; CurrentFrame = 0; this.MaxFrames = MaxFrames; //BaseTex = GeneralManager.Content.Load<Texture2D>("Textures/Animations/" + TexName); if (GeneralManager.Textures.ContainsKey("Animations/" + TexName)) { BaseTex = GeneralManager.Textures["Animations/" + TexName]; } else { GeneralManager.LoadTex("Animations/" + TexName); BaseTex = GeneralManager.Textures["Animations/" + TexName]; } MilisecondsPerFrame = MsPerFrame; Regions = new List <Rectangle>(); int SizeX = (BaseTex.Width / (int)FrameSize.X); int SizeY = (BaseTex.Height / (int)FrameSize.Y); for (int i = 0; i < MaxFrames; i++) { Regions.Add(new Rectangle((i % SizeX) * (int)FrameSize.X, (i / SizeX) * (int)FrameSize.Y, (int)FrameSize.X, (int)FrameSize.Y)); } }
public override bool HandleInput() { if (GeneralManager.CheckKeyEdge(Keys.Enter) && IsActive || Helper.CheckLMBClick(Position)) { if (Action != null) { Action(); } return(true); } return(false); }
public override bool HandleInput() { if (Enabled) { foreach (Keys k in Enum.GetValues(typeof(Keys))) { if (GeneralManager.CheckKeyEdge(k)) { if (k == Keys.Space) { Text += " "; } else if (k == Keys.Back && Text.Length > 0) { Text = Text.Remove(Text.Length - 1); } else if (k >= Keys.A && k <= Keys.Z) { Text += k.ToString(); } else if (k >= Keys.D0 && k <= Keys.D9) { Text += k.ToString().ToCharArray(1, 1)[0].ToString(); } switch (k) { case Keys.OemPeriod: Text += "."; break; case Keys.OemComma: Text += ","; break; case Keys.OemMinus: Text += "-"; break; } return(true); } } } Measure(); return(false); }
public override bool CheckActive() { if (Helper.CheckLMBClick(Position)) { IsActive = true; Enabled = true; return(true); } if (GeneralManager.IsLMBClicked() && !Helper.CheckIfInside(Position, GeneralManager.MousePos)) { IsActive = false; Enabled = false; return(false); } return(false); }
public override bool HandleInput() { if (Visible) { if (Position.Contains(Helper.VectorToPoint(GeneralManager.MousePos)) && GeneralManager.IsLMBClicked()) { foreach (GUIComponent G in GUIComponents) { if (G.HandleInput()) { break; } } return(true); } } return(false); }
public static bool CheckLMBClick(Rectangle Rect) { return(CheckIfInside(Rect, GeneralManager.MousePos) && GeneralManager.IsLMBClickedEdge()); }