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

前端 未结 4 976
礼貌的吻别
礼貌的吻别 2021-02-15 15:03

I\'m going to start programming a 2D tile-based game in Qt and read about the QGraphicsScene and QGraphicsView classes which are intended for displaying and handling lots of 2D

4条回答
  •  清酒与你
    2021-02-15 15:26

    I agree with what has been said. I've been doing QGraphicsView-based games for years (if you're on Linux, ask your package manager for KDiamond or Palapeli if you like), and while rendering performance has been an issue when QGraphicsView first came out years ago, these problems are now generally solved.

    What you should be concerned about is memory consumption. The chips example may have as many chips as you want to have tiles, but those chips are not kept in memory as pixmaps. If each tile is a fixed-size 50x50px image, that's already

    32bits*50px*50px*200*200 = 381,9 MiB
    

提交回复
热议问题