Skip to content

Commit

Permalink
added symmetry guidelines
Browse files Browse the repository at this point in the history
  • Loading branch information
rainlizard committed Apr 23, 2024
1 parent 4dc9a80 commit a199329
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 23 deletions.
5 changes: 5 additions & 0 deletions Autoload/Settings.gd
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ var listOfSettings = [
"smooth_pan_enabled",
"smoothing_rate",
"graphics_ownership_alpha",
"symmetry_guidelines",
"display_fps",
"mouse_sensitivity",
"fov",
Expand Down Expand Up @@ -214,6 +215,10 @@ func game_setting(doWhat,string,value):
var oOverheadOwnership = $'../Main/Game2D/OverheadOwnership'
if doWhat == SET: oOverheadOwnership.OWNERSHIP_ALPHA = value
if doWhat == GET: return oOverheadOwnership.OWNERSHIP_ALPHA
"symmetry_guidelines":
var oGuidelines = $'../Main/Game2D/Guidelines'
if doWhat == SET: oGuidelines.LINE_ALPHA = value
if doWhat == GET: return oGuidelines.LINE_ALPHA
"display_fps":
var oFPScounter = $'../Main/Ui/UiMessages/FPScounter'
if doWhat == SET: oFPScounter.visible = value
Expand Down
29 changes: 29 additions & 0 deletions Scenes/Guidelines.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
extends Node2D
onready var oMirrorPlacementCheckBox = Nodelist.list["oMirrorPlacementCheckBox"]

const TILE_SIZE = 96
var LINE_ALPHA:float = 0.03 setget set_line_alpha

func set_line_alpha(setVal):
LINE_ALPHA = setVal
update()

func _draw():
if LINE_ALPHA == 0: return
if oMirrorPlacementCheckBox.pressed == false: return
for i in range(2):
var size1 = M.xSize if i == 0 else M.ySize
var size2 = M.ySize if i == 0 else M.xSize

var center = floor(size1 * 0.5)
var offset = 0.5 if size1 % 2 == 1 else 0
var thickness = 0.15

var start = Vector2(center + offset - thickness, 0)
var end = Vector2(center + offset + thickness, size2)

if i == 1:
start = Vector2(start.y, start.x)
end = Vector2(end.y, end.x)

draw_rect(Rect2(start * TILE_SIZE, (end - start) * TILE_SIZE), Color(1, 1, 1, LINE_ALPHA), true)
85 changes: 62 additions & 23 deletions Scenes/Main.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=188 format=2]
[gd_scene load_steps=189 format=2]

[ext_resource path="res://Scenes/SlabStyle.gd" type="Script" id=1]
[ext_resource path="res://Scenes/SlabPlacement.gd" type="Script" id=2]
Expand Down Expand Up @@ -167,6 +167,7 @@
[ext_resource path="res://Scenes/Buffers.gd" type="Script" id=165]
[ext_resource path="res://Scenes/UndoStates.gd" type="Script" id=166]
[ext_resource path="res://Scenes/ThreadedSaveUndo.gd" type="Script" id=167]
[ext_resource path="res://Scenes/Guidelines.gd" type="Script" id=168]

[sub_resource type="CubeMesh" id=2]
size = Vector3( 1, 1, 1 )
Expand Down Expand Up @@ -581,6 +582,9 @@ expand = true
[node name="ScriptHelpers" type="Node2D" parent="Game2D"]
script = ExtResource( 133 )
[node name="Guidelines" type="Node2D" parent="Game2D"]
script = ExtResource( 168 )
[node name="Node2D" type="Node2D" parent="Game2D"]
z_index = 100
Expand Down Expand Up @@ -2673,9 +2677,9 @@ maximum_value = 4.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 0.0
margin_top = 70.0
margin_top = 105.0
margin_right = 544.0
margin_bottom = 101.0
margin_bottom = 136.0
settingText = "Editor font size"
slider_step = 1.0
minimum_value = 1.0
Expand All @@ -2685,9 +2689,9 @@ maximum_value = 24.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 0.0
margin_top = 70.0
margin_top = 140.0
margin_right = 544.0
margin_bottom = 101.0
margin_bottom = 171.0
settingText = "Script editor font size"
slider_step = 1.0
minimum_value = 1.0
Expand All @@ -2697,15 +2701,24 @@ maximum_value = 72.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 0.0
margin_top = 375.0
margin_right = 532.0
margin_bottom = 406.0
margin_top = 175.0
margin_right = 544.0
margin_bottom = 206.0
settingText = "Ownership alpha"

