Skip to content

Instantly share code, notes, and snippets.

@chanwit
Created October 28, 2011 18:09
Show Gist options
  • Select an option

  • Save chanwit/1322937 to your computer and use it in GitHub Desktop.

Select an option

Save chanwit/1322937 to your computer and use it in GitHub Desktop.
<zk apply="zk.grails.Hangman">
<vbox>
<hbox>
Number of Wrong Guess: <label id="count" />
</hbox>
<image id="imgStep"/>
<hbox>
The Word:
<label id="answer"/>
</hbox>
Chracters:
<hbox id="buttons"/>
<hbox id="buttons"/>
<box height="20px"/>
<label value="New Game?" id="lblNewGame"
style="cursor: pointer; text-decoration: underline; color: maroon;" />
</vbox>
</zk>
class HangmanComposer {
}
class HangmanViewModel {
static binding = {
count 'value,style':'count'
imgStep src:"hangmanStep"
}
def hangmanStep = { "images/hangman/step${hangman.wrong+1}.gif" }
def count = {
if (hangman.win)
[style:"color: green", value: "YOU WIN !!"]
else if(hangman.gameOver)
[style:"color: red", value: "GAME OVER"]
else
[style:"color: black", value: hangman.wrong]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment