pix.script 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. screen_width = Window.GetWidth();
  2. screen_height = Window.GetHeight();
  3. theme_image = Image("splash.png");
  4. image_width = theme_image.GetWidth();
  5. image_height = theme_image.GetHeight();
  6. scale_x = image_width / screen_width;
  7. scale_y = image_height / screen_height;
  8. flag = 1;
  9. if (scale_x > 1 || scale_y > 1)
  10. {
  11. if (scale_x > scale_y)
  12. {
  13. resized_image = theme_image.Scale (screen_width, image_height / scale_x);
  14. image_x = 0;
  15. image_y = (screen_height - ((image_height * screen_width) / image_width)) / 2;
  16. }
  17. else
  18. {
  19. resized_image = theme_image.Scale (image_width / scale_y, screen_height);
  20. image_x = (screen_width - ((image_width * screen_height) / image_height)) / 2;
  21. image_y = 0;
  22. }
  23. }
  24. else
  25. {
  26. resized_image = theme_image.Scale (image_width, image_height);
  27. image_x = (screen_width - image_width) / 2;
  28. image_y = (screen_height - image_height) / 2;
  29. }
  30. if (Plymouth.GetMode() != "shutdown")
  31. {
  32. sprite = Sprite (resized_image);
  33. sprite.SetPosition (image_x, image_y, -100);
  34. }
  35. message_sprite = Sprite();
  36. message_sprite.SetPosition(screen_width * 0.1, screen_height * 0.9, 10000);
  37. fun message_callback (text) {
  38. my_image = Image.Text(text, 1, 1, 1);
  39. message_sprite.SetImage(my_image);
  40. sprite.SetImage (resized_image);
  41. }
  42. Plymouth.SetUpdateStatusFunction(message_callback);