[node name="SymmetryGuidelinesSetting" parent="Ui/UiSystem/PreferencesWindow/VBoxContainer/TabSettings/TabUI/VBoxContainer" instance=ExtResource( 16 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 0.0
margin_top = 210.0
margin_right = 544.0
margin_bottom = 241.0
settingText = "Symmetry guidelines"

[node name="CheckBoxNewMapAutoOpensMapSettings" type="CheckBox" parent="Ui/UiSystem/PreferencesWindow/VBoxContainer/TabSettings/TabUI/VBoxContainer"]
margin_top = 410.0
margin_right = 532.0
margin_bottom = 439.0
margin_top = 245.0
margin_right = 544.0
margin_bottom = 274.0
text = "Open map settings for new map"

[node name="TabCamera" type="ScrollContainer" parent="Ui/UiSystem/PreferencesWindow/VBoxContainer/TabSettings"]
Expand Down Expand Up @@ -3055,7 +3068,7 @@ visible = true
margin_left = -2754.0
margin_top = 720.0
margin_right = -1623.0
margin_bottom = 1192.0
margin_bottom = 1243.0
window_title = "Controls"

[node name="ScrollContainer" type="ScrollContainer" parent="Ui/UiSystem/ControlsWindow"]
Expand All @@ -3064,7 +3077,7 @@ anchor_bottom = 1.0

[node name="MarginContainer" type="MarginContainer" parent="Ui/UiSystem/ControlsWindow/ScrollContainer"]
margin_right = 1130.0
margin_bottom = 464.0
margin_bottom = 514.0
custom_constants/margin_right = 20
custom_constants/margin_top = 20
custom_constants/margin_left = 20
Expand All @@ -3074,12 +3087,12 @@ custom_constants/margin_bottom = 20
margin_left = 20.0
margin_top = 20.0
margin_right = 1110.0
margin_bottom = 444.0
margin_bottom = 494.0
custom_constants/separation = 24

[node name="VBoxContainer" type="VBoxContainer" parent="Ui/UiSystem/ControlsWindow/ScrollContainer/MarginContainer/HBoxContainer"]
margin_right = 674.0
margin_bottom = 424.0
margin_bottom = 474.0

[node name="Label2" type="Label" parent="Ui/UiSystem/ControlsWindow/ScrollContainer/MarginContainer/HBoxContainer/VBoxContainer"]
margin_right = 674.0
Expand All @@ -3096,7 +3109,7 @@ rect_min_size = Vector2( 24, 24 )
[node name="GridContainer" type="GridContainer" parent="Ui/UiSystem/ControlsWindow/ScrollContainer/MarginContainer/HBoxContainer/VBoxContainer"]
margin_top = 53.0
margin_right = 674.0
margin_bottom = 424.0
margin_bottom = 474.0
custom_constants/hseparation = 21
columns = 2

Expand Down Expand Up @@ -3271,32 +3284,58 @@ text = "Quickly set creature level / brush size"
margin_top = 325.0
margin_right = 287.0
margin_bottom = 346.0
text = "Alt + Enter"
text = "Ctrl + Z"

[node name="Label31" type="Label" parent="Ui/UiSystem/ControlsWindow/ScrollContainer/MarginContainer/HBoxContainer/VBoxContainer/GridContainer"]
[node name="Label18" type="Label" parent="Ui/UiSystem/ControlsWindow/ScrollContainer/MarginContainer/HBoxContainer/VBoxContainer/GridContainer"]
margin_left = 308.0
margin_top = 325.0
margin_right = 674.0
margin_bottom = 346.0
text = "Fullscreen"
text = "Undo"

[node name="Label15" type="Label" parent="Ui/UiSystem/ControlsWindow/ScrollContainer/MarginContainer/HBoxContainer/VBoxContainer/GridContainer"]
[node name="Label33" type="Label" parent="Ui/UiSystem/ControlsWindow/ScrollContainer/MarginContainer/HBoxContainer/VBoxContainer/GridContainer"]
margin_top = 350.0
margin_right = 287.0
margin_bottom = 371.0
text = "ESC"
text = "Ctrl + S"

[node name="Label32" type="Label" parent="Ui/UiSystem/ControlsWindow/ScrollContainer/MarginContainer/HBoxContainer/VBoxContainer/GridContainer"]
[node name="Label34" type="Label" parent="Ui/UiSystem/ControlsWindow/ScrollContainer/MarginContainer/HBoxContainer/VBoxContainer/GridContainer"]
margin_left = 308.0
margin_top = 350.0
margin_right = 674.0
margin_bottom = 371.0
text = "Save"

[node name="Label35" type="Label" parent="Ui/UiSystem/ControlsWindow/ScrollContainer/MarginContainer/HBoxContainer/VBoxContainer/GridContainer"]
margin_top = 375.0
margin_right = 287.0
margin_bottom = 396.0
text = "Alt + Enter"

[node name="Label31" type="Label" parent="Ui/UiSystem/ControlsWindow/ScrollContainer/MarginContainer/HBoxContainer/VBoxContainer/GridContainer"]
margin_left = 308.0
margin_top = 375.0
margin_right = 674.0
margin_bottom = 396.0
text = "Fullscreen"

[node name="Label15" type="Label" parent="Ui/UiSystem/ControlsWindow/ScrollContainer/MarginContainer/HBoxContainer/VBoxContainer/GridContainer"]
margin_top = 400.0
margin_right = 287.0
margin_bottom = 421.0
text = "ESC"

[node name="Label32" type="Label" parent="Ui/UiSystem/ControlsWindow/ScrollContainer/MarginContainer/HBoxContainer/VBoxContainer/GridContainer"]
margin_left = 308.0
margin_top = 400.0
margin_right = 674.0
margin_bottom = 421.0
text = "Exit"

[node name="VBoxContainer2" type="VBoxContainer" parent="Ui/UiSystem/ControlsWindow/ScrollContainer/MarginContainer/HBoxContainer"]
margin_left = 698.0
margin_right = 1090.0
margin_bottom = 424.0
margin_bottom = 474.0

[node name="Label2" type="Label" parent="Ui/UiSystem/ControlsWindow/ScrollContainer/MarginContainer/HBoxContainer/VBoxContainer2"]
margin_right = 392.0
Expand Down
2 changes: 2 additions & 0 deletions Scenes/MirrorOptions.gd
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ onready var oMirrorColor1 = Nodelist.list["oMirrorColor1"]
onready var oMirrorColor2 = Nodelist.list["oMirrorColor2"]
onready var oMirrorColor3 = Nodelist.list["oMirrorColor3"]
onready var oMirrorFlipCheckBox = Nodelist.list["oMirrorFlipCheckBox"]
onready var oGuidelines = Nodelist.list["oGuidelines"]

var splitType = 2
var ownerValue = [0,1,2,3]
Expand Down Expand Up @@ -112,6 +113,7 @@ func gui_input_on_color_fields(event, buttonIndex, buttonNode):

func _on_MirrorPlacementCheckBox_pressed():
visible = oMirrorPlacementCheckBox.pressed
oGuidelines.update()

func get_quadrant(pos, fieldX, fieldY):
match splitType:
Expand Down
3 changes: 3 additions & 0 deletions Scenes/OpenMap.gd
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ onready var oUndoStates = Nodelist.list["oUndoStates"]
onready var oDisplaySlxNumbers = Nodelist.list["oDisplaySlxNumbers"]
onready var oThingDetails = Nodelist.list["oThingDetails"]
onready var oInspector = Nodelist.list["oInspector"]
onready var oGuidelines = Nodelist.list["oGuidelines"]

var TOTAL_TIME_TO_OPEN_MAP

Expand Down Expand Up @@ -247,6 +248,7 @@ func continue_load_openmap(map):
oCurrentMap.set_path_and_title(map)
oCamera2D.reset_camera(M.xSize, M.ySize)
oUndoStates.clear_history()
oGuidelines.update()
oMapSettingsWindow.visible = false
if map == "":
oMessage.quick('New map')
Expand All @@ -261,6 +263,7 @@ func continue_load_openmap(map):
oEditor.mapHasBeenEdited = true
oMessage.quick("Fixed column index 0, re-save your map.")
oDataClm.store_default_data()


func _on_ConfirmDecompression_confirmed():
print('Attempting to decompress...')
Expand Down
2 changes: 2 additions & 0 deletions Scenes/ResizeCurrentMapSize.gd
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ onready var oDataClmPos = Nodelist.list["oDataClmPos"]
onready var oCurrentFormat = Nodelist.list["oCurrentFormat"]
onready var oMapSettingsWindow = Nodelist.list["oMapSettingsWindow"]
onready var oInstances = Nodelist.list["oInstances"]
onready var oGuidelines = Nodelist.list["oGuidelines"]

func _on_ResizeCurrentMapSizeButton_pressed():
Utils.popup_centered(self)
Expand Down Expand Up @@ -87,6 +88,7 @@ func update_editor_appearance():
oEditor.update_boundaries()
oOverheadOwnership.start()
oOverheadGraphics.update_full_overhead_map()
oGuidelines.update()

# The main function that calls all the helper functions
func _on_ResizeApplyButton_pressed():
Expand Down
5 changes: 5 additions & 0 deletions Scenes/SettingsWindow.gd
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ onready var oOwnerAlpha = Nodelist.list["oOwnerAlpha"]
onready var oScriptEditorFontSize = Nodelist.list["oScriptEditorFontSize"]
onready var oEditorFontSize = Nodelist.list["oEditorFontSize"]
onready var oCheckBoxNewMapAutoOpensMapSettings = Nodelist.list["oCheckBoxNewMapAutoOpensMapSettings"]
onready var oSymmetryGuidelinesSetting = Nodelist.list["oSymmetryGuidelinesSetting"]

#onready var oTabEditor = Nodelist.list["oTabEditor"]
#onready var oTabGraphics = Nodelist.list["oTabGraphics"]
Expand Down Expand Up @@ -75,6 +76,7 @@ func _on_SettingsWindow_about_to_show():
oSlabWindowScale.update_appearance(Settings.get_setting("slab_window_scale"))
oThingWindowScale.update_appearance(Settings.get_setting("thing_window_scale"))
oOwnerAlpha.update_appearance(Settings.get_setting("graphics_ownership_alpha"))
oSymmetryGuidelinesSetting.update_appearance(Settings.get_setting("symmetry_guidelines"))
oCreatureLevelFontSizeScale.update_appearance(Settings.get_setting("font_size_creature_level_scale"))
oCreatureLevelFontSizeMaxZoom.update_appearance(Settings.get_setting("font_size_creature_level_max"))
oSciptIconScale.update_appearance(Settings.get_setting("script_icon_scale"))
Expand Down Expand Up @@ -173,6 +175,9 @@ func edited_OwnerWindowScale(new_text):
func edited_OwnerAlpha(new_text):
Settings.set_setting("graphics_ownership_alpha", float(new_text))

func edited_SymmetryGuidelinesSetting(new_text):
Settings.set_setting("symmetry_guidelines", float(new_text))

func _on_CheckBoxDisplay3dInfo_toggled(button_pressed):
Settings.set_setting("display_3d_info", button_pressed)

Expand Down

0 comments on commit a199329

Please sign in to comment.