
SFML Game Development By Example
By :

An interface, in its simplest meaning, is a container of elements. It's a window that can be moved around and scrolled and has all of the same features and event hooks as a regular element. Efficiency is also a great concern, as dealing with lots of elements in a single window is a definite possibility. Those problems can be dealt with by carefully designing a way of drawing elements at the appropriate time.
The way we want our interfaces to draw content is by using three separate textures for different purposes, as shown below:
With the design details out of the way, element storage deserves some attention. As it happens, the std::unordered_map
structure serves this purpose well:
using Elements = std::unordered_map<...
Change the font size
Change margin width
Change background colour