Skip to content
ickard edited this page Nov 13, 2011 · 19 revisions

Welcome to the gdt wiki!

Introduction

gdt is a C library which, together with OpenGL ES 2.0, is meant to provide a cross-platform (mainly iOS/Android currently) API for making games for the supported platforms.

With gdt you should be able to just target the simple gdt.h C API and don't have to bother with all the platform-specific "glue" code.

Building gdt-based projects

There are currently no obviously best solutions to build gdt-based projects. Below are some suggestions how one might go about building gdt-based projects.

iOS

Create a new iOS project in Xcode. There is no need for interface (xib/nib) files.

I think you need these frameworks: AVFoundation, OpenGLES, QuartzCore, UIKit, Foundation, CoreGraphics.

Suggested way to add gdt source files:

  • simple_example.c
  • gdt/GdtAppDelegate.{m/h}
  • gdt/GdtView.{m/h}
  • gdt/gdt_common.c
  • gdt/gdt.h
  • gdt/gdt_gles2.h
  • gdt/gdt_ios.h
  • gdt/main.m

Android

I use Eclipse with http://mobilepearls.com/labs/ndk-builder-in-eclipse/ for automatic NDK builds.

Make an android 2.2 project (API level 8) and add the GdtActivity.java to src/gdt/GdtActivity.java.

You need an Android.mk ndk-build makefile, maybe it could look something like this:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := native

LOCAL_CFLAGS := -DANDROID_NDK -DDISABLE_IMPORTGL

LOCAL_SRC_FILES := gdt/gdt_android.c gdt/gdt_common.c simple_example.c

LOCAL_LDLIBS := -lGLESv2 -ldl -llog

include $(BUILD_SHARED_LIBRARY)

Example jni folder structure:

  • gdt/gdt_android.c
  • gdt/gdt_common.c
  • gdt/gdt.h
  • gdt/gdt_gles2.h
  • gdt/gdt_android.h
  • simple_example.c

C++ Tip (not gdt-specific)

If you need proper C++ support with the ndk use something like the following Application.mk:

APP_CPPFLAGS += -frtti -fexceptions

APP_STL := gnustl_static

Todo

High priority

  • Replace the current touch API with a multitouch-capable API
  • Extend audioplayer with more functions
  • Think through and fix screen orientation
  • Implement text input on android fully
  • General polish; make sure we are not leaking memory or ignoring errors etc

Longer term possible todos

  • More input APIs (gyroscope etc)
  • Make sure APIs are as general and portable as possible. For instance, the current storage dir path/ cache dir path setup may not be portable to other platforms
  • More platforms (ideas: Chrome NaCl, Windows 8 WinRT)
  • Some kind of build system
  • Maybe use NativeActivity on the android backend