Jorhlok

Me, my opinion, and things I do.

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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: