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.


Topics - wmbuRn

Pages: [1]
1
Audio / Cant get to play next song after first is finnished
« on: January 28, 2014, 12:00:23 am »
I tried something simple. It should work, but simply it doesnt and i have no idea why.

sf::Music musicPlayer;
    musicPlayer.openFromFile("song1.wav");
    musicPlayer.play();

    if ( musicPlayer.getStatus() == sf::Music::Stopped )
// OR if ( musicPlayer.getStatus() != sf::Music::Playing )
    {
    musicPlayer.openFromFile("song2.wav");
    musicPlayer.play();
    std::cout << "Playing second song" << std::endl;
    }
 

So after first song is finished it should play 2nd song, but it doesnt, no matter what conditional i use.
Anyone have idea how to implement this?

Thanks in advance
-----------------------------------------------------------------------------------
Also i have popping/cracking sound when i use .ogg files. .wav files works ok.
I have sfml 2.1.

2
General / sfml 2.1 build log shows some warnings
« on: August 15, 2013, 03:07:28 am »
http://pastebin.com/SYvGB6N5  << entire build log.

Actual warning is on 36%
[ 36%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/Linux/JoystickImpl.cpp.o
/home/xwm/Downloads/SFML-2.1/src/SFML/Window/Linux/JoystickImpl.cpp: In static member function ‘static bool sf::priv::JoystickImpl::isConnected(unsigned int)’:
/home/xwm/Downloads/SFML-2.1/src/SFML/Window/Linux/JoystickImpl.cpp:123:51: warning: ignoring return value of ‘ssize_t read(int, void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
 

Have i done something wrong? I installed sfml after it and sfml is working. Havent tested joystick so far.

info:
Linux 3.2.0-51 Kernel
Gcc 4.6.3
GNU Make 3.81

3
General / Fullpath or execution dir on widows/linux/mac[SOLVED]
« on: July 28, 2013, 04:35:44 pm »
I read a tons of post of the same question from google search but it didnt help. Can somebody pooint me to a post i can read to figure this one out.

I know using full path doesnt require and platform specific code. But doing so i have to:
1. Make windows only application by changing [ if (!texture.loadFromFile("c:/somDir/image.png" ))
2. Make linux only applocation by changing  [ if (!texture.loadFromFile("/home/user/programDir/image.png"))
Which is not best soluton since i cant know
1. Where the user will put the program
2. The username from linux user.

Hence, it is better to use execution dir. But how to do it? And how will this line look like  [ if (!texture.loadFromFile("image.png")) also looking for a reliable cross-platform code, or platform specific that can be put into cpp file and thati can compile it with gcc on diferent sistems.

Thank you in advance
wmbuRn

4
General / vectorName.clear() causing problems?
« on: July 25, 2013, 04:24:34 pm »
This works:
for (unsigned int i = 0; i < 30; ++i)
            {

EditBoxNames[i] = Group1->get("Ime" + tgui::to_string(i));  // call EditBox named Ime
GroupNames.push_back(EditBoxNames[i]->getText());         // Take values from
saveGroup1Names(GroupNames);    // call function to save Names to file

EditBoxLastNames[i] = Group1->get("Prezime" + tgui::to_string(i));
GroupLastNames.push_back(EditBoxLastNames[i]->getText());
saveGroup1LastNames(GroupLastNames);

EditBoxBrojTelefona[i] = Group1->get("BrojTelefona" + tgui::to_string(i));
GroupBrojTelefona.push_back(EditBoxBrojTelefona[i]->getText());
saveGroup1BrojTelefona(GroupBrojTelefona);

EditBoxDatumRodjenja[i] = Group1->get("DatumRodjenja" + tgui::to_string(i));
GroupDatumRodjenja.push_back(EditBoxDatumRodjenja[i]->getText());
saveGroup1DatumRodjenja(GroupDatumRodjenja);

TextBoxGrupaNapomene[i] = Group1Napomene->get("Group1NapomeneUcenik" + tgui::to_string(i));
GroupNapomene.push_back(TextBoxGrupaNapomene[i]->getText());
saveGroup1Napomene(GroupNapomene);

}
 

After that i called:
// here was for loop from prevoius code

// here was cout about vector size and capacity [ see picture ]
EditBoxNames.clear();
EditBoxLastNames.clear();
EditBoxBrojTelefona.clear();
EditBoxDatumRodjenja.clear();
// here was cout about new size and capacity [see picture ]

// new for loop starts here
 
So i clear those vectors to use them again in new for loop [ if needed i will post new for loop ] . And just before new for loop program crashes with core dumped. dbg says:
-------------------------------------------------------------------
nr: Adress:        Func:    File:
#0 0xb7d587b8 ??()     (/lib/i386-linux-gnu/libc.so.6:??)
#1 ??             ?? ()    (??:??)
--------------------------------------------------------------------
picture:  http://s16.postimg.org/ro920dvd1/Screenshot_from_2013_07_25_16_18_44.png .

Have i done vectorName.clear wrong? Or it is something else?

Using gcc 4.6.3
code blocks 12.11
elementary os Luna Beta 2

if need more details ask and i will post

thank you in advance
wmbuRn


EDIT: When i comment entire new for loop with /* */ program doesnt crash. And it does do whatever is suposed to do. New for loop uses same vectors just like for loop i posted

5
So i have variable
std::vector<sf::String> variableName;  // dont mind the name
 
And i want to write its contents to a file. here is function:

void writte2file(std::vector<sf::String> Text) // problem is here
{
ofstream saveIt;
saveIt.open ("Data.txt", ios::app);
saveIt << Text;   // and problem here, will post it after code
saveIt << "\n";
saveIt.close();
}
 

Here is how i called function from for loop:
for (unsigned int i = 0; i < 30; ++i)
{
writte2file(variableName);
}
 

Error:  no match for ‘operator<<’ in ‘saveIt << Text’ .

 I think thats becouse standard c++ doesnt know of sf::String. Any idea how to solve this? And sfml addon for file system or anything?

Thank you in Advance
wmbuRn


 

6
Graphics / shaking window [SOLVED]
« on: July 09, 2013, 05:39:15 am »
So i got this idea from most of the linux programs. When you type wrong username or password entire window moves lef, right, left right.. you get the point. so i tried [and obviusly failed] to implement that in my test program. Here is the code, i can post entire code if needed. I am using tgui also.

screen.setPosition(sf::Vector2i(10, 50)); // first
screen.setPosition(sf::Vector2i(30, 50));
screen.setPosition(sf::Vector2i(10, 50));
screen.setPosition(sf::Vector2i(30, 50));
 


The only thing that happends is that it loads first [as typed // first] value and stops there, so i tought maybe sfml is too fast so i made big for loop and blocked entire desktop :)

So is it possible to implement this into programs or i should drop it ?

7
General / compiled and builded code that uses sfml wont start [Linux]
« on: July 08, 2013, 04:08:39 pm »
1. in code::blocks i set linker options as it should be. So everything works there. File that come out after compiling and building can not be started from its directory (and yes i put all resource files there, which is only 1 bmp file]. But when i start terminal > go to that file and execute ./program it works. I can use program. But why it is not working when i double click on program [or right mouse click > open]? screen just flashes and thats it.

2. I also tried to compile it with gcc but looks like i dont know how to invoke sfml libs. i tried -lSFML-graphic, -lSfml-Graphic, lSfml-graphic, -lsfml-graphic, -lsfml_graphic and what not [didnt invoke all the -l commands i just wrote at the same time in terminal] i also tried -L /usr/lib -L /usr/include and what not. So second question is how to compile from terminal code that uses sfml ? I googled it and there are no question [and since there is no questions there are no answers about this]. [[[[ SOLVED ]]] i checked tutorial again i made some mistakes so everything is in order now, except problem no. 1

Thank you in advance.

with Respect
wmbuRn

8
Graphics / can somebody post simple small code for loading 1 image
« on: July 08, 2013, 04:12:22 am »
Title says it all. Graphic tutorial is confusing (atleast for me). I added all the code, from tutorial, i added Textures and sprites code and i get tons of errors from copiler. Am not a c++ newb. [ in case someboy thinks i added "...." from tutorials into my code. So is somebody willing to write a simple program that loads single file and draws it on surface? Nothing more from that.

Thank you in advance

with respect
wmbuRn


9
Graphics / sf::Window and sf::RenderWindow confusion
« on: July 08, 2013, 03:27:54 am »
what is the difference between sf::Window and sf::RenderWindow ? In past tutorials [the Window module i used sf::Window command and now i switched to sf::RenderWindow). Why? Will that means that i didnt have to use sf::Window in first place and that i can simply start window tutorial with sf::RenderWindow ? And if that is true what is the point of using sf::Window in the first place when every program will need to render stuff on screen ?

with respect
wmbuRn

10
General / buttons, menu, compatibility and others, general questions
« on: July 07, 2013, 04:32:22 pm »
So i googled about this, i googled about comaptibility bot no answer satisfied me.

So  i will ask this questions here and hopefully i will get some answers.

1. Can sfml draw/make buttons so that i can use in program/game or i should use 3rd party library?
    It is important becouse i spend time and learned about 70% of SDL 1.2  and then i founded out that SDL cant make menu items, ration buttons, and other stuff you might need in games or applications.
 -- 1. I found out it is possible to do that inside SFML by loading diferent images and using mouse events. Will check Sfgui and Tgui to see are they satisfies my need. But still dont know can or how to make ration button and dropdown menu in SFML.



2. I am C++ linux programmer and my team mate is MAC OS C programmer, and we worked fine together with SDL, i used C++ code, he uses C code [since SDL is native C , and 99.99% of native C can be compiled with C++ code] . Can we do that with SFML? There are keybindings for C in SFML but how will SML react using 2 diferent [sligthly diferent] programming languages?

3. Will all SFML code work on every OS [Windows, Linux, MAC] or there should be platform specific code?
     I am interested in using SFML only if we dont need to work on platform specific code. Time is relevant since we are only 2 in team and we dont want to deal with platform specific code especially when we dont have windows programmer, and we refuse to use windows. :)

4. Can i use native openGl headers or i should only use SFML openGl header?
In SDL i can use native openGl headers, just include them in .cpp file.

5. Can SFML create new windows on top or independent from main window?
Just like when application or games work, you hit Help > About [or in games settings or help] and it displays new widow within main window, without clearing the main surface.
SDL cant do that, i tried that, i readed tons of tutorials [additional to books i have, and it requires 3rd party library to do that, and most of those libraries are not cross-platform].

My appologies if thise question are answered in FAQ, i did readed lot of texts but my poor english skills migth excluded important answers :)
Also my appology for poor english skills.

Thank you for your help in advance.

with respect
wmbuRn.

Pages: [1]