Exemple #1
0
        public void RenderTextToTexture(string text, float scale, Color fontColor, Color backgroundColor, int textureResolution, int aspectRatio)
        {
            string offscreenTexture = "LCDOffscreenTexture_" + m_textPanel.EntityId;

            int width  = textureResolution * aspectRatio;
            int height = textureResolution;

            MyRenderProxy.CreateGeneratedTexture(offscreenTexture, width, height);
            MyRenderProxy.DrawString((int)MyDefinitionManager.Static.GetFontSafe(m_textPanel.Font.SubtypeName).Id.SubtypeId, Vector2.Zero, fontColor, new StringBuilder(text), scale, float.PositiveInfinity, offscreenTexture);
            MyRenderProxy.RenderOffscreenTextureToMaterial(RenderObjectIDs[0], PANEL_MATERIAL_NAME, offscreenTexture, backgroundColor);
        }