Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. Creating the GUI for a Monopoly game
Forum Updated to NodeBB v4.3 + New Features

Creating the GUI for a Monopoly game

Scheduled Pinned Locked Moved Game Development
7 Posts 2 Posters 5.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tupla
    wrote on last edited by
    #1

    Hi everybody! I am trying to develop a Monopoly game in Qt (with some kde stuff), but I got stuck when I had to think about how to create the graphic interface. I read something about QGraphics Framework, but I have no idea how to set up a solution and use it.
    How can I draw the board using QGraphicsScene and QGraphicsView?
    Thanks in advance!

    1 Reply Last reply
    0
    • ? This user is from outside of this forum
      ? This user is from outside of this forum
      Guest
      wrote on last edited by
      #2

      and QML is not an option is it?

      simple way to approach this is take a look at the QGraphicsView framework documentation in the assistant. also there are very nice demos and examples with source code already available with Qt sdk.

      you have a scene that you set to the graphics view.
      you create your graphic items (various types) and add them to the scene.
      you can apply effects and also move these graphic items very easily within the scene.
      you can set the z order for these items and use them as layers too ...

      happy coding

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #3

        The GraphicsView framework does lend itself quite well for this kind of application, I think. As chetankjain pointed out, you'll need to dive into the documentation to learn how to use it. It really isn't all that difficult. The basic architecture is like this:

        A QGraphicsItem (or, more likely, one of its many subclasses) is an item that you can put on a QGraphicsScene. The scene acts as the canvas to put your rectangles, texts, etc. on. A QGraphicsView provides a view onto a QGraphicsScene. You might have more than one view on the same scene, just like you can have multiple item views display the same data model at the same time in different views. QGraphicsItems can also have parent-child relationships. That is: you can create hierarchy's of items belonging together. Note that unlike the situation in the QWidget world, this does not mean that the child item is somehow contained or clipped to the parent item. This allows you to make logical groupings of your items. In your case, you may want to create an item for each position on the monopoly board, with a child item for the colored bar where the houses and hotels will appear, and a child item for the text that indicates the street and city name. You can then position this item as one unit, and you can create many of these units to represent each position on the board.

        1 Reply Last reply
        0
        • T Offline
          T Offline
          Tupla
          wrote on last edited by
          #4

          Thank you very much for your replies. I hope there are methods that allow to arrange the positions side by side. Another discouraging thing is that I have to move pawns along the board, and retrieve the current "cell" after a roll... I'll give a look at the documentation, thank you!

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #5

            Positioning items next to onanother is not that hard, and recently got even easier. Take a look at QGraphicsAnchorLayout. This will make it quite easy to position the items relative to each other, including putting them in the configuration you need for a monopoly board.

            Moving pawns is not all that hard, and you can even animate these movements nicely.

            1 Reply Last reply
            0
            • T Offline
              T Offline
              Tupla
              wrote on last edited by
              #6

              Ok, thank you for your help, I'll start reading the docs and working on!

              1 Reply Last reply
              0
              • ? This user is from outside of this forum
                ? This user is from outside of this forum
                Guest
                wrote on last edited by
                #7

                do post back your monopoly in showcase, i'd like to download it ;)

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved