|
Poll: Allegro 5 GUI in C or C++? |
Mark Oates
Member #1,146
March 2001
|
An Allegro 5 GUI has the added complication of integrating multiple displays. It's a serious challenge. bamccaig said: You just go right after the data. It's bad practice to though because it's error prone and limits code reuse. In C, accepting a void * is a very common way to pass any arbitrary data into an API. Not using it is your fault; not the API. Again, it's not easier, but it's more correct, less error prone, and overall cleaner than using a global. If you want easier then you shouldn't be using C (nor C++) in the first place. Any kind of messaging or event system will pretty much need to resort to the same thing to pass arbitrary data around; unless it doesn't pass any data around and just assumes the message or event loop already has that data, but then that could require globals for some applications. BamBam... bambam... you need to try using more globals. All this void* cast with struct type identifier overhead workaround is more error prone than a single global. -- |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Bamccaig said: Any kind of messaging or event system will pretty much need to resort to the same thing to pass arbitrary data around; unless it doesn't pass any data around and just assumes the message or event loop already has that data, but then that could require globals for some applications. A widget messaging system has no need to pass any data around at all. You get the message from the widget, decide what to do based on which widget and what message it is, and then you do it. It makes it far easier to deal with an action locally as opposed to globally or wasting your time binding a 1000 different sets of data into 1000 different structs and having a custom callback function for each of your 1000 different structs. Bamccaig said: In C, accepting a void * is a very common way to pass any arbitrary data into an API. Not being forced to use it should be a valid choice. If you want easier then you shouldn't be using C Fixed X 2. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Thomas Fjellstrom
Member #476
June 2000
|
Mark Oates said: An Allegro 5 GUI has the added complication of integrating multiple displays. It's a serious challenge. What would probably make the most sense, is not having any fancyness in the api at all. You would be required to call the event pump function for the gui, as well as the drawing function, every loop, and pass in the display to draw to, etc. -- |
Evert
Member #794
November 2000
|
Edgar Reynaldo said: Taking the time to bind all the necessary information to that struct takes more time and takes more work to access than using global data in the first place. Possibly. Depends on whether you intend to re-use that function or not. If you do, best not to touch global data! Quote: A4's gui encourages use of global data. Sure you can get around it, but it's easier not to. That's again debatable, but it's not what you said earlier where you claimed you "have to use global data". It's ok, you don't like the A4 GUI. You don't have to either, and you don't have to rationalise it as far as I'm concerned. If you do though, at least keep your arguments consistent. Quote: All of that behaviour could have been easily prevented by making a slider widget that queues a value_changed message. That piece of code looks pretty obscure to me though! Quote: If someone does decide to make a C GUI for Allegro 5, please don't base it off of A4's gui, for the sake of your users.
Not even for the sake of those who like the A4 GUI? But don't worry, I'm sure that eventually different people will make different GUI addons since there's clearly room for different approaches here. |
axilmar
Member #1,204
April 2001
|
Mark Oates said: An Allegro 5 GUI has the added complication of integrating multiple displays. It's a serious challenge. My approach is very simple (already implemented): the GUI does not have a global state; all the state of the GUI is kept into the widgets, so one can run many widget trees at the same time and in parallel. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Evert said: That's again debatable, but it's not what you said earlier where you claimed you "have to use global data". Fair enough. Evert said: Also, to get back to an earlier point in the discussion, it doesn't require C++ either (Allegro 5's event system is C, afterall). Yeah well, consider me proven wrong. SiegeLord's and Matthew Leverton's designs seem reasonable enough to me. Still, using a this pointer seems rather archaic now that I use C++. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Evert
Member #794
November 2000
|
EDIT: seem to have somehow double posted with half an hour in between... |
GullRaDriel
Member #3,861
September 2003
|
That's because you're travelling quicker than the light, Evert. "Code is like shit - it only smells if it is not yours" |
axilmar
Member #1,204
April 2001
|
I've added a gui project to github, if anyone is interested. |
bamccaig
Member #7,536
July 2006
|
The example program doesn't actually seem to show me any GUI widgets. I don't know if it's because my Makefile is doing something wrong or if I'm just not using the program properly. Should it be drawing something? What platform(s) have you tried it on? Or is it just an empty shell right now that needs to be filled in? -- acc.js | al4anim - Allegro 4 Animation library | Allegro 5 VS/NuGet Guide | Allegro.cc Mockup | Allegro.cc <code> Tag | Allegro 4 Timer Example (w/ Semaphores) | Allegro 5 "Winpkg" (MSVC readme) | Bambot | Blog | C++ STL Container Flowchart | Castopulence Software | Check Return Values | Derail? | Is This A Discussion? Flow Chart | Filesystem Hierarchy Standard | Clean Code Talks - Global State and Singletons | How To Use Header Files | GNU/Linux (Debian, Fedora, Gentoo) | rot (rot13, rot47, rotN) | Streaming |
SiegeLord
Member #7,827
October 2006
|
bamccaig said: The example program doesn't actually seem to show me any GUI widgets. I don't know if it's because my Makefile is doing something wrong or if I'm just not using the program properly. Should it be drawing something? What platform(s) have you tried it on? Or is it just an empty shell right now that needs to be filled in? Try pressing keys 1, 2 or 3. "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
bamccaig
Member #7,536
July 2006
|
SiegeLord said: Try pressing keys 1, 2 or 3. OK, now I see. Thanks. -- acc.js | al4anim - Allegro 4 Animation library | Allegro 5 VS/NuGet Guide | Allegro.cc Mockup | Allegro.cc <code> Tag | Allegro 4 Timer Example (w/ Semaphores) | Allegro 5 "Winpkg" (MSVC readme) | Bambot | Blog | C++ STL Container Flowchart | Castopulence Software | Check Return Values | Derail? | Is This A Discussion? Flow Chart | Filesystem Hierarchy Standard | Clean Code Talks - Global State and Singletons | How To Use Header Files | GNU/Linux (Debian, Fedora, Gentoo) | rot (rot13, rot47, rotN) | Streaming |
Matthew Leverton
Supreme Loser
January 1999
|
For what it's worth, my GUI also uses the algui_ prefix. I don't really care at all if you use the same, but I won't be changing mine if I ever do release it. |
bamccaig
Member #7,536
July 2006
|
I was wondering about that. I just wasn't going to be the one to say anything. -- acc.js | al4anim - Allegro 4 Animation library | Allegro 5 VS/NuGet Guide | Allegro.cc Mockup | Allegro.cc <code> Tag | Allegro 4 Timer Example (w/ Semaphores) | Allegro 5 "Winpkg" (MSVC readme) | Bambot | Blog | C++ STL Container Flowchart | Castopulence Software | Check Return Values | Derail? | Is This A Discussion? Flow Chart | Filesystem Hierarchy Standard | Clean Code Talks - Global State and Singletons | How To Use Header Files | GNU/Linux (Debian, Fedora, Gentoo) | rot (rot13, rot47, rotN) | Streaming |
Ron Novy
Member #6,982
March 2006
|
Matthew Leverton, release it. Set it free. Let it roam free and be with it's own kind... Let it go. Let it grow. And some day it will use Allegro mind control to take over the world...
Just realized that Matthew Leverton must also be his porn name... Lever-Ton Arg! Why do I think up these things!
---- |
Mark Oates
Member #1,146
March 2001
|
Because you watch too much porn, Ron. Because you watch too much porn.
-- |
Ron Novy
Member #6,982
March 2006
|
That's just not true... I don't watch porn. I make it!
Stunt double! Where are you?
---- |
Trezker
Member #1,739
December 2001
|
I'm making a C++ GUI lib with the following features. And possibly more coming. Of course, even this basic list of features are under rather slow development since I have a full time coding jorb and is very tired in the evenings. I named the project SWAG. |
type568
Member #8,381
March 2007
|
And during the process of making, you're not looking?
|
axilmar
Member #1,204
April 2001
|
bamccaig said: The example program doesn't actually seem to show me any GUI widgets For now, the example program is the testing ground for the new features. It currently tests drawing, widget tree management, focus and layout management. Matthew Leverton said: For what it's worth, my GUI also uses the algui_ prefix. I don't really care at all if you use the same, but I won't be changing mine if I ever do release it. I will change it then, but in the future. |
Johan Halmén
Member #1,550
September 2001
|
type568 said: And during the process of making, you're not looking? A Finnish stand-up commedian pointed out that in Finland you're allowed to have sex at 16. And you're allowed to look at hard core porn at 18. So if a couple of 16 year olds are filming their act, they're allowed to look at the film only after two years. <edit> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest. |
Ron Novy
Member #6,982
March 2006
|
It would be nice to have a few official A5 GUI libraries to choose from... ---- |
Johan Halmén
Member #1,550
September 2001
|
It's not important that a GUI lib has a good set of gadgets. It's important that it's easy to write your own gadgets. If they are easy to create, then there will anyway automatically be a set of them in the first place, made by the creator of the GUI. And a good C++ lib is better than a lousy C lib, whereas a good C lib is better than a lousy C++ lib. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest. |
type568
Member #8,381
March 2007
|
Johan Halmén said: A Finnish stand-up commedian pointed out that in Finland you're allowed to have sex at 16. And you're allowed to look at hard core porn at 18. So if a couple of 16 year olds are filming their act, they're allowed to look at the film only after two years. Killed me.. So true, in Israel and many many other countries- it's the same.. However, I wonder how it goes if they film it, if they're allowed to and, or.. ? Kinda it's obvious that port would not be allowed to be sold cos' the actors have to be over 18 as well, but if they shot it(didn't look at it for 2 years), why the hell can't they sell it afterwards?! P.S:
|
AMCerasoli
Member #11,955
May 2010
|
So now we have four candidates working to create the best GUI for Allegro! Which are: axilmar: from Athens, Greece, 10 Years in the community. His web page has 50.000 visits per day. Edgar Reynaldo: from Vermont, United States 4 Years in the community. Very well known by his game on the depot entitled: "This member has no projects listed". Matthew Leverton: from Illinois, United States 12 years in the community. Many people say he was the original inventor of Tetris. Trezker: from Sweden, 10 Years in the community. Very well known for selling his "Map and terrain generator" to Google to create, Google Earth. So who you think is going to come up with the best GUI lib for this beautiful librarie? do your bets now!
|
|
|