public override void Render(DeviceContext graphics, Matrix4F matrix, Vector3D renderOrigin, Entity entity, AvatarController avatarController, Timestep renderTimestep, RenderMode renderMode) { if (renderMode == RenderMode.Normal) { this.WorldTextRenderer.Draw(graphics, renderOrigin, matrix); if (GameContext.DebugGraphics.Enabled) { BetterSignTileStateEntityLogic logic = entity.TileStateEntityLogic as BetterSignTileStateEntityLogic; if (logic != null) { Vector2F size = logic.GetTextRegionSize(); Vector3D rotatedRadius = VectorHelper.RotatePosition(this._rotation, new Vector3D(size.X, size.Y, 0) * 0.5); GameContext.DebugGraphics.DrawBoxCentered(this._position, rotatedRadius, Color.Yellow, 1); } } } }
/// <summary> /// Clear out any old pending draw calls pre-render /// </summary> /// <param name="graphics"></param> /// <param name="renderOrigin"></param> /// <param name="entity"></param> /// <param name="avatarController"></param> /// <param name="renderTimestep"></param> public override void BeforeRender(DeviceContext graphics, Vector3D renderOrigin, Entity entity, AvatarController avatarController, Timestep renderTimestep) { this.WorldTextRenderer.Init(graphics); if (!this._textInitialized) { //GameContext.DebugGraphics.Enabled = true; BetterSignTileStateEntityLogic logic = entity.TileStateEntityLogic as BetterSignTileStateEntityLogic; if (logic != null) { this._position = logic.GetCenterPosition(); if (this._position != Vector3D.Zero) { this._rotation = (logic.GetVariation() >> 10) & 3; this._message = logic.GetMessage(); this._color = logic.GetColor(); this._scale = logic.GetScale(); this._align = logic.GetAlign(); this.WorldTextRenderer.DrawString( this._message, logic.GetTextRegionSize(), this._align, Vector3D.Zero, this._position, this._scale, this._rotation, this._color ); this._textInitialized = true; } } } }