private void RenderHighlight() { var contentArea = GetContentArea(); var highlightRect = _metrics.HighlightFrame; highlightRect.Offset(contentArea.Location); _highlight.SetBounds(highlightRect); _highlight.Render(); }
private void RenderPortrait() { var contentArea = GetContentArea(); var portraitRect = contentArea; portraitRect.Offset(_metrics.PortraitOffset); _portrait.SetBounds(portraitRect); _portrait.Render(); }
private void RenderFrame() { var contentArea = GetContentArea(); // This was previously drawn in the context of the parent container contentArea.Offset(-X, -Y); contentArea.Offset(1, 1); contentArea.Size = _metrics.FrameSize; _frame.SetBounds(contentArea); _frame.Render(); }
public override void Render() { WidgetImage renderImage = null; if (ButtonState == LgcyButtonState.Hovered) { renderImage = _hoverImage; } else if (ButtonState == LgcyButtonState.Down) { renderImage = _downImage; } var contentArea = GetContentArea(); if (renderImage != null) { renderImage.SetBounds( new Rectangle( contentArea.X, contentArea.Y - 1, renderImage.GetPreferredSize().Width, renderImage.GetPreferredSize().Height ) ); renderImage.Render(); } var labelSize = _label.GetPreferredSize(); // Center horizontally and vertically within the content area var labelArea = new Rectangle( contentArea.X + (contentArea.Width - labelSize.Width) / 2, contentArea.Y + (contentArea.Height - labelSize.Height) / 2, contentArea.Width = labelSize.Width, contentArea.Height = labelSize.Height ); // Special cases for certain labels if (_stat == Stat.level) { labelArea.X = contentArea.X + 2; } else if (_stat == Stat.initiative_bonus) { labelArea.X = contentArea.X + 1; } _label.SetBounds(labelArea); _label.Render(); }
public override void Render() { WidgetImage renderImage = null; if (ButtonState == LgcyButtonState.Hovered) { renderImage = _hoverImage; } else if (ButtonState == LgcyButtonState.Down) { renderImage = _downImage; } var contentArea = GetContentArea(); if (renderImage != null) { renderImage.SetBounds( new Rectangle( contentArea.X, contentArea.Y - 1, renderImage.GetPreferredSize().Width, renderImage.GetPreferredSize().Height ) ); renderImage.Render(); } var critter = UiSystems.CharSheet.CurrentCritter; _label.Content = critter != null?_valueSupplier(critter) : null; var labelSize = _label.GetPreferredSize(); // Center horizontally and vertically within the content area var labelArea = new Rectangle( contentArea.X + (contentArea.Width - labelSize.Width) / 2, contentArea.Y + (contentArea.Height - labelSize.Height) / 2, contentArea.Width = labelSize.Width, contentArea.Height = labelSize.Height ); _label.SetBounds(labelArea); _label.Render(); }
public void Run() { _mainWindow.IsCursorVisible = false; int streamId = -1; if (_musicPath != null) { Tig.Sound.tig_sound_alloc_stream(out streamId, tig_sound_type.TIG_ST_VOICE); Tig.Sound.StreamPlayMusicOnce(streamId, _musicPath, 0, true, -1); if (!Tig.Sound.IsStreamActive(streamId)) { streamId = -1; } } var keyPressed = false; var stopwatch = Stopwatch.StartNew(); while (!keyPressed) { if (streamId == -1) { // Show slides for 3s without audio if (stopwatch.ElapsedMilliseconds >= 3000) { break; } } else { // Otherwise until the stream is done if (!Tig.Sound.IsStreamPlaying(streamId)) { break; } } _device.ClearCurrentColorTarget(LinearColorA.Black); var movieRect = MovieRenderer.GetMovieRect( _device, _image.GetPreferredSize().Width, _image.GetPreferredSize().Height ); _image.SetBounds(new Rectangle( (int)movieRect.X, (int)movieRect.Y, (int)movieRect.Width, (int)movieRect.Height )); _image.Render(); _subtitleRenderer?.Render(stopwatch.Elapsed.TotalSeconds); _device.Present(); Tig.SystemEventPump.PumpSystemEvents(); MovieRenderer.ProcessMessages(ref keyPressed); } if (streamId != -1) { Tig.Sound.FreeStream(streamId); } _mainWindow.IsCursorVisible = true; }