GuiScaledSkin Class |
Namespace: KSPDev.GUIUtils
The GuiScaledSkin type exposes the following members.
Name | Description | |
---|---|---|
![]() | GuiScaledSkin | Creates a scaled skin instance. |
Name | Description | |
---|---|---|
![]() | guiScale | The scale setting which this instance currently tracks. |
![]() | guiTitleHeight | The dialog title height with this skin applied. |
![]() | scaledSkin | The skin that is scaled to the current game's settings. |
Name | Description | |
---|---|---|
![]() | Finalize | Unregisters any game's callbacks. (Overrides ObjectFinalize.) |
![]() ![]() | ScaleGuiStyle | Makes a style that respects the provided scale factor. |
![]() ![]() | ScaleRectOffset | Scales the provided RectOffset by the scale factor. |
Name | Description | |
---|---|---|
![]() | scaledSkinIsDirty | Tells if the skin must be recalculated on the next access to scaledSkin. |
The scaling is achieved by proportional increase/decrease of the font size and margin/padding rects. The default font stays unchanged, but all the controls that use default font size will get overrides for the nwe scaled size. Some more elements will not get scaled:
GuiScaledSkin _guiScaledSkin; void OnAwake() { _guiScaledSkin = new GuiScaledSkin(() => GUI.skin); } void OnGUI() { using (new GuiSkinScope(GuiScaledSkin.scaledSkin) { _windowRect = GUILayout.Window(GetInstanceID(), _windowRect, WindowFunc, WindowTitle); } }