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

#1
Help requests / Re: Custom tgui::Signal functions
28 February 2022, 16:32:27
Oh sorry i missed that.
Thank you!
#2
Help requests / Custom tgui::Signal functions
27 February 2022, 20:21:53
Hello!
Im wondering how can i create custom functions like onSizeChange()?
Im trying to create something like Task::onStateChange().
In my Group class i have array of tasks.
Group::pushTask(){
     tasks.push_back(Task::create());
     tasks.[tasks.size-1]->onStateChange(&Group::TaskStateChanged,this,tasks.size()-1);
}
Group::TaskStateChanged(int index){
     tasks[index]->....
     ...
}
So when task changes state in scope Group::TaskStateChanged will be called.

Thanks!

#3
Help requests / Re: Custom Widgets and Themes
19 January 2022, 12:24:31
Thank you a lot.
You are big help, as always!
Everything is working fine now.

#4
Help requests / Re: Custom Widgets and Themes
19 January 2022, 01:50:31
First of all sry for obvious questions and late replies, feel free to answer whenever.
Also i didnt explain myself well before, sorry for that.

I made custom Renderer and got errors.
Here is one CustomRenderer:


HabitCardRenderer.h

#pragma once
#include <TGUI/TGUI.hpp>
#include <TGUI/Backend/SFML-Graphics.hpp>
#include <SFML/Graphics.hpp>

class HabitCardRenderer : public tgui::PanelRenderer
{
public:
   using tgui::PanelRenderer::PanelRenderer;
   
   std::shared_ptr<tgui::RendererData> getNameLabel() const;
   void setNameLabel(std::shared_ptr<tgui::RendererData> namelabelRenderer);

   std::shared_ptr<tgui::RendererData> getEditButton() const;
   void setEditButton(std::shared_ptr<tgui::RendererData> editbuttonRenderer);

   std::shared_ptr<tgui::RendererData> getTask() const;
   void setTask(std::shared_ptr<tgui::RendererData> taskRenderer);

};


HabitCardRenderer.cpp

#include <TGUI/RendererDefines.hpp>
TGUI_RENDERER_PROPERTY_RENDERER(HabitCardRenderer, NameLabel, "NameLabel")
TGUI_RENDERER_PROPERTY_RENDERER(HabitCardRenderer, EditButton, "EditButton")
TGUI_RENDERER_PROPERTY_RENDERER(HabitCardRenderer, Task, "Task")


TGUI_RENDERER_PROPERTY_RENDERER is giving me errors whatever i do.
for this code its giving me "name followed by '::' must be a class or namespace name"

TGUI_RENDERER_PROPERTY_COLOR is working tho like in tutorials


Other problem i have is that i cant figure out third parametar for TGUI_RENDERER_PROPERTY_RENDERER which is RENDERER
Is this a Renderer class name?

Let's say i want my CustomRenderer to have 2 Labels Renderers.
Do i code in cpp file someting like this?
TGUI_RENDERER_PROPERTY_RENDERER(CustomWidget, Label1, "LabelRenderer");
TGUI_RENDERER_PROPERTY_RENDERER(CustomWidget, Label2, "LabelRenderer");

Or is this "LabelRenderer" what i type in theme.txt

I mean i looked up WindowChildRenderer and for example:
In ChildWindow.cpp , in function  void ChildWindow::rendererChanged(const String& property)
it says :
       else if (property == "MaximizeButton")
         {
                ...
                m_maximizeButton->setRenderer(getSharedRenderer()->getMaximizeButton());
                ...
        }
  while in
ChildWindowRenderer.cpp it says "ChildWindowButton"
in TGUI_RENDERER_PROPERTY_RENDERER(ChildWindowRenderer, CloseButton, "ChildWindowButton")

My guess ChildWindowButton is base class of CloseButton, MaximizeButton and MinimizeButton i just dont know how :D

Anyway, thanks for support!

