Skip to content

A sample RPN calculator build with ImGui Bundle and HelloImGui

Notifications You must be signed in to change notification settings

pthom/rpn_calculator

Repository files navigation

RPN Calculator

A simple RPN Calculator, demonstrating how easy it can be to create a truly multi-platform application with Dear ImGui, and Hello ImGui.

Works under Windows, Linux, macOS, emscripten, iOS (as a native app, or as a Web Clip), Android

Online calculator

Video explanation

screenshot

Build for Linux and macOS

1. Optional: clone hello_imgui

Note: This step is optional, since the CMakeLists.txt file will be default download and build hello_imgui at configure time.

In this example, we clone hello_imgui inside external/hello_imgui.

Note: external/ is mentioned in .gitignore

mkdir -p external && cd external
git clone https://github.com/pthom/hello_imgui.git
cd ..

Add this line at the top of your CMakeLists.txt

add_subdirectory(external/hello_imgui)

2. Create the build directory, run cmake and make

mkdir build && cd build
cmake ..
make -j 4

Build for Windows

1. Optional: clone hello_imgui

Follow step 1 from the Linux/macOS section above.

2. Create the build directory, run cmake

mkdir build && cd build
cmake ..

3. Open the Visual Studio solution

It should be located in build/rpn_calculator.sln

Build for Android

1. Clone hello_imgui:

You will need to clone hello_imgui. In this example, we clone hello_imgui inside hello_imgui_template/external/hello_imgui

Note: external/ is mentioned in .gitignore

mkdir -p external && cd external
git clone https://github.com/pthom/hello_imgui.git
cd ..

Add this line at the top of your CMakeLists.txt

add_subdirectory(external/hello_imgui)

2. Create the Android Studio project

mkdir build_android && cd build_android
../external/hello_imgui/tools/android/cmake_arm-android.sh ../

3. Open the project in Android Studio

It should be located in build_android/rpn_calculator_AndroidStudio.

Build for iOS

1. Clone hello_imgui

mkdir -p external && cd external
git clone https://github.com/pthom/hello_imgui.git
cd ..

2. Create the Xcode project

mkdir build_ios && cd build_ios

Run CMake with the following command, where you replace XXXXXXXXX with your Apple Developer Team ID, and com.your_website with your website (e.g. com.mycompany).

cmake .. \
-GXcode \
-DCMAKE_TOOLCHAIN_FILE=../external/hello_imgui/hello_imgui_cmake/ios-cmake/ios.toolchain.cmake \
-DPLATFORM=OS64COMBINED \
-DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=XXXXXXXXX \
-DHELLO_IMGUI_BUNDLE_IDENTIFIER_URL_PART=com.your_website \
-DHELLOIMGUI_USE_SDL_OPENGL3=ON

Build for emscripten

mkdir build_ems && cd build_ems/
source ~/emsdk/emsdk_env.sh      # Activate emscripten (see https://emscripten.org/docs/getting_started/downloads.html)
emcmake cmake ..
make -j

Then, run a web-server, e.g.

python3 -m http.server  # and then browse to http://localhost:8000

About

A sample RPN calculator build with ImGui Bundle and HelloImGui

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages