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.

Messages - texus

Pages: 1 2 [3] 4 5 ... 94
General Discussion / Re: Buttons 0.9
« on: 29 May 2019, 19:56:21 »
In your code u wait for mouse up or key up event, correct?
The pressed signal is triggered on mouse up.
For the space and return key the behavior turned out to be a bit less expected. It triggers on a key press event. Which means that if you currently hold the key it will trigger multiple times.

I was going to write that just like the Clicked signal the Pressed signal fires on mouse release, but that made me realize something: you can already "disable" the space and return keys. The difference between the Clicked and Pressed signal is exactly that: Clicked only fires when clicking the button while Pressed also fires when pressing the space or return key while the button is focused. So if you don't want to get a callback on space/return then you can just use the Clicked signal.

Edit: I just looked at how it happens in my browser. Buttons were triggered when releasing the space key but continuously when holding the return key. So maybe I should also have a look at how other libraries handle it.

General Discussion / Re: Buttons 0.9
« on: 28 May 2019, 22:12:51 »
For other widgets I'll keep the amount of out-of-the-box customizability with outlines limited, but I guess for buttons I can put some extra effort into it and allow a different outline thickness (and color) for every state. Buttons are probably the most used widgets after all.

Maybe I should also add FocusedHover and FocusedDown states? Right now you can't tell that a button is focused when it is being hovered.

General Discussion / Re: Buttons 0.9
« on: 28 May 2019, 20:24:09 »
Every state (Normal, hover, etc) can have its own text color.
Every text can have its own style (regular, bold).
This is already possible in TGUI, so they don't need further discussion.

Outline can have a thickness value.
This will definitely be the case once I add support for outlines.

Every text for every state can have its own outline border.
Do you mean outline color or also thickness? Colors I can agree with, but I feel like nobody would ever change the thickness per state even if I made it possible.

Every text can have its own size.
Do you mean for every state? If yes then the text size would have to become part of the renderer. The problem with doing that is that the renderer would include a "size". My idea is to let the renderer contain stuff like colors and let the widget have any size that it wants (so e.g. item height and text size are part of the widget itself). Putting text sizes in the renderer means that a renderer is only suitable for widgets of certain sizes (e.g. a renderer with text size 12px is useless for a button of height 200px), which I want to avoid. So this might be a bit difficult to implement.

Buttons can blink, meaning that over a period of time can change background and text appearence. For instance can tongle between normal sprite and focused sprite. (global timer)
This doesn't look very easy to implement as it requires a "global" state which overrides other focus/hover states. It might be better to implement this in user code. Of course it would be easier if the gui supported it directly, but it looks like a very niche feature. Same goes for other points below where I mention it can be done in your own code, it doesn't mean that it shouldn't be in the gui at all, just that it would get rather low priority.

Every text can have its own vertical and horizontal alignment on a given position inside the button (i can show you some button images if that is not clear).
Could you show some examples of cases where not centering the text looks good?

A button can trigger (or not) from one or more keys. In my game i give the owner the ability to add any key he wants for every available button.
To me this sounds like something that should be done in user code. The user has full control over what keys are pressed and what he wants to do in these cases. I could make things easier by adding a function to Button that calls the connected signal handlers so that the user doesn't has to call them manually.
This probably can't even be implemented at the level of the button itself as key pressed are only passed when the widget is focused and I assume you also mean key presses when the button isn't focused. If you did mean only triggering on these keys when the button is focused then I would like to hear some examples of cases where you use other keys than space and return.

Having 9,there is no need of having "space" and "enter" as default keys out of the box.
I actually want these things to work out of the box. I want TGUI to be as easy to use a possible, so things that most people want should be the default behavior.
The big problem is that I don't have a specific target audience for TGUI which means that it is hard to predict what most people would want and people use TGUI in very different situations and will want different behaviors.
If triggering on space and return remains the default then I do agree that there should be some way to disable the behavior for those that don't want it.

Focusing in my opinion is over estimated but essential when you want to navigate with tab box. Bilinking over rules hovering and focusing.
Being able to tab between widgets is the main reason why focusing even exists in TGUI. That and figuring out which edit box should get the key presses.
If blinking overrules focusing, then basically you can't do anything while something is blinking (except for e.g. pressing the blinking button)?

