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

#1
Help requests / Re: Texture Class
21 January 2017, 12:48:43
Well, I am loading textures from memory (because they are loaded via sf::http), so I probably still need to use sf::Texture?

Just got slightly confused, because in sfml documentation it's said that Sprite contains only a pointer to texture, while tgui::Picture contains the texture itself and it mentioned nowhere.
#2
Help requests / Texture Class
21 January 2017, 07:56:32
Hello.

I spent some time writing resource manager, but then I noticed that tgui::Picture, unlike sf::Sprite, doesn't need it Texture to be alive after setTexture has been called. Is it true? If so, I can get rid of all the ptrs I used because it will work just fine like this:

1. Create/Load sf::texture.
2. Bind texture to tgui::Picture.
3. Don't care about sf::Texture anymore, tgui::Picture has stored the object itself and not a pointer.

How is it implemented? Is there any unneeded work transfering the texture? Or it just pointer transformed into something like shared_ptr so it will be saved without any additional memory management?

Also, what's the purpose for tgui::Texture class? I saw some widgets require it, but they also fine with sf::Texture.
#3
Help requests / Re: CPU-Heavy Scrolling
14 January 2017, 19:35:56
I have another question. It is more about me trying to learn and not some specific problem (because I found a workaround).

Here is my current code for initialization of panel and scrollbar for it:
Code (cpp) Select
CustomPanel pan;

tgui::Scrollbar::Ptr scroll = std::make_shared <tgui::Scrollbar>();
main_window.get_Gui()->add(scroll, "scroll_friends");
scroll->setPosition(1060, 100);
scroll->setSize(20, 620);
scroll->setLowValue(620);
scroll->setMaximum(1240);
scroll->hide();
pan.set_scroll(*main_window.get_Gui());

CustomPanel::Ptr panel = std::make_shared<CustomPanel>(pan);

panel->setSize(1060, 620);
panel->setPosition(0, 100);
//panel->setBackgroundColor(tgui::Color(0, 0, 0, 0));
panel->getRenderer()->setBackgroundColor(tgui::Color(70, 130, 180, 255));
panel->hide();
main_window.get_Gui()->add(panel, "panel_friends");


As you can see, I use my "set_scroll" function (which I use to store pointer of scrollbar inside CutomPanel class) of custom panel via panel object itself. I think it's a wrong way to do so, because we use shared pointers to widgets anyway, right? However, once I do "CustomPanel::Ptr panel = std::make_shared<CustomPanel>(pan);" or something like that (just declaring new panel for example and not sharing existing one) I have'nt access to "set_scroll" anymore, so anything like "panel->set_scroll" is not possible. Where is my mistake?


CustomPanel.h code:
Code (cpp) Select
class CustomPanel : public tgui::Panel {
public:
void set_scroll(tgui::Gui& gui);
void draw(sf::RenderTarget& target, sf::RenderStates states) const;
private:
tgui::Scrollbar::Ptr scrollbar;
};

#4
Help requests / Re: CPU-Heavy Scrolling
14 January 2017, 19:26:13
Yes, realized that just one second before you answered. Sorry for these questions.
#5
Help requests / Re: CPU-Heavy Scrolling
14 January 2017, 19:19:39
I am not sure how to copy it, it seems like there are also Borders and Clipping classes used.

UPD: Huh, I am kinda stupid, forgot about namespace for Borders. But I don't see anything related to Clipping in tgui space.
#6
Help requests / Re: CPU-Heavy Scrolling
03 January 2017, 21:08:08
Quote from: texus on 03 January 2017, 19:16:45
Note: this code is based in 0.7, to do the same in 0.8-dev just have a look at how the parameters of the functions are in the tgui::Panel class.
I looked into 0.8 source code and it seems like Panel::draw has the same parameters, why would not custom widget work without changing the code?

