Click or drag to resize

GuiScaledSkin Class

Component for automatic GUISkin rescaling, based on the current game's GUI scale setting.
Inheritance Hierarchy
SystemObject
  KSPDev.GUIUtilsGuiScaledSkin

Namespace:  KSPDev.GUIUtils
Assembly:  KSPDev_Utils.2.5 (in KSPDev_Utils.2.5.dll) Version: 2.5 for KSP v1
Syntax
C#
public class GuiScaledSkin
Request Example View Source

The GuiScaledSkin type exposes the following members.

Constructors
  NameDescription
Public methodGuiScaledSkin
Creates a scaled skin instance.
Top
Properties
  NameDescription
Public propertyguiScale
The scale setting which this instance currently tracks.
Public propertyguiTitleHeight
The dialog title height with this skin applied.
Public propertyscaledSkin
The skin that is scaled to the current game's settings.
Top
Methods
  NameDescription
Protected methodFinalize
Unregisters any game's callbacks.
(Overrides ObjectFinalize.)
Public methodStatic memberScaleGuiStyle
Makes a style that respects the provided scale factor.
Public methodStatic memberScaleRectOffset
Scales the provided RectOffset by the scale factor.
Top
Fields
  NameDescription
Public fieldscaledSkinIsDirty
Tells if the skin must be recalculated on the next access to scaledSkin.
Top
Examples
GuiScaledSkin _guiScaledSkin;

void OnAwake() {
  _guiScaledSkin = new GuiScaledSkin(() => GUI.skin);
}

void OnGUI() {
  using (new GuiSkinScope(GuiScaledSkin.scaledSkin) {
    _windowRect = GUILayout.Window(GetInstanceID(), _windowRect, WindowFunc, WindowTitle);
  }
}
See Also