[opt] large textures loading

This commit is contained in:
Brahim Hadriche committed 2024-08-04 18:17:32 -04:00
1 parent d967fa11bb
commit 4af500bec0
4 files changed
+27 -12

No files matched your search

+6
View File
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Fixed
- Few optimizations with texture loading to improve memory usage
## [0.25.1] - 2024-08-03 ## [0.25.1] - 2024-08-03
### Added ### Added
@@ -1,10 +1,14 @@
function Init() function Init()
m.busySpinner = m.top.findNode("busySpinner") m.busySpinner = m.top.findNode("busySpinner")
m.busyspinner.poster.width = 150 poster = m.busyspinner.poster
m.busyspinner.poster.height = 150 poster.width = 150
poster.height = 150
poster.loadWidth = 150
poster.loadHeight = 150
poster.loadDisplayMode = "limitSize"
' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK ' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK
m.busyspinner.poster.observeField("loadStatus", "PositionSpinner") poster.observeField("loadStatus", "PositionSpinner")
m.busySpinner.poster.uri = "pkg:/images/spinner.png" poster.uri = "pkg:/images/spinner.png"
' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK ' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK
m.top.observeField("visible", "OnVisibleChange") m.top.observeField("visible", "OnVisibleChange")
end function end function
@@ -17,6 +17,9 @@
<Poster <Poster
id="banner" id="banner"
width="1280" width="1280"
loadWidth="1280"
loadHeight="500"
loadDisplayMode="limitSize"
visible="false" /> visible="false" />
<Group id="container"> <Group id="container">
@@ -6,21 +6,23 @@ import "pkg:/source/utils/Types.bs"
function Init() function Init()
m.busySpinner = m.top.findNode("busySpinner") m.busySpinner = m.top.findNode("busySpinner")
m.busySpinnerPoster = m.busySpinner.poster m.busySpinnerPoster = m.busySpinner.poster
m.busySpinnerPoster.loadDisplayMode = "limitSize"
m.busySpinnerPoster.uri = "pkg:/images/spinner.png"
m.top.observeField("width", FuncName(OnSizeChange)) m.top.observeField("width", FuncName(OnSizeChange))
m.top.observeField("height", FuncName(OnSizeChange)) m.top.observeField("height", FuncName(OnSizeChange))
OnSizeChange() OnSizeChange()
m.busySpinnerPoster.uri = "pkg:/images/spinner.png"
end function end function
function OnSizeChange() function OnSizeChange()
width = m.top.width spinnerWidth = m.top.width / 2
height = m.top.height spinnerHeight = m.top.height / 2
m.busySpinnerPoster.width = spinnerWidth
m.busySpinnerPoster.width = width / 2 m.busySpinnerPoster.height = spinnerHeight
m.busySpinnerPoster.height = height / 2 m.busySpinnerPoster.loadWidth = spinnerWidth
m.busySpinner.translation = [width / 4, height / 4] m.busySpinnerPoster.loadHeight = spinnerHeight
m.busySpinner.translation = [spinnerWidth / 2, spinnerHeight / 2]
end function end function
function OnTextChange() as void function OnTextChange() as void