center_x = Window.GetWidth() / 2; center_y = Window.GetHeight() / 2; ### BACKGROUND ### Window.SetBackgroundTopColor(%BASE00%); Window.SetBackgroundBottomColor(%BASE00%); ### LOGO ### logo.image = Image("logo.png"); logo.sprite = Sprite(logo.image); logo.sprite.SetPosition( center_x - (logo.image.GetWidth() / 2), center_y - (logo.image.GetHeight() / 2), 1 ); baseline_y = center_y + logo.image.GetHeight(); ### PROGRESS ### progress_background.width = Math.Int(logo.image.GetWidth() * 0.65); progress_background.height = 6; progress_background.original_image = Image("progress-background.png"); progress_background.image = progress_background.original_image.Scale(progress_background.width, progress_background.height); progress_background.sprite = Sprite(progress_background.image); progress_background.sprite.SetPosition( center_x - (progress_background.width / 2), baseline_y - (progress_background.height / 2), 1 ); progress_bar.width = 0; progress_bar.max_width = progress_background.width; progress_bar.height = progress_background.height; progress_bar.original_image = Image("progress-bar.png"); progress_bar.sprite = Sprite(); progress_bar.sprite.SetPosition( center_x - (progress_bar.max_width / 2), baseline_y - (progress_bar.height / 2), 1 ); fun progress_callback (duration, progress) { progress_bar.width = Math.Int(progress_background.width * progress); if (progress_bar.image.GetWidth() != progress_bar.width) { progress_bar.image = progress_bar.original_image.Scale(progress_bar.width, progress_bar.height); progress_bar.sprite.SetImage(progress_bar.image); } } Plymouth.SetBootProgressFunction(progress_callback); ### PASSWORD ### prompt = null; bullets = null; bullet.image = Image.Text("•", %BASE05%); fun password_callback (prompt_text, bullet_count) { progress_background.sprite.SetOpacity(0); progress_bar.sprite.SetOpacity(0); prompt.image = Image.Text("Enter password", %BASE05%); prompt.sprite = Sprite(prompt.image); prompt.sprite.SetPosition( center_x - (prompt.image.GetWidth() / 2), baseline_y - prompt.image.GetHeight(), 1 ); total_width = bullet_count * bullet.image.GetWidth(); start_x = center_x - (total_width / 2); bullets = null; for (i = 0; i < bullet_count; i++) { bullets[i].sprite = Sprite(bullet.image); bullets[i].sprite.SetPosition( start_x + (i * bullet.image.GetWidth()), baseline_y + bullet.image.GetHeight(), 1 ); } } Plymouth.SetDisplayPasswordFunction(password_callback); ### NORMAL ### fun normal_callback() { prompt = null; bullets = null; progress_background.sprite.SetOpacity(1); progress_bar.sprite.SetOpacity(1); } Plymouth.SetDisplayNormalFunction(normal_callback); ### QUIT ### fun quit_callback () { prompt = null; bullets = null; progress_background.sprite.SetOpacity(0); progress_bar.sprite.SetOpacity(0); } Plymouth.SetQuitFunction(quit_callback);