public override void Render(SpriteBatch spriteBatch, FieldFontRenderer fieldFontRenderer) { if (!Hidden) { NinePatchRegion2D ninePatch = _releasedNinePatch; if (SliderState == SliderState.Hover && Root.MouseMode == true) { ninePatch = _hoverNinePatch; } if (this.isSelected == true && Root.MouseMode == false) { ninePatch = _hoverNinePatch; } if (SliderState == SliderState.Pressed) { ninePatch = _pressedNinePatch; } spriteBatch.Draw(ninePatch, new Rectangle((int)TopLeft.X, (int)(TopLeft.Y + (Height / 2) - Height / 20), (int)Width, (int)Height / 10), Color.Green); SliderButton.Render(spriteBatch, fieldFontRenderer); } }
public override void Render(SpriteBatch spriteBatch, FieldFontRenderer fieldFontRenderer) { if (!Hidden) { NinePatchRegion2D ninePatch = _releasedNinePatch; if (ButtonState == ButtonState.Hover && Root.MouseMode == true) { ninePatch = _hoverNinePatch; } if (this.isSelected == true && Root.MouseMode == false) { ninePatch = _hoverNinePatch; } if (ButtonState == ButtonState.Pressed || ForceShowAsPressed) { ninePatch = _pressedNinePatch; } spriteBatch.Draw(ninePatch, new Rectangle((int)TopLeft.X, (int)TopLeft.Y, (int)Width, (int)Height), TintColor); SubPanel.Render(spriteBatch, fieldFontRenderer); } }
private bool ArmedForSceneChangeOnPlayerLostAnimationComplete = false; // TODO This doesn't have logic to switch scenes yet public AdriftGameState(GameManager gameManager, SharedGameState sharedState, Player[] players) : base(gameManager, sharedState) { Players = players; _spriteBatch = new SpriteBatch(GameManager.GraphicsDevice); _fieldFontRenderer = new FieldFontRenderer(Content, GameManager.GraphicsDevice); }
public override void Render(SpriteBatch spriteBatch, FieldFontRenderer fieldFontRenderer) { if (!Hidden) { for (int i = 0; i < _widgets.Count; i++) { _widgets[i].Render(spriteBatch, fieldFontRenderer); } } }
public override void Render(SpriteBatch spriteBatch, FieldFontRenderer fieldFontRenderer) { if (!Hidden) { spriteBatch.Draw(NinePatch, new Rectangle((int)TopLeft.X, (int)TopLeft.Y, (int)Width, (int)Height), TintColor); } }
public UIOptionsGameState(GameManager gameManager, SharedGameState sharedState) : base(gameManager, sharedState) { _spriteBatch = new SpriteBatch(GameManager.GraphicsDevice); _fieldFontRenderer = new FieldFontRenderer(Content, GameManager.GraphicsDevice); supportedResolutions = new List <string>(); IEnumerator <DisplayMode> enumerator = GameManager.Graphics.GraphicsDevice.Adapter.SupportedDisplayModes.GetEnumerator(); while (enumerator.MoveNext()) { supportedResolutions.Add(enumerator.Current.ToString()); } }
public UILobbyGameState(GameManager gameManager, SharedGameState sharedState, Player[] players = null) : base(gameManager, sharedState) { _spriteBatch = new SpriteBatch(GameManager.GraphicsDevice); _fieldFontRenderer = new FieldFontRenderer(Content, GameManager.GraphicsDevice); if (players != null) { for (int i = 0; i < players.Length; i++) { int idx = players[i].LobbySeatIndex > 0 && players[i].LobbySeatIndex < MAX_PLAYERS ? players[i].LobbySeatIndex : i; _playersSeated[idx] = players[i]; } } }
public RenderSystem(GraphicsDevice graphics, ContentManager content, Engine engine) { Engine = engine; _spriteEntities = Engine.GetEntitiesFor(_spriteFamily); _fontEntities = Engine.GetEntitiesFor(_fontFamily); _fieldFontEntities = Engine.GetEntitiesFor(_fieldFontFamily); _vectorSpriteEntities = Engine.GetEntitiesFor(_vectorSpriteFamily); SpriteBatch = new SpriteBatch(graphics); FieldFontRenderer = new FieldFontRenderer(content, graphics); GraphicsDevice = graphics; _vectorSpriteEffect = new BasicEffect(GraphicsDevice); _vectorSpriteEffect.AmbientLightColor = new Vector3(1, 1, 1); _vectorSpriteEffect.World = Matrix.Identity; _vectorSpriteEffect.TextureEnabled = false; _vectorSpriteEffect.VertexColorEnabled = true; }
public override void Render(SpriteBatch spriteBatch, FieldFontRenderer fieldFontRenderer) { if (!Hidden) { Vector2 scale = (BottomRight - TopLeft) / _bounds; /*spriteBatch.Draw(Texture, * TopLeft, * null, * TintColor, * 0, * Vector2.Zero, * scale, * SpriteEffects.None, * 0);*/ spriteBatch.Draw(Texture, TopLeft, TintColor, 0, Vector2.Zero, scale, SpriteEffects.None, 0); } }
protected override void OnInitialize() { _textRenderer = new FieldFontRenderer(Content, GameManager.GraphicsDevice); Engine = new Engine(); Entity entity = Engine.CreateEntity(); entity.AddComponent(new FieldFontComponent(Content.Load <FieldFont>("font_msdf_hyperspace"), "The quick brown fox jumped over the lazy dog!?")); entity.GetComponent <FieldFontComponent>().OptimizeForSmallText = true; entity.AddComponent(new TransformComponent()); entity.GetComponent <TransformComponent>().SetPosition(new Vector2(0, 0), true); entity.GetComponent <TransformComponent>().SetScale(1, true); Camera = new Camera(GameManager.GraphicsDevice.Viewport.Width, GameManager.GraphicsDevice.Viewport.Height); base.OnInitialize(); }
private void DrawFieldFontEntities(Camera camera, byte groupMask, float dt, float betweenFrameAlpha, Camera debugCamera) { Matrix transformMatrix = debugCamera == null?camera.GetInterpolatedTransformMatrix(betweenFrameAlpha) : debugCamera.GetInterpolatedTransformMatrix(betweenFrameAlpha); if (_fieldFontEntities.Count > 0) { CheckUpdateProjections(); Matrix wvp = transformMatrix * _fieldFontRendererProjection; FieldFontRenderer.Begin(wvp); foreach (Entity entity in _fieldFontEntities) { FieldFontComponent fieldFontComp = entity.GetComponent <FieldFontComponent>(); if (fieldFontComp.Hidden || (fieldFontComp.RenderGroup & groupMask) == 0) { continue; } TransformComponent transformComp = entity.GetComponent <TransformComponent>(); BoundingRect boundRect = new BoundingRect(transformComp.Position.X - (fieldFontComp.Font.MeasureString(fieldFontComp.Content).X *transformComp.Scale / 2), transformComp.Position.Y - (fieldFontComp.Font.MeasureString(fieldFontComp.Content).Y *transformComp.Scale / 2), fieldFontComp.Font.MeasureString(fieldFontComp.Content).X *transformComp.Scale, fieldFontComp.Font.MeasureString(fieldFontComp.Content).Y *transformComp.Scale); if (!boundRect.Intersects(camera.BoundingRect) && CVars.Get <bool>("debug_show_render_culling")) { continue; } Vector2 position; float rotation; float transformScale; transformComp.Interpolate(betweenFrameAlpha, out position, out rotation, out transformScale); FieldFontRenderer.Draw(fieldFontComp.Font, fieldFontComp.Content, position, rotation, fieldFontComp.Color, transformScale, fieldFontComp.EnableKerning); } FieldFontRenderer.End(); } }
protected override void OnInitialize() { SpriteBatch = new SpriteBatch(GameManager.GraphicsDevice); _fieldFontRenderer = new FieldFontRenderer(Content, GameManager.GraphicsDevice); Root = new Root(GameManager.GraphicsDevice.Viewport.Width, GameManager.GraphicsDevice.Viewport.Height); LoadContent(); Root.FindWidgetsByClass("main_fade_in").ForEach((Widget widget) => { widget.Alpha = 0; }); ProcessManager.Attach(new WidgetClassFadeAnimation(Root, "main_fade_in", 0, 1, CVars.Get <float>("game_over_ui_fade_in_duration"), Easings.Functions.SineEaseOut)); UpdateScores(); base.OnInitialize(); }
public override void Render(SpriteBatch spriteBatch, FieldFontRenderer fieldFontRenderer) { if (!Hidden) { // Labels maintain aspect-ratio, so it shouldn't matter which // axis we get the scale from. float scale = (BottomRight.X - TopLeft.X) / _bounds.X; Vector2 position = (BottomRight - TopLeft) / 2 + TopLeft; position.Y = Root.Height - position.Y; fieldFontRenderer.Draw(_font, Content, position, 0, TintColor, scale, true); } }
public override void Render(SpriteBatch spriteBatch, FieldFontRenderer fieldFontRenderer) { if (!Hidden) { fieldFontRenderer.Begin(); spriteBatch.Begin(); for (int i = 0; i < _widgets.Count; i++) { _widgets[i].Render(spriteBatch, fieldFontRenderer); } spriteBatch.End(); fieldFontRenderer.End(); fieldFontRenderer.Begin(); spriteBatch.Begin(); for (int i = 0; i < _deferredDrawQueue.Count; i++) { _deferredDrawQueue[i].Render(spriteBatch, fieldFontRenderer); } spriteBatch.End(); fieldFontRenderer.End(); _deferredDrawQueue.Clear(); } }
public PauseGameState(GameManager gameManager, SharedGameState sharedState, Process gameProcess) : base(gameManager, sharedState) { _spriteBatch = new SpriteBatch(GameManager.GraphicsDevice); _fieldFontRenderer = new FieldFontRenderer(Content, GameManager.GraphicsDevice); _gameProcess = gameProcess; }
public UIMenuGameState(GameManager gameManager, SharedGameState sharedState) : base(gameManager, sharedState) { _spriteBatch = new SpriteBatch(GameManager.GraphicsDevice); _fieldFontRenderer = new FieldFontRenderer(Content, GameManager.GraphicsDevice); }
public abstract void Render(SpriteBatch spriteBatch, FieldFontRenderer fieldFontRenderer);
public UIPlaygroundGameState(GameManager gameManager) : base(gameManager) { _spriteBatch = new SpriteBatch(GameManager.GraphicsDevice); _fieldFontRenderer = new FieldFontRenderer(Content, GameManager.GraphicsDevice); }