TextTexture GetTextTexture(string text, FontCi font) { for (int i = 0; i < textTexturesCount; i++) { TextTexture t = textTextures[i]; if (t == null) { continue; } if (t.text == text && t.font.size == font.size && t.font.family == font.family && t.font.style == font.style) { return(t); } } TextTexture textTexture = new TextTexture(); Text_ text_ = new Text_(); text_.text = text; text_.font = font; text_.color = Game.ColorFromArgb(255, 255, 255, 255); BitmapCi textBitmap = textColorRenderer.CreateTextTexture(text_); int texture = p.LoadTextureFromBitmap(textBitmap); IntRef textWidth = new IntRef(); IntRef textHeight = new IntRef(); p.TextSize(text, font, textWidth, textHeight); textTexture.texture = texture; textTexture.texturewidth = p.FloatToInt(p.BitmapGetWidth(textBitmap)); textTexture.textureheight = p.FloatToInt(p.BitmapGetHeight(textBitmap)); textTexture.text = text; textTexture.font = font; textTexture.textwidth = textWidth.value; textTexture.textheight = textHeight.value; p.BitmapDelete(textBitmap); textTextures[textTexturesCount++] = textTexture; return(textTexture); }