Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - fivesprites

Pages: 1 ... 3 4 [5] 6 7
Announcements / Android Extras
« on: 2013-Apr-29 »
Hi All,

For those interested in GLBasic Android development, I've put a small compilation of extras into the Code Snippets section:

This allows you to use GPS, Virtual Keyboard and enhanced audio.

Enjoy :)


Hi All,

I've been working away on a few extra Android utilities and I ended up realising it was a bit dumb to have multiple forum posts - especially when it meant getting people to make the same changes every time.  Eww.

So, I've wrapped everything up into one and I've even written some instructions! (see the ReadMe file)

Download and updates here (its now version 3.0 using sdk 22, Android 5.1):

Questions in this thread please (or create your own).

Current Version: AndroidExtras_v1.1
This ONLY supports the new beta v11.414

Changes in v1.1:

- Added new commands to TMusic:
   - getDuration()  - returns the length of the music track currently playing (in milliseconds)
   - getCurrentPosition()  - returns the current position in the playing track (in milliseconds)

- Added support to reload textures on some devices when OpenGL context is lost (please see the sample application for details)

If you want to try out Game Controller support for OUYA/Android then SpaceFractal has implemented the code and integrated it into AndroidExtras.  A beta release is available here:

Current Beta Version: 1.4beta3


I've not had time to try this out, but if it can be confirmed as working then I'll update this post accordingly.  Thanks again SpaceFractal! :)

Please see the ReadMe.txt file inside the zip for installation instructions.

If you have any questions then fire away.


GLBasic - en / Re: 2D Lightning & Kerning
« on: 2013-Apr-29 »
More than welcome :)


GLBasic - en / Re: 2D Lightning & Kerning
« on: 2013-Apr-29 »
For the alpha issue, try using:



I've had the same problem, but found out that it was my app not loading some resources for Windows.  In my case it was some audio files.

Once I'd ensured that all image/sound/music files were loading up correctly then this "No file" error stopped.


Announcements / Re: GLBasic V11 public beta
« on: 2013-Apr-28 »
Both of your test programs work fine for me using V11.322 on Windows 7 (64bit).  All colours show and 0 errors.  Your previous test program shows alternating grey colours as expected.


GLBasic - en / Re: Android Virtual Keyboard
« on: 2013-Apr-27 »
Thanks for testing erico!

It's only landscape as I forced the app into landscape mode.  It should work in portrait if that's what you use.

Will clean the project up and place it in Code Snippets this weekend.


GLBasic - en / Re: Android Virtual Keyboard
« on: 2013-Apr-27 »
Sorry chaps - didn't notice it hadn't been accepted!

I've zipped the APK up this time :)

Think I need to go get more coffee!


GLBasic - en / Android Virtual Keyboard
« on: 2013-Apr-27 »
Hi All,

I've managed to get a dialog window to appear above GLBasic applications to allow text entry.  If you click on the text entry field then the Android Virtual Keyboard will appear :)

I'm currently cleaning up the code and trying to test on a variety of devices.  I'd be grateful if you guys could try out the attached APK and let me know what you think.   Just tap anywhere on screen to start text entry.

Note: The attached APK is also the demo app for the Android GPS stuff I put in the Code Snippets forum last night - so you'll be trying two things at once :)

Any suggestions for improvements, or if you have found a bug, then please let me know.   


//Andy    :bed:

GLBasic - en / Android GPS Location
« on: 2013-Apr-27 »
For those that are interested, I've posted in the Code Snippets forum with details on how to get GPS locations using Android:

There's still lots that could be done with it, but I personally don't have much use for GPS at the moment - I wrote the above to help some people on the #glbasic IRC channel  :nana:

Have fun!


Code Snippets / Android GPS Location
« on: 2013-Apr-27 »
Hi Chaps,

By request of a few of the #glbasic IRC regulars, here's an example of how to obtain GPS information on an Android device.  The information below refers to the V11 beta.  It should be simple enough to copy/paste code into a V10 release of GLB, but if you're finding difficulty then let me know and I'll post up some V10 sources.

First up, if you are using the V11.322 beta and have NOT modified the following files:

