Page 1 of 2

Help with Text and Sound

Posted: Fri Dec 20, 2013 10:08 pm
by jonaspm
Hello ZGE community! :D

Please help me with those questions:

¿Is there a way to import .wav or .ogg files to Music component?

¿Why RenderText doesn't work on Android 4.3? The text displays very well under Windows but running it on Android shows nothing.


Thanks in advance! :D

Re: Help with Text and Sound

Posted: Fri Dec 20, 2013 10:58 pm
by Kjell
Hi jonaspm,
jonaspm wrote:Is there a way to import .wav or .ogg files to Music component?
Nope, you need to use a external library to play a .mp3 or .ogg file.
jonaspm wrote:Why RenderText doesn't work on Android 4.3? The text displays very well under Windows but running it on Android shows nothing.
Are you using the built-in font?

K

Posted: Sat Dec 21, 2013 9:11 am
by jonaspm
Could you please refer me to that library? :) Thank you!


Yes, i am using the built-in font.

Posted: Sat Dec 21, 2013 11:41 am
by Rado1
jonaspm wrote:Could you please refer me to that library?
The simplest way to play music is to use either Sunvox or Bass libraries. Both working on Windows and Android . ZGE contains adaptors to both libs; go to the OnLoaded section, activate context menu Add from library.../External libraris and select one of them.
jonaspm wrote:Yes, i am using the built-in font.
Instead, you should use another bitmap font explicitly defined. The easiest possibility is to use the Dina font from library available in ZGE (use context menu in the project browser view Add from library.../Fonts/Dina). If needed, I'm creating own fonts with Codehead's Bitmap Font Generator (CBFG). There are some more tools for rasterization fonts but this one is the best regarding to the features I need.

Posted: Sat Dec 21, 2013 12:30 pm
by Kjell
Hi guys,

Keep in mind that Bass is only free for non-commercial use. And although i think SunVox is great, you can't play MP3 / Ogg files with it. Anyway, most operating systems come with MP3 / Ogg playback capabilities, so you could simply use that ( a Windows example is available here ). Otherwise, free alternatives to Bass include Audiere and OpenAL.

And Rado1 is right, the build-in font is only available on Windows ;)

K

Posted: Sat Dec 21, 2013 8:38 pm
by jonaspm
Thank you both, i really apreciate your words :)

BTW, i have another question, if you could help me i would be really happy :D

I want App.Camera to follow a model even when rotating, i mean, keep the camera away from the model X of radius and rotate through that radius as the model rotates...

here is a small screenshot of what i am saying xD

Also, i have problems with wireframe... the player's mesh shouldn't show as wireframe but the entire faces, the floor is the wireframe... not the ship... sometimes the ship turns "normal" and then "wireframe" when crossing the "0" value on Z
VIDEO:
http://www.2shared.com/video/r1CziNrX/V ... 33245.html

thanks in advance!

Posted: Sat Dec 21, 2013 9:43 pm
by Kjell
Hi jonaspm,
jonaspm wrote:I want App.Camera to follow a model even when rotating
Not exactly sure what you're after, but attached is a example. Use left mouse button to move forward.
jonaspm wrote:i have problems with wireframe
You forgot to create & use a separate Material for your ship ;)

K

Posted: Sun Dec 22, 2013 4:12 am
by jonaspm
THANK YOU KJELL! that is exactly what i was trying to achieve! THANKS! :D

Posted: Sun Dec 22, 2013 7:26 am
by jonaspm
I got another question... sorry for bothering you :S


¿Is there a way to keep an image or a sprite always in front of the Camera? Just like text does, because i'm having trouble creating an ingame-GUI in this game :oops:

Thanks in advance guys! you are amazing!

Posted: Sun Dec 22, 2013 12:28 pm
by Kjell
Hi jonaspm,
jonaspm wrote:Is there a way to keep an image or a sprite always in front of the Camera? Just like text does, because i'm having trouble creating an ingame-GUI in this game.
Unfortunately there's no build-in component specifically for that* However, you could simply use the RenderText component for GUI elements as well ( just use a Bitmap containing GUI elements instead of a Font ). Alternatively you can use the setMatrix function to switch to a proper 2D projection. Attached is a example.

*Well, technically there is ( the Camera component ), but you can't switch Cameras mid-rendering. And you don't want to go multi-pass for these kind of situations either.

K

Posted: Mon Dec 23, 2013 5:51 am
by jonaspm
Oh! Tank you Kjell!

With the font solution, can i interact with it? Like clicking on it and changing AppState or something like that? Thanks! :)

Posted: Mon Dec 23, 2013 1:46 pm
by Kjell
Hi jonaspm,
jonaspm wrote:With the font solution, can i interact with it? Like clicking on it and changing AppState or something like that?
Not really no. You can't ( comfortably ) use collision with the RenderText component. You want to use the setMatrix solution + individual Models for elements you want to interact with.

Attached is a simple example how to use make clickable buttons .. in case you were going to ask that after this ;)

K

Posted: Mon Dec 23, 2013 3:18 pm
by Rado1
Kjell, just one detail - your Buttons project throws syntax error; so instead of

Code: Select all

return Button[0] && !Button[1];
should be written, for example

Code: Select all

return Button[0]!=0 && Button[1]==0;
This is due to ZGE's inability (bug) to convert from byte.

Posted: Mon Dec 23, 2013 3:22 pm
by Kjell
Hi Rado1,

This bug was recently fixed ( on November 15th ), make sure to get the latest Beta ;)

K

Posted: Mon Dec 23, 2013 3:40 pm
by Rado1
Kjell wrote:This bug was recently fixed ( on November 15th ), make sure to get the latest Beta ;)
Aha, I was not aware of this update. I did not catch any mention at the forum. Thanks Kjell for letting know.