/// <summary> /// 文字列用テクスチャをキャッシュから探し、もしなければ読み込みます。 /// </summary> public TextTexture GetTextTexture(string text, TextTextureFont textureFont) { if (this.context != GraphicsContext.CurrentContext) { throw new GLException( "OpenGLコンテキストが正しく設定れていません><"); } if (text == null) { throw new ArgumentNullException("text"); } if (textureFont == null) { throw new ArgumentNullException("textureFont"); } try { var key = new TextTextureKey(text, textureFont); return(this.cache.GetOrCreate(key)); } catch (Exception ex) { Util.ThrowIfFatal(ex); Log.ErrorException(ex, "文字列テクスチャの作成に失敗しました。"); return(null); } }
/// <summary> /// 文字列用テクスチャを作成します。 /// </summary> private TextTexture CreateTextTexture(TextTextureKey key) { var textTexture = new TextTexture() { Text = key.Text, TextureFont = key.TextureFont, }; // テクスチャを作成してからオブジェクトを返します。 textTexture.UpdateTexture(); return(textTexture); }