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

#1
Feature requests / [v0.6] setTextStyle
02 February 2015, 16:40:04
i just want your permission to pull request with setting text style, everywhere is sf::Text present.
Ofc i didn't done it yet.
#2
General Discussion / Re: [vs12] 0.7 warnings
02 February 2015, 14:13:28
okay, i'll add ifdef around it.
i have no github acc, wait a while i'll create one.

EDIT:
https://github.com/texus/TGUI/pull/34
#3
General Discussion / Re: [vs12] 0.7 warnings
02 February 2015, 13:51:24
Clipboard.cpp
- changed:
    strcpy(pchData, m_contents.toAnsiString().c_str());
    to:
    strcpy_s(pchData, sizeof(pchData), m_contents.toAnsiString().c_str());

Layout.cpp
- added: #pragma warning(disable: 4503)

TextBox.cpp
- changed:
    m_lineHeight = m_font->getLineSpacing(m_textSize);
    to:
    m_lineHeight = static_cast<unsigned int>(m_font->getLineSpacing(m_textSize));

ThemeFileParser.cpp
- added: #pragma warning(disable: 4503)

EDIT:
succesfully compiled without warnings.
#4
Quote
I was thinking of giving all widgets a setTextFont function. What do you think about that? It would mean that widgets like Picture get a useless function, but it would also mean that setGlobalFont can change existing widgets (after adding extra bool parameter indicating if change is for future or all widgets). This would mean that with a single function call the font of all widgets could be changed.

That will be a nice & usable feature.
#5
I would love to see function like (not probably the only one):

Code (cpp) Select
inline void Picture::loadFromTexture(sf::Texture& _texture)
{
     m_texture = _texture;
}


because without it i can't use v0.7, otherwise you will wait seconds to see any page in my game...
Ofc i can write it to your code but i think many users will appreciate this, because i'm not probably
the only one with Resource Managers ...
And i'm not the only one who want to manage resources by myself.

EDIT:

Code (cpp) Select
void setTextFont(std::shared_ptr<sf::Font> font);

Can you please add option with only sf::Font&, otherwise there is need to use std::make_shared.
Most of the tut's on net uses res-managers with & return type and most of the begginers
don't know anything about smart pointers.

example:

using your code:
Code (cpp) Select
#include <memory>
sf::Font m_font;
m_font.loadFromFile("my_font.ttf")
m_label.setTextFont(std::make_shared<sf::Font>(m_font));


more readable version for begginers:
Code (cpp) Select

sf::Font m_font;
m_font.loadFromFile("my_font.ttf")
m_label.setTextFont(m_font);


