Main Menu
Menu

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.

Show posts Menu

Messages - texus

#1546
Ah, I misread your first post. I read that you didn't find it a good way to add internal to the functions.
But I think I'm just going to do it for the duplicate functions at first (focusWidget, get, remove, ...) and not for functions like initialize, mouseOnWidget, leftMousePressed, ...

Anyway that would just be temporary until I get a better design and can do a better job.


But I see problems with removing some of the internal functions. I even have reasons to no longer make them internal.
In the widget callbacks, I am forced to use a Widget* instead of Widget::Ptr (to avoid the big memory leak that I had). But that means that Container will need a remove function that takes a Widget*. But I also want you to remove a Widget::Ptr without first calling the get function on it to retrieve the Widget*. That is why I believe that both remove functions should stay.
#1547
I have to look into this, because it isn't that easy and it definately isn't a small change.
The difference with sfml is that my classes highly depend on each other, so it can't be fixed that easily.

If I would be able to declare a namespace inside a class it would be fixed a lot faster, but I can't so I'll have to look for other solutions.
#1548
Actually I realized that too, I just couldn't find a better name than getLines.
I was thinking about things like getNumberOfLines or getAmountOfLines but I didn't like them. But getLineAmount should do.
#1549
Help requests / Re: [SOLVED] sf::View and TGUI
18 September 2013, 18:25:17
I decided to make it a bit easier.

gui.draw now has a parameter to reset the view. By default false will be passed and the current view will be used. But you can pass true to render the widgets with the default view. After the gui has been drawn, your old view will be restored.

So you no longer have to set a separate view for sfml and tgui every frame, just set your view once for sfml and pass true to gui.draw.
#1550
An option has been added to cmake. I only tested it on linux so far though.
#1551
It was planned, I even added the doxyfile, but I didn't look further into it yet.

It can't be that hard, copying a few lines from the sfml cmake script should be enough.

I'll see what I can do.
#1552
Ok, it now has a getLines function which will return the amount of lines in the chat box.
#1553
The changes have been made.

addLine no longer returns anything, everything passed to addLine is considered to be a single line.
#1554
The "if(callback.id==1)" part in your code still contains old code. You should clean up your code a bit more, because you aren't using half of the code anymore.

You now simply need something like this:
if(callback.id==1)
{
    auto it = sounds.begin();
    std::advance(it, listBox->getSelectedItemIndex());
    it->play();
}
#1555
You don't just have to load the animal names from the text file, you also need to load the sound that belongs to the animal.

Something like this (untested)
while(ifile>>name)
{
    ifile.ignore(10,'\n');
    listBox->addItem(name);

    buffers.push_back(sf::SoundBuffer());
    buffers.back().loadFromFile(name + ".wav");

    sounds.push_back(sf::Sound());
    sounds.back().setBuffer(buffers.back());
}
#1556
Ok, I figured out what is happening. You are loading stuff so you are adding items to the list box. But no sound is being loaded that belongs to these items. So the amount of items in the list box will be bigger than the amount of loaded sounds.

So instead of just adding the read line to the list box, you should also load the corresponding sound.
while(ifile>>name)
{
    ifile.ignore(10,'\n');

    // Do something here similar to what you do when pressing the 'add animal' buttons.
}
#1557
- When creating the ofile, you are checking if the ifile is open. You should check ofile instead.

- Close ifile when you are done with it. It is automatically closed when going out of scope, but because everything is inside the main function, this will be when the program quits. And you don't want the file to still be open for reading when at the same time opening it for writing.

- The following lines don't work correctly.
while(!ifile.eof())
{
    ifile>>name;


You should change it to the following to get the desired effect.
while(ifile>>name)
{
#1558
You must have downloaded it right before I fixed it. Try downloading the latest tgui version again, it should be fixed.
#1559
Installation help / Re: [MSVC 2010] Build errors
17 September 2013, 01:41:26
The latest version should compile again.

I haven't been able to test it myself though, as my VC++10 compiler is suddenly 'broken', even though I had been using it earlier to reproduce the fact that the code didn't compile.
#1560
Installation help / Re: [MSVC 2010] Build errors
16 September 2013, 21:03:45
It will take some time to fix this, I will at least need one day.

I was going to send a link to to the v0.6-alpha2, but everything seems to be going wrong today. I can't login to my wordpress anymore and my last backup is like a month old. So I'll have more things to do tomorrow then just getting the code to compile on VS2010 again.

All I can do for now is send v0.6-alpha1 which I still had on my pc. It has a known memory leak, so this is only temporary until I get this issue solved (I'll post here when that happens).