Skip to content

Francesco149/cubecalc-ui

Repository files navigation

GUI for the average cubing chances calculator for MapleStory.

the idea is that through the graph you can configure it for any complicated stat combination you’re looking for as well as have multiple calculations for different combinations on screen.

check out the presets combo box in the bottom/right bar for common setups

usage

web version

windows

  • download the exe (x86 for 32-bit, x86_64 for 64-bit) from the latest releases

AppImage: almost every linux distro

  • download the AppImage from the latest releases
  • on most distros, you can just chmod +x cubecalc-ui-*.AppImage and run it.
  • on NixOS you need to also install appimage-run and use it to run it, but I recommend just using nix as described below for NixOS.

nix: linux, WSL, probably macOS too?

  • install the nix package manager
  • nix run github:Francesco149/cubecalc-ui
  • you might need to use NixGL on non-nixos distros to fix library errors
  • this builds the calculator from source code

nightly builds

to get the very latest pre-release version (automatically built on every change), you can use these links

host your own web version on NixOS

look at this commit for an example of adding this flake’s overlay and exposing cubecalc through nginx. note that I use declarative-cachix for the binary cache, but it’s not required

navigating the code (for developers)

this is a quite unusual stack. the UI is written in C using nuklear, the cubing calculator is also written in C, and it’s all running in a browser. a lot of the code is generated from the python proof-of-concept of the cubing calc that I initially wrote. I am planning to make a desktop build for this now that I got rid of all python code

emscripten is used to compile the C ui to wasm. see src/build.sh.

to set up the dev environment, install the nix package manager and run nix develop, you will be put into a shell with all the dependencies installed.

to build the project, cd into src and type ./build.sh emcc

you should be able to see the result at http://0.0.0.0:6969/test

for an optimized release build, do ./build.sh emcc release

publish.sh is used to copy the emscripten compiled version to my github.io page

I am trying to get meson to build the emscripten version, so it can be easily deployed with nix

for quick iterative desktop builds, do ./build.sh tcc (fastest build time)

for optimized desktop build,s do ./build.sh clang release

to create a new release, do git tag -a vx.x.x -m "some release notes" and git push --follow-tags

cross compiling to windows (arch linux, mingw)

sudo pacman -Sy git base-devel --needed

git clone https://aur.archlinux.org/trizen.git
cd trizen
makepkg -si
trizen -Sy mingw-w64 mingw-w64-glfw

cd
git clone https://github.com/Francesco149/cubecalc-ui
cd cubecalc-ui/src
meson setup --cross-file x86_64-w64-mingw32.txt -Dbuildtype=release build-mingw
meson compile -C build-mingw

# binary is build-mingw/cubecalc-ui.exe

cross compiling to windows (ubuntu, llvm-mingw)

sudo apt install git wget mingw-w64 ninja-build cmake make python3 autoconf libtool libxinerama-dev libxcursor-dev libxi-dev

# build llvm-mingw toolchain
git clone https://github.com/mstorsjo/llvm-mingw
cd llvm-mingw
./build-all.sh ~/toolchain
sudo ln -s $HOME/toolchain /opt/llvm-mingw
cd

# build glfw with llvm-mingw
git clone https://github.com/glfw/glfw
mkdir glfw/build
cd glfw/build

cmake \
  -DGLFW_BUILD_EXAMPLES=OFF \
  -DGLFW_BUILD_TESTS=OFF \
  -DBUILD_SHARED_LIBS=OFF \
  -DCMAKE_TOOLCHAIN_FILE=~/cubecalc-ui/src/x86_64-w64-llvm-mingw32.cmake \
  -DCMAKE_INSTALL_PREFIX=/opt/llvm-mingw/x86_64-w64-mingw32/ \
  -DCMAKE_BUILD_TYPE=Release \
  ..

sudo make VERBOSE=1 -j$(nproc) install
cd

# build cubecalc-ui with llvm-mingw
git clone https://github.com/Francesco149/cubecalc-ui

PKG_CONFIG_PATH=/opt/llvm-mingw/x86_64-w64-mingw32/lib/pkgconfig \
PKG_CONFIG_LIBDIR=/opt/llvm-mingw/x86_64-w64-mingw32/lib/pkgconfig \
meson setup builddir \
  --prefix ~/cubecalc-mingw \
  -Dbuildtype=release \
  --cross-file x86_64-w64-llvm-mingw32.txt

cd builddir

# workaround for meson bug that is fixed in 0.62.2
sed -i 's/-Wl,--allow-shlib-undefined//g' build.ninja

meson install

# binary is cubecalc-ui.exe in ~/cubecalc-mingw/bin/

compiling on macOS (not tested because I don’t have gpu accel in the vm)

brew install meson pkg-config glfw
git clone https://github.com/Francesco149/cubecalc-ui
cd cubecalc-ui/src
meson setup -Dbuildtype=release build
meson compile -C build
./build/cubecalc-ui