Skip to content

finjosh/cpp-Utilities

Repository files navigation

cpp-Utilities

C++ utility classes that I have made during other projects and think would be useful for other applications

Some of the classes are built for the "Simple and Fast Multimedia Library" (SFML) and the "Texus' Graphical User Interface" (TGUI)

Tested with:

  • Compiler: MSYS2
  • Version: g++.exe (Rev3, Built by MSYS2 project) 12.1.0

SFML:

  • Version: 2.6.1

TGUI:

  • Version: 1.2

Utilities breakdown

File Brief Description Dependencies
funcHelper.hpp Makes taking, storing, and using functions as variables easier. Functions set can have dynamic data given to them when the function is invoked. None
EventHelper.hpp Event class with thread-safety. Functions set to an event can have dynamic data given when the event is invoked. None
StringHelper.hpp Simple class for common string operations like trimming and converting char to lowercase. Includes functions for converting a string to float, int, etc. None
UpdateLimiter.hpp Used to limit the speed of a thread None
Stopwatch.hpp Used to check how long operations take None
Log.hpp Simple class that prints logs into a file None
iniParser.hpp Easy to use ini parser StringHelper.hpp
CommandHandler.hpp Used to create and use commands. The command handler also has the ability to search commands. funcHelper.hpp, StringHelper.hpp
CommandPrompt.hpp Simple command prompt that uses the command handler as its backend CommandHandler.hpp, StringHelper.hpp, TGUICommon.hpp, TGUI
TerminatingFunction.hpp Functions that will be called every frame until it says it is done running funcHelper.hpp
TFuncDisplay.hpp Simple display for terminating functions for debugging TerminatingFunction.hpp, TGUICommon.hpp, TGUI, CommandHandler.hpp (optional)
LiveVar.hpp Live variables are used for debugging and testing EventHelper.hpp, funcHelper.hpp, SFML Events, CommandHandler.hpp (optional)
VarDisplay.hpp Simple display for live vars, which shows all the current live vars and their values LiveVar.hpp, TGUICommon.hpp, TGUI, CommandHandler.hpp (optional)
GraphData.hpp Used to store data used for Graph.hpp SFML Color and Vector2, StringHelper.hpp
Graph.hpp A simple graph drawing class. Can draw any of the following Histogram, Bar, Scatter, and Line graphs. Can draw to a SFML texture or straight to the window GraphData.hpp, StringHelper.hpp, Spline.hpp (from here)
TGUICommon.hpp Simple classes with features that I find myself using often TGUI, CommandHandler.hpp (optional)
TestHelper.hpp Helper for testing a function or a sequence of functions runtime SFML Window, SFML Graphics, TGUI, iniParser.hpp, Stopwatch.hpp, funcHelper.hpp, Graph.hpp

A preview of a few utilities

Note that the theme can be set to any TGUI theme, and the utilities UI will update accordingly.

Command Prompt

Firstly, to open and close the command prompt, you can use the tilde key (~)

image

To get a list of commands, use the command help

image

To find out more about a specific command, type help 'command'

image

Untitledvideo-MadewithClipchamp-ezgif com-video-to-gif-converter

Var Display and Live Var

Live vars can have key binds set to them for specific values or to increment them.

Example:

2024-01-1419-44-59-ezgif com-video-to-gif-converter

Example usage with command prompt:

VarDisplayAndCommandPrompt.mp4

Terminating Functions Display

Display for seeing the name and total time of each terminating function

image

TFunc

Graphing Class

Simple Graphing class that supports line graphs, bar graphs, scatter plots and histograms.

image image image image image image

Graph

Test Helper

Helper for testing a function or a sequence of functions runtime

Testing UI

image

Test Graphing UI

image