https://github.com/zreechxnn/calculator-sdl2
SDL2 Calculator: A simple calculator built with C++ and SDL2, supporting basic arithmetic, advanced math functions, and trigonometry. Features a user-friendly graphical interface.
https://github.com/zreechxnn/calculator-sdl2
calculator calculator-application conio cpp cross-platform graph gui math math-operations opensource sdl2 sdl2-library sdl2-ttf simple-app software-development stdlib trigonometry
Last synced: about 1 year ago
JSON representation
SDL2 Calculator: A simple calculator built with C++ and SDL2, supporting basic arithmetic, advanced math functions, and trigonometry. Features a user-friendly graphical interface.
- Host: GitHub
- URL: https://github.com/zreechxnn/calculator-sdl2
- Owner: Zreechxnn
- License: gpl-3.0
- Created: 2024-08-25T06:55:12.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-01-19T10:40:13.000Z (over 1 year ago)
- Last Synced: 2025-03-29T07:22:43.768Z (about 1 year ago)
- Topics: calculator, calculator-application, conio, cpp, cross-platform, graph, gui, math, math-operations, opensource, sdl2, sdl2-library, sdl2-ttf, simple-app, software-development, stdlib, trigonometry
- Language: C++
- Homepage:
- Size: 108 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# calculator-SDL2
# SDL2 Calculator
detail
A simple calculator application developed using SDL2 and SDL_ttf. This calculator includes various mathematical functions and operations, such as square root, pi, exponentiation, trigonometric functions, and basic arithmetic operations.

Features
- **Basic Arithmetic Operations**: Addition, subtraction, multiplication, and division.
- **Mathematical Functions**: Square root, exponentiation, factorial, and more.
- **Trigonometric Functions**: Sine, cosine, and tangent.
- **Advanced Features**: Decimal points, parentheses, percentage calculations, and more.
Getting Started
To build and run this project, you need to have the following installed:
- SDL2
- SDL2_ttf
You can install these libraries using your package manager or from the official SDL website.
Instalation
1. **Clone the repository**:
```bash
git clone https://github.com/Zreechxnn/calculator-SDL2.git
cd calculator-SDL2
```
2. **Install dependencies**:
- On Ubuntu/Debian-based systems:
```bash
sudo apt-get install libsdl2-dev libsdl2-ttf-dev
```
- On Fedora-based systems:
```bash
sudo dnf install SDL2-devel SDL2_ttf-devel
```
3. **Build the project**:
```bash
gcc -o calculator main.cpp -lSDL2 -lSDL2_ttf -lm
```
4. **Run the application**:
```bash
./calculator
```
## Usage
- **Basic Operations**: Click the buttons to input numbers and operators. Click the `=` button to calculate the result.
- **Advanced Functions**: Use buttons like `sqrt`, `pi`, `^`, `!`, `deg`, `sin`, `cos`, `tan`, and `AD` for advanced calculations (coming soon) .
- **Clear and Delete**: Click `D` to delete the last character and `0` to reset the input.
## Troubleshooting
- **Font Issues**: Ensure 'lonely.ttf` is present in the same directory as the executable or adjust the path in the source code.
- **Library Errors**: Verify that SDL2 and SDL2_ttf libraries are installed and properly linked during compilation.
## Contributing
Feel free to open issues or submit pull requests if you find bugs or have suggestions for improvements.
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
## Acknowledgments
- [SDL2](https://www.libsdl.org/) - Simple DirectMedia Layer
- [SDL2_ttf](https://www.libsdl.org/projects/SDL_ttf/) - SDL2 font rendering library
⚠️Disclaimer
The code in this repository is intended **only for developers** with a basic understanding of programming. Please use it responsibly and for development purposes only.
- **Not recommended for direct use in production environments without thorough testing.**
- No guarantees are provided regarding the absence of bugs or errors.
- The author is not liable for any damages or issues caused
©️ 2024 Rechan Dinata