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

#26
Feature requests / Label - set size
17 July 2013, 17:53:42
I think that editbox does it (and probably chatbox as well).

Label should allow to set its size and if the text doesn't fit inside it then the text will be cut (very important step to implement resizing). The same should apply to text on buttons etc.

What do you think?

Gui libs like QT etc implement this.
#27
Pure virtual seems like a good choice.

Edit:

Look at my new topic in feature requests - it adds another usage for setSize that currently does nothing.
#28
Thanks :)

On the unexpected usage when it's empty - I don't know how doxygen works, but if you set description in widget::set/getSize() that it does nothing and don't implement it in children class, will the description from base class appear or no description at all? If it's the first case then problem is solved.

Edit:

Important thing is that virtual getSize() must be implemented as well. I think it should return empty vector by default, so it's shows 0x0 dimensions ie no size at all.
#29
I'm currently working on something I really need and I call it "semi-automatic resize handling". The idea is very simple:

Code (cpp) Select

classs GuiManager
{
   std::map<tgui::Widget::Ptr, ResizeBehaviour> widgets; //I store pointers to widget in this class
};

struct ResizeBehaviour
{
  bool changeX = false;
  bool changeY = false;
  bool changeWidth = false;
  bool changeHeight = false;
};

Then we have function:

GuiManger::handleResize(int deltaX, int deltaY) //called when resize SFML event happens
{
   //when a widget has for example changeX set to true
   //then widget->x += deltaX etc.
}


This allows for very basic layouting (altough I use similar method and it works very well for handling resizing in gui!).
My problem is that tgui::Widget doesn't have virtual set/get Size function. Thus I can't make it as simple as in the above code.

What is the reason why there can't be even empty virtual setSize function in widget? Basically every widget has its size (unless it's container widget and then we can happily don't implement the virtual function body).

It's very simple way of handling basically the biggest TGUI problem (at least for me) and after some tuning (this code isn't really integrated into TGUI) I could write a patch.

However I really need that size in tgui::Widget class. Is it possible to place empty virtual function in the class? I think it won't hurt.

If it's not possible, do you have any other idea how I can workaround it?
#30
Help requests / Re: scrollbar tutorials?
15 July 2013, 09:46:15
I agree that if someone doesn't have experience with scrollbar, they are a bit hard to understand at first. I think some example code would be good and should be written.
#31
General Discussion / C# binding
13 July 2013, 20:44:26
How is C# binding doing? I'm asking because I fall in love with C#, it's so easier and faster to code and I'm thinking about porting my app to sfml.net but I use tgui heavily so I need it too.
#32
Feature requests / Re: Child windows again
13 July 2013, 17:10:02
Post here when you apply the patch so I can remove child window checking in downstream code.
#33
Feature requests / Re: Child windows again
13 July 2013, 16:21:59
Just add my name in the commit message. This patch is so small that there is no point to bother with making github account :P
#34
Feature requests / Re: Child windows again
13 July 2013, 15:47:04
Here is the current git snapshot with changed ChildWindow files. Create patch yourself :P

TGUI-patch.tar.gz
#35
Feature requests / Re: Child windows again
13 July 2013, 15:44:07
It doesn't work.

cp -R changed_tgui_folder . -- it gives the error than it's the same file

git diff produces empty file.

#36
Feature requests / Re: Child windows again
13 July 2013, 15:20:38
I hope the .diff file is good, because it shows some strange changes that I didn't make. (mostly formatting and in one place it uses ! instead of +). Tell me if it works, if not I will just upload the changed files.

Also I removed virtual keyword from Transformable::setPosition, because if you decided to use it as a virtual function my patch wouldn't work (because I explicitly call Transformable::setPosition in a few places).
#37
Feature requests / Re: Child windows again
13 July 2013, 14:52:35
I'm working on linux so I can easily make it. I will send it you as soon as possible but I encountered a very strange bug and I'm looking into it. (for some reason it ignores my "if" and it always keeps in parent, despite debugger saying the value is set to false as it should). I will do a short break and then look into it.
#38
Feature requests / Re: Child windows again
13 July 2013, 14:37:44
(I think) it's working. Now I only need to find out how to make a diff file.
#39
Feature requests / Re: Child windows again
13 July 2013, 14:04:33
Well it's almost done except one thing that I can't solve - tgui::Container doesn't have its size. And dynamic casting to check if it's a tgui::ContainerWidget or a tgui::Gui isn't a good solution... Do you have any idea?

And if we can't solve it, then all I can do is to make it keepInWindow only (but, I'm not sure if Widget has access to the window).
#40
Feature requests / Re: Child windows again
13 July 2013, 13:24:24
I will do only inParent and dontKeep. Of course naming could be better because sometimes it's hard to think of a good name in english.

