Help with Text and Sound

All topics about ZGameEditor goes here.

Moderator: Moderators

User avatar
jonaspm
Posts: 89
Joined: Fri Jul 06, 2012 3:51 pm
Contact:

Help with Text and Sound

Post 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
User avatar
Kjell
Posts: 1883
Joined: Sat Feb 23, 2008 11:15 pm

Re: Help with Text and Sound

Post 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
User avatar
jonaspm
Posts: 89
Joined: Fri Jul 06, 2012 3:51 pm
Contact:

Post by jonaspm »

Could you please refer me to that library? :) Thank you!


Yes, i am using the built-in font.
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post 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.
User avatar
Kjell
Posts: 1883
Joined: Sat Feb 23, 2008 11:15 pm

Post 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
User avatar
jonaspm
Posts: 89
Joined: Fri Jul 06, 2012 3:51 pm
Contact:

Post 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!
Attachments
NEWars.zgeproj
project file
(242.96 KiB) Downloaded 454 times
"normal view"
"normal view"
zge.png (26.39 KiB) Viewed 15299 times
"not normal view" (wireframe)
"not normal view" (wireframe)
zge2.png (35.41 KiB) Viewed 15299 times
User avatar
Kjell
Posts: 1883
Joined: Sat Feb 23, 2008 11:15 pm

Post 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
Attachments
Ship.zgeproj
(2.3 KiB) Downloaded 477 times
User avatar
jonaspm
Posts: 89
Joined: Fri Jul 06, 2012 3:51 pm
Contact:

Post by jonaspm »

THANK YOU KJELL! that is exactly what i was trying to achieve! THANKS! :D
User avatar
jonaspm
Posts: 89
Joined: Fri Jul 06, 2012 3:51 pm
Contact:

Post 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!
User avatar
Kjell
Posts: 1883
Joined: Sat Feb 23, 2008 11:15 pm

Post 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
Attachments
Layer2D.zgeproj
This is a updated version of the example i posted last year ( before setMatrix was available ).
(24.48 KiB) Downloaded 492 times
User avatar
jonaspm
Posts: 89
Joined: Fri Jul 06, 2012 3:51 pm
Contact:

Post 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! :)
User avatar
Kjell
Posts: 1883
Joined: Sat Feb 23, 2008 11:15 pm

Post 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
Attachments
Buttons.zgeproj
(2.76 KiB) Downloaded 579 times
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post 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.
User avatar
Kjell
Posts: 1883
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hi Rado1,

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

K
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post 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.
Post Reply