Giter Site home page Giter Site logo

ptkkhiem / mcalculator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from muzam1l/mcalculator

0.0 0.0 0.0 10.27 MB

Web port of Microsoft calculator, written in cpp, using WebAssembly to run on all platforms.

Home Page: https://muzam1l.github.io/mcalculator/

License: MIT License

CMake 0.31% C++ 92.24% C 2.01% Shell 0.08% JavaScript 2.66% CSS 1.50% HTML 1.20%

mcalculator's Introduction

mcalculator

It is a web port of Microsoft Calculator App engine, emulating the same UI on frontend.

This project exists to test the scope of porting Desktop utilities, written in native code, to Web so as to run everywhere #WebIsTheFuture.

Try it here https://muzam1l.github.io/mcalculator/ (new link)(faster)

https://mcalculator.herokuapp.com/ (old link)(slower)(still mantained)

screenshot

Core

Engine is written entirely in cpp with modern cpp17 and legacy code mixed with windows specific tools. However modifying it to make it work with other tools like gcc or clang was not so diffcult thanks to efforts in last year by contributers of calculator on github. After adding my thin cpp View layer to interact with it, i compiled the engine to WebAssembly using Emscripten (which behaves like clang), adding my hooks here and there to make it interact with javascript in browser enviroment. So i was successful in getting engine.wasm to run locally in browser.

UI

UI layer was written in plane HTML, CSS, and vanilla Javascript to make it and whole app tiny sized to load and run fast. All the front-end tasks, like capturing Keyboard and button clicks and maping these to commands to be sent to engine are maintained at this layer. This layer then sends these commands to engine which does all the calcualtion and most of the error and state handling.

UI is very responsive and fluent and loads super fast even on slower connections and low-end mobile devices. Once loaded for first time, sebsequent loads are even faster thanks to caching of of files like wasm assets.

App now can be installed like native app and is available offline, thanks to @NWylynko. On mobile devices use "Add to homescreen" and on desktop use plus icon in adress bar to install (new link).

responsive example

Current development

As of now only Standard mode is available in this build ๐Ÿ˜œ(#reduces to more of a POC ๐Ÿ˜Š). But i am working on Scientific Mode which will be pushed in few days ๐Ÿค—. Offline mode and Native app is also soon. Further development is subjected to interests and contributions of you guys (whoever reads this or just for myself ๐Ÿฅด๐Ÿ˜ญ)

Features working as of now

  • infinite precision (#as it is engine feature).
  • Whole Standard Mode (#i know this isn't much, so using 'whole' to exaggerate) to meet basic calculator requirements.
  • History panel, with NO copy paste as of now (#on both web and phones ๐Ÿค”).
  • Memory list panel, WITH individual memory item change (MC, M+, M- on each list item, hover or tap list to show these buttons)

memory-screenshot

Contributing

There ain't even any tests, so make it or break it, i just need your contri (and again, if i am only one reading, contri on me only ๐Ÿ˜ฃ)

Build ๐Ÿคทโ€โ™‚๏ธ

You'll need Emscripten to build.

  1. Download and install emscripten.

Then you may have emscripten installed on some path say /path/to/emscripten (for example my path to emcc looks like this /home/muzam/bin/emsdk/upstream/emscripten/emcc )

  1. Then cd to engine/ (or copy engine/ to different location to play around) and enter following in terminal

    </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

First two lines genrates cmake files and lib.a files respectively in their respective folders. All this behavior is controlled in respective CmakeFiles.txt

Third one generates engine.js and engine.wasm in project root (-o flag), These files can be copied directly and pasted in public/js of server (which is not automated yet ๐Ÿ˜ฌ)

Reporting Issues

if you are not using this on daily basis, dont report anything, contribute instaed ๐Ÿ˜ช.

And ... nothing i am just ........ ๐Ÿค.

mcalculator's People

Contributors

muzam1l avatar nwylynko avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.