Skip to content

Commit

Permalink
Merged changes in master into xml_converter
Browse files Browse the repository at this point in the history
  • Loading branch information
klingbolt committed Oct 1, 2024
2 parents 4637b96 + 12fb1e1 commit 0c37c45
Show file tree
Hide file tree
Showing 7 changed files with 276 additions and 156 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ Roadmap

Known Bug Workarounds
=====================
* Burrito launches off-center or on the wrong monitor
* This seems to be WM dependant. on Gnome it can be solved by holding down the super key and dragging burrito to the right position.
* Burrito launches off-center or on the wrong monitor (This seems to be WM dependant.)
* On Gnome and KDE it can be solved by holding down the super key and dragging burrito to the right position.
* On KDE it is also possible to use [window-rules](https://docs.kde.org/stable5/en/kwin/kcontrol/windowspecific/examples.html) to set the position or a target monitor automatically by adding a new rule to `System Settings → Window Behavior → Window Rules` and setting `window class (application)` to `burrito`.
47 changes: 41 additions & 6 deletions Spatial.gd
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,22 @@ onready var markers_ui := $Control/Dialogs/CategoriesDialog/MarkersUI as Tree
onready var markers_3d := $Markers3D as Spatial
onready var markers_2d := $Control/Markers2D as Node2D

# Variables that store informations about ui scaling
# The ui-size as read from the link can have the values [0=small; 1=normal; 2=large; 3=larger]
var ui_size: int = 1
# This dictionary holds the left and right margin for the main button for every ui-scale
const button_margin = {
0: {"left": 292, "right": 318}, # small
1: {"left": 323, "right": 352}, # normal
2: {"left": 361, "right": 394}, # large
3: {"left": 395, "right": 431} # larger
}
const minimap_scale = {
0: {"offset": 32, "factor": 0.9}, # small
1: {"offset": 36, "factor": 1}, # normal
2: {"offset": 40, "factor": 1.11}, # large
3: {"offset": 44, "factor": 1.22} # larger
}

# Called when the node enters the scene tree for the first time.
func _ready():
Expand Down Expand Up @@ -269,7 +285,7 @@ func decode_frame_packet(spb: StreamPeerBuffer):
if (!map_is_open):
map_size = Vector2(compass_width, compass_height)
if !compass_is_top_right:
map_corner = get_viewport().size - Vector2(compass_width, compass_height + 36)
map_corner = get_viewport().size - Vector2(compass_width, compass_height + self.minimap_scale[self.ui_size]["offset"])
else:
map_corner = Vector2(get_viewport().size.x - compass_width, 0)

Expand Down Expand Up @@ -341,6 +357,20 @@ func decode_context_packet(spb: StreamPeerBuffer):
# vs radians. 70deg = 1.22173rad and 25deg = 0.4363323rad. We should redo
# this to just be a radian to degree conversion.

# Calculations to dynamically place the main icon/button
self.ui_size = int(identity["uisz"])
# If the value is not part of the dictionary use the "normal" size.
if !self.button_margin.has(self.ui_size):
self.ui_size = 1

$Control/GlobalMenuButton.margin_left = self.button_margin[self.ui_size]["left"]
$Control/GlobalMenuButton.margin_right = self.button_margin[self.ui_size]["right"]
if !is_any_dialog_visible():
set_minimal_mouse_block()

compass_width = compass_width * self.minimap_scale[self.ui_size]["factor"]
compass_height = compass_height * self.minimap_scale[self.ui_size]["factor"]

if self.map_id != old_map_id:
print("New Map")
var old_texture_path: String = ""
Expand Down Expand Up @@ -371,8 +401,8 @@ func reset_minimap_masks(reset_3d: bool = true):
var compass_corner1 = Vector2(0, 0)
var compass_corner2 = viewport_size
if !map_is_open && !compass_is_top_right:
compass_corner1 = Vector2(viewport_size.x-self.compass_width, 36)
compass_corner2 = compass_corner1 + Vector2(self.compass_width, self.compass_height)
compass_corner1 = Vector2(viewport_size.x-compass_width, self.minimap_scale[self.ui_size]["offset"])
compass_corner2 = compass_corner1 + Vector2(compass_width, compass_height)
elif !map_is_open && compass_is_top_right:
compass_corner1 = viewport_size - Vector2(self.compass_width, self.compass_height)
compass_corner2 = compass_corner1 + Vector2(self.compass_width, self.compass_height)
Expand Down Expand Up @@ -910,11 +940,16 @@ func _on_main_menu_toggle_pressed():
$Control/Dialogs/MainMenu.show()
set_maximal_mouse_block()

func _on_Dialog_hide():
func is_any_dialog_visible():
for dialog in $Control/Dialogs.get_children():
if dialog.visible:
return
set_minimal_mouse_block()
return true
return false


func _on_Dialog_hide():
if !is_any_dialog_visible():
set_minimal_mouse_block()


func _on_LoadTrail_pressed():
Expand Down
2 changes: 1 addition & 1 deletion burrito_link/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ target_link_libraries(${DX11LIB} PRIVATE "ws2_32")
set_target_properties(${DX11LIB} PROPERTIES
PREFIX ""
SUFFIX ""
LINK_FLAGS "../deffile.def -Wl,--allow-shlib-undefined -Wl,-O1 -shared -static -static-libgcc -static-libstdc++ -Wl,--file-alignment=4096 -lm -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32"
LINK_FLAGS "../deffile.def -Wl,--allow-shlib-undefined,--no-insert-timestamp -Wl,-O1 -shared -static -static-libgcc -static-libstdc++ -Wl,--file-alignment=4096 -lm -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32"
)
Loading

0 comments on commit 0c37c45

Please sign in to comment.