Windowing library

So I'm working on a project and need to load up a window however the only information I can find is for windows (windows.h) and the project is kind of stalled for now so any help would be nice, My first goal for this project is simply to make a Hello World window, after that I'll get down to the rest of it anyway thanks in advance.

--Ela
closed account (Dy7SLyTq)
if you want to stick with windows... ncurses. gui: opengl
I recomend GTK+ or QT.
I second GTK+ and QT.

One thing I love about GTK+ is how easy it is to make the user interface using XML.

An example:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//
// main.cpp
//

static void setup_ui()
{
	GtkBuilder* builder = gtk_builder_new();

	// Load everything about the window from a file named `builder.ui'
	gtk_builder_add_from_file(builder, "builder.ui", NULL); 

	window = GTK_WIDGET(gtk_builder_get_object(builder, "window"));
	/* Add buttons, text areas, scrollbars, etc. here... */

	// Quit program when window is closed, or "destroy"ed
	g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
}


int main(int argc, char** argv)
{
	// Required to use GTK+ functions...
	gtk_init(&argc, &argv);
	
	// Our function below sets up the entire user interface
	setup_ui();

	// Everything is hidden by default, so let's show it
	gtk_widget_show_all(window);

	// This is the main loop that keeps the user interactions going until the application is quit
	gtk_main();

	return 0;
}


and the user interface file (named `builder.ui' here...)
1
2
3
4
5
6
7
8
<interface>
  <object id="window" class="GtkWindow">
    <property name="visible">True</property>
    <property name="title">Hello, World!</property>
    <property name="default-width">800</property>
    <property name="default-height">600</property>
  </object>
</interface>


While the XML may seem odd, you can look up how to use it fairly easily. Also, if you prefer not to write the XML by hand, you can use a program called Glade to edit the .ui file graphically. It writes the XML for you, and you just use it in your project.

GTK+ website: http://www.gtk.org
GTK+ reference: https://developer.gnome.org/gtk3/stable/
Glade UI designer: https://glade.gnome.org
----------------------
BTW, the example I gave used was for the C syntax instead of the C++ bindings (you can use either one for C++). If you are that interested, though, you could look at the C++ bindings: http://www.gtkmm.org/en/
----------------------
I haven't used Qt all that much, but take a look: http://qt-project.org

GTK+ and Qt both also offer more than just getting a window on the screen. They both offer a lot of convenience functions. For example, the GLib library includes a parser so you can read XML files and settings files really easily.

Lastly, don't let the screenshots of a particular library be the thing to convince you to use that library. For whatever reason, some really good interface libraries use really bad/out of date screenshots.
Topic archived. No new replies allowed.