SDL port for Android SDK/NDK 1.6

Quickly share your Android Code Snippets here...

Re: SDL port for Android SDK/NDK 1.6

Postby Mixu » Mon May 20, 2013 3:27 pm

pelya wrote:It is compiled with codecs, as far as I can tell. could you try running it in emulator, so maybe you'll get stacktrace in ADB logcat? Or create a minimal test app, for me to debug.

When I get home I'll try to make a sample app for you to test.
Mixu
Junior Developer
Junior Developer
 
Posts: 20
Joined: Wed Mar 20, 2013 1:41 am

Top

Re: SDL port for Android SDK/NDK 1.6

Postby protomank » Mon May 20, 2013 4:04 pm

Oh, I tought you only needed to play/sample/mix them.
In this case, it is better to bypass SDL and use the library directly as you said.
protomank
Freshman
Freshman
 
Posts: 5
Joined: Mon Apr 29, 2013 2:18 pm

Re: SDL port for Android SDK/NDK 1.6

Postby pelya » Mon May 20, 2013 7:27 pm

Okay okay, I'v efixed libsndfile and added a test app, now it's late and my head hurts :(
pelya
Master Developer
Master Developer
 
Posts: 323
Joined: Mon Nov 23, 2009 11:31 am

Re: SDL port for Android SDK/NDK 1.6

Postby Mixu » Mon May 20, 2013 7:59 pm

Oh man, you're awesome!!!!
I'll compile my project later and tell you about it!
And remember, I'd like to donate something for you effort! :D

EDIT: OMGOMGOMG!!! It works!!! :D
Tons of thanks dude! I really really thank you so much!
As I said I want to donate, tell me anything about it, please!
Mixu
Junior Developer
Junior Developer
 
Posts: 20
Joined: Wed Mar 20, 2013 1:41 am

Re: SDL port for Android SDK/NDK 1.6

Postby confi » Sun Jul 07, 2013 8:44 am

Hello Pelya,

I am trying to change the resolution of your test-opengl demo to 320x240 by passing this values in setVideoMode, but when I launch the app on my phone the resolution is not changed and I get a cropped display in the bottom left of my phone with the rest of the screen black, at standard resolution.
I put the resize param to 'y' in AndroidAppSetting...

Any idea?
Thanks in advance
confi
Junior Developer
Junior Developer
 
Posts: 15
Joined: Tue Dec 27, 2011 11:12 pm

Re: SDL port for Android SDK/NDK 1.6

Postby pelya » Sun Jul 07, 2013 9:42 am

With OpenGL, there is no screen auto-resizing, because you are working directly with hardware - it's only for software framebuffer modes. This is typically fixed by adding glOrthof() call before running your Opengl code, with coefficients that will resize 320x240 to fullscreen. If you're using on-screen keys, you have to repeat that call after each SDL_OpenGL_Flip()
pelya
Master Developer
Master Developer
 
Posts: 323
Joined: Mon Nov 23, 2009 11:31 am

Top

Re: SDL port for Android SDK/NDK 1.6

Postby awulms » Sun Nov 03, 2013 7:20 pm

Hi Pelya,

I have made a small patch for the build.sh script. The patch makes sure that the build.sh script returns the appropriate status code, regardless of the build options. Without the patch, the build.sh script for example always returns an error status code (exit 1) when it is executed without the '-i' or '-r' option but now it will return the result of the build step when -i and -r options are not specified on the command line.

Sorry, my patch was based on an old version. I'll include new patch here later today

Update: don't know if you still need the patch but here is the updated version:
Code: Select all
diff --git a/build.sh b/build.sh
index 6a6b9ed..37c9d3a 100755
--- a/build.sh
+++ b/build.sh
@@ -92,13 +92,21 @@ cd project && env PATH=$NDKBUILDPATH BUILD_NUM_CPUS=$NCPU nice -n19 ndk-build -j
                        ant debug ; \
                fi ; } && \
        {       if $sign_apk; then cd .. && ./sign.sh && cd project ; else true ; fi ; } && \
