Add graphics settings
This commit is contained in:
parent
814a7c3c3c
commit
207629e014
@ -8,7 +8,7 @@ bg_color = Color(0.2, 0.2, 0.2, 0.921569)
|
|||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_q40bd"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_q40bd"]
|
||||||
bg_color = Color(0.25, 0.25, 0.25, 0.909804)
|
bg_color = Color(0.25, 0.25, 0.25, 0.909804)
|
||||||
|
|
||||||
[node name="PauseMenu" type="Control" node_paths=PackedStringArray("InitialFocusTarget", "VolumeSlider", "CameraSensitivityX", "CameraSensitivityY", "CameraInvertX", "CameraInvertY", "TableOrbitSpeedX", "TableOrbitSpeedY", "TableOrbitInvertX", "TableOrbitInvertY")]
|
[node name="PauseMenu" type="Control" node_paths=PackedStringArray("InitialFocusTarget", "VolumeSlider", "CameraSensitivityX", "CameraSensitivityY", "CameraInvertX", "CameraInvertY", "TableOrbitSpeedX", "TableOrbitSpeedY", "TableOrbitInvertX", "TableOrbitInvertY", "MsaaOptions", "RenderScaleOptions", "UpscalingOptions", "WindowModeOptions")]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
@ -27,6 +27,10 @@ TableOrbitSpeedX = NodePath("CenterContainer/HBoxContainer/OptionsAndButtonsCont
|
|||||||
TableOrbitSpeedY = NodePath("CenterContainer/HBoxContainer/OptionsAndButtonsContainer/MarginContainer/Options and buttons/TabContainer/Building/Grid/TiltSpeedSlider")
|
TableOrbitSpeedY = NodePath("CenterContainer/HBoxContainer/OptionsAndButtonsContainer/MarginContainer/Options and buttons/TabContainer/Building/Grid/TiltSpeedSlider")
|
||||||
TableOrbitInvertX = NodePath("CenterContainer/HBoxContainer/OptionsAndButtonsContainer/MarginContainer/Options and buttons/TabContainer/Building/Grid/InvertRotateCheck")
|
TableOrbitInvertX = NodePath("CenterContainer/HBoxContainer/OptionsAndButtonsContainer/MarginContainer/Options and buttons/TabContainer/Building/Grid/InvertRotateCheck")
|
||||||
TableOrbitInvertY = NodePath("CenterContainer/HBoxContainer/OptionsAndButtonsContainer/MarginContainer/Options and buttons/TabContainer/Building/Grid/InvertTiltCheck")
|
TableOrbitInvertY = NodePath("CenterContainer/HBoxContainer/OptionsAndButtonsContainer/MarginContainer/Options and buttons/TabContainer/Building/Grid/InvertTiltCheck")
|
||||||
|
MsaaOptions = NodePath("CenterContainer/HBoxContainer/OptionsAndButtonsContainer/MarginContainer/Options and buttons/TabContainer/Graphics/ScrollContainer/Grid/MsaaOptions")
|
||||||
|
RenderScaleOptions = NodePath("CenterContainer/HBoxContainer/OptionsAndButtonsContainer/MarginContainer/Options and buttons/TabContainer/Graphics/ScrollContainer/Grid/RenderScaleOptions")
|
||||||
|
UpscalingOptions = NodePath("CenterContainer/HBoxContainer/OptionsAndButtonsContainer/MarginContainer/Options and buttons/TabContainer/Graphics/ScrollContainer/Grid/UpscaleOptions")
|
||||||
|
WindowModeOptions = NodePath("CenterContainer/HBoxContainer/OptionsAndButtonsContainer/MarginContainer/Options and buttons/TabContainer/Graphics/ScrollContainer/Grid/FullscreenOptions")
|
||||||
|
|
||||||
[node name="CenterContainer" type="CenterContainer" parent="."]
|
[node name="CenterContainer" type="CenterContainer" parent="."]
|
||||||
process_mode = 2
|
process_mode = 2
|
||||||
@ -69,7 +73,7 @@ text = "Continue"
|
|||||||
custom_minimum_size = Vector2(340, 200)
|
custom_minimum_size = Vector2(340, 200)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme_override_font_sizes/font_size = 11
|
theme_override_font_sizes/font_size = 11
|
||||||
current_tab = 2
|
current_tab = 3
|
||||||
|
|
||||||
[node name="General settings" type="MarginContainer" parent="CenterContainer/HBoxContainer/OptionsAndButtonsContainer/MarginContainer/Options and buttons/TabContainer"]
|
[node name="General settings" type="MarginContainer" parent="CenterContainer/HBoxContainer/OptionsAndButtonsContainer/MarginContainer/Options and buttons/TabContainer"]
|
||||||
visible = false
|
visible = false
|
||||||
@ -154,6 +158,7 @@ size_flags_horizontal = 3
|
|||||||
action_mode = 0
|
action_mode = 0
|
||||||
|
|
||||||
[node name="Building" type="MarginContainer" parent="CenterContainer/HBoxContainer/OptionsAndButtonsContainer/MarginContainer/Options and buttons/TabContainer"]
|
[node name="Building" type="MarginContainer" parent="CenterContainer/HBoxContainer/OptionsAndButtonsContainer/MarginContainer/Options and buttons/TabContainer"]
|
||||||
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme_override_constants/margin_left = 10
|
theme_override_constants/margin_left = 10
|
||||||
theme_override_constants/margin_top = 10
|
theme_override_constants/margin_top = 10
|
||||||
@ -208,7 +213,6 @@ size_flags_horizontal = 3
|
|||||||
action_mode = 0
|
action_mode = 0
|
||||||
|
|
||||||
[node name="Graphics" type="MarginContainer" parent="CenterContainer/HBoxContainer/OptionsAndButtonsContainer/MarginContainer/Options and buttons/TabContainer"]
|
[node name="Graphics" type="MarginContainer" parent="CenterContainer/HBoxContainer/OptionsAndButtonsContainer/MarginContainer/Options and buttons/TabContainer"]
|
||||||
visible = false
|
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme_override_constants/margin_left = 10
|
theme_override_constants/margin_left = 10
|
||||||
theme_override_constants/margin_top = 10
|
theme_override_constants/margin_top = 10
|
||||||
@ -216,19 +220,35 @@ theme_override_constants/margin_right = 10
|
|||||||
theme_override_constants/margin_bottom = 10
|
theme_override_constants/margin_bottom = 10
|
||||||
metadata/_tab_index = 3
|
metadata/_tab_index = 3
|
||||||
|
|
||||||
[node name="Grid" type="GridContainer" parent="CenterContainer/HBoxContainer/OptionsAndButtonsContainer/MarginContainer/Options and buttons/TabContainer/Graphics"]
|
[node name="ScrollContainer" type="ScrollContainer" parent="CenterContainer/HBoxContainer/OptionsAndButtonsContainer/MarginContainer/Options and buttons/TabContainer/Graphics"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Grid" type="GridContainer" parent="CenterContainer/HBoxContainer/OptionsAndButtonsContainer/MarginContainer/Options and buttons/TabContainer/Graphics/ScrollContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme_override_constants/h_separation = 14
|
theme_override_constants/h_separation = 14
|
||||||
theme_override_constants/v_separation = 9
|
theme_override_constants/v_separation = 9
|
||||||
columns = 2
|
columns = 2
|
||||||
|
|
||||||
[node name="MsaaLabel" type="Label" parent="CenterContainer/HBoxContainer/OptionsAndButtonsContainer/MarginContainer/Options and buttons/TabContainer/Graphics/Grid"]
|
[node name="FullscreenLabel" type="Label" parent="CenterContainer/HBoxContainer/OptionsAndButtonsContainer/MarginContainer/Options and buttons/TabContainer/Graphics/ScrollContainer/Grid"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Display mode"
|
||||||
|
|
||||||
|
[node name="FullscreenOptions" type="OptionButton" parent="CenterContainer/HBoxContainer/OptionsAndButtonsContainer/MarginContainer/Options and buttons/TabContainer/Graphics/ScrollContainer/Grid"]
|
||||||
|
layout_mode = 2
|
||||||
|
selected = 0
|
||||||
|
item_count = 3
|
||||||
|
popup/item_0/text = "Windowed"
|
||||||
|
popup/item_1/text = "Fullscreen"
|
||||||
|
popup/item_1/id = 1
|
||||||
|
popup/item_2/text = "Exclusive fullscreen"
|
||||||
|
popup/item_2/id = 2
|
||||||
|
|
||||||
|
[node name="MsaaLabel" type="Label" parent="CenterContainer/HBoxContainer/OptionsAndButtonsContainer/MarginContainer/Options and buttons/TabContainer/Graphics/ScrollContainer/Grid"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "MSAA"
|
text = "MSAA"
|
||||||
|
|
||||||
[node name="MsaaOptions" type="OptionButton" parent="CenterContainer/HBoxContainer/OptionsAndButtonsContainer/MarginContainer/Options and buttons/TabContainer/Graphics/Grid"]
|
[node name="MsaaOptions" type="OptionButton" parent="CenterContainer/HBoxContainer/OptionsAndButtonsContainer/MarginContainer/Options and buttons/TabContainer/Graphics/ScrollContainer/Grid"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
disabled = true
|
|
||||||
selected = 2
|
selected = 2
|
||||||
item_count = 4
|
item_count = 4
|
||||||
popup/item_0/text = "Disabled"
|
popup/item_0/text = "Disabled"
|
||||||
@ -239,14 +259,13 @@ popup/item_2/id = 2
|
|||||||
popup/item_3/text = "8 samples"
|
popup/item_3/text = "8 samples"
|
||||||
popup/item_3/id = 3
|
popup/item_3/id = 3
|
||||||
|
|
||||||
[node name="RenderScaleLabel" type="Label" parent="CenterContainer/HBoxContainer/OptionsAndButtonsContainer/MarginContainer/Options and buttons/TabContainer/Graphics/Grid"]
|
[node name="RenderScaleLabel" type="Label" parent="CenterContainer/HBoxContainer/OptionsAndButtonsContainer/MarginContainer/Options and buttons/TabContainer/Graphics/ScrollContainer/Grid"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "Render scale
|
text = "Render scale
|
||||||
"
|
"
|
||||||
|
|
||||||
[node name="RenderScaleOptions" type="OptionButton" parent="CenterContainer/HBoxContainer/OptionsAndButtonsContainer/MarginContainer/Options and buttons/TabContainer/Graphics/Grid"]
|
[node name="RenderScaleOptions" type="OptionButton" parent="CenterContainer/HBoxContainer/OptionsAndButtonsContainer/MarginContainer/Options and buttons/TabContainer/Graphics/ScrollContainer/Grid"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
disabled = true
|
|
||||||
selected = 3
|
selected = 3
|
||||||
item_count = 6
|
item_count = 6
|
||||||
popup/item_0/text = "25%"
|
popup/item_0/text = "25%"
|
||||||
@ -262,11 +281,11 @@ popup/item_4/id = 150
|
|||||||
popup/item_5/text = "200%"
|
popup/item_5/text = "200%"
|
||||||
popup/item_5/id = 200
|
popup/item_5/id = 200
|
||||||
|
|
||||||
[node name="UpscaleLabel" type="Label" parent="CenterContainer/HBoxContainer/OptionsAndButtonsContainer/MarginContainer/Options and buttons/TabContainer/Graphics/Grid"]
|
[node name="UpscaleLabel" type="Label" parent="CenterContainer/HBoxContainer/OptionsAndButtonsContainer/MarginContainer/Options and buttons/TabContainer/Graphics/ScrollContainer/Grid"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "Upscaling"
|
text = "Upscaling"
|
||||||
|
|
||||||
[node name="UpscaleOption" type="OptionButton" parent="CenterContainer/HBoxContainer/OptionsAndButtonsContainer/MarginContainer/Options and buttons/TabContainer/Graphics/Grid"]
|
[node name="UpscaleOptions" type="OptionButton" parent="CenterContainer/HBoxContainer/OptionsAndButtonsContainer/MarginContainer/Options and buttons/TabContainer/Graphics/ScrollContainer/Grid"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
disabled = true
|
disabled = true
|
||||||
selected = 0
|
selected = 0
|
||||||
|
@ -25,6 +25,15 @@ namespace Gmtk24 {
|
|||||||
public BaseButton TableOrbitInvertX;
|
public BaseButton TableOrbitInvertX;
|
||||||
[Export]
|
[Export]
|
||||||
public BaseButton TableOrbitInvertY;
|
public BaseButton TableOrbitInvertY;
|
||||||
|
[ExportCategory("Setting controls (graphics)")]
|
||||||
|
[Export]
|
||||||
|
public OptionButton MsaaOptions;
|
||||||
|
[Export]
|
||||||
|
public OptionButton RenderScaleOptions;
|
||||||
|
[Export]
|
||||||
|
public OptionButton UpscalingOptions;
|
||||||
|
[Export]
|
||||||
|
public OptionButton WindowModeOptions;
|
||||||
|
|
||||||
[Export]
|
[Export]
|
||||||
public Table Table;
|
public Table Table;
|
||||||
@ -53,6 +62,57 @@ namespace Gmtk24 {
|
|||||||
TableOrbitInvertY.ButtonPressed = UserSettings.Singleton.TableOrbitInvertY;
|
TableOrbitInvertY.ButtonPressed = UserSettings.Singleton.TableOrbitInvertY;
|
||||||
TableOrbitInvertY.Toggled += (on) => UserSettings.Singleton.TableOrbitInvertY = on;
|
TableOrbitInvertY.Toggled += (on) => UserSettings.Singleton.TableOrbitInvertY = on;
|
||||||
|
|
||||||
|
Viewport vp = GetViewport();
|
||||||
|
|
||||||
|
MsaaOptions.Selected = (int)vp.Msaa3D;
|
||||||
|
MsaaOptions.ItemSelected += (index) => {
|
||||||
|
vp.Msaa3D = (Viewport.Msaa)index;
|
||||||
|
GD.Print("Set MSAA to: ", vp.Msaa3D);
|
||||||
|
};
|
||||||
|
|
||||||
|
RenderScaleOptions.Selected = -1;
|
||||||
|
for (int i = 0; i < RenderScaleOptions.ItemCount; i++) {
|
||||||
|
if ((int)(vp.Scaling3DScale * 100) == RenderScaleOptions.GetItemId(i)) {
|
||||||
|
RenderScaleOptions.Selected = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RenderScaleOptions.ItemSelected += (index) => {
|
||||||
|
vp.Scaling3DScale = RenderScaleOptions.GetItemId((int)index) / 100f;
|
||||||
|
UpscalingOptions.Disabled = vp.Scaling3DScale > 1;
|
||||||
|
GD.Print("Set scale to: ", vp.Scaling3DScale);
|
||||||
|
};
|
||||||
|
|
||||||
|
UpscalingOptions.Selected = (int)vp.Scaling3DMode;
|
||||||
|
UpscalingOptions.ItemSelected += (index) => {
|
||||||
|
vp.Scaling3DMode = (Viewport.Scaling3DModeEnum)index;
|
||||||
|
GD.Print("Set scaling mode to: ", vp.Scaling3DMode);
|
||||||
|
};
|
||||||
|
|
||||||
|
DisplayServer.WindowMode mode = DisplayServer.WindowGetMode();
|
||||||
|
WindowModeOptions.Selected = 0;
|
||||||
|
if (mode == DisplayServer.WindowMode.Fullscreen) {
|
||||||
|
WindowModeOptions.Selected = 1;
|
||||||
|
} else if (mode == DisplayServer.WindowMode.ExclusiveFullscreen) {
|
||||||
|
WindowModeOptions.Selected = 2;
|
||||||
|
}
|
||||||
|
WindowModeOptions.ItemSelected += (index) => {
|
||||||
|
DisplayServer.WindowMode currentMode = DisplayServer.WindowGetMode();
|
||||||
|
DisplayServer.WindowMode windowedMode = DisplayServer.WindowMode.Windowed;
|
||||||
|
if (currentMode != DisplayServer.WindowMode.Fullscreen
|
||||||
|
&& currentMode != DisplayServer.WindowMode.ExclusiveFullscreen) {
|
||||||
|
// Not fullscreen: set the windowed mode to the current one to preserve maximizing status
|
||||||
|
windowedMode = currentMode;
|
||||||
|
}
|
||||||
|
if (index == 0) {
|
||||||
|
DisplayServer.WindowSetMode(windowedMode);
|
||||||
|
} else if (index == 1) {
|
||||||
|
DisplayServer.WindowSetMode(DisplayServer.WindowMode.Fullscreen);
|
||||||
|
} else if (index == 2) {
|
||||||
|
DisplayServer.WindowSetMode(DisplayServer.WindowMode.ExclusiveFullscreen);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
Open();
|
Open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user