Pressed time for "m_spriteDown" must be configurable. Action of triggering must be on the last frame. Zero value triggers the button at once showing one down frame.
Do you mean that the down state should automatically jump to normal state even when keeping the mouse button pressed? Can you give some examples where this is used?

Clicks or key presses can have "continuality" or not. Meaning that over pressing time, buttons can re-triggered as long as mouse or key is down.
This could be useful for implementing custom spin buttons where you have one button with a "-" and one button with a "+". Is that what you had in mind or did you know another use case for this?
Although for a spin button I feel like it should trigger immediately on mouse down, then after a "long" time trigger a second time and then each time after a "short" time trigger again. So that would be different from the "continuality", which wouldn't trigger immediately after mouse down? Or maybe it does trigger immediately on mouse down when this "continuality" setting is enabled?

A button can be tongle - switch button. (I saw you think for a different widget. It is not a bad idea having different widget. In my case is configurable (setTongle)).
I'm not sure how to best implement this, but this is the one thing on your list that I find the most important (which doesn't mean that it will be the first thing to be added though).

Hovering can be disabled in touch screens because it is unnecessary (for all widgets).
Touch screen support is something that needs further investigation. TGUI was written as a desktop gui and I've never really used it on a touch screen (except for some brief tests with android), so some there are probably some other improvements that could be made as well. So maybe there should be some global toggle to change touch screen friendliness which would disable hovering for all widgets. The main problem would be to figure out whether a touch screen is used or not, but that would be up to the user. If the user doesn't explicitly asks to disable the hover states then I don't think I should make that decision in TGUI because I can't be certain that the device will only be used as a touch screen.

Batch for rendering.
Currently TGUI 0.9-dev is being designed such that all rendering has to go through a minimal interface. Drawing to the screen is only possible through this interface so everything that gets rendered will be batchable together with other widgets.

Having different text position or and text size you can have very pretty pressed states. The text can grow or can be positioned a little downwards during the pressed event.
This would look nice but I fear that this is hard to do. The user would have to hardcode the text position in the renderer?

Having a simple enum for all button states, you can simplify the code so you can have one function for all states.
That would indeed simplify things.
Ideally I would just have some properties that you can set directly instead of needing setters and getters but that will probably never work (because the widget needs to be notified about some changes such as border thickness and because I would like to be able to cache rendering in 0.9-dev which is only possible if I can detect that changes were made).
Given the huge amount of tunable things in the renderer I even considered having the property, setter and getter (both declaration and definition) generated with a define. The big issue with that is that I wouldn't be able to document the properties.

General Discussion / Re: warnings building latest tgui
« on: 28 May 2019, 19:04:32 »
Thanks, the warnings have been fixed.

The unreachable code warning also shows up in my AppVeyor builds, the others don't.
There still seems to be a signed/unsigned mismatch warning that I get in my VS2017 build that isn't showing up with VS2015, but I'll fix that later (as my VS2017 build is a unity build which makes it harder to find where the warning came from).

General Discussion / Re: Buttons 0.9
« on: 28 May 2019, 08:20:26 »
Just wanted to let you know that I haven't forgotten about this yet, I just haven't had the time yet to go over the list in detail.

General Discussion / Re: About TGUI 0.9-dev
« on: 25 May 2019, 19:37:47 »
the absolute buttons
What did you mean with this part exactly?
Any help to improve TGUI is always welcome, although the look of only buttons isn't going to have much value if the rest of the gui looks completely different.

General Discussion / Re: About TGUI 0.9-dev
« on: 25 May 2019, 16:56:09 »
I was already thinking about doing it for buttons as well.

Adding an outline for all text rendering in TGUI 0.9-dev might not be that hard as long as all texts within the widget use the same outline thickness and color. I'm not looking forward to adding functions to change the outline for each widget state (e.g. different outline for button hover, down and focus states). I actually asked the question because I started adding it to Button and found that it would take quite a while to do that for all widgets.

