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 static void Print(FontInstance font, int x, int y, string text) { Graphics.SpriteBatch sb = new Gk3Main.Graphics.SpriteBatch(); sb.Begin(); Print(sb, font, x, y, text); sb.End(); }
public void Render(Gk3Main.Graphics.SpriteBatch sb, int tickCount) { if (_vbs != null) { if (_vbs.Active) { _vbs.Render(sb, tickCount); } else { _vbs = null; } } }
public static void Render(Gk3Main.Graphics.SpriteBatch spriteBatch) { if (_visible) { spriteBatch.Begin(); // draw a background { var renderer = Gk3Main.Graphics.RendererManager.CurrentRenderer; var bg = Gk3Main.Graphics.RendererManager.CurrentRenderer.DefaultTexture; var r = new Gk3Main.Graphics.Rect(0, 0, renderer.Viewport.Width, (_numVisibleLines + 1) * _font.Font.LineHeight); spriteBatch.Draw(bg, r, null, new Gk3Main.Graphics.Color(0, 0, 0, 0.7f), 0); } int startLine = Math.Max(0, _lines.Count - _numVisibleLines); int cursorY = 0; for (int i = startLine; i < _lines.Count; i++) { Gk3Main.Graphics.Color color; if (_lines[i].Severity == Gk3Main.ConsoleSeverity.Error) { color = Gk3Main.Graphics.Color.Red; } else if (_lines[i].Severity == Gk3Main.ConsoleSeverity.Warning) { color = Gk3Main.Graphics.Color.Orange; } else { color = Gk3Main.Graphics.Color.White; } var f = _font; f.Color = color; Gk3Main.Gui.Font.Print(spriteBatch, f, 0, cursorY, _lines[i].Text); cursorY += _font.Font.LineHeight; } Gk3Main.Gui.Font.Print(spriteBatch, _font, 0, cursorY, _command.ToString()); spriteBatch.End(); } }
public static void RenderProperCursor(Gk3Main.Graphics.SpriteBatch sb, Gk3Main.Graphics.Camera camera, int mx, int my, Gk3Main.Gui.CursorResource point, Gk3Main.Gui.CursorResource zoom) { if (_vbs != null || camera == null) { point.Render(sb, mx, my); return; } int count = getNounVerbCaseCountUnderCursor(camera, mx, my); if (count == 0) { point.Render(sb, mx, my); } else { zoom.Render(sb, mx, my); } }
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); } } }