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 pelya » Sat Aug 21, 2010 6:29 pm

Published Ur-Quan Masters game.

Edit: currently I'm looking for a designer who will draw a nicer overlay buttons - just give me the images, I'll do the rest.
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 DangerMouse » Mon Aug 23, 2010 2:15 am

Can I put the 3d0 files and remixes in there somewhere and be able to get support for them? I'll see what I can come up with as far as control layer image. Any specific image size needed? ie screen size? or individual button sizes?
DangerMouse
Developer
Developer
 
Posts: 25
Joined: Mon Aug 23, 2010 2:11 am

Re: SDL port for Android SDK/NDK 1.6

Postby pelya » Mon Aug 23, 2010 9:07 am

DangerMouse wrote:Can I put the 3d0 files and remixes in there somewhere and be able to get support for them? I'll see what I can come up with as far as control layer image. Any specific image size needed? ie screen size? or individual button sizes?

I'll add 3DO music and other files as optional download, when I'll get familiar with UQM package system.
I just took the content from project SVN and zipped it as-is - it unzips to the directory "/scdard/app-data/com.sourceforge.sc2/" on your phone (if you've selected "Install to SDcard" option), you can try to unzip 3DO music package there and maybe the game will load it.

You may create buttons of any size you want - there is option for several on-screen keyboard sizes, I'll draw your images resized to the same position where currently my poorly drawn arrows and stars are (or propose me a better button layout, I think I'll add layout editor to my config dialog so users will stop whining about bad controls)

You should give me 2 versions of images - normal and pressed state. If you'll draw just one image I'll be changing transparency value for it to show that it's pressed (this is also needed if you're using accelerometer, to show when you can stop tilting your phone).

Total amount of buttons my on-screen keyboard supports is 7, so I would be glad if you'd draw all 7 images (not necessarily stars and asterisks, just some pictograms so user will understand where to click). UQM uses just 2 buttons, OpenTyrian uses 4, but I might port someday a game that will require all 7 or even more.

Also, the main button (the asterisk symbol) supports auto-fire, so it's actually 3-state button. That feature is of use mainly to OpenTyrian, however I think it won't hurt for UQM too. To make it easier for users to find that auto-fire is actually present I've added small animation to the main button, maybe you can come up with better animation, like some parts of button shrinking or extending, or I can just remove the animation and rely on my help message in config popup.
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 DangerMouse » Mon Aug 23, 2010 10:12 am

I'll see what I can come up with. I read the the natural resolution for the Droid X is 854 x 480, but I realize that it's android specific and not droid x specific. Would be cool if it could use vertex images for scaling to different resolutions. Oh well. What I was thinking is that the alpha of the button could be configured by the user in options or something.. so a user can specify how transparent the button images are... ...think that would be do-able?
DangerMouse
Developer
Developer
 
Posts: 25
Joined: Mon Aug 23, 2010 2:11 am

Re: SDL port for Android SDK/NDK 1.6

Postby pelya » Mon Aug 23, 2010 10:37 am

