UberFader.gd 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. extends Fader
  2. #var MONTH_SIZE = 20
  3. #var TITLE_SIZE = 30
  4. var MONTH_SIZE = 30
  5. var TITLE_SIZE = 40
  6. #var titlefont_path = "res://fonts/Now FL/Now-Regular.otf"
  7. #var bold_titlefont_path = "res://fonts/Now FL/Now-SemiBold.otf"
  8. #var titlefont_path = "res://fonts/luculent/luculent.ttf"
  9. #var bold_titlefont_path = "res://fonts/luculent/luculentb.ttf"
  10. #var titlefont_path = "res://fonts/Avara-master/Avara.otf"
  11. #var bold_titlefont_path = "res://fonts/Avara-master/Avara.otf"
  12. #var titlefont_path = "res://fonts/Sansita-for-Print/Sansita-Regular.otf"
  13. #var bold_titlefont_path = "res://fonts/Sansita-for-Print/Sansita-Bold.otf"
  14. #var titlefont_path = "res://fonts/Subotype Steady.otf"
  15. #var bold_titlefont_path = "res://fonts/Subotype Steady.otf"
  16. var titlefont_path = "res://fonts/HiLo-Deco.ttf"
  17. var bold_titlefont_path = "res://fonts/HiLo-Deco.ttf"
  18. var titlefont = DynamicFont.new()
  19. var bold_titlefont = DynamicFont.new()
  20. var month = "April"
  21. var month_label = null
  22. var title = "PLP's Sadness"
  23. var title_label = null
  24. func _init():
  25. var titlefont_data=DynamicFontData.new()
  26. titlefont_data.font_path = titlefont_path
  27. titlefont.font_data=titlefont_data
  28. titlefont.size=MONTH_SIZE
  29. var bold_titlefont_data=DynamicFontData.new()
  30. bold_titlefont_data.font_path = bold_titlefont_path
  31. bold_titlefont.font_data=bold_titlefont_data
  32. bold_titlefont.size=TITLE_SIZE
  33. func make_central_label(text,font):
  34. var res = Label.new()
  35. res.add_font_override("font",font)
  36. res.add_color_override("font_color",ColorN("white"))
  37. res.text = text
  38. res.rect_size.x = get_viewport().size.x
  39. res.align = Label.ALIGN_CENTER
  40. res.valign = Label.VALIGN_CENTER
  41. add_child(res)
  42. return res
  43. func make_title(month,title):
  44. var INTERROW_DIST = 40
  45. for l in [month_label,title_label]:
  46. if l:
  47. l.queue_free()
  48. month_label = make_central_label(month+":", titlefont)
  49. month_label.rect_position.y = get_viewport().size.y/2 - INTERROW_DIST/2
  50. title_label = make_central_label(title, bold_titlefont)
  51. title_label.rect_position.y = get_viewport().size.y/2 + INTERROW_DIST/2
  52. func _ready():
  53. pass
  54. # make_title()
  55. # fade_out()