/// <summary> /// Draws a vertical frame marker at the specified time. /// </summary> /// <param name="t">Time at which to draw the marker.</param> private void DrawFrameMarker(float t) { int xPos = (int)(((t - rangeOffset) / GetRange()) * drawableWidth) + PADDING; Vector2I start = new Vector2I(xPos, 0); Vector2I end = new Vector2I(xPos, height); canvas.DrawLine(start, end, Color.BansheeOrange); }
/// <summary> /// Rebuilds the internal GUI elements. Should be called whenever timeline properties change. /// </summary> public void Rebuild() { canvas.Clear(); int heightOffset = height / 2; float pixelsPerHeight; if (rangeEnd != rangeStart) { pixelsPerHeight = height / (rangeEnd - rangeStart); } else { pixelsPerHeight = 0; } float yOffset = rangeStart + (rangeEnd - rangeStart) * 0.5f; int numTickLevels = tickHandler.NumLevels; for (int i = numTickLevels - 1; i >= 0; i--) { float[] ticks = tickHandler.GetTicks(i); float strength = tickHandler.GetLevelStrength(i); if (ticks.Length > 0) { float valuePerTick = (rangeEnd - rangeStart) / ticks.Length; for (int j = 0; j < ticks.Length; j++) { int yPos = (int)((ticks[j] - yOffset) * pixelsPerHeight); yPos = heightOffset - yPos; // Offset and flip height (canvas Y goes down) Vector2I start = new Vector2I(0, yPos); Vector2I end = new Vector2I((int)(width * strength), yPos); Color color = COLOR_TRANSPARENT_LIGHT_GRAY; color.a *= strength; canvas.DrawLine(start, end, color); // Draw text for the highest level ticks if (i == 0) { DrawValue(yPos, ticks[j], ticks[j] <= 0.0f); } } } } }