Allegro.cc - Online Community

Allegro.cc Forums » The Depot » new GUI library for Allegro.

This thread is locked; no one can reply to it. rss feed Print
new GUI library for Allegro.
axilmar
Member #1,204
April 2001

Hi all.

I am announcing a new allegro GUI project in C++ with working title "ALGUI". The purpose of this library is:

1) to be able to write application GUIs (game tools, etc).
2) to be able to write game GUIs.

The library has the following features:

  • pass-by-name semantics for object construction; no longer you need to write or remember many different constructors for an object.

  • support for left-handed mouse.

  • a global thread-safe event queue; events can be sent to the main queue from any worker thread.

  • an object-oriented event system; each event is an object.

  • reference-counted wrappers around primitives: bitmap, font, string, cursor.

  • queued mouse and keyboard input; allegro callbacks are hooked and mouse/keyboard input is placed in an internal buffer so as that they are not lost.

  • properties; no longer you need to remember get and set functions.

  • signals and slots

  • a simple widget styling mechanism based on allegro config routines.

  • customizable screen updating mechanisms: by default, the library provides a double buffered mechanism for apps/games and a direct one used for full screen games.

  • widget reflection; I will make a GUI Form designer that will use the reflection info to interface with widget libraries.

  • model-based architecture; most widgets are views. Models include: command, value, range, vector, list, set, tree, table, document. Models have an STL interface where expected.

  • easiest drag-n-drop between widgets (not with other apps though).

  • support for truetype fonts through the alfont library.

  • thread support through the pthreads library.

  • variant and typesafe variable argument lists.

  • weak and shared ptrs.

  • automatic widget layout.

The list of widgets includes:

  • line

  • panel

  • push button

  • toggle button

  • check box

  • radio button

  • button frame

  • scroll bar

  • progress bar

  • text box

  • combo box

  • spin box

  • text view

  • list view

  • tree view

  • table view

  • icon view

  • window

  • dialog

  • message box

  • tab pane

  • tab page

  • menu

  • menu item

  • app screen

  • toolbar

  • tool push button

  • tool toggle button

  • tool radio button

The attached file contains the source code, the documentation for all the features mentioned above, and a small style file.
Except the widgets, that is :-) (but now that the core is done, adding widgets should be easy).

I aim for the easiest style of programming possible with C++. GUI apps will be something like this:

1#include "algui.hpp"
2 
3int main() {
4 //init allegro and stuff
5 allegro_init();
6 install_keyboard();
7 install_mouse();
8 install_timer();
9 set_color_depth(32);
10 set_gfx_mode(GFX_AUTODETECT, 1024, 768, 0, 0);
11 show_mouse(screen);
12 
13 //load resources
14 DATAFILE *res = load_datafile("myapp.dat");
15 
16 //the application's models
17 Command newCommand(command = slot(newProc), enabled = true);
18 Command openCommand(command = slot(openProc), enabled = true);
19 Command saveCommand(command = slot(saveProc), enabled = false);
20 Value<int> intData(value = 5, modified = slot(intDataModifiedProc));
21 Vector<float> floatData(size = 10);
22 Tree<String> stringData;
23 ...
24 
25 //the gui tree
26 SharedPtr<Screen> guiScreen = new Screen(width = SCREEN_W, height = SCREEN_H);
27 Menu *mainMenu = new Menu(parent = guiScreen);
28 MenuItem *fileMenuItem = new MenuItem(parent = mainMenu, text = "&File");
29 ToolBar *mainToolBar = new ToolBar(parent = guiScreen, text = "Main");
30 ToolButton *newButton = new ToolButton(parent = mainToolBar, bitmap = (BITMAP *)res[NEW_BITMAP].dat, command = newCommand);
31 ...
32 
33 //apply style
34 Style style1("default.algui");
35 guiScreen->setStyle(style1);
36 
37 //open screen
38 guiScreen->activate();
39 
40 //event loop
41 while (loopFlag) {
42 yield_timeslice();
43 updateGUI(screen);
44 }
45 
46 return 0;
47}
48END_OF_MAIN();

