One of the areas that I worked on was the UI. Various UI components were needed such as an animated component, button component, text component etc. To create these components, I created a UI component parent class. This class provided basic functionality such as the ability to create a quad with a set width and height in screen space. Another bit of functionality provided was the ability to have a parent UI component. This allows entire UI elements to be moved around and scaled without needing the transformation to be applied manually to each component.
Using this parent class, I created the other components mentioned earlier. The animated UI component takes a vector of textures and timings representing when the textures should switch. You can then enable interpolation which will lerp between the textures based on the frame timings.
Another component I created was the bar component. This was used to create things like health bars. It works by taking in 2 memory addresses. The first address references the max value the variable can be and the second is the current value the variable is set to. The width the bar should be is then calculated using the max and current variable values.
One of the final components I made was the button component. This component takes a function pointer to a void function with no parameters. This function is called whenever the button is pressed. It also takes references to 2 textures. One texture for the pressed button and another texture for the unpressed button. On top of this the colour of the texture when hovered over is calculated automatically.
On reflection an improvement I would have made to this system is to render into the depth stencil buffer wherever any non-transparent UI is located. This could then be used to not render pixels where the UI is located saving on pixel shader invocations.