/* Lliurex 11.09 Marty Plymouth theme */ color_phase=0; color_start=[0.0,0.0,0.0]; color_base=[0.14,0.45,0.92]; color_blink=[1.0,0.78,0.19]; color_vector=[0.0,0.0,0.0]; color_pos=[0.0,0.0,0.0]; esc_counter=0; real_width=1024; real_height=768; /* 97c324 green desktop */ img_background = Image("background.png"); img_banner = Image("banner.png"); img_boot = Image("boot.png"); img_eject = Image("eject.png"); img_shutdown = Image("shutdown.png"); img_fsck = Image("fsck.png"); img_esc0 = Image("press-ESC00.png"); img_esc1 = Image("press-ESC01.png"); tmp = img_background.Scale(Window.GetWidth(),Window.GetHeight()); spr_background=Sprite(tmp); Window.SetBackgroundTopColor(color_start[0],color_start[1],color_start[2]); spr_esc = Sprite(img_esc0); spr_icon = Sprite(img_boot); if(Plymouth.GetMode()=="shutdown") spr_icon = Sprite(img_shutdown); spr_icon.SetX((Window.GetWidth()*0.5)-48); spr_icon.SetY((Window.GetHeight()*0.5)-48); rx = Window.GetWidth() / real_width; ry = Window.GetHeight() / real_height; tmp = img_banner.Scale(img_banner.GetWidth()*rx,img_banner.GetHeight()*ry); spr_banner = Sprite(tmp); spr_banner.SetX(0); spr_banner.SetY(0.87 * Window.GetHeight()); message="LliureX 11.09 marty"; spr_msg = Sprite(Image.Text("LliureX 11.09 marty")); /* * message callback function */ fun message_callback(msg) { string_it = 0; update_strings[string_it] = ""; for (i=0; (String(msg).CharAt(i) != ""); i++) { local.temp_char = String(msg).CharAt(i); if (temp_char != ":") update_strings[string_it] += temp_char; else update_strings[++string_it] = ""; } if(update_strings[0]=="fsck") { message="Escaneando disco duro, espere"; spr_icon.SetImage(img_fsck); }else if(update_strings[0]=="Please" && update_strings[1]=="remove") { message="Saque el Disco y presione ENTER"; spr_icon.SetImage(img_eject); } else message=msg; color_phase=3; } fun draw_message() { image = Image.Text(message,1,1,1,1); spr_msg.SetImage(image); spr_msg.SetZ(1); spr_msg.SetX(0.1 * Window.GetWidth()); spr_msg.SetY(0.88 * Window.GetHeight()); } fun refresh_callback() { esc_counter=esc_counter + 1; if(esc_counter == 30) { spr_esc.SetImage(img_esc0); } if(esc_counter == 60) { spr_esc.SetImage(img_esc1); esc_counter=0; } /*color computing*/ if(color_phase==0) { color_vector[0]=0.005*(color_base[0] - color_start[0]); color_vector[1]=0.005*(color_base[1] - color_start[1]); color_vector[2]=0.005*(color_base[2] - color_start[2]); color_phase=1; } if(color_phase==1) { color_pos[0]=color_pos[0]+color_vector[0]; color_pos[1]=color_pos[1]+color_vector[1]; color_pos[2]=color_pos[2]+color_vector[2]; tx = color_base[0] - color_pos[0]; ty = color_base[1] - color_pos[1]; tz = color_base[2] - color_pos[2]; dist=Math.Sqrt(tx*tx +ty*ty +tz*tz); if(dist<0.1) color_phase=2; } /* blink vector computing*/ if(color_phase==3) { color_vector[0]=0.025*(color_blink[0] - color_pos[0]); color_vector[1]=0.025*(color_blink[1] - color_pos[1]); color_vector[2]=0.025*(color_blink[2] - color_pos[2]); color_phase=4; } if(color_phase==4) { color_pos[0]=color_pos[0]+color_vector[0]; color_pos[1]=color_pos[1]+color_vector[1]; color_pos[2]=color_pos[2]+color_vector[2]; tx = color_blink[0] - color_pos[0]; ty = color_blink[1] - color_pos[1]; tz = color_blink[2] - color_pos[2]; dist=Math.Sqrt(tx*tx +ty*ty +tz*tz); if(dist<0.1) color_phase=5; } if(color_phase==5) { color_vector[0]=0.025*(color_base[0] - color_pos[0]); color_vector[1]=0.025*(color_base[1] - color_pos[1]); color_vector[2]=0.025*(color_base[2] - color_pos[2]); color_phase=6; } if(color_phase==6) { color_pos[0]=color_pos[0]+color_vector[0]; color_pos[1]=color_pos[1]+color_vector[1]; color_pos[2]=color_pos[2]+color_vector[2]; tx = color_base[0] - color_pos[0]; ty = color_base[1] - color_pos[1]; tz = color_base[2] - color_pos[2]; dist=Math.Sqrt(tx*tx +ty*ty +tz*tz); if(dist<0.1) color_phase=3; } Window.SetBackgroundTopColor(color_pos[0],color_pos[1],color_pos[2]); Window.SetBackgroundBottomColor(color_pos[0],color_pos[1],color_pos[2]); /*Window.SetBackgroundBottomColor(color_pos[0]*0.2,color_pos[1]*0.2,color_pos[2]*0.2);*/ draw_message(); } Plymouth.SetMessageFunction(message_callback); Plymouth.SetRefreshFunction (refresh_callback); Plymouth.SetDisplayNormalFunction(refresh_callback); Plymouth.SetUpdateStatusFunction(message_callback); /* End */