Scal - (simple or silly, you decide) graphical calculator, written in C.
Scal was made to test two very cool technologies: Nob.h
- evolution of "No Build" idea, made by Tsoding, and C Layout library made by nicbarker.
Also i wanted to expiriment with how prasing works, since i couldn't get my head around it in first few tries.
- Responisve immidiate-style User Interface with "Cobalt" theme.
- Simple Recusrive-Descent parser for expression evaluation
- Keyboard input support
- Plug-In font loading (Might be buggy)
You can grab prebuild binaries with default font included in Releases Page. There are pre-build binaries for x86_64 Windows and Linux (Posix).
Otherwise you can build it yourself.
Requirements:
- clang compiler for linux OR Mingw for windows
-
Grab source code from git via
git clone --depth 1 https://github.com/amuerta/scal
or download it from webpage. -
Navigate to repo root directory where all files all source files are sotred
-
Compile build.c "build-script" using command
cc -o build build.c
-
Run it with appropriate target selected:
- Windows:
./build release windows
- Posix(linux):
./build release linux
- Windows:
Optionally you can specifiy no font loading, by adding --default-font
at the end of the build command.
- Test produced executable
./build_output/scal(.exe for windows)
Calculator expects for a ./assets/AppFont.ttf
to exist somewhere near it. Its hardcoded path, thus you have to either create a softlink to the directory of the font, or a link to the executable.
If no font found, calculator will use default raylib font, which due to some dubious Clay font spacing WILL overlap its glyphs.
Since Scal has error-handling system, it will show Syntax error
when you provide invalid input expression. You might enter expression like -1
and get an error, even tho the expression is valid. That happens because Scal uses simplified parser grammar, where it would expect an expression with two operands, to acomidate this, just put 0 before whatever number you need to be negative:
Invalid Expr:
-1
Valid Expr:
0-1
Expressions with just numbers like (10)
, 10
, 10+
will evaluate without error.