/// <summary>Processes the specified entity.</summary> /// <param name="entity">The entity.</param> public override void Process(Entity entity, TextComp textComp, PositionComp posComp, DrawComp drawComp) { textComp.UpdateComp(dt); if (drawComp.IsVisible) { // use set screen, or default if not given. ScreenComp screen = drawComp.Screen; if (screen == null) { screen = activeScreen; } // update drawpos FIXME - should one system do this, now it's two? or make a helper method. var p = posComp.Position + posComp.PositionModifier; drawComp.DrawPosition = screen.ToPixels(p); drawComp.LayerDepth = p.Z; // Z position is translated to a layer depth // draw sprite TTSpriteBatch sb = screen.SpriteBatch; sb.DrawString(textComp.Font, textComp.Text, drawComp.DrawPosition, drawComp.DrawColor, 0f, Vector2.Zero, drawComp.DrawScale, SpriteEffects.None, drawComp.LayerDepth); } }
/// <summary>Processes the specified entity.</summary> /// <param name="entity">The entity.</param> public override void Process(Entity entity, SpriteComp spriteComp, PositionComp posComp, DrawComp drawComp) { if (drawComp.IsVisible) { ScreenComp screen = drawComp.Screen; // if no specific screen... if (screen == null) { screen = activeScreen; } // update drawpos var p = posComp.Position + posComp.PositionModifier; drawComp.DrawPosition = screen.ToPixels(p); drawComp.LayerDepth = p.Z; // Z position is translated to a layer depth //spriteComp.DrawCenter = screen.ToPixels(spriteComp.Center); // TODO check TTSpriteBatch sb = screen.SpriteBatch; // draw sprite sb.Draw(spriteComp.Texture, drawComp.DrawPosition, null, drawComp.DrawColor, drawComp.DrawRotation, spriteComp.DrawCenter, drawComp.DrawScale, SpriteEffects.None, drawComp.LayerDepth); } }
protected override void Begin() { activeScreen = TTGame.Instance.DrawScreen; dt = TimeSpan.FromTicks(EntityWorld.Delta).TotalSeconds; }
public Level() { Subtitles = new SubtitleManager(); Screen = TTGame.Instance.BuildScreen.GetComponent <ScreenComp>(); }
protected override void Begin() { activeScreen = TTGame.Instance.DrawScreen; }