main_builders.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. """Functions used to generate source files during build time"""
  2. import methods
  3. def make_splash(target, source, env):
  4. buffer = methods.get_buffer(str(source[0]))
  5. with methods.generated_wrapper(str(target[0])) as file:
  6. # Use a neutral gray color to better fit various kinds of projects.
  7. file.write(f"""\
  8. static const Color boot_splash_bg_color = Color(0.14, 0.14, 0.14);
  9. inline constexpr const unsigned char boot_splash_png[] = {{
  10. {methods.format_buffer(buffer, 1)}
  11. }};
  12. """)
  13. def make_splash_editor(target, source, env):
  14. buffer = methods.get_buffer(str(source[0]))
  15. with methods.generated_wrapper(str(target[0])) as file:
  16. # The editor splash background color is taken from the default editor theme's background color.
  17. # This helps achieve a visually "smoother" transition between the splash screen and the editor.
  18. file.write(f"""\
  19. static const Color boot_splash_editor_bg_color = Color(0.125, 0.145, 0.192);
  20. inline constexpr const unsigned char boot_splash_editor_png[] = {{
  21. {methods.format_buffer(buffer, 1)}
  22. }};
  23. """)
  24. def make_app_icon(target, source, env):
  25. buffer = methods.get_buffer(str(source[0]))
  26. with methods.generated_wrapper(str(target[0])) as file:
  27. # Use a neutral gray color to better fit various kinds of projects.
  28. file.write(f"""\
  29. inline constexpr const unsigned char app_icon_png[] = {{
  30. {methods.format_buffer(buffer, 1)}
  31. }};
  32. """)