Welcome, Guest. Please login or register. Did you miss your activation email?

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 - jorgerosa

Pages: [1]
1
SFML projects / Unknown Invaders (Simple-Full-Free-Game)
« on: January 18, 2019, 01:50:39 am »
Hello all

Last week... I was going for SFML library (first try for me), and...
The learning experience was so fast and so great, that I had the idea to make a full game.
Simple and basic... but its a game! :p

Unknown Invaders - DOWNLOAD: https://sourceforge.net/projects/unknown-invaders-game

HAVE FUN !!!...

Thankyou for all SFML developers, for your hard work!
This library is really fantastic, I think that I will not change for any other one, any time soon...
I´m really still  impressed!

2
Audio / Click in a button, then (re)loads a music
« on: March 26, 2011, 11:45:43 pm »
Code: [Select]

   <SFML/Audio.hpp>

   // Global vars:
   sf::SoundBuffer buffer;
   sf::Sound sound;
   float sduration = 0.0;
   float sposition = 0.0;


   // Function that loads (and reloads) and play music:
   int playThisMusic(std::string musicPath)
   {
   sound = sf::Sound();
   buffer.LoadFromFile(musicPath.c_str());
   sound.SetBuffer(buffer);
   sound.Play();
   }


   // Main loop:
   int main()
   {
   // MY ISSUE ####### 1 #######
   // Retrieve music current time and total length:
   sduration = buffer.GetDuration();
   sposition = sound.GetPlayingOffset();

   float milliseconds  = sduration - (sduration - sposition); // Current music position
   float millisecondss = sduration; // Music length

   // The correct formula, is:
   int hours   = milliseconds/(1000*60*60);
   int minutes = (milliseconds%(1000*60*60))/(1000*60);
   int seconds = ((milliseconds%(1000*60*60))%(1000*60))/1000;  
   // Display current music position here... (in a HH:MM:SS format)

   // The correct formula, is:
   int hourss   = millisecondss/(1000*60*60);
   int minutess = (millisecondss%(1000*60*60))/(1000*60);
   int secondss = ((millisecondss%(1000*60*60))%(1000*60))/1000;  
   // Display current music length here... (in a HH:MM:SS format)

   // MY ISSUE ####### 2 #######
   // Buttons: (Pseudo code)
   // onClick1 --> playThisMusic("musics/firstSong.ogg");
   // onClick2 --> playThisMusic("musics/secondSong.ogg");
   // onClick3 --> playThisMusic("musics/thirdSong.ogg");
   // onClick4 --> playThisMusic("musics/fourthSong.ogg");
   }



I have 2 issues with SFML in my project:

1) The idea is to retrieve music current position and total length (in seconds).
(Im returning only zeros numbers).

2) And how can I click and (re)load a music?
(Allways plays first selected music, so i think im missing something to clear/delete the buffer, then refill it with the new selected music)

Thanks in advance for any solution/suggestion :)

3
SFML projects / IMP - Irrlicht Media Player [Moving to SFML]
« on: March 26, 2011, 11:03:48 pm »
Just instaled it, took a long time, but just cause i´m a noob... But works so great !!! "MP3 is not free to decode" yep, i can see that now :(
Stupid licences, always with catches... Anyways im on the project, already uses SFML all runs great, except i dunno how to clear the buffer and load a new song on it. Im digging over it now. Laurent, thankyou for the fast response, and how about create a "Code Snippets" section and "Competitions" just for fun, with videos and screenshots, in the forums? ;)

4
SFML projects / IMP - Irrlicht Media Player [Moving to SFML]
« on: March 26, 2011, 03:11:52 am »
IMP - Irrlicht Media Player [Moving to SFML]
Hello all, i´m working on this project, here:
http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=39695
I´m using Audiere lib on it for the audio. But now ive found SFML...
I´m very impressed with your awesome work and the SFML features. So after digg a little, i resolved that, i´ll replace Audiere with the SFML there. The only issue is that Audiere is VERY easy to install, and SFML seems to be a bit more complicated (has to. Has a lot MORE features!), so a little help would be welcome. Im using Code::Blocks, and i have low c++ skills. Thanks! :)

Just another question... SFML cant handle MP3, right?... or I´m missing something?...

Pages: [1]
anything