When you create a model for your domain, C++ offers you flexibility and increates type-safety with so-called Strong Types. Rather than working with simple built-in types, you can create a set of well-defined classes that better suits your needs. In a new blog post, you can see one concrete example of such a design practice.
I took my old pet project from 2006, experimented, refactored it and made it more modern C++. Here are my lessons and six practical steps that you can apply in your projects.
Background And Test Project All changes that I describe here are based on my experience with a pet project which I dig out from the studies.
Let’s look at the following problem:
We are designing a drawing application. We want some objects to be automatically scaled to fit inside parent objects. For example: when you make a page wider, images can decide to scale up (because there’s more space). Or if you make a parent box narrower image needs to scale down.
In our particle system we have already a basic foundation: the container and the framework. Now we need some modules that can actually wake particles. In this post I will describe the emitter module and generators.
The Series Initial Particle Demo Introduction Particle Container 1 - problems Particle Container 2 - implementation Generators & Emitters (this post) Updaters Renderer Introduction to Optimization Tools Optimizations Code Optimizations Renderer Optimizations Summary Introduction Basic design: