1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-04 21:18:28 +03:00

lvgui: Make base window use the app background

This commit is contained in:
Samuel Dionne-Riel 2021-06-13 18:08:23 -04:00
parent 0e1b8b47c4
commit 5a7d09bcd6

View File

@ -18,6 +18,7 @@ module LVGUI
# Preps a basic display
@screen = Screen.new()
on_background_init()
@status_bar = StatusBar.new(@screen)
on_header_init()
@toolbar = Toolbar.new(@screen)
@ -81,5 +82,21 @@ module LVGUI
# Hooking point to customize initialization
def on_initialization_finished()
end
# Hook point to customize the background
def on_background_init()
background_path = LVGL::Hacks.get_asset_path("app-background.svg")
if File.exist?(background_path)
@background = LVGL::LVImage.new(@screen).tap do |el|
el.set_protect(LVGL::PROTECT::POS)
el.set_height(@screen.get_height())
el.set_width(@screen.get_width())
el.set_x(0)
el.set_y(LVGUI.pixel_scale(0))
el.set_src("#{background_path}?height=#{el.get_height()}")
end
end
end
end
end