public GoldDisplay(int _startGold, int _goldRecieved) { startGold = goldDisplayed = _startGold; goldRecieved = _goldRecieved; _displayPos = new Vector2(EquestriEngine.Settings.WindowWidth - 80, EquestriEngine.Settings.WindowHeight - 46); }
private void FillVertices(float uvX, float uvY) { Vector2 texUpperLeft = new Vector2(0.0f, 0.0f); Vector2 texUpperRight = new Vector2(uvX, 0.0f); Vector2 texLowerLeft = new Vector2(0.0f, uvY); Vector2 texLowerRight = new Vector2(uvX, uvY); for (int i = 0; i < vertices.Length; i++) { vertices[i].Normal = _normal; } vertices[0].Position = _lowerLeft; vertices[0].TextureCoordinate = texLowerLeft; vertices[1].Position = _upperLeft; vertices[1].TextureCoordinate = texUpperLeft; vertices[2].Position = _lowerRight; vertices[2].TextureCoordinate = texLowerRight; vertices[3].Position = _upperRight; vertices[3].TextureCoordinate = texUpperRight; indices[0] = 0; indices[1] = 1; indices[2] = 2; indices[3] = 2; indices[4] = 1; indices[5] = 3; _ready = true; }
public PopTextWidget(PopType type) { _life = start_life = random.Next(1, 3); _velocity = new Vector2((float)((random.NextDouble() * 5) - 2.5f), -5); Position = new Vector2(1024 / 2, 768 / 2); _type = type; }
public AchievementDisplay(float life,Achievement achievement) { _startLife = _life = life; _achievement = achievement; initPosition = new Vector2(EngineGlobals.Settings.WindowWidth - WIDGET_WIDTH - 4, EngineGlobals.Settings.WindowHeight); finalPosition = new Vector2(EngineGlobals.Settings.WindowWidth - WIDGET_WIDTH - 4, EngineGlobals.Settings.WindowHeight - WIDGET_HEIGHT - Height_Displace); Height_Displace += WIDGET_HEIGHT; Position = new Vector2(0, -WIDGET_HEIGHT); instanceNumber = _instances; _instances++; }
public MessageBoxScreen(string _message, ActionList actions) : base(false,true) { Systems.InputManager.RegisterScreen(this); boxPosition = new Vector2(EquestriEngine.Settings.WindowWidth / 2, EquestriEngine.Settings.WindowHeight / 1.25f); _actions = actions; //_data = new TextLineData[_windowLines.Length / 4][]; var rough = _message.Split(new string[] { "/n[", "]" },System.StringSplitOptions.RemoveEmptyEntries); if (rough.Length > 1) { name = rough[0]; message = rough[1]; } else message = rough[0]; }
public MessageBoxScreen(string _message) : base(false) { Systems.InputManager.RegisterScreen(this); endPos = new Vector2(EngineGlobals.Settings.WindowWidth / 2, EngineGlobals.Settings.WindowHeight / 1.25f); startPos = new Vector2(EngineGlobals.Settings.WindowWidth / 2, EngineGlobals.Settings.WindowHeight + 200); //_data = new TextLineData[_windowLines.Length / 4][]; var rough = _message.Split(new string[] { "/n[", "]" }, System.StringSplitOptions.RemoveEmptyEntries); if (rough.Length > 1) { name = rough[0]; message = rough[1]; } else message = rough[0]; method = new Data.Inputs.MethodParamPair(EngineGlobals.WaitForInput, new Data.Inputs.ControlInput() { Control = this.ControlReference[Data.Controls.ControlTypes.Interaction] }, 0); }
public void Draw(TextureObject textureObject, Vector2 position, Rectangle? sourceRect, Color color, float rotation, Vector2 origin, Vector2 scale, int effects, float depth) { SpriteEffects sfx; switch (effects) { case 1: sfx = SpriteEffects.FlipHorizontally; break; case 2: sfx = SpriteEffects.FlipVertically; break; case 3: sfx = SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically; break; default: sfx = SpriteEffects.None; break; } base.Draw(textureObject.Texture, position, sourceRect, color, rotation, origin, scale, sfx, depth); }
public static Vector2 Reflect(Vector2 v, Vector2 n) { return Vector.Reflect(v, n); }
public override void LoadContent() { //_messageBoxWindow = Systems.AssetManager.GetTexture("message_box"); if (_messageBoxWindowTexture == null) { _messageBoxWindowTexture = new TextureObject("message_box", @"Graphics\UI\MessageBox"); _nameBoxWindowTexture = new TextureObject("name_box", @"Graphics\UI\namebox"); _continueArrowTexture = new TextureObject("continue_arrow", @"Graphics\UI\textbox_arrow"); } _messageBoxFont = EquestriEngine.AssetManager.GetFont("{largefont}"); boxOrigin = new Vector2(_messageBoxWindowTexture.Width / 2, _messageBoxWindowTexture.Height / 2); name = "Fluttershy"; if (name != null) { _nameBoxWindow = EquestriEngine.AssetManager.CreateTargetObject("{namebox_texture}", (int)_messageBoxFont.Measure(name).X + 50, 74); _nameBoxWindow.RunTarget(DrawNameBox, Color.Transparent); } base.LoadContent(); }
public static Vector2 CatmullRom(Vector2 v1, Vector2 v2, Vector2 v3, Vector2 v4, float amount) { return new Vector2(Vector.CatmullRom(v1, v2, v3, v4, amount)); }
public override void Draw(float dt) { SpriteBatch.Begin(); //if (name != null) // SpriteBatch.Draw(_nameBoxWindow.Texture, boxPosition - new Vector2(320, 200), Color.Multiply(Color.White, alphaModifer)); boxOrigin = new Vector2(_messageBoxWindowTexture.Width / 2, _messageBoxWindowTexture.Height / 2); SpriteBatch.Draw(_messageBoxWindowTexture.Texture, boxPosition, null, Color.Multiply(EngineGlobals.Settings.SkinColor, alphaModifer), 0.0f, boxOrigin, 1, Microsoft.Xna.Framework.Graphics.SpriteEffects.None, 0.0f); SpriteBatch.DrawString(_messageBoxFont, message.Substring(0, _charactersShown), boxPosition - new Vector2(319, 71), Color.Multiply(Color.Black, alphaModifer)); SpriteBatch.DrawString(_messageBoxFont, message.Substring(0, _charactersShown), boxPosition - new Vector2(320, 72), Color.Multiply(Color.White, alphaModifer)); if (messageDisplayed) SpriteBatch.Draw(_continueArrowTexture.Texture, boxPosition + Arrow_Pos - _arrowRise, Color.Multiply(Color.White, alphaModifer)); SpriteBatch.End(); }
public static Vector2 Barycentric(Vector2 v1, Vector2 v2, Vector2 v3, float a1,float a2) { return new Vector2(Vector.Barycentric(v1, v2, v3, a1,a2)); }
public static Vector2 Clamp(Vector2 val, Vector2 min,Vector2 max) { return new Vector2(Vector.Clamp(val, min, max)); }
public static float DistanceSquared(Vector2 v1, Vector2 v2) { return Vector.DistanceSquared(v1, v2); }
public static Vector2 Lerp(Vector2 v1, Vector2 v2, float amount) { return new Vector2(Vector.Lerp(v1, v2, amount)); }
public static Vector2 Hermite(Vector2 v1,Vector2 t1, Vector2 v2, Vector2 t2, float amount) { return new Vector2(Vector.Hermite(v1,t1, v2,t2, amount)); }
public static float Dot(Vector2 v1, Vector2 v2) { return Vector.Dot(v1, v2); }
public void Draw(TextureObject textureObject, Vector2 position, Rectangle? sourceRect, Color color) { base.Draw(textureObject.Texture, position, sourceRect, color); }
public static Vector2 Slerp(Vector2 v1, Vector2 v2, float amount) { return new Vector2(Vector.SmoothStep(v1, v2, amount)); }
public override void Update(Microsoft.Xna.Framework.GameTime gameTime) { base.Update(gameTime); if (Console_Open) { if (_currentMode == ConsoleMode.Stats) { refresh += (float)gameTime.ElapsedGameTime.TotalSeconds; if (refresh > 1.0) { refresh = 0; _entries = string.Format( "--Engine Stats--\n" + "FPS: {0}\n" + "Memory Used: {1} MB\n" + "Objects Loaded: {2}", new object[] { frames, ((int)System.Diagnostics.Process.GetCurrentProcess().PagedMemorySize64 / 1048576), EngineGlobals.AssetManager.ItemsLoaded }); Refresh_Required = true; frames = 0; } } showAmount += (float)gameTime.ElapsedGameTime.TotalSeconds; if (showAmount > 1) showAmount = 1; } else { showAmount -= (float)gameTime.ElapsedGameTime.TotalSeconds; if (showAmount < 0) showAmount = 0; } _consoleClosed = showAmount == 0.0f; if ((!Console_Open && !_consoleClosed) ^ (Console_Open && windowShown != CONSOLE_HEIGHT)) { windowShown = (int)MathHelper.Slerp(0, CONSOLE_HEIGHT, showAmount); _consoleTextPos = Vector2.Slerp( new Vector2(0, EngineGlobals.Settings.WindowHeight), new Vector2(0, EngineGlobals.Settings.WindowHeight - CONSOLE_HEIGHT), showAmount); } }
public override void Update(float dt) { if (fadingIn) { _deltaTime += dt; alphaModifer = MathHelper.Slerp(0, 1, _deltaTime / FADE_IN_TIME); boxPosition = Vector2.Slerp(startPos, endPos, _deltaTime / FADE_IN_TIME); if (alphaModifer == 1) { _deltaTime = 0; fadingIn = false; } } else if (fadingOut) { _deltaTime += dt; alphaModifer = MathHelper.Slerp(1, 0, _deltaTime / FADE_OUT_TIME); boxPosition = Vector2.Slerp(endPos, startPos, _deltaTime / FADE_OUT_TIME); if (alphaModifer == 0) { _deltaTime = 0; fadingOut = false; StateManager.RemoveScreen(this); } } else { _deltaTime += dt; _arrowRise.Y = (float)System.Math.Sin(_deltaTime) * 16; if (!methodExecuted) { method.ExecuteMethod(null); methodExecuted = true; } if (!messageDisplayed) { _charactersShown++; } messageDisplayed = _charactersShown == message.Length; } }
public override void Initialize() { logoPos = new Vector2(EngineGlobals.Settings.WindowWidth / 2, EngineGlobals.Settings.WindowHeight / 2); logoOrigin = new Vector2(_logo.Width / 2, _logo.Height / 2); }
public static Vector2 TransformNormal(Vector2 vector, Matrix transform) { return new Vector2(Vector.TransformNormal(vector, transform)); }