Skip to content

NoiSek/libgdx-cpp

 
 

Repository files navigation

Libgdx-cpp: libgdx C++ port

Build guide

Linux

These are the requirements to compile libgdx-cpp over linux(ubuntu):

  • cmake
  • libsdl
  • libgles1-mesa-dev
  • libgles2-mesa-dev
  • libopenal-dev

Step-by-step (Ohhh baby)

  1. create a build dir somewhere on your home partition
  2. cmake PATH-TO-CHECKED-OUT-LIBGDXCPP
  3. ccmake .
  4. Edit your configuration as needed
  5. make

Libraries will be generated under the lib folder, binaries under the bin folder

Running the tests

  1. Create/Symlink the data folder to the assets directory
  2. Execute the desired test

Android

LibgdxCpp uses the cmake toolset from android-cmake. Sadly, currently cmake doesn't support multiple toolsets under the same build directory, so you'll have to create another build folder.

Requirements:

  • Android r5b or newer (platform9)
  • Eclipse + DDMS (to actually build the apk's)

Step-by-step guide

  1. create a build dir somewhere on your home partition
  2. cmake -DCMAKE_TOOLCHAIN_FILE=PATH-TO-CLONED-LIBGDXCPP/cmake/android.toolchain.cmake PATH-TO-CLONED-LIBGDXCPP
  3. ccmake .
  4. Edit your configuration as needed
  5. make

Libraries will be generated under the lib folder, binaries under the bin folder

Running the tests

  1. Import the Eclipse project under PATH-TO-CLONED-LIBGDXCPP/src/backends/gdx-cpp-backend-android/android-support
  2. Import the Eclipse project under PATH-TO-CLONED-LIBGDXCPP/src/test/backend/android (I'll call it test-project from now)
  3. Under Eclipse, edit the test project to point to the android support library (witch you imported on step 1)
  4. Under the test-project/libs you'll have to symlink the required shared libraries to make the test run.If you compiled the backend to armeabi it will be test-project/libs/armeabi. If armeabi-v7a it will be under test-project/libs/armeabi-v7a. Make sure you symlinked all requirements (like libgdx-cpp, libgdx-box2d, libBox2D, and so on)
  5. Under Eclipse, change the initializeWithSharedLib method to the desired library without the lib prefix on it.
  6. Run the project and pray for the Android gods

Running the tests (Eclipse-less way)

  1. cd to PATH-TO-CLONED-LIBGDXCPP/src/backends/gdx-cpp-backend-android/android-support
  2. Under the test-project/libs you'll have to symlink the required shared libraries to make the test run.If you compiled the backend to armeabi it will be test-project/libs/armeabi. If armeabi-v7a it will be under test-project/libs/armeabi-v7a. Make sure you symlinked all requirements (like libgdx-cpp, libgdx-box2d, libBox2D, and so on)
  3. Open LibGdxCppTestActivity.java (under src), change the initializeWithSharedLib method to the desired library without the lib prefix on it.
  4. ant install

Differences from libgdx

  • The texture class constructors that received an managed texture data had to be changed to static constructors. This is because C++ contruction blocks us to use shared_pointers, so we had to make it two-phase-like. So instead of calling the constructor, you'll have to call, for example:

    Texture::fromFile()

with the same parameters that you would expect on the constructor.

  • The pixmap class was converted to an interface

Analogically, the calls to create an PixMap now are:

Pixmap::newFromFile()
Pixmap::newFromPixmap()
Pixmap::newFromRect()
  • The Pixmap class has turned into an interface. This had to be done because we can have different pixmap backends (currently we have Svg and Gdx2d). The gdx_cpp::Graphics interface now have to handle the TextureData and Pixmap resolution and creation. This was made to decouple the texture class from determining how to load and create TextureData (etc1, wich is not supported in all platforms per example).

What's working

  • The linux backend has file,input and audio working
  • The android backend has input, file and audio working
  • SVG support through AntiGrainGeometry

What has to be done

  • Backend polishing. Seriously, it's working, but there is a lot of stuff that is ugly and in a haste.
  • iOs support
  • GLEs 2. Check if it's working
  • etc

About

libgdx-cpp is a port of the awesome java libgdx 2d and 3d engine for C++ so we can run it on desktop, android and ios (hopefully)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published