memorygame.qml 668 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * Copyright (c) 2011 Nokia Corporation.
  3. */
  4. import Qt 4.7
  5. import "memorygame.js" as GameLogic
  6. Image {
  7. id: game
  8. property bool gameStarted: false
  9. property int cards: 24
  10. property int columns: 8
  11. property int rows: 3
  12. // Because the card.qml won't see the GameLogic java script we use this function
  13. function handleClick(index) {
  14. GameLogic.selectCard(index)
  15. }
  16. function initialize() {
  17. if(gameStarted == false) {
  18. gameStarted = true
  19. GameLogic.initBoard(cards)
  20. gameStarted = true
  21. }
  22. }
  23. anchors.fill: parent
  24. source: "back_memorygame.png"
  25. fillMode: "Stretch"
  26. }