O'Reilly logo

Mastering SFML Game Development by Raimondas Pupius

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Building the control mechanism

While building maps, the user tends to run into situations where they need more than just a tile being placed where the mouse clicks. It would definitely be useful to have tools that would enable them to freely pan around, select chunks of the map for deletion or copying, erase them and so on. Our control class is going to serve this exact purpose. It will provide a set of tools that can be used for multiple different situations:

enum class ControlMode{None, Pan, Brush, Bucket, Eraser, Select}; 

The preceding control mode enumeration represents a couple of the most common tools that come in a variety of different pieces of software. We're going to implement some of them here, and leave the rest up to you! In the end, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required