STGUI Write-Up

Silent G, pronounced like "Stewie"

Page Summary

This page is an information dump for a project I worked on during the Summer of 2022.

This project was part of a much larger project that was ultimately cancelled due to reasons beyond my control.

I created this page mainly to have public "proof" of this project existing and the time and effort I invested into it.


Project Summary

STGUI is a basic but unfinished GUI system designed from near-scratch for a cancelled/delayed project.

STGUI was written in C++ on top of the Source Engine's Surface drawing library.

It is not at all fit for public use or use outside of its intended project, therefore it will not be released to the public.


Classes

STGUI is comprised of the following classes:


Remarks

The STBaseElement class handles structuring elements and painting them.

STBaseElement contains a field next that keeps track of the next element. This means that every element is a node in a linked list.

The project's global object keeps track of the tail element, and every time an STBaseElement-derived object is constructed, adds it to the end of the list.


A global STWindow is defined to contain all elements, and subsequent elements are constructed with a pointer to this global window as an argument.

Each frame, the global window runs its next element's Tick method.

This Tick method calls the element's Paint method which only runs if the its IsVisible method return true. The Tick method also calls this element's next element's Tick method.


Most element classes have a function pointer parameter in their constructor argument list.

Depending on the element type, this function is called when the element is interacted with, such as when an STButton is clicked or when an STNumSlider's value changes.

These functions must have a pointer to the element's type as a parameter.


Some element classes also have a void* parameter that corresponds to a global object's field that is updated by the element's predefined callback function.

This was only seen being used in STDropDown callbacks to set a global variable to the value of the chosen item.


The STDropDown class has a method AddListItem that adds an STDropDownItem as a child element of the STDropDown.

Each STDropDown has its own linked list of STDropDownItem objects.

AddListItem must be called after every other control has been created or else the STDropDownItem elements will appear behind any element created after them.

This is because the method creates the STDropDownItem immediately instead of when the menu is opened. This needs to be changed.


Every element has a style structure property that defines how it looks.

This structure usually has other structures in it to color multiple parts of the element, such as the STDropDownItems of an STDropDown.