C++ Tiled Tmx Parser

I had a need for a lightweight quick and down to business tmx parser.

For those unfamiliar TMX is the file format used by Tiled.  Tiled is a map editor for tile maps.

The parser at the moment required C++11x but only for one small bit of code which could easily be removed.  The parser is mostly a C library in its usage.  It returns simply an error code and a struct you allocated the memory for containing the entirety of the tmx file.

GitHub Source: libtmx-parser

IOS Launch Image For Landscape Only App for iPhone’s

Nearing the end of an app development cycle it came time to add a splash screen or in IOS SDK terms the LaunchImage.  The app in question is to be locked in landscape mode as per request of the client.  There is no way to specify a launch image for phones in landscape mode.  If you are using Images.xcassets then you have probably already noticed this.

The following is a very quick and simple way to fix this.

  1. To start, you will need to design your launch image using portrait dimensions.  This is very simple, just rotate the image you want to use as a launch image by 90 degrees.
  2. There are several ways to specify your Launch Image and this is not the subject of this document.  For me I used Images.xcassets to setup the Launch Images.  Take your rotated landscape ready portrait dimensions image and place it into the Images.xcassets appropriately.
  3. Re-Enable portrait mode in your Application Settings.  You can do this via YOURAPP-Info.plist or in the project settings.  Make sure if you do it within YOURAPP-Info.plist that portrait mode is first.
  4. Add the following code snippet to AppDelegate.m (change that return value appropriately for your app):

    -(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
    {

    return UIInterfaceOrientationMaskLandscapeRight;

    }

     

  5. Everything is working now however you will notice that the status bar appears in a funny position.  Add the following the YOURAPP-Info.plist:
           “Status bar is initially hidden” -> YES

There you have it.  Landscape mode locked application with a clean launch image.

Enjoy!

Halsafar

MOGA Virtual Keyboard

About a month ago I released Moga VK.  This is an application that can turn a standard MOGA controller into a keyboard.  This is useful for games or applications like my emulators that do not directly support MOGA.  There is an application to do this already called MOGA Universal.  The major difference is it handles the Bluetooth connection on its own, this leads to many benefits but also adds a whole layer of complexity and potential crashes.  MOGA VK uses MOGA Pivot to manage the connection, this guarantees a stable and hassle free connection at a loss to some expert level features.  The app is very easy to use, merely start it up, enable the MOGA IME and it is ready to go for my emulators.

Enjoy!

Download

Eclipse – See All Shortcuts Available

A short post but a big tip.  It seems I have somehow used Eclipse for years without learning this very simple hotkey.

CTLR+SHIFT+L

This will bring up a window showing all available shortcuts given the current context.  There are hundreds of hotkeys available in Eclipse and the only way to make them habit is to find and use them.

Android NDK Standalone GCC 4.6

Not entirely sure when Google started to include the GCC 4.6 sources.  I have first noticed it at the current NDK r8 when running the download-toolchain-sources.sh

You have to compile it yourself.  There are instructions out there but now that google is including it things have gotten easier.  These instructions only apply to Linux.  Specifically tested in Ubuntu 12.04.

  • sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl
  • Download NDK
  • Untar NDK to [SOME_LOCATION], using /opt/ndk/
  • Set NDK_ROOT=/opt/ndk/
  •  ./build/tools/download-toolchain-sources.sh src/
  • Download MPC 0.9
  • Move mpc tar to ./src/mpc/
  • ./build/tools/build-gcc.sh --gmp-version=4.3.2 --mpc-version=0.9 --mpfr-version=2.4.2 --binutils-version=2.21 $(pwd)/src $(pwd) arm-linux-androideabi-4.6
  • ./build/tools/build-gcc.sh --gmp-version=4.3.2 --mpc-version=0.9 --mpfr-version=2.4.2 --binutils-version=2.21 $(pwd)/src $(pwd) x86-4.6
  • ./build/tools/build-gcc.sh --gmp-version=4.3.2 --mpc-version=0.9 --mpfr-version=2.4.2 --binutils-version=2.21 $(pwd)/src $(pwd) mipsel-linux-android-4.6
  • (Patience)

Now you can generate a standalone toolchain for distribution:

  • ./build/tools/make-standalone-toolchain.sh --toolchain=arm-linux-androideabi-4.6 --platform=android-9 --install-dir=/opt/android-9_arm/
  • ./build/tools/make-standalone-toolchain.sh --toolchain=x86-4.6 --platform=android-9 --install-dir=/opt/android-9_x86/
  • ./build/tools/make-standalone-toolchain.sh --toolchain=mipsel-linux-android-4.6 --platform=android-9 --install-dir=/opt/android-9_mips/

Done.

Similar steps can be applied to MAC OS X however setting up the development environment is far more annoying.  I have a feeling this might be near impossible to pull off in Windows without jumping through major hoops.