Its simple 600x950 Calculator created in C++ 17 using SDL3 lib used for renderering.
Linux Ubuntu/Debian:
- First Clone git repo
git clone https://github.com/Pekos123/Calculator.git
cd Calculator- Make build direcotry and run cmake
mkdir build
cd build
cmake ../CMakeLists.txt
make- Run calculator
src/calculatorfor tests
tests/calculator_tests- ESC Key for quit
- Suported math operations: '-' subtraction, '+' addition, ':' devide, 'x' multiplication;
- Other '±' toggle negative number sign, '.' adding decimal point, '=' calculate results;
Calculator/
├── src/ # Source files
│ ├── main.cpp # Application entry point
│ ├── CalculatorApp.cpp # Main application class
│ ├── CalculatorEngine.cpp # All math logic
│ ├── Button.cpp # Button UI component
│ ├── Text.cpp # Text rendering component
│ ├── Frame.cpp # UI layout container
│ ├── Event.cpp # Events
│ ├── GUIElement.cpp # Base UI element class
│ └── CMakeLists.txt # CMake build configuration
├── include/ # Header files
│ ├── CalculatorApp.h
│ ├── CalculatorEngine.h
│ ├── Button.h
│ ├── Text.h
│ ├── Frame.h
│ ├── Event.h
│ ├── GUIElement.h
│ └── CMakeLists.txt # CMake build configuratio
├── tests/ # Unit test using Gtest lib
├── lib/
├── font.otf # Application font
├── CMakeLists.txt # CMake build configuration
├── .gitignore # Git ignore rules
└── README.md # This file
The calculator follows a modular architecture:
- CalculatorApp: Main application class handling initialization and game loop
- CalculatorEngine: Handle all calculator logic
- GUIElement: Base class for all UI components
- Button: Interactive button component with text and click event handling
- Text: Text rendering component using SDL3_ttf
- Frame: Layout container for organizing UI elements
- SDL3
- SDL3_ttf
- GTest
- CMake (build system)
- C++17 compatible compiler