summaryrefslogtreecommitdiff
path: root/client.gd
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2025-01-14 14:38:52 +0100
committerDaniel Weipert <git@mail.dweipert.de>2025-01-14 14:38:52 +0100
commite8f03c4d6a94aa16b3587bdce525cf0cf7c6c6c3 (patch)
treed8d5a78a0872b86c3b40089e465120883669542b /client.gd
parentb75cc72c4e10bd652330b6d2bd99f3fd9129a3b3 (diff)
next commit
Diffstat (limited to 'client.gd')
-rw-r--r--client.gd73
1 files changed, 35 insertions, 38 deletions
diff --git a/client.gd b/client.gd
index 31264a6..516ba4d 100644
--- a/client.gd
+++ b/client.gd
@@ -11,43 +11,40 @@ var character: Dictionary = {
}
-func _ready() -> void:
- #var grf = GRF.open("res://client_data/data.grf")
- #grf.extract()
- #grf.convert()#"user://data")
+func show_message_window(
+ message: String,
+ title: String = "",
+ attached_to: Control = null,
+ anchor: Side = SIDE_TOP
+) -> GameWindow:
+ var window = preload("res://ui/message_window.tscn").instantiate()
+ window.message = message
+ window.title = title
- #Sprite.from_bytes(FileAccess.get_file_as_bytes("res://client_data/data/sprite/cursors.spr"))
- #ActionFormat.from_bytes(
- #ByteStream.from_bytes(
- #FileAccess.get_file_as_bytes("res://client_data/data/sprite/cursors.act")
- #)
- #)
- #GATFormat.from_bytes(
- #ByteStream.from_bytes(
- #FileAccess.get_file_as_bytes("res://client_data/data/int_land02.gat")
- #)
- #)
- #GNDFormat.from_bytes(
- #ByteStream.from_bytes(
- #FileAccess.get_file_as_bytes("res://client_data/data/int_land02.gnd")
- #)
- #)
- var rsw = RSWFormat.from_bytes(
- ByteStream.from_bytes(
- #FileAccess.get_file_as_bytes("res://client_data/data/int_land02.rsw")
- FileAccess.get_file_as_bytes("res://client_data/data/pay_dun00.rsw")
- )
- )
- #RSMFormat.from_bytes(
- #ByteStream.from_bytes(
- ##FileAccess.get_file_as_bytes("res://client_data/data/model/prontera/chair_01.rsm")
- #FileAccess.get_file_as_bytes("res://client_data/data/model/izlude/iz_academy.rsm")
- ## TODO: not parseable
- ##FileAccess.get_file_as_bytes("res://client_data/data/model/graywolf/bridge_e_01.rsm2")
- #)
- #)
+ # add window first to get the correct size
+ get_tree().current_scene.add_child(window)
- #var scene_root := rsw.convert("pay_dun00", "res://client_data")
- #var scene := PackedScene.new()
- #scene.pack(scene_root)
- #ResourceSaver.save(scene, "res://extractor/test/pay_dun00.tscn")
+ # attach window to control
+ if attached_to:
+ window.global_position = attached_to.global_position
+
+ if anchor == SIDE_TOP:
+ window.global_position.y -= window.size.y
+ window.size.x = max(window.size.x, attached_to.size.x)
+ elif anchor == SIDE_BOTTOM:
+ window.global_position.y += attached_to.size.y
+ window.size.x = max(window.size.x, attached_to.size.x)
+ elif anchor == SIDE_LEFT:
+ window.global_position.x -= window.size.x
+ window.size.y = max(window.size.y, attached_to.size.y)
+ elif anchor == SIDE_RIGHT:
+ window.global_position.x += attached_to.size.x
+ window.size.y = max(window.size.y, attached_to.size.y)
+
+ # else add window in center
+ else:
+ window.global_position = get_viewport().get_visible_rect().size * 0.5 - window.size * 0.5
+
+ window.minimum_size = window.size
+
+ return window