summaryrefslogtreecommitdiff
path: root/themes
diff options
context:
space:
mode:
authorCharlie Brej <cbrej@cs.man.ac.uk>2009-06-30 16:58:39 +0100
committerRay Strode <rstrode@redhat.com>2009-07-24 09:30:16 -0400
commitd7fa520a77939a1e69f377821033af5b622ccb63 (patch)
tree542d0e69a72ee690de0c6fd666703cd9309e38a5 /themes
parenta3b9e728c64074bb31eba31c91a50cf29adb6922 (diff)
[script] Add support for the password dialogue in the example script theme
Diffstat (limited to 'themes')
-rw-r--r--themes/script/Makefile.am6
-rw-r--r--themes/script/box.pngbin0 -> 870 bytes
-rw-r--r--themes/script/bullet.pngbin0 -> 296 bytes
-rw-r--r--themes/script/entry.pngbin0 -> 350 bytes
-rw-r--r--themes/script/lock.pngbin0 -> 1896 bytes
-rw-r--r--themes/script/script.script172
6 files changed, 118 insertions, 60 deletions
diff --git a/themes/script/Makefile.am b/themes/script/Makefile.am
index b66a8013..add4bb97 100644
--- a/themes/script/Makefile.am
+++ b/themes/script/Makefile.am
@@ -1,7 +1,11 @@
themedir = $(datadir)/plymouth/themes/script
dist_theme_DATA = \
script.plymouth \
- script.script
+ script.script \
+ box.png \
+ bullet.png \
+ entry.png \
+ lock.png
MAINTAINERCLEANFILES = Makefile.in script.plymouth
diff --git a/themes/script/box.png b/themes/script/box.png
new file mode 100644
index 00000000..54876e68
--- /dev/null
+++ b/themes/script/box.png
Binary files differ
diff --git a/themes/script/bullet.png b/themes/script/bullet.png
new file mode 100644
index 00000000..dd527369
--- /dev/null
+++ b/themes/script/bullet.png
Binary files differ
diff --git a/themes/script/entry.png b/themes/script/entry.png
new file mode 100644
index 00000000..a9f4157b
--- /dev/null
+++ b/themes/script/entry.png
Binary files differ
diff --git a/themes/script/lock.png b/themes/script/lock.png
new file mode 100644
index 00000000..a0f8c12f
--- /dev/null
+++ b/themes/script/lock.png
Binary files differ
diff --git a/themes/script/script.script b/themes/script/script.script
index a84448ed..59a43e97 100644
--- a/themes/script/script.script
+++ b/themes/script/script.script
@@ -1,78 +1,132 @@
+
+
+
index = 0;
+while (1){
+ index_string = "" + index;
+ if (index < 10) index_string = "0" + index_string;
+ frame_image[index] = ImageNew("../spinfinity/throbber-" + index_string + ".png");
+ if (!frame_image[index]) break;
+ index++;
+ }
+frame_count = index + 1;
+frame_index = 0;
+throbber_sprite = SpriteNew();
-while (index<30){
- mystring = index;
- if (index<10) mystring = "0" + index;
- sprites[index] = SpriteNewWithImage("../spinfinity/throbber-" + mystring + ".png");
- sprites[index].orig_image = sprites[index].image;
- sprites[index].xd = (50 + index)/10;
- sprites[index].yd = (50 + index)/10;
- index = index + 1;
+fun refresh (){
+ if (status == "normal"){
+ frame_index = (frame_index + 20/50) % frame_count;
+ int_frame_index = MathInt(frame_index);
+ SpriteSetImage (throbber_sprite, frame_image[int_frame_index]);
+ SpriteSetX (throbber_sprite, 400 - ImageGetWidth(frame_image[int_frame_index]) / 2);
+ SpriteSetY (throbber_sprite, 300 - ImageGetHeight(frame_image[int_frame_index]) / 2);
+ SpriteSetOpacity (throbber_sprite, 1);
+ }
+ if (status != "normal"){
+ SpriteSetOpacity (throbber_sprite, 0);
+ }
}
-random = 1;
-count = 0;
-progress=0;
+refresh (); # do one at the start
+PlymouthSetRefreshFunction (refresh);
+
+
+
+
+
+
+
+
+
+
+
+
-fun update_logo_sprite (sprite){
- image_width = ImageGetWidth (sprite.image);
- image_height = ImageGetHeight(sprite.image);
+#-----------------------------------------Dialogue stuff --------------------------------
+
+
+status = "normal";
+
+fun dialogue_setup(){
+ local.box;
+ local.lock;
+ local.entry;
+ local.bullet_image;
+
+ box.image = ImageNew("box.png");
+ lock.image = ImageNew("lock.png");
+ entry.image = ImageNew("entry.png");
+ bullet_image = ImageNew("bullet.png");
+
+ box.sprite = SpriteNew();
+ SpriteSetImage(box.sprite, box.image);
+ box.x = 400 - ImageGetWidth (box.image)/2;
+ box.y = 300 - ImageGetHeight(box.image)/2;
+ box.z = 10000;
+ SpriteSetPosition(box.sprite, box.x, box.y, box.z);
- if (sprite.x < 0)
- sprite.xd = +(global.random % 5 + 1);
- if (sprite.y < 0)
- sprite.yd = +(global.random % 5 + 1);
- if ((sprite.x + image_width) > 800)
- sprite.xd = -((global.random % 5 + 1));
- if ((sprite.y + image_height) > 600)
- sprite.yd = -((global.random % 5 + 1));
-
- global.random = (1 + global.random * 7) % 101;
+ lock.sprite = SpriteNew();
+ SpriteSetImage(lock.sprite, lock.image);
+ lock.x = box.x + ImageGetWidth(box.image)/2 - (ImageGetWidth(lock.image) + ImageGetWidth(entry.image)) / 2;
+ lock.y = box.y + ImageGetHeight(box.image)/2 - ImageGetHeight(lock.image)/2;
+ lock.z = box.z + 1;
+ SpriteSetPosition(lock.sprite, lock.x, lock.y, lock.z);
- sprite.x = sprite.x + sprite.xd*global.progress;
- sprite.y = sprite.y + sprite.yd*global.progress;
- sprite.image = ImageRotate(sprite.orig_image, count*0.1);
- SpriteUpdate(sprite);
+ entry.sprite = SpriteNew();
+ SpriteSetImage(entry.sprite, entry.image);
+ entry.x = lock.x + ImageGetWidth(lock.image);
+ entry.y = box.y + ImageGetHeight(box.image)/2 - ImageGetHeight(entry.image)/2;
+ entry.z = box.z + 1;
+ SpriteSetPosition(entry.sprite, entry.x, entry.y, entry.z);
+
+
+ global.dialogue = local;
}
-
-
-fun refresh (){
+
+fun dialogue_opacity(opacity){
+ global.dialogue.opacity = opacity;
+ local = global.dialogue;
+ SpriteSetOpacity (box.sprite, opacity);
+ SpriteSetOpacity (lock.sprite, opacity);
+ SpriteSetOpacity (entry.sprite, opacity);
index = 0;
- count++;
- while (!(index>=30)){
- update_logo_sprite (sprites[index]);
+ while (bullet[index]){
+ SpriteSetOpacity(bullet[index].sprite, opacity);
index++;
}
- return;
}
-fun on_progress (duration, progress){
- global.progress = progress*300;
+fun display_normal (){
+ global.status = "normal";
+ if (!global.dialogue) return;
+ dialogue_setup();
+ dialogue_opacity (0);
}
-
-fun on_keyboard (key){
+
+PlymouthSetDisplayNormalFunction(display_normal);
+
+fun display_password (prompt, bullets){
+ global.status = "password";
+ if (!global.dialogue) dialogue_setup();
+ dialogue_opacity (1);
index = 0;
- if (key == "a"){
- while (!(index>=30)){
- sprites[index].x = 0;
- index++;
+ while (dialogue.bullet[index] || index < bullets){
+ if (!dialogue.bullet[index]){
+ dialogue.bullet[index].sprite = SpriteNew();
+ SpriteSetImage(dialogue.bullet[index].sprite, dialogue.bullet_image);
+ dialogue.bullet[index].x = dialogue.entry.x + index * ImageGetWidth(dialogue.bullet_image);
+ SpriteSetX(dialogue.bullet[index].sprite, dialogue.bullet[index].x);
+ dialogue.bullet[index].y = dialogue.entry.y + ImageGetHeight(dialogue.entry.image)/2 - ImageGetHeight(dialogue.bullet_image)/2;
+ SpriteSetY(dialogue.bullet[index].sprite, dialogue.bullet[index].y);
+ dialogue.bullet[index].z = dialogue.entry.z + 1;
+ SpriteSetZ(dialogue.bullet[index].sprite, dialogue.bullet[index].z);
}
- }
- if (key == "b"){
- while (!(index>=30)){
- sprites[index].y = 0;
- index++;
+ SpriteSetOpacity(dialogue.bullet[index].sprite, 0);
+ if (index < bullets){
+ SpriteSetOpacity(dialogue.bullet[index].sprite, 1);
}
+
+ index++;
}
- return;
}
-
-
-// This is a comment
-# As is this (both are acceptable because people do forget which to use)
-/* A block comment /* with a nested sub-comment */ */
-
-PlymouthSetRefreshFunction(refresh);
-PlymouthSetKeyboardInputFunction(on_keyboard);
-PlymouthSetBootProgressFunction(on_progress);
-PlymouthSetUpdateStatusFunction(on_keyboard);
+PlymouthSetDisplayPasswordFunction(display_password);