1
votes

I want to make a 2D level editor, where i can load images, crop them and then place them onto a tiled map. I want to mark tiles and give them additional properties like "with collision", later i want to export the whole map.

What Qt classes are best suited for the job to display this tiled map? I guess for drawing i would use a derived QGraphicsview/QGraphicsscene. But how should I display the tilemap? Crop the Graphicsview into (for example) 128x128 parts and represent each image as QPixmap?

This is what i got for now, the next part would be to create an empty tilemap in the middle of the editor...enter image description here

The idea is to select the tiles on the left, and drag and drop them to the middle..the tile should then snap into the tilemap grid. But, as for now..i have no idea how to represent that tiled grid in my QGraphicsview.

1

1 Answers

2
votes

Getting started with a Tile-based game in Qt using QGraphicsScene and QGraphicsView

Use the same scene for both the full view and the mini view. But use a switch statement when drawing them for the level of detail. (see the lod variable in the tile game example)

http://doc.qt.io/qt-5/qtwidgets-graphicsview-chip-example.html