Code: (glbasic) [Select]


then you can use the files of the same name as attached and save them to:

Code: (glbasic) [Select]

        C:\Program Files (x86)\GLBasic_v11\Compiler\platform\android\templateproj\AndroidManifest.xml
        C:\Program Files (x86)\GLBasic_v11\Compiler\platform\android\templateproj\src\com\glbasic\test\
        C:\Program Files (x86)\GLBasic_v11\Compiler\platform\android\bin\sdl_main.cpp

then, save the new file to:

Code: (glbasic) [Select]
        C:\Program Files (x86)\GLBasic_v11\Compiler\platform\android\templateproj\src\com\glbasic\test

Extract the GLB test app that and try it out and see the notes below.

However, if you have modified the above files then please compare and adjust accordingly :)

If GPS is disabled on your device then a dialog box will appear asking if you wish to jump to settings to enable it.

Important Note: The output may show 0 or some bizarre location initially.  You must wait for your device to lock onto a satellite, so please be patient before saying this doesn't work :D

Also, this is only a GPS implementation - it does not fall back to a Network Provider if GPS is unavailable. I will add this when I get time.

Assuming all of the above worked, then implementing GPS in your own project is very simple:

- Include the AndroidGPS.gbas file in your project

Use the functions as shown in the test project.

- When you don't need GPS anymore, call: stopGPS()

Apologies if this sounds a little complicated - it's late and I need sleep :)  If you need help then feel free to ask.

One last note: Thanks must go to spacefractal for the initial idea with the GLB/Android JavaCall:


Well, I fixed my issue by using soundpool/mediaplayer for a glb game I'm working on.  It seems that there may be some interest in this until our busy bee Gernot has time to implement all sound fixes (I know he's got sound working on V11 beta again).

So, as soon as my day job has calmed down a little, I'll find some time to extract out the code I used and post it on the Code Snippets forum.  Hopefully be soon, but I'm mega busy :(


Unfortunately, all platforms use a different sound API so it's not so easy to compare one with another.

I ran into a similar problem with Android and it took a while to figure out properly.  I'm away from my development PC at the moment so can only recall from memory!...

Small sounds - if you have one that repeats, try to make it a longer sample if possible (a few footsteps in one sample rather than one).  Also, keep your sounds in a low bitrate, mono format (mono, 16bit pcm, 22.5khz).  Having a few buffers also helps.  I also find that OGG format plays better.

There's an issue with ISSOUNDPLAYING.  If the call to PLAYSOUND returns -1 (quite possible with hammering the sound engine with lots of play requests) then performing ISSOUNDPLAYING with a channel id of -1 will cause an error (something like -7 - out of memory). 

To check for this error, print out the last error message in GLB:


Do that after PLAYSOUND and again after ISSOUNDPLAYING.

You have to check that the channel id from PLAYSOUND is valid before calling ISSOUNDPLAYING.

Repeatedly calling PLAYSOUND can also lead to the channel id being returned as -1.

It's probably a good idea to take a look at the Android log file whilst running your game - you should be able to see if the sound engine is farting or not.  Note: Don't use _Logview.bat to view the logs as this only shows GLBasic specific log output - you need to see everything!

Instead, in a command tool, cd to:

C:\Program Files (x86)\GLBasic_v11\Compiler\platform\android\android-sdk-windows\platform-tools

and then run:

adb shell logcat


Announcements / Re: GLBasic V11 public beta
« on: 2013-Apr-17 »
Probably not a good idea to use v11.322 (latest beta) if you need sound on Android - it doesn't work at all.   

I use V11 beta as it fixes lots of bugs found in V10 (and performance seems to be a little better too).  However, having no sound, I had to write an extension to SDLActivity to support native audio (soundpools/mediaplayer).  It does work nicely, but I'd rather not do it this way - so I'm looking forward to better audio support in GLB.

Announcements / Re: GLBasic V11 public beta
« on: 2013-Apr-16 »
I'd happily share the code with Gernot, but I think his plan to use SDL for sound across all platforms is better than splicing in platform specific fixes.  I'm sure he's on the case :)

Pages: 1 ... 3 4 [5] 6 7