mirror of
https://github.com/danth/stylix
synced 2024-11-29 07:30:23 +00:00
72 lines
1.4 KiB
Text
72 lines
1.4 KiB
Text
|
center_x = Window.GetWidth() / 2;
|
||
|
center_y = Window.GetHeight() / 2;
|
||
|
baseline_y = Window.GetHeight() * 0.9;
|
||
|
|
||
|
|
||
|
### 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
|
||
|
);
|
||
|
|
||
|
### PASSWORD ###
|
||
|
|
||
|
prompt = null;
|
||
|
bullets = null;
|
||
|
bullet.image = Image.Text("•", %BASE05%);
|
||
|
|
||
|
fun password_callback (prompt_text, bullet_count) {
|
||
|
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;
|
||
|
}
|
||
|
|
||
|
Plymouth.SetDisplayNormalFunction(normal_callback);
|
||
|
|
||
|
|
||
|
### QUIT ###
|
||
|
|
||
|
fun quit_callback() {
|
||
|
prompt = null;
|
||
|
bullets = null;
|
||
|
}
|
||
|
|
||
|
Plymouth.SetQuitFunction(quit_callback);
|