saikyo-packages-src/saikyo-plymouth-installer/usr/share/plymouth/themes/saikyo-boot/saikyo-boot.script

126 lines
3.1 KiB
Plaintext

# SAIKYO OS Boot Plymouth Theme
# Simple and reliable boot splash
# Set dark background
Window.SetBackgroundTopColor(0.02, 0.02, 0.02);
Window.SetBackgroundBottomColor(0.02, 0.02, 0.02);
# Screen dimensions
screen_width = Window.GetWidth();
screen_height = Window.GetHeight();
center_x = screen_width / 2;
center_y = screen_height / 2;
# Create logo text "SAIKYO OS" in green
logo_image = Image.Text("SAIKYO OS", 0.0, 1.0, 0.4);
logo_sprite = Sprite(logo_image);
logo_sprite.SetX(center_x - logo_image.GetWidth() / 2);
logo_sprite.SetY(center_y - 80);
# Create subtitle
subtitle_image = Image.Text("Загрузка системы...", 1.0, 1.0, 1.0);
subtitle_sprite = Sprite(subtitle_image);
subtitle_sprite.SetX(center_x - subtitle_image.GetWidth() / 2);
subtitle_sprite.SetY(center_y - 20);
# Progress bar dimensions
bar_width = 400;
bar_height = 8;
bar_x = center_x - bar_width / 2;
bar_y = center_y + 60;
# Create progress bar background (dark gray)
bar_bg_image = Image(bar_width, bar_height);
for (x = 0; x < bar_width; x++)
{
for (y = 0; y < bar_height; y++)
{
bar_bg_image.SetPixel(x, y, 0.15, 0.15, 0.15, 1.0);
}
}
bar_bg_sprite = Sprite(bar_bg_image);
bar_bg_sprite.SetX(bar_x);
bar_bg_sprite.SetY(bar_y);
# Create progress bar fill (green)
bar_fill_sprite = Sprite();
bar_fill_sprite.SetX(bar_x);
bar_fill_sprite.SetY(bar_y);
# Version text
version_image = Image.Text("v1.0", 0.5, 0.5, 0.5);
version_sprite = Sprite(version_image);
version_sprite.SetX(center_x - version_image.GetWidth() / 2);
version_sprite.SetY(screen_height - 50);
# Progress value
progress_val = 0;
# Update progress bar
fun update_progress(p)
{
global.progress_val = p;
if (p < 0) p = 0;
if (p > 1) p = 1;
fill_w = Math.Int(bar_width * p);
if (fill_w < 1) fill_w = 1;
fill_image = Image(fill_w, bar_height);
for (x = 0; x < fill_w; x++)
{
for (y = 0; y < bar_height; y++)
{
fill_image.SetPixel(x, y, 0.0, 1.0, 0.4, 1.0);
}
}
bar_fill_sprite.SetImage(fill_image);
}
# Callbacks
fun refresh_callback()
{
update_progress(global.progress_val);
}
fun boot_progress_callback(time, progress)
{
global.progress_val = progress;
update_progress(progress);
}
fun display_normal_callback()
{
}
fun display_password_callback(prompt, bullets)
{
pass_image = Image.Text(prompt, 1.0, 1.0, 1.0);
pass_sprite = Sprite(pass_image);
pass_sprite.SetX(center_x - pass_image.GetWidth() / 2);
pass_sprite.SetY(center_y + 120);
}
fun display_message_callback(text)
{
msg_image = Image.Text(text, 0.8, 0.8, 0.8);
msg_sprite = Sprite(msg_image);
msg_sprite.SetX(center_x - msg_image.GetWidth() / 2);
msg_sprite.SetY(center_y + 150);
}
fun quit_callback()
{
}
# Register callbacks
Plymouth.SetRefreshFunction(refresh_callback);
Plymouth.SetBootProgressFunction(boot_progress_callback);
Plymouth.SetDisplayNormalFunction(display_normal_callback);
Plymouth.SetDisplayPasswordFunction(display_password_callback);
Plymouth.SetMessageFunction(display_message_callback);
Plymouth.SetQuitFunction(quit_callback);
# Initial draw
update_progress(0);