Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
33a6bbcc8f | ||
|
|
e49c13053f | ||
|
|
0cd3039438 |
BIN
game_godot/TinMerezhi.exe
(Stored with Git LFS)
BIN
game_godot/TinMerezhi.exe
(Stored with Git LFS)
Binary file not shown.
@@ -272,6 +272,7 @@ func _ready() -> void:
|
||||
Settings.load_into(self)
|
||||
UiBuild.build(self)
|
||||
Settings.apply(self)
|
||||
get_window().size_changed.connect(func(): Settings.apply_scale(self)) # масштаб залежить від розміру вікна
|
||||
_load_ach()
|
||||
var loaded := Save.load_into(self)
|
||||
apply_branches()
|
||||
|
||||
@@ -45,17 +45,25 @@ static func auto_scale() -> float:
|
||||
static func ui_scale(g: Main) -> float:
|
||||
return g.cfg["ui"] / 100.0 if g.cfg["ui"] > 0 else auto_scale()
|
||||
|
||||
static var _want := 0.0 # останній обраний масштаб: вікно підганяємо лише коли він змінився
|
||||
|
||||
# Інтерфейс розрахований на 1366x860 логічних пікселів: масштаб не більший, ніж влазить у вікно,
|
||||
# інакше нижні кнопки й рядок вводу йдуть за край (1080p зі 150% дає лише 1280x688)
|
||||
static func apply_scale(g: Main, resize := false) -> void:
|
||||
var w := g.get_window()
|
||||
var s := ui_scale(g)
|
||||
if is_equal_approx(w.content_scale_factor, s) and not resize:
|
||||
return
|
||||
w.content_scale_factor = s
|
||||
# у вікні збільшуємо й саме вікно, щоб на інтерфейс лишилось стільки ж місця (не більше екрана)
|
||||
if DisplayServer.get_name() != "headless" and w.mode == Window.MODE_WINDOWED:
|
||||
var area := DisplayServer.screen_get_usable_rect(w.current_screen)
|
||||
w.size = Vector2i((Vector2(BASE) * s).min(Vector2(area.size) * 0.95))
|
||||
w.position = area.position + (area.size - w.size) / 2
|
||||
var want := ui_scale(g)
|
||||
if want != _want or resize:
|
||||
_want = want
|
||||
# у вікні (не розгорнутому) збільшуємо й саме вікно, не більше екрана
|
||||
if DisplayServer.get_name() != "headless" and w.mode == Window.MODE_WINDOWED:
|
||||
var area := DisplayServer.screen_get_usable_rect(w.current_screen)
|
||||
w.size = Vector2i((Vector2(BASE) * want).min(Vector2(area.size) * 0.95))
|
||||
w.position = area.position + (area.size - w.size) / 2
|
||||
var fit := minf(float(w.size.x) / BASE.x, float(w.size.y) / BASE.y)
|
||||
var s := maxf(1.0, minf(want, floorf(fit * 100.0) / 100.0))
|
||||
if not is_equal_approx(w.content_scale_factor, s):
|
||||
w.content_scale_factor = s
|
||||
g.ui.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) # контейнер сам не стискається назад після більшого масштабу
|
||||
|
||||
static func apply(g: Main) -> void:
|
||||
g.sfx_player.volume_db = vol_db(g.cfg["sfx"])
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
uid://c3ru5ch31mo2l
|
||||
@@ -75,7 +75,10 @@ func _run() -> void:
|
||||
# ── налаштування ──
|
||||
g.Settings.set_value(g, "crt", 40)
|
||||
g.Settings.set_value(g, "font", 20)
|
||||
g.get_window().size = Vector2i(1920, 1032)
|
||||
g.Settings.set_value(g, "ui", 150)
|
||||
ok(is_equal_approx(g.get_window().content_scale_factor, 1.2), "масштаб не більший, ніж влазить у вікно")
|
||||
g.get_window().size = Vector2i(2732, 1720)
|
||||
ok(is_equal_approx(g.get_window().content_scale_factor, 1.5), "масштаб інтерфейсу застосовано")
|
||||
g._on_submit("status")
|
||||
g._on_submit("scan")
|
||||
@@ -89,6 +92,7 @@ func _run() -> void:
|
||||
g.Settings.load_into(g)
|
||||
ok(g.cfg["ui"] == 0, "невідомий масштаб → авто")
|
||||
g.Settings.set_value(g, "ui", 0)
|
||||
g.get_window().size = g.Settings.BASE
|
||||
ok(g.history.slice(-2) == ["status", "scan"], "історія команд зберігається між запусками")
|
||||
g.history = []
|
||||
g._on_submit("help")
|
||||
|
||||
@@ -8,6 +8,7 @@ const Updater = preload("res://updater.gd")
|
||||
const MAX_ITEMS := 8 # коротко: вікно має влазити й з великим шрифтом
|
||||
|
||||
const CHANGES := [
|
||||
["1.0.74", "Масштаб інтерфейсу більше не виштовхує кнопки за край: він зменшується до того, що влазить у вікно.", "Interface scale no longer pushes buttons off the screen: it shrinks to what fits the window."],
|
||||
["1.0.73", "Масштаб інтерфейсу в налаштуваннях (100–200%). За замовчуванням береться з масштабу Windows, тож на ноутбуках з високою роздільністю все більше.", "Interface scale in settings (100–200%). By default it follows the Windows scale, so everything is bigger on high-resolution laptops."],
|
||||
["1.0.72", "Нові замки серверів: на частині з них замість коду — фаєрвол, пароль-слово, шифр або дзвінок працівнику.", "New server locks: some servers need a firewall bypass, a password word, a cipher or a phone call instead of a code."],
|
||||
["1.0.72", "Чорний лід на сильних серверах: помилки вдвічі дорожчі. Розтопи криптою (exploit ice) або новою програмою Криголам.", "Black ice on strong servers: mistakes cost double. Melt it with crypto (exploit ice) or the new Icebreaker program."],
|
||||
|
||||
Reference in New Issue
Block a user