General Discussion / Re: About TGUI 0.9-dev
« on: 25 May 2019, 16:10:45 »
What happens in future if tgui texts have outline color?
In what kind of situation do you want support for text outline? Maybe it should only be supported in Label to start with?

Help requests / Re: unfocusing widgets
« on: 24 May 2019, 18:04:37 »
I have added a setFocusable function for all widgets. The updated TGUI version can be downloaded from github.

Help requests / Re: unfocusing widgets
« on: 24 May 2019, 17:13:35 »
Perhaps a simple boolean is good enough.
Perhaps. But I don't like that the user would have to do it for every widget he creates. There will always be cases where the default doesn't match what you want and where you need to set the value each time, but I was hoping to find a way on a slightly higher level (e.g. a single function to disable it on all buttons). Maybe something in the theme. Although that sounds similar to earlier TGUI versions where widgets were only focusable if it had a focus texture (with EditBox as exception which could gain focus even without such texture).

The biggest problem is always figuring out what would work best without actually knowing what people want or how they want it. So maybe I should indeed just add the simple boolean toggle to already allow it now and leave the better designs for later.

Help requests / Re: unfocusing widgets
« on: 24 May 2019, 16:46:51 »
The oldest version that I can check is TGUI 0.4 and even there it already responded to pressing space or enter.

What would happen after adding a key to addEventCodeTrigger? I don't see any use case except for this one so I might as well add a function to disable using space and return keys to buttons.

The issue is a bit related to the question of which widgets should be focusable. Some people might e.g. want to be able to focus a slider and use the arrow keys to change the value while other might want the tab key to skip the slider. So if I could find a good way to allow the user to decide which widgets can gain focus then you would be able to solve it by making the buttons unfocusable.

Help requests / Re: unfocusing widgets
« on: 24 May 2019, 14:13:26 »
Yes, something like that.

Help requests / Re: unfocusing widgets
« on: 24 May 2019, 11:34:06 »
Is there any option to disable auto focusing last pressed widget?
No. You can disable it visually so that the user can't tell the difference between focused widgets but that won't solve the issue.
I can see how what you ask makes sense for buttons, but not allowing focusing widgets isn't a good solution in the general case because then you would no longer be able to use edit boxes and similar widgets that rely on the focusing.

If you need some events to go to TGUI while other events should be handled in your code and there is some overlap in the events then you should probably just not call gui.handleEvent for events you want to handle. So basically call gui.handleEvent for every event except for the space key press event.

General Discussion / Re: About TGUI 0.9-dev
« on: 19 May 2019, 10:41:38 »
The renderer that I provide (not to be confused with widget renderers) will continue to use SFML for rendering, so it is unlikely that I will add any features not supported by SFML myself. I will of course open for pull requests if someone can add extra functionality.

It may also be possible to completely swap out the rendering code in the future and replace it with your own code, but at this point I can neither confirm nor deny the existence or nonexistence of a Backends/SFML/BackendRendererSFML.cpp file that would contain all actual rendering code.

General Discussion / Re: About TGUI 0.9-dev
« on: 19 May 2019, 09:48:03 »
May be you meaning milliseconds?
You are right, it should have been milliseconds (I edited the post now). That's what you get when quickly writing a post at the end of the day.

What happens in future if tgui texts have outline color?
In order to batch texts, I couldn't use the sf::Text class and had to implement what sf::Text does in my code. I removed things related to outline because it couldn't be set anyway, but I could add it back when support gets added (and it won't interfere with the batching as it is rendered together with the text). I'm still not sure how to give more control in rendering, this is one of the outstanding issues that I want to solve in TGUI 0.9.

Will this be configurable, meaning select the way tgui renders?
I'm not sure how the relation between widget and renderer will eventually look like. Maybe it will end up being the same as now but with the drawing code split in multiple functions inside the renderer, so that you just have to inherit the renderer and override one function to draw slightly differently. I've been too busy with the batch renderer until now to look into the other parts of the code that needs changing. And the batch renderer still needs some finishing touches before I can start on other parts of the code.

Pages: 1 2 [3] 4 5 ... 94