As in my last thread: https://forum.tgui.eu/index.php?topic=280.0
i can do the code for you, because of this:
Quote from: texus on 01 October 2014, 22:29:31
But seeing how much work I'm going to get with my university projects, it will probably be for July next year. Most v0.7 progress will be delayed till next year since I simply don't have the time for it.
#6
General Discussion / [vs12] 0.7 warnings
02 February 2015, 10:24:36
Visual Studio 2013
tgui 0.7 (latest from github)
sfml 2.2 (latest from https://www.nightlybuilds.ch)
cmake 2.8

Release Build:

Code (cpp) Select
1>------ Build started: Project: ZERO_CHECK, Configuration: Release Win32 ------
1>  Checking Build System
1>  CMake does not need to re-run because C:/Users/SHADOW/Desktop/TGUI-0.7-dev/bin/CMakeFiles/generate.stamp is up-to-date.
1>  CMake does not need to re-run because C:/Users/SHADOW/Desktop/TGUI-0.7-dev/bin/src/TGUI/CMakeFiles/generate.stamp is up-to-date.
2>------ Build started: Project: tgui, Configuration: Release Win32 ------
2>  Building Custom Rule C:/Users/SHADOW/Desktop/TGUI-0.7-dev/src/TGUI/CMakeLists.txt
2>  CMake does not need to re-run because C:\Users\SHADOW\Desktop\TGUI-0.7-dev\bin\src\TGUI\CMakeFiles\generate.stamp is up-to-date.
2>  Button.cpp
2>  Canvas.cpp
2>  ChatBox.cpp
2>  Checkbox.cpp
2>  ChildWindow.cpp
2>  ClickableWidget.cpp
2>  Clipboard.cpp
2>..\..\..\src\TGUI\Clipboard.cpp(86): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
2>          C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\string.h(112) : see declaration of 'strcpy'
2>  ComboBox.cpp
2>  Container.cpp
2>  EditBox.cpp
2>  Global.cpp
2>  Grid.cpp
2>  Gui.cpp
2>  Knob.cpp
2>  Label.cpp
2>  Layout.cpp
2>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xmemory0(532): warning C4503: 'std::_Tree<std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,false>>::_Insert_hint' : decorated name length exceeded, name was truncated
2>          with
2>          [
2>              _Kty=tgui::Widget *
2>  ,            _Ty=std::map<tgui::LayoutChangeTrigger,std::map<const tgui::Layout *,std::function<void (void)>,std::less<const tgui::Layout *>,std::allocator<std::pair<const tgui::Layout *const ,std::function<void (void)>>>>,std::less<tgui::LayoutChangeTrigger>,std::allocator<std::pair<const tgui::LayoutChangeTrigger,std::map<const tgui::Layout *,std::function<void (void)>,std::less<const tgui::Layout *>,std::allocator<std::pair<const tgui::Layout *const ,std::function<void (void)>>>>>>>
2>  ,            _Pr=std::less<tgui::Widget *>
2>  ,            _Alloc=std::allocator<std::pair<tgui::Widget *const ,std::map<tgui::LayoutChangeTrigger,std::map<const tgui::Layout *,std::function<void (void)>,std::less<const tgui::Layout *>,std::allocator<std::pair<const tgui::Layout *const ,std::function<void (void)>>>>,std::less<tgui::LayoutChangeTrigger>,std::allocator<std::pair<const tgui::LayoutChangeTrigger,std::map<const tgui::Layout *,std::function<void (void)>,std::less<const tgui::Layout *>,std::allocator<std::pair<const tgui::Layout *const ,std::function<void (void)>>>>>>>>>
2>          ]
2>  ListBox.cpp
2>  MenuBar.cpp
2>  MessageBox.cpp
2>  Panel.cpp
2>  Generating Code...
2>  Compiling...
2>  Picture.cpp
2>  ProgressBar.cpp
2>  RadioButton.cpp
2>  Scrollbar.cpp
2>  Signal.cpp
2>  Slider.cpp
2>  SpinButton.cpp
2>  Tab.cpp
2>  TextBox.cpp
2>..\..\..\src\TGUI\TextBox.cpp(424): warning C4244: '=' : conversion from 'float' to 'unsigned int', possible loss of data
2>  Texture.cpp
2>  TextureManager.cpp
2>  ThemeFileParser.cpp
2>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xtree(836): warning C4503: 'std::_Tree<std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,false>>::_Insert_hint' : decorated name length exceeded, name was truncated
2>          with
2>          [
2>              _Kty=std::string
2>  ,            _Ty=std::map<std::string,std::vector<std::pair<std::string,std::string>,std::allocator<std::pair<std::string,std::string>>>,std::less<std::string>,std::allocator<std::pair<const std::string,std::vector<std::pair<std::string,std::string>,std::allocator<std::pair<std::string,std::string>>>>>>
2>  ,            _Pr=std::less<std::string>
2>  ,            _Alloc=std::allocator<std::pair<const std::string,std::map<std::string,std::vector<std::pair<std::string,std::string>,std::allocator<std::pair<std::string,std::string>>>,std::less<std::string>,std::allocator<std::pair<const std::string,std::vector<std::pair<std::string,std::string>,std::allocator<std::pair<std::string,std::string>>>>>>>>
2>          ]
2>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xtree(836): warning C4503: 'std::_Tree<std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,false>>::_Insert_at' : decorated name length exceeded, name was truncated
2>          with
2>          [
2>              _Kty=std::string
2>  ,            _Ty=std::map<std::string,std::vector<std::pair<std::string,std::string>,std::allocator<std::pair<std::string,std::string>>>,std::less<std::string>,std::allocator<std::pair<const std::string,std::vector<std::pair<std::string,std::string>,std::allocator<std::pair<std::string,std::string>>>>>>
2>  ,            _Pr=std::less<std::string>
2>  ,            _Alloc=std::allocator<std::pair<const std::string,std::map<std::string,std::vector<std::pair<std::string,std::string>,std::allocator<std::pair<std::string,std::string>>>,std::less<std::string>,std::allocator<std::pair<const std::string,std::vector<std::pair<std::string,std::string>,std::allocator<std::pair<std::string,std::string>>>>>>>>
2>          ]
2>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xtree(836): warning C4503: 'std::_Tree<std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,false>>::_Insert_nohint' : decorated name length exceeded, name was truncated
2>          with
2>          [
2>              _Kty=std::string
2>  ,            _Ty=std::map<std::string,std::vector<std::pair<std::string,std::string>,std::allocator<std::pair<std::string,std::string>>>,std::less<std::string>,std::allocator<std::pair<const std::string,std::vector<std::pair<std::string,std::string>,std::allocator<std::pair<std::string,std::string>>>>>>
2>  ,            _Pr=std::less<std::string>
2>  ,            _Alloc=std::allocator<std::pair<const std::string,std::map<std::string,std::vector<std::pair<std::string,std::string>,std::allocator<std::pair<std::string,std::string>>>,std::less<std::string>,std::allocator<std::pair<const std::string,std::vector<std::pair<std::string,std::string>,std::allocator<std::pair<std::string,std::string>>>>>>>>
2>          ]
2>  Tooltip.cpp
2>  Transformable.cpp
2>  Widget.cpp
2>  AnimatedPicture.cpp
2>  Slider2d.cpp
2>  SpriteSheet.cpp
2>  Generating Code...
2>     Creating library C:/Users/SHADOW/Desktop/TGUI-0.7-dev/bin/lib/Release/tgui.lib and object C:/Users/SHADOW/Desktop/TGUI-0.7-dev/bin/lib/Release/tgui.exp
2>  tgui.vcxproj -> C:\Users\SHADOW\Desktop\TGUI-0.7-dev\bin\lib\Release\tgui.dll
3>------ Build started: Project: ALL_BUILD, Configuration: Release Win32 ------
3>  Building Custom Rule C:/Users/SHADOW/Desktop/TGUI-0.7-dev/CMakeLists.txt
3>  CMake does not need to re-run because C:\Users\SHADOW\Desktop\TGUI-0.7-dev\bin\CMakeFiles\generate.stamp is up-to-date.
3>  Build all projects
4>------ Skipped Build: Project: INSTALL, Configuration: Release Win32 ------
4>Project not selected to build for this solution configuration
========== Build: 3 succeeded, 0 failed, 0 up-to-date, 1 skipped ==========


If you have no time then i can repair most of those warnings.
#7
Help requests / Re: ::Ptr in class = no text
18 December 2014, 05:35:21
Sorry for double post.

I've identified the problem why unique_ptr::~unique_ptr was not calling destructor, cuz they were not tagged as virtual :P :D
#8
Help requests / Re: tgui::Picture callback
17 December 2014, 18:11:14
Minimal code works, but for some reason mine code doesn't.
I really can't post code because it's really huge.

I'll let you know what happened.

(sorry for causing you troubles, i know exactly what is it when someone tell that something is malfunctioning)


EDIT: After whole night of searching for any prog. error,  i came to conclusion that picture callback doesn't work.
code structure is same like in here: https://forum.tgui.eu/index.php?topic=260.0
I'll do further investigation to be sure.
#9
Help requests / tgui::Picture callback
17 December 2014, 10:18:52
Visual Studio 2013
sfml 2.2
tgui 0.6.6

I think code for this isn't needed.
When you will create tgui::Picture::Ptr object you can bind a number to callback but it won't respond.

m_picture = tgui::Picture::Ptr(*fw::g_gui);
m_picture -> bindCallback(tgui::Picture::LeftMouseClicked);
m_picture -> setCallbackId(1);


tgui::Button with callback works, but tgui::Picture don't.
#10
Help requests / Re: ::Ptr in class = no text
07 December 2014, 14:35:44
Trust me, i need it :D
#11
Help requests / Re: ::Ptr in class = no text
07 December 2014, 14:26:15
i didn't use mutex cuz i was waiting when game crashes or shows any artifact, in short i was reckless :D .
#12
Help requests / Re: ::Ptr in class = no text
07 December 2014, 14:11:14
problem with "tgui::Gui::setGlobalFont(...)" is that it doesn't work.

Edit:
BTW: Render is in another thread.

Quote from: texus on 07 December 2014, 14:09:27
This is a limitation in the way v0.6 works.
i don't use 0.7 because resource has to be loaded at widget creation instead of giving reference as in 0.6.6
#13
Help requests / Re: ::Ptr in class = no text
07 December 2014, 14:07:37
calling "widget->setTextFont(...)" after i call "fw::g_gui->add(widget)" works :) .

Quote
Your screen is only updated when drawing. If you call removeAllWidgets and then add the needed widgets before you update your screen then nothing will blink. Of course recreating widgets takes time and it is slightly more efficient to keep the ones that you need, but I just though I should mention it.
Thanks :) i'll try that.
#14
Help requests / Re: ::Ptr in class = no text
07 December 2014, 13:51:54
Minimal code:

construct()
   // load needed resources
   Assets::Data::loadFont("font", "xxx.otf");

   // UserName entry field
   m_entry_user -> load(THEME_CONFIG_FILE);
   m_entry_user -> setMaximumCharacters(20);
   m_entry_user -> setPosition(10,10);
   m_entry_user -> setSelectedTextBackgroundColor(sf::Color(0,0,50));
   m_entry_user -> setSize(size_x, size_y);
   m_entry_user -> setTextFont(Assets::Data::getFont("font"));
   m_entry_user -> setTransparency(200);

   // Button
   m_button -> load(THEME_CONFIG_FILE);
   m_button -> setSize(size_x, size_y);
   m_button -> setPosition(m_entry_user -> getPosition().x + m_entry_user -> getSize().x + offset, m_entry_user -> getPosition().y);
   m_button -> setText("Log-in");
   m_button -> setTextColor(sf::Color::Yellow);
   m_button -> setTextFont(Assets::Data::getFont("font"));
   m_button -> setTextSize(16);
   m_button -> bindCallback(tgui::Button::LeftMouseClicked);
   m_button -> setCallbackId(1);
   m_button -> setTransparency(200);

   fw::g_gui -> add(m_entry_user);
   fw::g_gui -> add(m_button);

destruct()
   fw::g_gui -> remove(m_entry_user);
   fw::g_gui -> remove(m_button);

BTW:
std::unique_ptr<thor::Gui> g_gui; // under namespace fw

when i'll declare (let's say tgui::Button) in function body then font-text works, but it's going to be a part of multiplayer game so i cant use function tgui::Gui::removeAllWidgets() because certain things must be still visible (it sucks when your game screen blinks)

Please dont blame functions load* get*, they work.

Quote from: texus on 07 December 2014, 11:14:39
If no text shows up it means that there is no font. The font is normally set with gui.setGlobalFont and then passed to the widget when connecting it to the gui.
Minimal code:
For some unknown reason it never worked.

Quote from: texus on 07 December 2014, 11:14:39
PS: Is there any reason why u don't use normal constructors and destructors?
I was in a hurry :) thanks ;) .
#15
Help requests / ::Ptr in class = no text
07 December 2014, 09:52:42
Example:

class CGuiBasePage
{
     public:
          virtual void construct();
          virtual void destruct();
}

class CButton : public CGuiBasePage
{
     private:
          tgui::Button::Ptr m_button;

     public:
          void construct();
          void destruct();
};

std::unique_ptr<CGuiBasePage> m_page;
m_page = std::move(std::make_unique<CGuiBasePage>());

main.cpp
m_page -> construct();


result of this code is that i can't see any text in Button or EditBox.

Using:
Visual Studio 2013
sfml 2.1
tgui 0.6.6
everything is compiled by me, but problem is reproducable even on sfml build from your website.