Testing out JmonkeyEngine to make a game in Scala with Akka Actors within a pure FP layer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
3.0 KiB

  1. package wow.doge.mygame.launcher
  2. import scalafx.geometry.Insets
  3. import scalafx.scene.Scene
  4. import scalafx.scene.effect.DropShadow
  5. import scalafx.scene.layout.HBox
  6. import scalafx.scene.paint.Color._
  7. import scalafx.scene.paint._
  8. import scalafx.scene.text.Text
  9. import scalafx.scene.control.Button
  10. import scalafx.scene.layout.VBox
  11. import scalafx.scene.layout.FlowPane
  12. import scalafx.geometry.Orientation
  13. import scalafx.geometry.Pos
  14. import scalafx.stage.Stage
  15. object DefaultUI {
  16. def scene(
  17. // stage: Stage,
  18. launchButton: Button,
  19. exitButton: Button
  20. ) =
  21. new Scene {
  22. fill = Color.rgb(38, 38, 38)
  23. content = new VBox {
  24. children = Seq(
  25. new HBox {
  26. padding = Insets(50, 80, 50, 80)
  27. children = Seq(
  28. new Text {
  29. text = "JMonkeyEngine"
  30. style = "-fx-font: normal bold 50pt sans-serif"
  31. fill = new LinearGradient(endX = 0, stops = Stops(Red, DarkRed))
  32. },
  33. new Text {
  34. text = " Game"
  35. style = "-fx-font: italic bold 50pt sans-serif"
  36. fill = new LinearGradient(
  37. endX = 0,
  38. stops = Stops(White, DarkGray)
  39. )
  40. effect = new DropShadow {
  41. color = DarkGray
  42. radius = 15
  43. spread = 0.25
  44. }
  45. }
  46. )
  47. },
  48. new FlowPane {
  49. hgap = 10
  50. padding = Insets(50, 80, 50, 80)
  51. orientation = Orientation.Horizontal
  52. alignment = Pos.Center
  53. children = Seq(launchButton, exitButton)
  54. }
  55. )
  56. }
  57. // onMousePressed = (pressEvent) => {
  58. // onMouseDragged = (dragEvent) => {
  59. // stage.setX(dragEvent.getScreenX() - pressEvent.getSceneX())
  60. // stage.setY(dragEvent.getScreenY() - pressEvent.getSceneY())
  61. // }
  62. // }
  63. }
  64. def box(launchButton: Button, exitButton: Button) =
  65. new VBox {
  66. children = Seq(
  67. new HBox {
  68. padding = Insets(50, 80, 50, 80)
  69. children = Seq(
  70. new Text {
  71. text = "JMonkeyEngine"
  72. style = "-fx-font: normal bold 50pt sans-serif"
  73. fill = new LinearGradient(endX = 0, stops = Stops(Red, DarkRed))
  74. },
  75. new Text {
  76. text = " Game"
  77. style = "-fx-font: italic bold 50pt sans-serif"
  78. fill = new LinearGradient(
  79. endX = 0,
  80. stops = Stops(White, DarkGray)
  81. )
  82. effect = new DropShadow {
  83. color = DarkGray
  84. radius = 15
  85. spread = 0.25
  86. }
  87. }
  88. )
  89. },
  90. new FlowPane {
  91. hgap = 10
  92. padding = Insets(50, 80, 50, 80)
  93. orientation = Orientation.Horizontal
  94. alignment = Pos.Center
  95. children = Seq(launchButton, exitButton)
  96. }
  97. )
  98. }
  99. }