370 likes | 890 Views
Cross-platform GUI Frameworks for 3D Apps and Games: Qt vs wxWidgets. April 1 , 2011 Nima Nikfetrat AmirSam Khataie. Introduction. Ultra Entertainment , a new game development company GUI frameworks to accelerate the production of: 3D tools / editors for game development .
E N D
Cross-platform GUI Frameworks for 3D Apps and Games:QtvswxWidgets April1, 2011 NimaNikfetrat AmirSamKhataie
Introduction • Ultra Entertainment , a new game development company • GUI frameworks to accelerate the production of: • 3D tools / editors for game development. • C/C++ Cross-platform GUI frameworks • Qt • wxWidgets. • Third-party or built-In GUI generators: • “QtDesigner” • “DialogBlocks” • We present candidate frameworks and tools • Present our 3D sample applications • Ranking for each section
Introduction • How the company uses or sells our 3D tools: • Binary Tools + Source codes (Game Engines): • To distribute/sell the binary format + source codes • A few customers ($1,000$ to $+50,000 per license / per game) • Binary format tools (Game / Apps): • Only binary format (bundled with the game) • Thousands of customers Rank: Poor (1) to excellent (5)Criterion: Low impact (1) to High impact (4)
Introduction of wxWidgets • wxWidgetswas started in 1992 by Julian Smart at the University of Edinburgh • Initially for Unix andWindows • Later Mac platform, WinCE, etc. • Supported by volunteers (such as AOL) • GUI framework + more : • Network, • Clipboard , drag & drop, • Multithreading, • Image loading and saving, • Database, Platform Details: wxGTK (GTK+ 2.0) wxX11 (X11) wxMotif (X11 using Motif) wxOSX (Cocoa or Carbon API) wxMSW (Windows API)
For each compiler and platform: • Libraries must be compiled (very fast, less than 5 minutes) • Configuring compilers are a bit complex and different Hello world, wxWidgets classMyApp : publicwxApp { public: virtualboolOnInit(); }; //------------------------------------------- classMyFrame : publicwxFrame { public: MyFrame (constwxString& title); voidOnQuit (wxCommandEvent& event); voidOnAbout (wxCommandEvent& event); private: DECLARE_EVENT_TABLE() }; // Using Macros BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU (Minimal_Quit, MyFrame::OnQuit) EVT_MENU (Minimal_About, MyFrame::OnAbout) END_EVENT_TABLE() IMPLEMENT_APP (MyApp)
wxWidgets features • Widgets will be defined with IDs • (Similar to Win32 API) • Uses Macros for Event handling • (Similar to MFC) • Platform specific flags for methods/classes: • Always documentations must be checked • Lacks: • No integrated UI builder • No integration with compilers (Only manually as a library) • A third party GUI generator is really needed
DialogBlocks (A GUI Generator for wxWidgets)
DialogBlocks • Price: $90 (student $47) • DialogBlocksis NOTadrag-and-drop tool !! • More efficient portable dialogs with sizers • Can create “gcc” / “VC++” project files • Using outputs of DialogBlocks: • generated C++ .h and .cpp file • A separate XRC resource file (for each dialog) • A global XRC resource file (contains all dialog resources) • copy and paste the C++ or XRC code into your own project
No Drag&Drop Any platforms
OpenGL in Qt (3D Rendering) • wxGLCanvasclass, 3D view can be displayed on: • widgets • wxPanel • wxFrame • To display: • Split the window: wxBoxSizer • Flags: wxHORIZONTAL,wxVERTICAL
Introduction of Qt • Nokia acquired Trolltechfor $153 million, 2008 • Not the end of freedom for Qt: • GPL license LGPL (Qt4.5, March 2009)
Hello world, Qt #include “myApp.h" #include <QtGui/QApplication> intmain(intargc, char*argv[]) { QApplication app(argc, argv); myApp win; win.show(); returnapp.exec(); } • setupUi: Automatic UI generation • .uifile: An XML-based file format buttonBox= newQDialogButtonBox(test1Class); buttonBox->setObjectName(QString::fromUtf8("buttonBox")); buttonBox->setGeometry(QRect (80, 320, 156, 23)); buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
Signals and Slots, Qt // ** Auto-Connect ** private slots: voidon_pushButton_clicked(); // void on_<object name>_<signal name>(); voidmyApp::on_pushButton_clicked() { QMessageBox::information(this, tr("Text"), lineEdit1->text(), QMessageBox::Cancel); } // ** Without Auto-Connect ** connect (pushButton, SIGNAL (clicked()), this, SLOT (showTextMSg())); // Notice Macros and new keywords
Qt Visual Studio integration • No complex setup • No libs configuration • Exclusive Qt Menu and wizard available • Dynamic or static libs
Qt Designer (GUI Generator for Qt)
Qt Designer • Edit Signal / Slots • First Implement methods in .cpp • Connect signals to slots • Example: clicked() showText()
Qt Designer • Extended properties • Visual text paragraph, font , color editor (html format)
Qt Designer • Style sheet: • Customizing appearance of widgets • ToolTip • WhatsThis • Morph to other widgets
QtDesigner’s .ui file (XML) to C++ • The qmaketool: • detects .ui file • generates the makefilerules • The uictool: • converts .ui file into C++ • puts the result in ui_name.h
OpenGL in Qt (3D Rendering) • QGLWidgetclass: • Enable OpenGL graphics to be rendered within a UI. • 3D scenes can be displayed on widgets (can be placed in layouts) • QGLShaderclass: • Compiling OpenGL shaders • Displaying: • QGLWidget subclass as a QtDesignerplugin • Manually inside the source codes
Comparison and Evaluation
Property Editor • Required for any Game editors • Available for Qt : • QtPropertyBrowser framework(bysource codes from Nokia) • Available for wxWidgets: • wxPropertyGrid (Active SourceForge project) (Now Part of wxWidgets)
Summary of Evaluation Rank: Poor (1) to excellent (5) Criteria: Low impact (1) to High impact (4)
Summary of Evaluation • Advanced 2D/3D hardware accelerated features:
Summary of Evaluation • Additional framework features:
Total Scores (out of 5) • Qt: 4.74 • wxWidgets: 4.18 • We recommend using Qt to facilitate the development of 3D game tools.
Major Users and Applications • Qt: • 3D games / apps: • Autodesk Maya 2011 • Autodesk Mudbox3D • NextlimitRealFlow • Google Earth • Other apps: • VLC player • Skype • wxWidgets : • 3D games / apps: • Unreal Game Engine 3 • (Price: +1 million USD) • Shark 3D for games • Other apps: • Code::Blocks • FileZilla • AOL Communicator • AMD, Advanced Micro Devices