Skip to content

Instantly share code, notes, and snippets.

@soc
Created October 12, 2011 07:00
Show Gist options
  • Save soc/1280501 to your computer and use it in GitHub Desktop.
Save soc/1280501 to your computer and use it in GitHub Desktop.
import scala.swing._
import java.awt.Color
import javax.swing.ImageIcon
import java.lang.Thread
object Main extends SimpleSwingApplication {
def top = new MainFrame {
title = "Foo"
minimumSize = new Dimension(800, 640)
maximumSize = new Dimension(800, 640)
contents = mainMenu
def mainMenu = new GridBagPanel {
//new BoxPanel(Orientation.Vertical) {
background = Color.BLACK
val cons = new Constraints()
cons.grid = (1, 0)
add(welcomeLabel, cons)
cons.grid = (0, 2)
// add(titleImage, cons)
cons.grid = (0, 3)
add(singleplayerButton, cons)
cons.grid = (1, 3)
add(createCoopButton, cons)
cons.grid = (2, 3)
add(joinCoopButton, cons)
cons.grid = (1, 4)
add(replayButton, cons)
cons.grid = (2, 4)
add(highscoreButton, cons)
}
def welcomeLabel = new Label("Wilkommen!") {
foreground = Color.WHITE
}
def emptyLabel = new Label("")
def singleplayerButton = Button("Einzelspielerspiel starten") {
background = Color.GRAY
val game = new SinglePlayerGame {
minimumSize = new Dimension(700, 600)
visible = true
}
contents = game
game.init()
game.start()
val thread = new Thread()
// while(game.loopThread != null){
// //println("loopThread nicht null!") <---- not work!!!
// }
//
// println("loopThread null")
//
// contents = new BoxPanel(Orientation.Vertical) {
// contents ++= Seq(HighScore.highScore, Button("Zurück zum Hauptmenü") {
//
// }
// )
// }
}
def showHighscore = {
contents = new BoxPanel(Orientation.Vertical) {
contents ++= Seq(HighScore.highScore, Button("Zurück zum Hauptmenü") {
}
)
}
}
def createCoopButton = Button("Kooperatives Spiel erstellen") {
background = Color.GRAY
}
def joinCoopButton = Button("Kooperativem Spiel beitreten") {
background = Color.GRAY
}
def replayButton = Button("Replay anschauen") {
background = Color.GRAY
}
def highscoreButton = Button("Highscore anschauen") {
background = Color.GRAY
contents = new BoxPanel(Orientation.Vertical) {
contents ++= Seq(HighScore.highScore, Button("Zurück zum Hauptmenü") {
}
)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment