diff --git a/clientstructure/lib/plymouth/themes/opengnsys/box.png b/clientstructure/lib/plymouth/themes/opengnsys/box.png new file mode 100644 index 0000000..54876e6 Binary files /dev/null and b/clientstructure/lib/plymouth/themes/opengnsys/box.png differ diff --git a/clientstructure/lib/plymouth/themes/opengnsys/bullet.png b/clientstructure/lib/plymouth/themes/opengnsys/bullet.png new file mode 100644 index 0000000..dd52736 Binary files /dev/null and b/clientstructure/lib/plymouth/themes/opengnsys/bullet.png differ diff --git a/clientstructure/lib/plymouth/themes/opengnsys/entry.png b/clientstructure/lib/plymouth/themes/opengnsys/entry.png new file mode 100644 index 0000000..a9f4157 Binary files /dev/null and b/clientstructure/lib/plymouth/themes/opengnsys/entry.png differ diff --git a/clientstructure/lib/plymouth/themes/opengnsys/lock.png b/clientstructure/lib/plymouth/themes/opengnsys/lock.png new file mode 100644 index 0000000..a0f8c12 Binary files /dev/null and b/clientstructure/lib/plymouth/themes/opengnsys/lock.png differ diff --git a/clientstructure/lib/plymouth/themes/opengnsys/logoopengnsys.png b/clientstructure/lib/plymouth/themes/opengnsys/logoopengnsys.png new file mode 100644 index 0000000..c87ca25 Binary files /dev/null and b/clientstructure/lib/plymouth/themes/opengnsys/logoopengnsys.png differ diff --git a/clientstructure/lib/plymouth/themes/opengnsys/opengnsys.plymouth b/clientstructure/lib/plymouth/themes/opengnsys/opengnsys.plymouth new file mode 100644 index 0000000..a974b70 --- /dev/null +++ b/clientstructure/lib/plymouth/themes/opengnsys/opengnsys.plymouth @@ -0,0 +1,11 @@ +[Plymouth Theme] +Name=Script +Description=Script example plugin. +ModuleName=script + +[script] +ImageDir=/lib/plymouth/themes/opengnsys +ScriptFile=/lib/plymouth/themes/opengnsys/opengnsys.script + +[script-env-vars] +example_env_var=example env var value diff --git a/clientstructure/lib/plymouth/themes/opengnsys/opengnsys.png b/clientstructure/lib/plymouth/themes/opengnsys/opengnsys.png new file mode 100644 index 0000000..c87ca25 Binary files /dev/null and b/clientstructure/lib/plymouth/themes/opengnsys/opengnsys.png differ diff --git a/clientstructure/lib/plymouth/themes/opengnsys/opengnsys.script b/clientstructure/lib/plymouth/themes/opengnsys/opengnsys.script new file mode 100644 index 0000000..dc0c854 --- /dev/null +++ b/clientstructure/lib/plymouth/themes/opengnsys/opengnsys.script @@ -0,0 +1,203 @@ +# This is an example plymouth plugin script + +Window.SetBackgroundTopColor(0, 0, 0); +Window.SetBackgroundBottomColor(0, 0, 0); + +#logo.image = Image("special://logo"); +logo.image = Image ("opengnsys.png"); +logo.sprite = Sprite(logo.image); +logo.opacity_angle = 0; + +fun refresh_callback () + { + if (status == "normal") + { + logo.opacity_angle += ((2 * 3.14) / 50) * 0.5; # 0.5 HZ + min_opacity = 0.3; + opacity = (Math.Cos(logo.opacity_angle) + 1) / 2; + opacity *= 1 - min_opacity; + opacity += min_opacity; + logo.sprite.SetX (Window.GetX() + Window.GetWidth() / 2 - logo.image.GetWidth() / 2); + logo.sprite.SetY (Window.GetY() + Window.GetHeight() / 2 - logo.image.GetHeight() / 2); + logo.sprite.SetOpacity (opacity); + } + else + { + logo.sprite.SetX (0); + logo.sprite.SetY (0); + logo.sprite.SetOpacity (1); + } + } + +Plymouth.SetRefreshFunction (refresh_callback); + +#----------------------------------------- Dialogue -------------------------------- + +status = "normal"; + +fun dialog_setup() + { + local.box; + local.lock; + local.entry; + + box.image = Image("box.png"); + lock.image = Image("lock.png"); + entry.image = Image("entry.png"); + + box.sprite = Sprite(box.image); + box.x = Window.GetX() + Window.GetWidth() / 2 - box.image.GetWidth ()/2; + box.y = Window.GetY() + Window.GetHeight() / 2 - box.image.GetHeight()/2; + box.z = 10000; + box.sprite.SetPosition(box.x, box.y, box.z); + + lock.sprite = Sprite(lock.image); + lock.x = box.x + box.image.GetWidth()/2 - (lock.image.GetWidth() + entry.image.GetWidth()) / 2; + lock.y = box.y + box.image.GetHeight()/2 - lock.image.GetHeight()/2; + lock.z = box.z + 1; + lock.sprite.SetPosition(lock.x, lock.y, lock.z); + + entry.sprite = Sprite(entry.image); + entry.x = lock.x + lock.image.GetWidth(); + entry.y = box.y + box.image.GetHeight()/2 - entry.image.GetHeight()/2; + entry.z = box.z + 1; + entry.sprite.SetPosition(entry.x, entry.y, entry.z); + + global.dialog.box = box; + global.dialog.lock = lock; + global.dialog.entry = entry; + global.dialog.bullet_image = Image("bullet.png"); + dialog_opacity (1); + } + +fun dialog_opacity(opacity) + { + dialog.box.sprite.SetOpacity (opacity); + dialog.lock.sprite.SetOpacity (opacity); + dialog.entry.sprite.SetOpacity (opacity); + for (index = 0; dialog.bullet[index]; index++) + { + dialog.bullet[index].sprite.SetOpacity(opacity); + } + } + +fun display_normal_callback () + { + global.status = "normal"; + if (global.dialog) + dialog_opacity (0); + } + +fun display_password_callback (prompt, bullets) + { + global.status = "password"; + if (!global.dialog) + dialog_setup(); + else + dialog_opacity(1); + for (index = 0; dialog.bullet[index] || index < bullets; index++) + { + if (!dialog.bullet[index]) + { + dialog.bullet[index].sprite = Sprite(dialog.bullet_image); + dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_image.GetWidth(); + dialog.bullet[index].y = dialog.entry.y + dialog.entry.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2; + dialog.bullet[index].z = dialog.entry.z + 1; + dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y, dialog.bullet[index].z); + } + if (index < bullets) + dialog.bullet[index].sprite.SetOpacity(1); + else + dialog.bullet[index].sprite.SetOpacity(0); + } + } + +Plymouth.SetDisplayNormalFunction(display_normal_callback); +Plymouth.SetDisplayPasswordFunction(display_password_callback); + +#----------------------------------------- Progress Bar -------------------------------- + +progress_box.original_image = Image("progress_box.png"); +progress_box.image = progress_box.original_image.Scale(Window.GetWidth (), progress_box.original_image.GetHeight()); +progress_box.sprite = Sprite(progress_box.image); + +progress_box.x = Window.GetX() + Window.GetWidth() / 2 - progress_box.image.GetWidth() / 2; +progress_box.y = Window.GetY() + Window.GetHeight() - progress_box.image.GetHeight(); +progress_box.sprite.SetPosition(progress_box.x, progress_box.y, 0); + +progress_bar.original_image = Image("progress_bar.png"); +progress_bar.image = progress_bar.original_image.Scale(0, progress_box.image.GetHeight()); +progress_bar.sprite = Sprite(); + +progress_bar.x = Window.GetX() + Window.GetWidth() / 2 - progress_box.image.GetWidth() / 2; +progress_bar.y = Window.GetY() + Window.GetHeight() - progress_box.image.GetHeight(); +progress_bar.sprite.SetPosition(progress_bar.x, progress_bar.y, 1); + +fun progress_callback (duration, progress) + { + if (progress_bar.image.GetWidth () != Math.Int (progress_bar.original_image.GetWidth () * progress)) + { + progress_bar.image = progress_bar.original_image.Scale(progress_box.image.GetWidth(progress_box.image) * progress, progress_box.image.GetHeight()); + progress_bar.sprite.SetImage (progress_bar.image); + } + } + +Plymouth.SetBootProgressFunction(progress_callback); + +#----------------------------------------- Quit -------------------------------- + +fun quit_callback () +{ + logo.sprite.SetOpacity (1); +} + +Plymouth.SetQuitFunction(quit_callback); + +#----------------------------------------- Message -------------------------------- + +message_sprite = Sprite(); +message_sprite.SetPosition(10, 10, 10000); + +fun message_callback (text) +{ + my_image = Image.Text(text, 0.6, 0.6, 0.6); + message_sprite.SetImage(my_image); + message_sprite.SetX(Window.GetWidth () / 2 - my_image.GetWidth() / 2); + message_sprite.SetY((Window.GetHeight () * 0.7) - (2 * my_image.GetHeight())); + message.sprite.SetZ(11); +} + +Plymouth.SetMessageFunction(message_callback); + + +#----------------------------------------- Status Update -------------------------------- + +statusupdate_sprite = Sprite(); + +fun StringLength(string) { + + index = 0; + str = String(string); + while(str.CharAt(index)) index++; + return index; +} + +fun status_callback (text) +{ + // Truncate the message if too long + if (StringLength(text) > (Window.GetHeight () / 4 )) { + text = text.SubString(0, (Window.GetHeight () / 4 ) - 3); + text += "..."; + } + + my_image = Image.Text(text, 0.4, 0.4, 0.4); + statusupdate_sprite.SetPosition(10, 10 + (i * 20), 10000); + statusupdate_sprite.SetImage(my_image); + statusupdate_sprite.SetX(Window.GetWidth () / 2 - my_image.GetWidth() / 2); + statusupdate_sprite.SetY((Window.GetHeight () * 0.7) - my_image.GetHeight()); + statusupdate.sprite.SetZ(11); +} + +Plymouth.SetUpdateStatusFunction(status_callback); + + diff --git a/clientstructure/lib/plymouth/themes/opengnsys/progress_bar.png b/clientstructure/lib/plymouth/themes/opengnsys/progress_bar.png new file mode 100644 index 0000000..fad2e3f Binary files /dev/null and b/clientstructure/lib/plymouth/themes/opengnsys/progress_bar.png differ diff --git a/clientstructure/lib/plymouth/themes/opengnsys/progress_box.png b/clientstructure/lib/plymouth/themes/opengnsys/progress_box.png new file mode 100644 index 0000000..bdc029e Binary files /dev/null and b/clientstructure/lib/plymouth/themes/opengnsys/progress_box.png differ