Results 1 to 6 of 6

Thread: tile mapping in qt?

  1. #1
    Join Date
    Nov 2012
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default tile mapping in qt?

    i am currently writing a tile editor for my game engine using qt, and i just have to check if im doing the tiling the best/smartest way, or if i should rewrite it.

    right now my tiles are a custom graphics item that i created, and it has a mousepress event that changes the image on the tile to whatever the current selected tile is. it works and all but i have a few things to clear up before i continue coding on it:

    1. is this a stupid approach? if so, what is a better way of doing it?
    2. right now i have to manually click on every tile item to change them, and it worries me. is it even possible to do stuff like a pen, fill bucket etc etc doing it this way?

    thanks for any help

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: tile mapping in qt?

    I would probably handle all (or most) user interaction in the scene or in the view, leaving the interaction in the item only for item specific things.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Nov 2012
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: tile mapping in qt?

    care to explain a bit more detailed, i'm not quite sure i understand, sorry

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: tile mapping in qt?

    For example changing the tile image should be easier handled by overriding mousePressEvent for the scene rather than for the item. This is a generic action, not tied to the type of the tile (assuming you can have more than one tile type).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Nov 2012
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: tile mapping in qt?

    hmm, how can i have the mousepress event on the scene then? could i create the scene as well through a custom item?

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: tile mapping in qt?

    Items are in the scene, not the other way round. Have a look at QGraphicsScene and what it offers.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Qt Tile Stack On Click?
    By steadi in forum Newbie
    Replies: 1
    Last Post: 11th October 2012, 02:44
  2. QSortFilterProxyModel mapping
    By Sparhawk in forum Qt Programming
    Replies: 1
    Last Post: 17th December 2011, 21:00
  3. Tile editor
    By danca226 in forum Newbie
    Replies: 1
    Last Post: 10th September 2011, 19:01
  4. Tile rendering with QGLWidget
    By h123 in forum Qt Programming
    Replies: 2
    Last Post: 10th November 2008, 23:27
  5. How works tile() ?
    By looki in forum Qt Programming
    Replies: 0
    Last Post: 30th September 2008, 14:25

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.