CGamesPlay
Member #2,559
July 2002
avatar

That pass-by-name stuff looks like it pollutes the global namespace quite a bit...

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

Thomas Fjellstrom
Member #476
June 2000
avatar

Quote:

The list of widgets includes: ...

Quote:

The attached file contains the source code, the documentation for all the features mentioned above, and a small style file.
Except the widgets, that is :-)

Don't those two statements conflict a little? The gui includes all those widgets, yet they arn't in the file, or even coded?

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Jonny Cook
Member #4,055
November 2003

Looks very impressive! It's almost like Qt for Allegro! :o I have been looking for a good GUI to use (gave up making one myself :P) so maybe I'll try this.

Quote:

Don't those two statements conflict a little? The gui includes all those widgets, yet they arn't in the file, or even coded?

Not really... he said it includes all of the about except for the Widgets. He finished the core (most likely the hardest part), so now I he just has to code the widgets.

The face of a child can say it all, especially the mouth part of the face.

Steve Terry
Member #1,989
March 2002
avatar

Wish I had more time and will to code at home or I would code the widgets. Too bad NAS and AWE died but now that I've been doing quite a bit of C++ coding I think a good C++ GUI is a better idea.

___________________________________
[ Facebook ]
Microsoft is not the Borg collective. The Borg collective has got proper networking. - planetspace.de
Bill Gates is in fact Shawn Hargreaves' ßî+çh. - Gideon Weems

axilmar
Member #1,204
April 2001

CGamesPlay said:

That pass-by-name stuff looks like it pollutes the global namespace quite a bit...

A pass-by-name parameter is a global variable declared in the namespace algui::arguments.

Thomas Fjellstrom said:

Don't those two statements conflict a little? The gui includes all those widgets, yet they arn't in the file, or even coded?

Jonny Cook said:

Not really... he said it includes all of the about except for the Widgets. He finished the core (most likely the hardest part), so now I he just has to code the widgets.

Indeed, the core is probably the hardest part. You've got to design the interfaces and all the silly stuff that later stuff will depend on. You've got to be careful.

Jonny Cook said:

Looks very impressive! It's almost like Qt for Allegro! :o I have been looking for a good GUI to use (gave up making one myself :P) so maybe I'll try this.

We all have done so. The allegro.cc forum is filled with topics about GUI and allegro.

Steve Terry said:

Wish I had more time and will to code at home or I would code the widgets. Too bad NAS and AWE died but now that I've been doing quite a bit of C++ coding I think a good C++ GUI is a better idea.

Hi Steve! This is what I wanted AWE to be, to be honest...but as you can see, it is very difficult, on the verge of being impossible, to do all this stuff in C.

I will start coding widgets as soon as it is possible and when I have the time (an 8-hour programming job does not leave you with much room). The next release will hopefully contain many small widgets and a web site; I have also got to finish the models part (list, tree, table), so don't expect anything in the very near future.

Matt Smith
Member #783
November 2000

I thought we had all agreed that the ALGUI name was reserved for whichever gui is adopted as the official add-on in Allegro 5

Personally I see less need to start a new one than to finish some of the existing ones, and provide the necessary RAD tools to use them effectively.

CGamesPlay
Member #2,559
July 2002
avatar

Quote:

A pass-by-name parameter is a global variable declared in the namespace algui::arguments.

I'm going to assume that your example is missing the using declaration and also that algui.hpp doesn't have it, because otherwise it is pretty worthless to be using the namespace :)

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

Thomas Fjellstrom
Member #476
June 2000
avatar

Quote:

Not really... he said it includes all of the about except for the Widgets.

Right, I quoted that too, but up above that he stated that it INCLUDES a large list of widgets. The two statements conflict.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Go to: