plymouth-theme/content/moritz.script
2026-09-07 00:54:48 +02:00

123 lines
3.6 KiB
Text
Executable file

//--------------------------------- Refresh (Logo animation) --------------------------
// Boot
if(Plymouth.GetMode () == "boot" || Plymouth.GetMode () == "resume") {
for (i = 0; i < 60; i++)
build_image[i] = Image("boot/progress-" + i + ".png");
build_sprite = Sprite();
build_sprite.SetX(Window.GetX() + (Window.GetWidth(0) / 2 - build_image[0].GetWidth() / 2));
build_sprite.SetY(Window.GetY() + (Window.GetHeight(0) / 3 - build_image[0].GetHeight() / 2));
} else {
// Shutdown
for(i = 0; i < 37; i++)
shutdown_image[i] = Image("shutdown/shutdown-" + i + ".png");
shutdown_sprite = Sprite();
shutdown_sprite.SetX(Window.GetX() + (Window.GetWidth(0) / 2 - shutdown_image[0].GetWidth() / 2));
shutdown_sprite.SetY(Window.GetY() + (Window.GetHeight(0) / 3 - shutdown_image[0].GetHeight() / 2));
}
progress = 0;
// Password
password_stage = "OUT";
password_progress = 48;
fun refresh_callback ()
{
// Boot
if(Plymouth.GetMode () == "boot" || Plymouth.GetMode () == "resume") {
build_sprite.SetImage(build_image[Math.Int(progress / 2) % 60]);
if(progress < 118)
progress++;
} else {
shutdown_sprite.SetImage(shutdown_image[Math.Int(progress / 2) % 37]);
if(progress < 72)
progress++;
}
// Password
password_sprite.SetImage(password_image[Math.Int(password_progress / 2) % 25]);
if(password_progress < 48)
password_progress++;
}
Plymouth.SetRefreshFunction (refresh_callback);
// ----------------------------------------- Dialog ------------------------------------
password_init = 0;
fun build_password_in(prompt, bullets) {
if(password_init == 0)
{
for (i = 0; i < 25; i++)
global.password_image[i] = Image("password/in-" + i + ".png");
global.password_sprite = Sprite();
password_x = Window.GetX() + (Window.GetWidth(0) / 2 - global.password_image[0].GetWidth() / 2);
password_y = Window.GetY() + (Window.GetHeight(0) * (3/4) - global.password_image[0].GetHeight() / 2);
global.password_sprite.SetX(password_x);
global.password_sprite.SetY(password_y);
global.bullet_image = Image("password/bullet.png");
global.bullet_x = password_x + 100;
global.bullet_y = password_y + 22;
global.password_stage = "IN";
global.password_progress = 0;
global.password_init = 1;
}
for (index = 0; global.bullet[index] || index < bullets; index++)
{
if (!global.bullet[index])
{
global.bullet[index] = Sprite(bullet_image);
global.bullet[index].SetX(global.bullet_x + (index * (bullet_image.GetWidth() + 10)));
global.bullet[index].SetY(global.bullet_y);
global.bullet[index].SetZ(100000);
}
if (index < bullets)
global.bullet[index].SetOpacity(1);
else
global.bullet[index].SetOpacity(0);
}
}
fun build_password_out() {
for (i = 0; i < 25; i++)
global.password_image[i] = Image("password/out-" + i + ".png");
global.password_stage = "OUT";
global.password_progress = 0;
global.password_init = 0;
// remove dots
for (index = 0; global.bullet[index]; index++)
global.bullet[index] = 0;
}
Plymouth.SetDisplayNormalFunction(build_password_out);
Plymouth.SetDisplayPasswordFunction(build_password_in);
//----------------------------------------- Message --------------------------------
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
fun display_message_callback (text)
{
my_image = Image.Text(text, 1, 1, 1);
message_sprite.SetImage(my_image);
}
fun hide_message_callback (text)
{
message_sprite = Sprite();
message_sprite.SetPosition(10, 10, 10000);
}
Plymouth.SetDisplayMessageFunction (display_message_callback);
Plymouth.SetHideMessageFunction (hide_message_callback);