I know everyone says not to make GUIs in C++, but what would you guys recommend if I were to do so?
Name:
Anonymous2012-05-18 1:00
What is your target platform?
Name:
Anonymous2012-05-18 1:05
Windows
Name:
Anonymous2012-05-18 1:18
Best way is switching to csharp
Name:
Anonymous2012-05-18 2:17
Qt
WxWidgets
GTK
Agar
Name:
Anonymous2012-05-18 4:02
CGI is piss-easy; just read a couple of environment variables (REQUEST_METHOD, PATH_INFO) and emit HTML.
If you want to run it locally on Windows workstations you could either package it with a light web server (NGinX? LigHTTPD?) set to run on port 8080 or just write a simple web server class: /* pseudo-C */
void server(){
int conn;
int sock = socket(AF_INET, SOCK_STREAM, 0);
bind(s, localhost 8080);
listen(s, 1);
while(conn = accept(s, &addr)){
stdout = fdopen(conn, "w");
printf("HTTP/1.0 200 OK\r\n");
printf("Content-type: text/dicks\r\n\r\n");
printf("<html><body><blink><marquee><h1>poo hole</h1></marquee></blink></body></html>\n");
}
}
It doesn't have to handle multiple connections or anything fancy since there's only one user, and can maintain all sorts of gross state to make things even easier.
The best way to make GUIs in C++ is to make an interpreter of a declarative language that describe graphical primitives (think HTML but better). It's basically a scene graph renderer, so make rendering fast (C++) and GUI creation fast (DSL). This can often be faster than making everythin in C++, since C++ classes can't easily be broken up, i.e. what the virtual paint() method does is anyone's guess, and you're bound to the painter's algorithm. But the scenegraph can choose to render front-to-back, and other things.
Examples: Qt Quick, JavaFX, Flex, XUL Runner and XAML
Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy