public Effect_FlyingTextureText(Vector2 v2Position, RC_TextAsTexture.TextType enType, SpriteFont font, string sSourceString) { this.xTransform = new TransformComponent(v2Position); this.xRenderComponent = new RC_TextAsTexture(enType, font, sSourceString); this.xRenderComponent.xTransform = this.xTransform; RC_TextAsTexture xRC = this.xRenderComponent as RC_TextAsTexture; Program.game.xRenderMaster.AddToPrerenderQueue(xRC); xRC.v2Offset = Utility.PointToVector2(xRC.rt2dText.Bounds.Center); Program.game.xRenderMaster.RegisterGUIRenderComponent(this.xRenderComponent); }
public RC_TextAsTexture(RC_TextAsTexture.TextType enType, SpriteFont font, string sSourceString) { Vector2 v2Dimensions = font.MeasureString(sSourceString); Vector2 v2Add = Vector2.Zero; if (enType == RC_TextAsTexture.TextType.Shaded) { v2Add = new Vector2(1f, 1f); } else if (enType == RC_TextAsTexture.TextType.Outlined) { v2Add = new Vector2(2f, 2f); } v2Dimensions += v2Add; this.rt2dText = new RenderTarget2D(Program.game.GraphicsDevice, (int)v2Dimensions.X, (int)v2Dimensions.Y, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8); this.font = font; this.enType = enType; this.sSourceString = sSourceString; }