Jorhlok

Me, my opinion, and things I do.

Monthly Archives: July 2013

From *nix to Android with SDL2 and SDL_image. Using the Command Line of Course!

Let me paint a picture;

My development environment on linux consists of a text editor with code highlighting (GEdit in my case), GCC/G++, and make. Development goes like this for me: Tickatickatype, Ctrl-S, “make ; ./test” . Using a basic handwritten Makefile isn’t that hard for testing a small project. I make it automate things like adding flags and defines from the command line. In the case of Android, I have it copy my source into the android project, compile it, pack it in an apk, and then copy the apk to dropbox so I can test it on my device.

If you use cygwin on windows with GCC/G++ you can more or less follow along as long as you promise to use your best judgment.

I’ve got three links that I used to figure out how to hack a function android project together with the latest SDL2 source.

Read more of this post

Advertisements

My (Poor) Code Now Runs (Poorly) on Android

poorandroid

Dell Latitude E6400. Samsung Captivate. Pengpod 700. Yes the screen is that bad on the pengpod. Do not get a pengpod.

I had the adventure of flailing the Android NDK at SDL2 and SDL_image today. I had written some code to understand tiles inside of png images, to sort sprites with a z value, and to draw evenly spaced tile background. I wrote a small demo of a ghost of the graveyard security guard (no collision detection, yet, lol). I had it randomly generate a field of 128×128 tiles with grass and graves, but it ran so slowly on my phone (didn’t test that on my tablet). My code has glaring optimization issues, but it ran okay on my laptop. Removing the background or making it 32×32 (possibly larger) will make it run okay. My code doesn’t cull tiles that are off-screen (bad, I know, there’s worse you don’t know in my code). Detecting a touch input at all worked on the first try.

Aside from my code that’s the same on my computer and android, getting the android project together took hours out of the day today. I’ll post a tutorial tomorrow. There’s alot of parts to an android project that you need to understand if you want to get anything to work at all.

Personally, porting to java/android will probably be the best option. It makes your app a whole lot leaner and probably faster for what I’m doing with code.