//Generates the code segements textures (colour) private void GenerateTextures() { display = false; for (int i = 0; i < codeTextures.Length; i++) { codeTextures[i] = new CodeSegmentTexture(); } }
//Method for rendering the code segements public void GUIDrawLabel(Rect position, CodeSegmentTexture texture, string codeLine) { if (_staticRectStyle == null) //This ensures that a GUIStyle does not get created for each code segement as it should be reused { _staticRectStyle = new GUIStyle(); } _staticRectStyle.normal.background = texture.getTexture(); _staticRectStyle.alignment = TextAnchor.MiddleLeft; _staticRectStyle.fontSize = currentFontSize; _staticRectStyle.normal.textColor = Color.white; _staticRectStyle.font = codeFont; GUI.Label(position, codeLine, _staticRectStyle); }