public void DrawString(SpriteFont font, string str, Point position, TerminalColor color) { if (!_isBegunToDraw) { throw new Exception("Please call BeginDraw() first"); } if (str.Contains("\r\n") || str.Contains("\n")) { DrawMultiLineString(font, str, position, color); } else { if (_cachedTextures.ContainsKey(str)) { var t = _cachedTextures[str]; Draw(t.GetAsPointer(), position, t.Width, t.Height); } else { var surface = TTF_RenderText_Blended(font.GetAsPointer(), str, color); var texture = SurfaceToTexture(surface, out var w, out var h); _cachedTextures[str] = new Texture2D(w, h, texture); Draw(texture, position, w, h); } } }
public void Clear(TerminalColor color) { SDL_RenderClear(_renderer); }