start_game.rml 1.8 KB

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