Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
127 lines (122 sloc) 6.05 KB

libcross2d

  • a c++ cross platform 2d graphic, input, audio and config library
  • run on Windows, Linux, Nintendo Switch, Nintendo 3DS and Sony PS Vita
  • draw textures, rectangles, circles, texts (TrueType) and more
  • basic tween engine (move, rotate, scale, color)
  • clock/timer classes
  • configuration file handling
  • pack your application (zip) for release on any target, including resources (data/common)
  • quickly prototype your application on desktop (Linux and Windows)
  • use hardware acceleration on Linux, Windows, Switch, 3DS and PS Vita
  • use some of the great sfml library stuff (fonts, shapes, matrices)
  • use tweeny for the (minimal) tween engine
  • use some of the great libretro shaders (Linux, Switch)
  • use some citro2d code for the 3ds renderer
  • use some vita2d code for the vita renderer
  • use libconfig for the configuration classes
  • preliminary developed for my own use, still a work in progress

A few cross2d examples

  • texture: drawing a simple texture...
  • font: drawing some text
  • input: handle inputs (gamepads, keyboard on linux)
  • fps: all about timing (fps, time, delta)
  • config: handle a configuration file
  • configbox: draw a configuration to screen
  • filer: a file manager example
  • crazy: some tweeny stuff...

Made with cross2d

Build and run...

  1. On Linux For Linux
  2. On Linux For Nintendo Switch
  3. On Linux For Nintendo 3DS
  4. On Linux For Sony Ps Vita
  5. On Windows For Windows

On Linux (For Linux)

  • Install dependencies
    sudo apt-get install build-essential cmake git libsdl2-dev libfreetype6-dev libglm-dev  
    
  • Then
    git clone --recursive https://github.com/Cpasjuste/libcross2d-examples.git
    cd libcross2d-examples
    mkdir cmake-build && cd cmake-build
    cmake -DBUILD_LINUX=1 ../
    make texture.elf
    cd examples/texture && ./texture.elf
    

On Linux (For Nintendo Switch)

  • Install dependencies
    wget https://github.com/devkitPro/pacman/releases/download/devkitpro-pacman-1.0.1/devkitpro-pacman.deb  
    sudo dpkg -i devkitpro-pacman.deb
    sudo dkp-pacman -S switch-dev switch-bzip2 switch-freetype switch-glad switch-glm switch-libdrm_nouveau switch-libpng switch-mesa switch-pkg-config switch-sdl2 switch-zlib  
    
  • Then
    git clone --recursive https://github.com/Cpasjuste/libcross2d-examples.git
    cd libcross2d-examples  
    mkdir cmake-build && cd cmake-build  
    export DEVKITPRO=/opt/devkitpro  
    cmake -DBUILD_SWITCH=1 ../  
    make texture.nro  
    make texture_switch_release.zip  
    

On Linux (For Nintendo 3DS)

  • Install dependencies
    wget https://github.com/devkitPro/pacman/releases/download/devkitpro-pacman-1.0.1/devkitpro-pacman.deb  
    sudo dpkg -i devkitpro-pacman.deb  
    sudo dkp-pacman -S 3ds-dev 3ds-zlib 3ds-freetype 3ds-libpng 3ds-pkg-config  
    
  • Then
    git clone --recursive https://github.com/Cpasjuste/libcross2d-examples.git
    cd libcross2d-examples  
    mkdir cmake-build && cd cmake-build  
    export DEVKITPRO=/opt/devkitpro  
    cmake -DBUILD_3DS=1 ../  
    make texture.3dsx  
    make texture_3ds_release.zip  
    

On Linux (For Sony Ps Vita)

  • Install dependencies
    git clone https://github.com/vitasdk/vdpm
    cd vdpm
    ./bootstrap-vitasdk.sh
    export VITASDK=/usr/local/vitasdk # define $VITASDK if you haven't already
    export PATH=$VITASDK/bin:$PATH # add vitasdk tool to $PATH if you haven't already
    ./install-all.sh
    
  • Then
    git clone --recursive https://github.com/Cpasjuste/libcross2d-examples.git
    cd libcross2d-examples
    mkdir cmake-build && cd cmake-build
    export VITASDK=/usr/local/vitasdk
    cmake -DBUILD_VITA=1 ../
    make texture.vpk
    make texture_vita_release.zip
    

On Windows (For Windows)

  • Install dependencies (from a working devkitPro installation, or preferably a mingw-w64 installation)
    echo -e "[mingw64]\nInclude = /etc/pacman.d/mirrorlist.mingw64" >> /etc/pacman.conf
    pacman -Syuu
    pacman -Sy bash git mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake mingw-w64-x86_64-SDL2 mingw-w64-x86_64-freetype mingw-w64-x86_64-glm mingw-w64-x86_64-glew mingw-w64-x86_64-mesa
    
  • Then
    C:\devkitPro\msys2> .\msys2_shell.bat -mingw64
    
    git clone --recursive https://github.com/Cpasjuste/libcross2d-examples.git
    cd libcross2d-examples
    mkdir cmake-build && cd cmake-build
    cmake -G "MSYS Makefiles" -DBUILD_WINDOWS=1 ../
    make texture.elf
    cd examples/texture && ./texture.elf