public void Render(Gk3Main.Graphics.SpriteBatch sb, int tickCount) { Gk3Main.Graphics.Viewport vp = Gk3Main.Graphics.RendererManager.CurrentRenderer.Viewport; Gk3Main.Graphics.Rect src; src.X = 0; src.Y = 0; src.Width = 1.0f; src.Height = 1.0f; // this keeps everything at a 4:3 ratio, even if it isn't IRL float screenWidth = (vp.Height * 4) / 3; float widescreenOffset = (vp.Width - screenWidth) / 2; Gk3Main.Graphics.Rect dest; dest.X = widescreenOffset + vp.X; dest.Y = vp.Y; dest.Width = screenWidth; dest.Height = vp.Height; sb.Draw(_background, dest, null, 0); _introButton.Render(sb, tickCount); _playButton.Render(sb, tickCount); _restoreButton.Render(sb, tickCount); _quitButton.Render(sb, tickCount); }
public void Render(Gk3Main.Graphics.SpriteBatch sb, int tickCount) { Gk3Main.Graphics.IRenderer renderer = Gk3Main.Graphics.RendererManager.CurrentRenderer; // draw the background centered in the screen Gk3Main.Graphics.Viewport viewport = renderer.Viewport; int centerX = viewport.Width / 2 + viewport.X; int centerY = viewport.Height / 2 + viewport.Y; int backgroundX = centerX - _background.Width / 2; int backgroundY = centerY - _background.Height / 2; sb.Draw(_background, new Gk3Main.Math.Vector2(backgroundX, backgroundY)); // draw the title if (_timeAtStartRender == 0) { _timeAtStartRender = tickCount; } int frame = calcCurrentFrame(_timeAtStartRender, tickCount); if (frame >= _title.Count) { frame = _title.Count - 1; } if (frame >= 0) { sb.Draw(_title[frame], new Gk3Main.Math.Vector2(backgroundX + _titleX, backgroundY + _titleY)); } if (tickCount > _timeAtStart + 4000) { if (_onFinished != null) { _onFinished(this, EventArgs.Empty); } } }