#5
Help requests / Re: Custom Widgets and Themes
17 January 2022, 22:47:17
Well ill try that now.
But anyway its not just BackgroundColor propertie. Its all tgui::Panel has because Group Class is derived from tgui::Panel so that got me thinking its possible
#6
Help requests / Custom Widgets and Themes
17 January 2022, 22:28:45
I've looked up almost every page there is on themes and renderers and im really stuck!
I've made a lot of custom widgets with most of them direved from tgui::Panel.
Im currently making theming system and i cant figure how to load custom widgets from theme file.
I made this and is working:
deafult.txt (Theme file)
TaskCard{
  BackgroundColor = (0,0,0);
  ...
}
with setRenderer(theme->getRenderer("TaskCard"));
But how to load children?
I mean what i got working is for every Custom widget i have seperated name in theme.txt like:

TaskCard{
...
}
TaskCard>Group{
...
}
TaskCard>CheckedGroup{
...
}

This is what im trying is to load them the way they are supposed to be loaded:
TaskCard{
    BackgroundColor = (0,0,0);
    ...
    CheckedGroup = {
        BackgroundColor = (0,0,0);
        ...
    }
    UnavailableGroup= {
           BackgroundColor = (255,0,0);
           ...
    }
}
I guess with custom widgets i need custom renderers?
#7
Help requests / Re: OnSizeChange() difference
17 January 2022, 17:38:06
Alright, thanks for help!
#8
Help requests / OnSizeChange() difference
15 January 2022, 20:33:25
Is there a way to get difference of new size - old size on size change?
I made a custom container similar to tgui::Grid and i want it to resize auto on child resize function
I mean i can store old size and just subtract it but i saw this "The size of the widget changed. Optimal parametar : new size" on definition of OnSizeChange()
I dont get where this parametar goes and how to do it
Thank you in advance!
#9
Help requests / Re: Drawing Shapes within gui
28 December 2021, 22:45:01
I guess i got confuesed because tgui::Panel draw is without virtual but now i know what override is for :)
Alright cool i dont have to use sf::Shapes now
I did something similar but it didnt work for some reason. Now it does!
Thank you :)
#10
Help requests / Drawing Shapes within gui
28 December 2021, 21:10:15
Can i draw sf::RectangleShape or any other shape within custom widget?
Is there a way for me to draw shapes in order like elements of container are drawn in order?
Like, if i make custom widget that inherits from tgui::Panel i see that i cant override draw function.
basically what i want is to draw everything from tgui::Panel and then draw my shapes.

Sorry for frequent questions but im relatively new :)
#11
Feature requests / Re: Animations
25 December 2021, 15:13:15
You are awesome!
Thank you.
#12
Feature requests / Re: Animations
24 December 2021, 00:09:33
Okey, im gonna try with shadows with textures now because it seems simple.
I've looked up animations and got confused i bit.
I got MoveAnimation from priv namespace.
The animation works! Widgets are moving, but i cant figure out how to make gui handle updates for it.
Thx for explaining the rest :)
#13
Feature requests / Re: Animations
22 December 2021, 23:29:14
Im excited to try animations!
I thought using texture for boxshadows, but now that you added rounded panels this cant be used (i think).
Im gonna try adding it with vertex soon because i did some rounded rectangles last year in sfml and maybe i can do it.
I'll post if i make it!
This is the first time i see braces for implicit conversation tbh.
Thank you for quick response!
#14
Feature requests / Animations
22 December 2021, 21:38:07
I've got couple of questions.
First:
      Is it possible to add animations on setSize() and setPosition()?
      I think it'll make a great addition!

Second:
      BoxShadows? is it possible? I tried adding it to my project with sf::Vertex,
      but i figured its gonna take me a lot of time because its to complex for me.

Third (least important):
      Can you add sf::Vector2f support for setSize() setPosition() as well?
      I have to add x and y separately every time.

I do understand this gui is supposed to be simple, but can you atleast help me on how to implement my own animations?
I am enjoying tgui very much tho :D
Thank you in advance!
#15
Thank you so much for implementing so fast!
I thought that could be a problem too.
I cant think of a solution is actually workable but im sure people will give ideas in future if they really mind it.
Anyway, its great for me! Thanks again  :D