I will write here when I finish it.
#41
Feature requests / Child windows again
13 July 2013, 10:46:28
Okay, after some profiling with a lot of objects I found manually keeping child windows in place is a little bottleneck and it's not very clean solution to iterate through thousands of gui objects every frame to check them type in my code.

Simple solution:
- child window has property like enum keepInPlace - inWindow, inPanel, dontKeep (default).
- when child window is forced to change its position, it makes sure it's in place using my simple code which actually works

Maybe not the cleanest possible solution, but it won't hurt and will be so damn useful for me.

If you agree I can submit a simple patch later today. It will be just optional feature and default it will be turned off.

Edit:
There is a possibility that object doesn't have acces to window - in that case, it will just keep itself in its container. I need your feedback here.
#42
Installation help / Re: gcc errors in linux
09 July 2013, 00:12:18
It seems strange. Are you sure that "sudo apt-get install libgl1-mesa-dev" says it's up to date?

Anyway, you can download tgui 0.5 from development ppa. That must work.
#43
Installation help / Re: gcc errors in linux
08 July 2013, 23:50:12
So I was right. Simply use development version of SFML from ppa and you can easily compile TGUI 0.6 that way (or use 0.5 from ppa).
#44
Installation help / Re: gcc errors in linux
08 July 2013, 23:44:15
Okay. Tell me if dev version from ppa or compiling sfml from source helped.

The error you get while compiling TGUI seems to me like it's using SFML header of some older version. Maybe it's a bug in .deb package? I'm almost sure that compiling sfml from source should solve it.
#45
Installation help / Re: gcc errors in linux
08 July 2013, 23:26:04
It could have been sfml 2.0 rc in launchpad or some mismatch in libs (your os may be a bit different from regular ubuntu). Generally it's better to compile libs on your own on linux, it's so damn easy and can avoid many problems usually.

Edit:
If you can't compile sfml then run:

sudo apt-get install libpthread-stubs0-dev libgl1-mesa-dev libxrandr-dev libfreetype6-dev libglew-dev libjpeg8-dev libsndfile1-dev libopenal-dev

It will install dependencies needed.
#46
Installation help / Re: gcc errors in linux
08 July 2013, 23:09:50
Maybe you are using outdated SFML2 version? Download sfml2 current sources and compile it using:

cmake .
make
sudo make install


Also make sure you use the same commands to compile tgui.

(just a guess, I never encountered something like that with tgui on linux)
#47
It's very nice day here in Poland though :P

"Useless post is useless" - Plato 385 BC
#48
General Discussion / Re: Tgui without Boost
07 July 2013, 20:26:57
When you get into C++11, you can develop I think easily 30% faster, C++11 is much more productive and modern. So that would be an advantage for you.

I builded and set to default gcc 4.8 on ubuntu 12.04, but that forced me to rebuild every library and basically broke my system, so... it's very bad idea.

However I have acces to gcc 4.8 on my chakra (also arch based, very fast and kiss-oriented!), but then I wouldn't be able to compile my code on any other distro so I will wait with using gcc 4.8 features until it gets shipped with ubuntu (probably 13.10 I think).
#49
General Discussion / Re: Tgui without Boost
07 July 2013, 20:05:34
The big problem with C++11 is that in g++ 4.6 (which is the one used in ubuntu 12.04 lts) it doesn't support this:


class a
{
int m_var = 0; //default value
};


And you have to manually write big constructor's initializer lists :( Once I discovered this feature I am much more productive when writing new classes (it's so damn easier now). Unfortunately, it forced me to move to (L)ubuntu 13.04 so I have better C++11 support.

Why care about ubuntu? Well a majority of linux users use ubuntu and a majority of ubuntu users use LTS. However in april 2014 with ubuntu 14.04 lts the problem will be automatically fixed :)

The rest of C++11 features I use are available in g++ 4.6 so tgui 0.6 can still use many of c++11 (I'm yet to see modern distro with g++ 4.5 other than centos)

Tdm-gcc 4.7 is standard for Windows (shipped by codeblocks and codelite and generally widely-used) so no problem there.

And well, on those visual c++ users, I think we shouldn't care about them :) It's better to force them to use open and better compilers, with better c++11 support.
#50
Is there any tutorial how exactly file with widget's position etc should look like?

I don't mean a theme file. I mean a file where I can put widget name, type, size, position etc so I can change most basic things without recompilation.

I wanted to create AngelScript wrapper of TGUI so I could handle GUI by scripts, but I found info about loading object positions from file on TGUI's site so I think it may be easier for me. I just can't find info about it.