/// <summary> /// Write full sprite info to JSON. /// </summary> /// <param name="writer">Writer.</param> public void ToJson(JsonWriter writer) { writer.WriteStartObject(); writer.WritePropertyName("asset"); writer.WriteValue(_textureAsset); writer.WritePropertyName("fwidth"); writer.WriteValue(_frameWidth); writer.WritePropertyName("fheight"); writer.WriteValue(_frameHeight); writer.WritePropertyName("scale"); writer.WriteVector2(Scale); writer.WritePropertyName("anchor"); writer.WriteVector2(Anchor); writer.WritePropertyName("color"); writer.WriteColor(Color); writer.WritePropertyName("effect"); writer.WriteValue(Effect.ToString()); writer.WritePropertyName("animregistry"); writer.WriteStartObject(); _animRegistry.ToList().ForEach(pair => { writer.WritePropertyName(pair.Key); pair.Value.ToJson(writer); }); writer.WriteEndObject(); writer.WriteEndObject(); }
public override void Serialize(StreamWriter SW) { SW.WriteLine(ToString()); base.Serialize(SW); if (Sprite != null) { Sprite.Serialize(SW, gameObject.Name); } else { SW.WriteLine("null\n"); // Make a check in deserialization } SW.Write("SpriteEffects:\t" + SpriteEffects.ToString() + "\n"); SW.Write("Color:\t" + Color.R.ToString() + "\t" + Color.G.ToString() + "\t" + Color.B.ToString() + "\t" + Color.A.ToString() + "\n"); if (Effect != null) { SW.Write("Effect:\t" + Effect.Name + "\n"); } else { SW.Write("Effect:\t" + "null\n"); } SW.WriteLine("End Of " + ToString()); }
public void Draw_with_SpriteEffects(SpriteEffects effects) { Game.DrawWith += (sender, e) => { _spriteBatch.Begin(); _spriteBatch.DrawString( _defaultFont, effects.ToString(), new Vector2(50, 50), Color.Orange, 0, Vector2.Zero, Vector2.One, effects, 0.0f); _spriteBatch.End(); }; RunSingleFrameTest(); }
public void Draw_with_SpriteEffects(SpriteEffects effects) { PrepareFrameCapture(); _spriteBatch.Begin(); // Row 0: String test. _spriteBatch.DrawString( _defaultFont, effects.ToString(), new Vector2(50, 50), Color.Orange, 0, Vector2.Zero, 1f, effects, 0.0f); _spriteBatch.DrawString( _defaultFont, effects.ToString(), new Vector2(450, 50), Color.Orange, 0, Vector2.Zero, Vector2.One, effects, 0.0f); // Row 1: StringBuilder test. _spriteBatch.DrawString( _defaultFont, new StringBuilder(effects.ToString()), new Vector2(50, 290), Color.Orange, 0, Vector2.Zero, 1f, effects, 0.0f); _spriteBatch.DrawString( _defaultFont, new StringBuilder(effects.ToString()), new Vector2(450, 290), Color.Orange, 0, Vector2.Zero, Vector2.One, effects, 0.0f); _spriteBatch.End(); CheckFrames(); }
public void rec(string a, ref float r, Vector2 pv, Vector2 nv) { Main.NewText(a + " Deg: " + ((int)d(rot)).ToString() + /**" Rad: " + rot.ToString() +**/ " MinVect: " + (minVect).ToString() + " R:" + d(r).ToString() + " Q: " + qnt.ToString() + " Mouth: " + pMth.ToString() + " Egg: " + pEgg.ToString() + " playerVel: " + pv.X.ToString() + " broodVel: " + vel.ToString() + " box: " + rand.ToString() + " turbo: " + turbo.ToString() + " phase: " + phase.ToString() + " pTimer: " + pTimer[phase].ToString() + " swpOrig: " + swpOrig.ToString() + " swpStrt: " + swpStrt.ToString() + " se: " + se.ToString() + " pos: " + nv.ToString() ); }
public void Draw_with_SpriteEffects (SpriteEffects effects) { Game.DrawWith += (sender, e) => { _spriteBatch.Begin (); _spriteBatch.DrawString ( _defaultFont, effects.ToString(), new Vector2 (50, 50), Color.Orange, 0, Vector2.Zero, Vector2.One, effects, 0.0f); _spriteBatch.End (); }; RunSingleFrameTest (); }