Yup, I can add yet another popup dialog asking for transparency level to the 7 that already exist there (don't you want to throw your phone to the wall when click through all of them just to play the game? Try selecting Trackball and then On-screen keyboard + Accelerometer to get them all shown).
You can see the example of vertex images in the current release :P I even have an editor for my on-screen keyboard font
BTW let's keep discussion here, I don'want to answer on the both forums.
Edit: I'll try to ask my friend to draw the buttons, I'll include all versions if there will be several ones (and also leave my yellow arrows, I've spent halfhour drawing them! :D )
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 DangerMouse » Mon Aug 23, 2010 11:33 am

I've drawn this one as a dpad, i named it droid-pad. :)
Image
DangerMouse
Developer
Developer
 
Posts: 25
Joined: Mon Aug 23, 2010 2:11 am

Top

Re: SDL port for Android SDK/NDK 1.6

Postby DangerMouse » Mon Aug 23, 2010 11:42 am

Here's what it looks like as a 100x100 instead of my initial 600x600, but I could make it any size you want without distortion or loss of quality.
Image
DangerMouse
Developer
Developer
 
Posts: 25
Joined: Mon Aug 23, 2010 2:11 am

Re: SDL port for Android SDK/NDK 1.6

Postby pelya » Mon Aug 23, 2010 11:57 am

Haha, I like the theme. Waiting for buttons, I think I'll manage to make new release with your artwork this Friday.
Also I suggest to draw another darker version - the green theme is okay for OpenTyrian, for UQM I think it will stand out in SuperMelee.
Oh, and plz make some "pressed" version of buttons (either 8 different images for each direction, or split the whole image to 4 subimages, as you wish. Mmm, droid eyes may also follow the direction you've pressed ;) ).
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 DangerMouse » Mon Aug 23, 2010 12:17 pm

Preliminary Button Layout. Buttons could have transparency ranges, also will make the highlighted changes if you like. And if you can make the buttons be move able for people who may like them in different areas... ie, left handed people or just people that prefer their own layout. I put the little droid guy up at the top left as a menu for your options. :)
Image
DangerMouse
Developer
Developer
 
Posts: 25
Joined: Mon Aug 23, 2010 2:11 am

Re: SDL port for Android SDK/NDK 1.6

Postby DangerMouse » Mon Aug 23, 2010 12:21 pm

Some reason it cut off the right side of the image. but basically i had 6 buttons at the right side.
Image Don't use this image as it's a compressed jpg.. just so you can see what was missing.
DangerMouse
Developer
Developer
 
Posts: 25
Joined: Mon Aug 23, 2010 2:11 am

Re: SDL port for Android SDK/NDK 1.6

Postby DangerMouse » Mon Aug 23, 2010 12:50 pm

Fiddled around with it.. not liking it as much... but it's different. Could go with grey-ish metal-style buttons.
Image
DangerMouse
Developer
Developer
 
Posts: 25
Joined: Mon Aug 23, 2010 2:11 am

Re: SDL port for Android SDK/NDK 1.6

Postby Dark_Neo » Mon Aug 23, 2010 1:09 pm

Hi there,
In the SDL port readme it says the application must support RGB565, does it not support RGB8888 then? What's causing this limitation?

I'm looking into porting TwinEngine (an open source engine for the game Little Big Adventure, link: http://sourceforge.net/projects/twin-e/), yet as far as I can see it's using 32 bit colours in the SDL setup code it's got. And I've just looked through it's rendering code and it also seems to be using 32 bit colours there.
Dark_Neo
Freshman
Freshman
 
Posts: 3
Joined: Mon Aug 23, 2010 12:59 pm

Re: SDL port for Android SDK/NDK 1.6

Postby DangerMouse » Mon Aug 23, 2010 1:11 pm

Not liking the blue much since it's really not droid theme related.. so I went on a different path. here's what it looks like with default, and then the up dpad button depressed.
Normal Resolution
Image
Zoomed Out
Image
Normal Resolution UP pressed
Image
Zoomed Out
Image
DangerMouse
Developer
Developer
 
Posts: 25
Joined: Mon Aug 23, 2010 2:11 am

Re: SDL port for Android SDK/NDK 1.6

Postby kurosu » Mon Aug 23, 2010 1:19 pm

I'm not completely in synch with your code, but in case you missed it, the manifest needs an addition to properly ignore screen orientation changes. It is summed up in this post, but basically, android:configChanges="keyboardHidden" is necessary.
kurosu
Experienced Developer
Experienced Developer
 
Posts: 94
Joined: Sat Jun 12, 2010 1:56 pm

Re: SDL port for Android SDK/NDK 1.6

Postby pelya » Mon Aug 23, 2010 3:53 pm

kurosu wrote:I'm not completely in synch with your code, but in case you missed it, the manifest needs an addition to properly ignore screen orientation changes. It is summed up in this post, but basically, android:configChanges="keyboardHidden" is necessary.


Thanks for the hint - I'll update my code. After I'll finish with keyboard I want to finally fix that crash when you're pressing Home key, it will also fix th ecrash when orientation changes, but till then I'll use your method (it seems not that complicated to me now, after all the work done).

DangerMouse wrote:Not liking the blue much since it's really not droid theme related.. so I went on a different path. here's what it looks like with default, and then the up dpad button depressed.


Looks nice as for me. Will buttons have some images, or they will be just plain green?
BTW I think I'll add auto-fire mode for the second button too - it's useful in UQM when controlling Pkunk ship.
Also you can add per-pixel alpha transparency, or short on-press animation, if your artist' soul desires that :)

Dark_Neo wrote:Hi there,
In the SDL port readme it says the application must support RGB565, does it not support RGB8888 then? What's causing this limitation?

I'm looking into porting TwinEngine (an open source engine for the game Little Big Adventure, link: http://sourceforge.net/projects/twin-e/), yet as far as I can see it's using 32 bit colours in the SDL setup code it's got. And I've just looked through it's rendering code and it also seems to be using 32 bit colours there.


You can use 32-bit surfaces in SW mode, however you should then use screen resolution not more than 320x240, otherwise your FPS will be awful. If you want it to render fast use RGB565 format + HWSURFACE fllag to SDL_SetVideoMode() + all surfaces that are blitted to video surface should also have HWSURFACE flag (you may use RGB4444 for per-pixel transparency).
That depends on a game - with some games it's enough to change "32" to "16" and it will work, with other games that do lot of pixel access operations it's almost impossible.
Edit: I've browsed through the code, and it seems to me that TwinEngine draws everything to 320x200x8 internal buffer, then resizes and renders it to 640x480x32 video surface. So just change constants across the code, it should work. With 320x200 SW video surface it renders with okay speed (both OpenTyrian and UQM render that way, only Alien Blaster is truly HW accelerated)
pelya
Master Developer
Master Developer
 
Posts: 323
Joined: Mon Nov 23, 2009 11:31 am

Top
PreviousNext

Return to Code Snippets for Android

Who is online

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