Update: I tried your code, but overrided "draw" function moves the panel itself, not the widgets on panel. Is it supposed to be like that?
#7
Help requests / Re: CPU-Heavy Scrolling
03 January 2017, 19:38:22
Quote from: texus on 03 January 2017, 19:16:45
Edit: can you check one more thing? Does the lag also occur when you have a ListBox with some items in it (which is very similar situation to having a scrollable panel of labels)?
0.7.2 test:
Placed 20 items in listbox, but only 7 were visible without scrolling.
Yes, it's lagging when I try to move the scrollbar while holding left mouse button. However, if I use mouse wheel for scrolling, then it's hard to see a lag probably because of less frequent step.

0.8.dev:
No lag even with 2000 items in listbox.
#8
Help requests / Re: CPU-Heavy Scrolling
03 January 2017, 18:56:43
I am no sure I can do something minimal enough, but I will try to test it a bit with 0.7/0.8.
Anyway, it seems like problem with scrolling is still here, so you can share about custom widget and stuff for better scrolling.
#9
Help requests / Re: CPU-Heavy Scrolling
03 January 2017, 18:41:02
Thank you.
By the way, what is replacement for "setTextColor" and "setBackgroundColor"?

Update: Seems like the issue with lag and CPU usage is still here. Also, I noticed CPU-usage spikes even in idle, haven't seen it on 0.7.
#10
Help requests / Re: CPU-Heavy Scrolling
03 January 2017, 17:03:50
I am not in hurry.
I would probably try (don't yet know how to) to compile them myself, if you are too busy, but I can also just wait and focus on other things meanwhile.
#11
Help requests / Re: CPU-Heavy Scrolling
03 January 2017, 15:44:35
Do you have precompiled version for Visual C++14 (2015)?
#12
Help requests / CPU-Heavy Scrolling
03 January 2017, 15:18:04
Hello.

I used this example of how to create a scrollable panel, but adjusted it to work with TGUI 0.7 (connectEx instead of bindCallbackEx). I created panel with a size of 1080*620 and placed 6 widgets on it (all of them are labels with 5-10 symbols of text). I also set maximum for scrollbar to 1240 (double of panel size). It seems that scrolling is very cpu-heavy even in this case, but I intended to add more than just 6 label on panel. Lag is not very noticeable, but is still is compared to empty scrolling. Is it the constant moving of widgets causing this?
#13
Thank you for fast and clear answer.
I will think about it and come back.
#14
Help requests / Possible bug with button (or more)
07 December 2016, 17:49:50
Hello.
I used a code which sends data to server.
The code executed when I press button.
I decided to disable button while user waiting for an answer from server to prevent packet-spamming.
When data arrives, button re-enabled.
However, if you keep your mouse cursor hovering the button while it's disabled, button graphically wont recognize a hovering from mouse after re-enabling even if you click on it. You need to move the mouse for any visible effect.
Button still will work when you click on it, you just wont see hover-difference.
#15
Help requests / Re: Cyrillic Symbols
03 December 2016, 20:49:19
Which one used by tgui by default?
I found only DejaVuSans inside the folder, but it seems like it does support these characters.
#16
Help requests / Cyrillic Symbols
03 December 2016, 16:36:31
Hello.
I tried to use cyrillic symbols in EditBox->setDefaultText property, but obviously there are some code page issues.
Is there any way to use cyrillic symbols?

https://puu.sh/sCQmm/534a405c30.png
#17
Help requests / Re: Editbox Lag
24 November 2016, 16:10:29
Okay, thanks for the reply.
I noticed fps drop even with something like 30 characters.
Is it the same for TextBox?
Normally TextBox could contain more characters than EditBox does without lags.
#18
Help requests / Editbox Lag
24 November 2016, 15:31:46
Hello.
Just started to use TGUI today and created one EditBox.
Tested it for a 10 seconds and encountered a problem.

Steps to reproduce:
1. Type enough letters inside EditBox so they won't fit anymore (text started to scroll).
2. Try to select the text with mouse and move mouse left/right to select/deselect parts of text.

Massive FPS drop appears to me (like, from 60 stable (framelimit) to 20-30).
If there are not many letters than I don't see any lag. Not sure if it's because of amount of characters or just because of scrolling.