mirror of
https://github.com/thegatesbrowser/thegates.git
synced 2025-09-06 23:27:51 -04:00
gate info (wip)
This commit is contained in:
parent
d6add34302
commit
71b8d06c69
8 changed files with 379 additions and 155 deletions
|
@ -21,10 +21,10 @@ func search(query: String) -> void:
|
|||
return
|
||||
|
||||
for gate in gates:
|
||||
Debug.logr(gate["url"])
|
||||
var result: SearchResult = result_scene.instantiate()
|
||||
result.fill(gate)
|
||||
add_child(result)
|
||||
Debug.logr(gate["url"])
|
||||
|
||||
|
||||
func search_request(query: String) -> void:
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
extends Panel
|
||||
|
||||
@export var gate_events: GateEvents
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
gate_events.first_frame.connect(func(): visible = true)
|
|
@ -1,6 +0,0 @@
|
|||
extends TextureRect
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
var tween = create_tween().set_loops()
|
||||
tween.tween_property(self, "rotation", 360, 50).from(0)
|
|
@ -4,40 +4,14 @@ class_name SplashScreen
|
|||
@export var gate_events: GateEvents
|
||||
@export var command_events: CommandEvents
|
||||
@export var ui_events: UiEvents
|
||||
@export var splash_screen: Texture2D
|
||||
|
||||
@onready var width: int = int(size.x)
|
||||
@onready var height: int = int(size.y)
|
||||
@export var render_result: RenderResult
|
||||
|
||||
|
||||
#func _ready():
|
||||
#gate_events.gate_info_loaded.connect(show_thumbnail)
|
||||
#gate_events.gate_entered.connect(show_splash_screen)
|
||||
func _ready():
|
||||
gate_events.gate_info_loaded.connect(show_thumbnail)
|
||||
#gate_events.first_frame.connect(func(): hide())
|
||||
#
|
||||
## Change size
|
||||
#show_splash_screen()
|
||||
|
||||
|
||||
func show_thumbnail(gate: Gate, is_cached: bool) -> void:
|
||||
if is_cached: return # Resource pack is already downloaded
|
||||
|
||||
var image: Image
|
||||
var tex = FileTools.load_external_tex(gate.image)
|
||||
|
||||
if tex != null: image = resize_and_convert(tex.get_image(), Image.FORMAT_RGB8)
|
||||
else: image = Image.create(width, height, false, Image.FORMAT_RGB8)
|
||||
|
||||
self.texture = ImageTexture.create_from_image(image)
|
||||
|
||||
|
||||
func show_splash_screen() -> void:
|
||||
var image = resize_and_convert(splash_screen.get_image(), Image.FORMAT_RGBA8)
|
||||
self.texture = ImageTexture.create_from_image(image)
|
||||
|
||||
|
||||
func resize_and_convert(image: Image, format: Image.Format) -> Image:
|
||||
image.resize(width, height)
|
||||
image.convert(format)
|
||||
#image.clear_mipmaps()
|
||||
return image
|
||||
func show_thumbnail(gate: Gate, _is_cached: bool) -> void:
|
||||
#if is_cached: return # Resource pack is already downloaded
|
||||
texture = FileTools.load_external_tex(gate.image)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue