Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Questions about GUI design

This thread is locked; no one can reply to it. rss feed Print
Questions about GUI design
axilmar
Member #1,204
April 2001

Which is proprietary, and very unuseful to anyone like us. Do they ever plan on making it open source? Probably not, it's their moneymaker.

That's not the point. The point is if my ideas are implemented anywhere, and yes, they are implemented.

Quote:

Obviously you have your own ideas and you don't care for anyone elses. Fine. That's why we have 10 different guis. I don't see myself abandoning what is already mostly working for something totally unwritten to work on a project with someone who refuses to see merit in any design other than his own. You want to be a project leader? Go ahead. But don't expect me to donate any of my time to your project.

Actually I am not refusing to see merit on your design, I am simply rejecting it in favor of a better design. My design has more advantages than yours, plainly and simply, in this area (in another area your design might have more advantages than mine, and so I'd choose your design over mine).

Quote:

And you have your design now, so why don't you go code it then. If it is so much simpler and easier to do it your way then you should be done in no time at all

I've already done it for my job, I am too tired and bored to go ahead and write another gui toolkit on my own.

Quote:

And those are features common to almost every widget. A widget should be able to have a border or margins and a 9 patch background that resizes automatically as they do. And you can leave any or all of it blank and it will not be drawn. It's a feature, not bloat.

Nope. Only some widgets have those features, not all widgets.

EDIT:

Your problem is your ego, actually: you think that your choices are the best, without sitting down and thinking about if they are truly the best.

And no, I do not have the same problem, because what I do is present a list of arguments that support my design, compare them to the list of arguments for your design and find my design better.

And I am admitting that this concerns only specific parts of a GUI library that I have experience on.

If you come up with a better design, then I'd gladly adopt it, something you will not do.

And thus 10 different gui libraries for allegro are born.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

There isn't just one perfect way to do everything axilmar. I expected someone of your age would know that by now.

No, I'm not going to implement your ideas, what I have works for now. If it ain't broke don't fix it. You're welcome to implement your own. And if and when you have something comparable to what I have spent the last 5 years working on then we'll talk.

Edit
----

axilmar said:

Your problem is your ego, actually: you think that your choices are the best, without sitting down and thinking about if they are truly the best.

I never said my ideas were best. I am saying its not worth it for me to re-implement something I have already done another way that is perfectly suitable already.

Quote:

I've already done it for my job, I am too tired and bored to go ahead and write another gui toolkit on my own.

Why should I abandon what I have to start all over with you? That's a serious investment of time to make for something that is still in design stages. My system is nearly complete. What do I get out of this? You say you have the experience to do it, so it should be a relatively simple matter for you to reimplement what you have done already. What do you need my help for? You know everything already, according to you.

axilmar
Member #1,204
April 2001

Your system is nearly complete? You don't even have a single widget yet.

If you don't want to cooperate, that's just fine with me. But don't you ever again say why do we have so many different guis.

jmasterx
Member #11,410
October 2009

Actually, I believe Eagle has several widgets, at least this image depicts this:

{"name":"EagleScreenie.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/5\/8\/585af629d1ee20e7211741423b70fad0.jpg","w":812,"h":632,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/5\/8\/585af629d1ee20e7211741423b70fad0"}EagleScreenie.png

Maybe they just have not been ported from the Allegro 4 version, but that would not be too hard to do... I would think.

Pho75_
Member #12,377
November 2010

There's valuable discussion going on here, let's not get derailed.
Finish the design doc and everybody can implement what parts they want and/or keep their own projects.

I don't think either of you guys has explained in enough in detail why your layout management system is
(better, easier, more flexible) than the other guys.
I'd be amazed if this hasn't been discussed ad-nauseum somewhere else.
How about a link to some other gui layout system that works similarly to what you want to implement.

Meanwhile discuss an interface for the layout system and come back to the details later:
widget->setOrientation(int type);
anything else ???

Meanwhile let's move on.

Returning to the design doc:
============================
Question about this:
“proper clipping; ignore widgets that do not intersect with the clipping rectangle defined by the hierarchy of widgets.”
-you mean ignore rendering of widgets outside parent clip boundary or input also?
-to be clear you're talking about view-clipping and not tracking changes/damage to gui.

widget-rendering:
============================
Requested Features:
-ability to override/disable rendering for a widget (without sub-classing?), without affecting child widgets. Children will be rendered normally.

-separate processing gui layout from the actual rendering.
I should be able to let the GUI do everything (layout+input management) for me and
I can still draw all the widgets myself if I so choose.

-widget->RenderOver : eg: over-hanging tabs

-widget->RenderUnder: eg: drop-shadows

Let's discuss render-backend:
============================
Support multiple render methods:
Eg:
1. SimpleRender – painter's algorithm (Render widgets back to front).
CONS: Slow
PROS: easy to implement when:
a) adding a new back-end (this is phase #1)
b) performance doesn't matter
c) no support for buffering (legacy / embedded / low-memory / ???)
2. CacheRender -
TODO: We haven't discussed tracking damages/changes for redrawing widgets
How to handle transparency/translucency?

-do you need to query what features are available?
-allow switching between render methods?

Should this be a class/interface?

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

jmasterx said:

Maybe they just have not been ported from the Allegro 4 version, but that would not be too hard to do... I would think.

Yes, just a matter of replacing some drawing calls and updating a few functions to match the new specs. But still I haven't had time for it yet. I have to update BITMAP* to EagleImage* too. I also have to replace Update and CheckInputs to use EagleEvent's. So there is a decent amount of work to be done yet.

axilmar said:

Your system is nearly complete? You don't even have a single widget yet.

Eagle4 is functional, but again, it depends on Allegro 4. It has lots of widgets, like button, bitmap viewer, camera, drop down list, scroll bars and buttons, icon button, list box, menu item and menu and menu bar, radio button, slider, tab and tab group. There is a file selection dialog and a gfx mode selection dialog. But, it has to be ported.

axilmar
Member #1,204
April 2001

Eagle4 is functional, but again, it depends on Allegro 4. It has lots of widgets, like button, bitmap viewer, camera, drop down list, scroll bars and buttons, icon button, list box, menu item and menu and menu bar, radio button, slider, tab and tab group. There is a file selection dialog and a gfx mode selection dialog. But, it has to be ported.

Oh, ok, I didn't see any widget code in the svn repository.

Well, if your system is nearly complete, then you don't need any help, do you? the discussion is pointless then, when it comes to a unified Allegro gui system.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

axilmar said:

Oh, ok, I didn't see any widget code in the svn repository.

I told you earlier it was in a different repo :
svn checkout "svn://svn.code.sf.net/p/eaglegui/code/trunk eaglegui-code"

My system is hardly complete, but its got all the pieces there alright. The system and events and input and drawing are all there but the gui pieces haven't been assembled yet, so their design is subject to modification. If there's anything I am interested in it is widget design and I know I could probably simplify a lot of my code, but I think my menus are that complex just because they are complex to begin with.

Anyway, I'm all for discussion.

edit
I think you think I should turn my library into what your idea of a library should be. That seems silly, and too much refactoring. Also the idea of starting over from nothing is silly and a complete waste of my collected gui work. So we're at somewhat of an impasse.

I don't mind contributing code and possible design discussion, but I don't want to be a full contributor. I already have one library to look after...

axilmar
Member #1,204
April 2001

Well, ok. I work full time anyway, so if you complete your library, kudos to you. As I said earlier, I am too bored to do it alone.

I didn't speak for a complete rewrite, of course, if we were to start over we'd bring the good parts of Eagle5 onto this library.

Edit: by the way, there are lots of other libraries we could use. For example:

http://sourceforge.net/projects/my-gui/?source=directory

Another nicer one:

http://static.cegui.org.uk/docs/current/

Edit2: wow, CEGUI is complex!!! why do they make such software...a gui library is a simple concept, it need not be so complex!!!

jmasterx
Member #11,410
October 2009

One major reason I think we have over 10+ guis is the following. Most people's motivation is to make a game, not a gui. But to make their game, they need a gui. They are therefore motivated to make a gui that will help them make their game.

If people are blindly contributing to a gui api, without any personal gain (eg, be able to use it in their own game) motivation significantly decreases.

This is probably also why we do not see many game engines. Good game engines should not really have a specific purpose, but without a specific purpose, motivation probably decreases after the first few weeks.

My motivation behind agui was for my card game, but I also hoped it could be useful for others so I made it backend independent and open source. Had my mindset been: I want to make 1 great gui that will satisfy all gui needs for no particular purpose, I would have probably not made it past a button.

I think this is also why there is nothing out there comparable to QT that is free and open source. Generally if people are motivated enough to complete a gui api, it will serve the purpose of being used in their software or it will be proprietary and sold.

That's how I see it.

bamccaig
Member #7,536
July 2006
avatar

A GUI is complex. You can certainly limit the scope of it, but you will be limiting its functionality. That will make it more suitable for some purposes, and less suitable for others. You need to fully define what purposes it should be suitable for to do that. "Games" is not defined.

axilmar
Member #1,204
April 2001

Personally, my motivation is quality software. I'd like to see a good gui library that will help all of us quickly create guis and with as few bugs as possible.

Elias
Member #358
May 2000

This reminds me a lot of an open source game called Wesnoth I contribute to. They started replacing their GUI system about 5 years ago because their original GUI code was just hacked together.

However despite a lot of continuous work on it the new GUI (called GUI2) still is nowhere near done and they are not using it yet. The source looks like this: [1]

I sometimes wonder if they will ever get to use it. I'm pretty sure they originally thought it would at most take a year or so to implement a simple GUI. And theirs also is designed specifically for one single game with no intention to ever use it for something else, so something much easier than a general one...

--
"Either help out or stop whining" - Evert

Polybios
Member #12,293
October 2010

Ok, say I want to use one of the GUIs kindly made available by people here before I spend weekends/months rolling my own. Wouldn't it be nice to agree on a (not too) simple example use case to see how that could be achieved with the different GUIs people have made here? I'd like to see some code, how to actually use the GUIs, in comparison. I can't think of a good example right now, though. Maybe that's the problem, as everyone here has different requirements. But it all comes down to the user pressing some buttons after all. ::)

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

My goal with my library is to provide the ease of gui programming with Java inside a C++ environment. And to make better built in layout managers than what Java provides, because they lack a lot of features. The one feature that they totally needed was a pin layout, where you specify coordinates from 0 to 1 and widths from 0 to 1. All relative to the container they are in. Or how FlowLayout needs a vertical alignment component, and how you need to be able to have empty places in a GridLayout without using invisible widgets. That sucks.

What is a good compiler to aim to support now? mingw32-gcc 4.7 and 4.8 support -std=c++11 and -std=gnu++11 and the latest version of mingw binaries for allegro is 4.7. To be honest I never really learned all the new features of C++ 11.

axilmar
Member #1,204
April 2001

that they totally needed was a pin layout, where you specify coordinates from 0 to 1 and widths from 0 to 1

Is that really needed? I mean, is there a use case where the contents of a container must scale uniformly? I have never seen such a case in all these years.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

I think I would find it handy at least. And it is simple enough to provide it anyway. And my GridLayout is going to support per cell horizontal and vertical alignment. As well as allowing cells to span multiple columns or rows like Java's GridBagLayout.

axilmar
Member #1,204
April 2001

Personally, I do not really see the need for cell horizontal and vertical alignment or a pin layout. So far every case of layout I have seen is covered by the following layouts: flexible, center, stack, grid, box (either horizontal or vertical).

For example, in order to achieve left-center alignment in a grid cell, I'd create a horizontal box with a centering box that includes the desired widget and a flexible box to push the centering box to the left.

For spanning multiple columns or rows I'd create a simple layout which simply drags the bottom left-corner of a widget to its own bottom left corner.

From experience I've seen that lego-like composition is nicer than programming specific features, if it can be avoided.

Elias
Member #358
May 2000

Why not use CSS for layout?

--
"Either help out or stop whining" - Evert

axilmar
Member #1,204
April 2001

Isn't CSS a bit too much to make a library of? it needs a parser, doesn't? also, doesn't it need a DOM or something similar?

Pho75_
Member #12,377
November 2010

Complicated or not: wouldn't a CSS layout manager just be another layout container widget?

axilmar
Member #1,204
April 2001

Pho75_ said:

wouldn't a CSS layout manager just be another layout container widget?

Actually no. A CSS document contains style instructions for a whole GUI (or HTML document). It's more like a skin.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

axilmar said:

For example, in order to achieve left-center alignment in a grid cell, I'd create a horizontal box with a centering box that includes the desired widget and a flexible box to push the centering box to the left.

What? Managing an invisible widget for the sake of alignment? That sounds like having to use invisible widgets as placeholders in Java's GridLayout. That sounds like a bad idea.

Quote:

For spanning multiple columns or rows I'd create a simple layout which simply drags the bottom left-corner of a widget to its own bottom left corner.

Why not just give it a cell x,y,w, and h?

bamccaig
Member #7,536
July 2006
avatar

Personally, I think that rather than looking for pixel-perfect GUIs we should seek fully dynamic GUIs that Just Work(tm). I'd prefer a GUI with zero coordinates or widths/heights. Something that just magically made everything flow together no matter how you resized things, etc. I only briefly worked with Qt tutorials, but I was quite pleased with the layout widgets that effectively did this for you. I'm sure that gets bastardized with fixed coordinates and dimensions, but it seems possible at least to leave that stuff out of the picture. You probably shouldn't want empty space in your UI. And when there has to be empty space, you should let the UI API figure out how to use it appropriately with subtle hints in the programming. The positioning and sizing should all be dynamic, IMO.

axilmar
Member #1,204
April 2001

What? Managing an invisible widget for the sake of alignment? That sounds like having to use invisible widgets as placeholders in Java's GridLayout. That sounds like a bad idea.

It's a great idea. You can create very complex guis very easily, even with one liners.

Actually, it's not an idea, it's the way DFUW's J2F framework works. It has an existing implementation.

Quote:

Why not just give it a cell x,y,w, and h?

Because a cell is redundant in this case.

Imagine having a grid of 10000x10 items, for example: if you have one cell object per cell, then you'll have 100,000 objects.

And if you think that 10000x10 is a rare case, it is not. Many games need that, to present long lists of items (market, leaderboards, achievements, etc).

bamccaig said:

Something that just magically made everything flow together no matter how you resized things, etc.

That's exactly what I am talking about.

In DFUW's new GUI system, the position and sizes of widgets is never specified. It's always computed automatically from the layouts.

For example, the chat window of DFUW is made entirely out of layouts:

http://www.youtube.com/watch?v=jU4ulaqYZfA

Take a minute to watch the video, it's pretty interesting: the chat window contains several popups, one of them being the chat options, which is quite complex: it has radio buttons, check boxes, labels, text boxes with custom backgrounds, accept and reject buttons, a dynamic list box, a scroll bar etc.

It's all made with layouts.

And if you play Darkfall and you switch languages, the chat window and its popups all automatically adjust themselves to the size of the fonts used in other languages.



Go to: