Screen Fades and Audio playback
BlitzMax Forums/BlitzMax Beginners Area/Screen Fades and Audio playback
| ||
Please would someone tell me how to (if its not too hard) 1 - Fade a screen to black 2- Fade a screen to white 3 - start playback of a sound part way through e.g. specify the position Thank you very much. |
| ||
Best way to do a screen fade is draw a rect Setcolor 0,0,0 the full width of the screen with a varying Alpha level. Works like a charm except for a small rendering hit. ;) |
| ||
Agreed. No idea on the sound thing though... |
| ||
you can play "parts" of a file via fmod if that is an option? |
| ||
Thank you very much Grey Alien and MGE - Does the screen fade work for fading to white too? Grisu - I have fmod - but I didn't realise I could play parts of a file. I found a command to Get the current position but not to set it - what command do I need to use? (I will check the documenatation again anyway because I probably missed it) Thank you everyone! |
| ||
Yes, the screen fade thing works for any colour. All you're doing is drawing your screen as usual and then drawing a rectangle of any colour of your choosing on top of it, but varying the alpha level for each frame. As for the sound thing, there is no way of doing this with the built in audio commands. But, as pointed out, you should be able to do this via FMod or any other third party audio module. I haven't used any of these myself, so can't give you the exact command(s) you need to use. |
| ||
As for the sound thing, there is no way of doing this with the built in audio commands. There is...But it ain't pretty. ;o) |
| ||
Here's some code I put in the Code Archives some time ago: It can do fade to black, fade to white, as well as a cross-fade from one image to another. And a somewhat related one: Fade to Monochrome. Converts a full-color image to a black-and-white version, or desaturate it to a shade in between. (Interesting effect, but much more CPU intensive) |
| ||
For setting the position inside a file I use: FSOUND_Stream_SetTime(shorttrailer, Value) |
| ||
Wow! - Thank you to everyone for all the kind help. I have tried your screen-fade routine xlsior - they are very good! You are right - the second routine will be very good for when the game is paused. Grisu and Yan - Thanks for the help with the audio- playback. I will try both methods. |