Vultraz

Untitled

Jun 29th, 2016
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1. {
  2. id: "titlescreen_controller",
  3. is_strict: true,
  4. use_absolute_screen_coordinates: true,
  5.  
  6. properties: {
  7. screen_width: "int :: SCREEN_WIDTH",
  8. screen_height: "int :: SCREEN_HEIGHT",
  9.  
  10. _play_button: { type: "obj button_controller" },
  11. _editor_button: { type: "obj button_controller" },
  12.  
  13. render: "def() ->commands
  14. set(animation, lib.util.render_frame(c, ww, hh,
  15. [
  16. c.rectangle(0,0,ww,hh),
  17. c.set_source_rgba(0.2,0.2,0.2,1.0),
  18. c.fill(),
  19. ]
  20. )) where ww = screen_width
  21. where hh = screen_height
  22. where c = canvas()",
  23.  
  24. init_controls: "def() ->commands
  25. spawn('button_controller', {
  26. text: 'Play',
  27. zorder: zorder+1,
  28. mid_x: int(screen_width/2),
  29. mid_y: int(screen_height/2) + lib.wesnoth.py(80),
  30. on_click: def() ->commands fadeout_and_exit_to('game_controller'),
  31. use_absolute_screen_coordinates: true,
  32. }, [
  33. set(me._play_button, child)
  34. ]);
  35.  
  36. spawn('button_controller', {
  37. text: 'Edit Map',
  38. zorder: zorder+1,
  39. mid_x: int(screen_width/2),
  40. mid_y: int(screen_height/2) + lib.wesnoth.py(140),
  41. on_click: def() ->commands fadeout_and_exit_to('editor_controller'),
  42. use_absolute_screen_coordinates: true,
  43. }, [
  44. set(me._editor_button, child)
  45. ]);
  46.  
  47. spawn('label', {
  48. zorder: zorder+10,
  49. mid_x: int(screen_width/2),
  50. mid_y: int(screen_height/3) + lib.wesnoth.py(80),
  51. _text: ['Wesnoth: Genesis Demo'],
  52. use_absolute_screen_coordinates: true,
  53. _font_size: 80,
  54. });
  55.  
  56. spawn('image_widget', {
  57. mid_x: int(screen_width/2),
  58. mid_y: int(screen_height/5),
  59. zorder: zorder+5,
  60. image: 'logo_256.png',
  61. image_area: [0,0,255,255],
  62. draw_width: 200,
  63. draw_height: 200,
  64. use_absolute_screen_coordinates: true,
  65. })",
  66.  
  67. fadeout_and_exit_to: "def(string to_spawn) ->commands
  68. map(level.chars,
  69. animate(value, {
  70. alpha: 0,
  71. }, {
  72. duration: 10,
  73. on_complete: remove_object(value); add_object(object_playable(to_spawn, 0, 0, 1, {})),
  74. })
  75. )"
  76. },
  77.  
  78. events: {
  79. create: "[
  80. render(); init_controls();
  81.  
  82. // The x,y position and level dimensions need to be set manually here
  83. set(x, 0);
  84. set(y, 0);
  85. set(level.dimensions, [0,0,screen_width,screen_height])
  86. ]",
  87. }
  88. }
Advertisement
Add Comment
Please, Sign In to add comment