Skip to content

fleimeris/libcross2d-examples

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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...
  • physics: basic box2d support

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 libconfig-dev libphysfs-dev
    
  • Then
    git clone --recursive https://github.com/Cpasjuste/libcross2d-examples.git
    cd libcross2d-examples
    mkdir cmake-build && cd cmake-build
    cmake -G "Unix Makefiles" -DPLATFORM_LINUX=ON -DOPTION_BOX2D=ON -DCMAKE_BUILD_TYPE=Release ../
    make texture
    cd examples/texture && ./texture
    

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-portlibs dkp-toolchain-vars switch-cmake devkita64-cmake switch-glad switch-glm
    
  • Then
    git clone --recursive https://github.com/Cpasjuste/libcross2d-examples.git
    cd libcross2d-examples  
    mkdir cmake-build && cd cmake-build  
    source /opt/devkitpro/switchvars.sh  
    aarch64-none-elf-cmake -G "Unix Makefiles" -DPLATFORM_SWITCH=ON -DCMAKE_BUILD_TYPE=Release ..
    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 -G "Unix Makefiles" -DPLATFORM_3DS=ON -DCMAKE_BUILD_TYPE=Release ../
    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 -G "Unix Makefiles" -DPLATFORM_VITA=ON -DCMAKE_BUILD_TYPE=Release ../
    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 mingw-w64-x86_64-libconfig mingw-w64-x86_64-physfs
    
  • 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" -DPLATFORM_WINDOWS=ON -DCMAKE_BUILD_TYPE=Release ../
    make texture
    cd examples/texture && ./texture
    

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • CMake 100.0%