start_game.rml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <rml>
  2. <head>
  3. <title>Start Game</title>
  4. <link type="text/template" href="window.rml" />
  5. <style>
  6. body
  7. {
  8. width: 300px;
  9. height: 225px;
  10. margin: auto;
  11. }
  12. div#title_bar div#icon
  13. {
  14. icon-image-s: 230px 281px;
  15. icon-image-t: 152px 191px;
  16. }
  17. form div
  18. {
  19. width: 200px;
  20. margin: auto;
  21. }
  22. </style>
  23. <script>
  24. StartGame = StartGame or {}
  25. function StartGame.SetupGame(event,document)
  26. if event.parameters['difficulty'] == 'hard' then
  27. Game.SetDifficulty(Game.difficulty.HARD)
  28. else
  29. Game.SetDifficulty(Game.difficulty.EASY)
  30. end
  31. --some lua trickery coming up. Compiling a string at runtime that will return the values,
  32. --because they are comma separated. For example, if the user chose "Denim", then the
  33. --compiled string would look like "return 21,96,189"
  34. local red,green,blue = load('return '..event.parameters['colour']) ()
  35. Game.SetDefenderColour(Colourb.new(red,green,blue,255))
  36. local elem = Window.LoadMenu('game',document):GetElementById('game')
  37. elem:Focus()
  38. end
  39. </script>
  40. </head>
  41. <body template="luawindow">
  42. <form onsubmit="StartGame.SetupGame(event,document)">
  43. <div>
  44. <p>
  45. Difficulty:<br />
  46. <input type="radio" name="difficulty" value="easy" checked="true" /> Easy<br />
  47. <input type="radio" name="difficulty" value="hard" /> Hard
  48. </p>
  49. <p>
  50. Colour:<br />
  51. <select name="colour">
  52. <option value="233,116,81">Burnt Sienna</option>
  53. <option value="127,255,0">Chartreuse</option>
  54. <option value="21,96,189">Denim</option>
  55. <option value="246,74,138">French Rose</option>
  56. <option value="255,0,255">Fuschia</option>
  57. <option value="218,165,32">Goldenrod</option>
  58. <option selected value="255,255,240">Ivory</option>
  59. </select>
  60. </p>
  61. </div>
  62. <input type="submit">Start Game!</input>
  63. </form>
  64. </body>
  65. </rml>