mcalculator
mcalculator copied to clipboard
Web port of Microsoft calculator, written in cpp, using WebAssembly to run on all platforms.
MCalculator
It is a port of the Microsoft Calculator App engine to the web, emulating the same UI on the front-end.
This project exists to test the scope of porting Desktop utilities, written in native code, to the web so as to run everywhere #WebIsTheFuture.
Try it here

Engine
The Engine is written entirely in cpp with modern and legacy C++ code mixed with Windows-specific tools. Modifying the bits here and there and making it work with CMakeTools was a challenge initially. However, after adding my thin cpp View layer to interact with the core engine, I compiled it to WebAssembly using Emscripten to make it interact with the browser environment.
UI
UI layer was written in plain HTML, CSS, and vanilla Javascript to make it run fast and have a small footprint. Keyboard and Button clicks are captured and mapped to the engine commands. The engine does all the calculations and most of the error and state handling and sends the results back to the UI.
Current development
Only the Standard mode of the calculator is available in this build as it is supposed to be just a POC. This project is NOT under active development. Contributions are however welcomed.
Features working as of now
- All basic operations.
- Infinite precision.
- History panel.
- Memory panel, with
MC
,M+
, andM-
functions. Hover or tap the list items to reveal these buttons.
Build 🤷♂️
You'll need Emscripten to build.
-
Download and install Emscripten.
-
cd to
engine/
and run:
%/path/to/emscripten%/emcmake cmake .
%/path/to/emscripten%/emmake make
%/path/to/emscripten%/emcc -02 libEngine.a CalcManager/libCalcManager.a CalcModel/libCalcModel.a -o engine.js
The first two lines generate Cmake files and library.a files respectively in their respective folders.
See CMakeLists.txt.
The third one generates the engine.js
and engine.wasm
which are used by the server.
More
Now go get a life!