-       $install_apk && [ -n "`adb devices | tail -n +2`" ] && \
-       {       cd bin && adb install -r MainActivity-debug.apk | grep 'Failure' && \
-               adb uninstall `grep AppFullName ../../AndroidAppSettings.cfg | sed 's/.*=//'` && adb install -r MainActivity-debug.apk ; true ; } && \
-       $run_apk && { \
-               ActivityName="`grep AppFullName ../../AndroidAppSettings.cfg | sed 's/.*=//'`/.MainActivity" ; \
-               RUN_APK="adb shell am start -n $ActivityName" ; \
-               echo "Running $ActivityName on the USB-connected device:" ; \
-               echo "$RUN_APK" ; \
-               eval $RUN_APK ; \
+       {       if $install_apk ; then \
+                       [ -n "`adb devices | tail -n +2`" ] && \
+                       {       cd bin && adb install -r MainActivity-debug.apk | grep 'Failure' && \
+                               adb uninstall `grep AppFullName ../../AndroidAppSettings.cfg | sed 's/.*=//'` && adb install -r MainActivity-debug.apk ; true ; }
+               else
+                       true
+               fi
+       } && \
+       {       if $run_apk; then \
+                       ActivityName="`grep AppFullName ../../AndroidAppSettings.cfg | sed 's/.*=//'`/.MainActivity" ; \
+                       RUN_APK="adb shell am start -n $ActivityName" ; \
+                       echo "Running $ActivityName on the USB-connected device:" ; \
+                       echo "$RUN_APK" ; \
+                       eval $RUN_APK ; \
+               else
+                       true
+               fi
        }



Cheers,
Alex
Last edited by awulms on Sun Nov 03, 2013 10:56 pm, edited 2 times in total.
awulms
Junior Developer
Junior Developer
 
Posts: 13
Joined: Sun Nov 11, 2012 11:48 am

Re: SDL port for Android SDK/NDK 1.6

Postby pelya » Sun Nov 03, 2013 9:06 pm

I've merged it, thanks.
pelya
Master Developer
Master Developer
 
Posts: 323
Joined: Mon Nov 23, 2009 11:31 am

Re: SDL port for Android SDK/NDK 1.6

Postby awulms » Mon Nov 04, 2013 9:23 pm

I have merged your fix to build.sh into my branch. Its a clean and compact solution. Thanks
awulms
Junior Developer
Junior Developer
 
Posts: 13
Joined: Sun Nov 11, 2012 11:48 am

Re: SDL port for Android SDK/NDK 1.6

Postby dedek » Thu Nov 07, 2013 4:18 pm

Hello Pelya,

Like others I'd like to start with big thanks to you for your great work. I've developed SDL-based games for 9 years and thanks to you we were able to publish our small games in Google Play. It was few months ago. We published 2 apps - one with Admob, another without. Today we wanted to add ads to another App, so I registered game in admob and received Ad unit Id. However in previous game there was Legacy Publisher number which was assigned to AdmobPublisherId and AdmobTestDeviceId in AndroidAppSettings.cfg . When I assign this new number (Ad unit Id) build.sh fails with output:

android-sdk-linux/tools/ant/build.xml:720: The following error occurred while executing this line:
android-sdk-linux/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.

Can we ask for help..?
dedek
Freshman
Freshman
 
Posts: 2
Joined: Thu Nov 07, 2013 3:52 pm

Re: SDL port for Android SDK/NDK 1.6

Postby dedek » Thu Nov 07, 2013 9:22 pm

Heh, I think I found solution: in script ChangeAppSettings.sh is line:

Code: Select all
sed "s/public static String AdmobTestDeviceId = .*/public static String AdmobTestDeviceId = \"$AdmobTestDeviceId\";/" | \


but Ad unit Id contains char "/" which damages script. Temporary I write this number directly with "\" before "/" .
dedek
Freshman
Freshman
 
Posts: 2
Joined: Thu Nov 07, 2013 3:52 pm

Re: SDL port for Android SDK/NDK 1.6

Postby pelya » Thu Nov 07, 2013 10:21 pm

Thanks, I've fixed that.
pelya
Master Developer
Master Developer
 
Posts: 323
Joined: Mon Nov 23, 2009 11:31 am

Top
Previous

Return to Code Snippets for Android

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests