i just want your permission to pull request with setting text style, everywhere is sf::Text present.
Ofc i didn't done it yet.
Ofc i didn't done it yet.
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 MenuQuote
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.
inline void Picture::loadFromTexture(sf::Texture& _texture)
{
m_texture = _texture;
}
void setTextFont(std::shared_ptr<sf::Font> font);
#include <memory>
sf::Font m_font;
m_font.loadFromFile("my_font.ttf")
m_label.setTextFont(std::make_shared<sf::Font>(m_font));
sf::Font m_font;
m_font.loadFromFile("my_font.ttf")
m_label.setTextFont(m_font);
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.
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 ==========
m_picture = tgui::Picture::Ptr(*fw::g_gui);
m_picture -> bindCallback(tgui::Picture::LeftMouseClicked);
m_picture -> setCallbackId(1);
"tgui::Gui::setGlobalFont(...)"
is that it doesn't work.Quote from: texus on 07 December 2014, 14:09:27i don't use 0.7 because resource has to be loaded at widget creation instead of giving reference as in 0.6.6
This is a limitation in the way v0.6 works.
QuoteThanks i'll try that.
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.
Quote from: texus on 07 December 2014, 11:14:39Minimal code:
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.
Quote from: texus on 07 December 2014, 11:14:39I was in a hurry thanks .
PS: Is there any reason why u don't use normal constructors and destructors?
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();