Skip to main content
GameDev.net gamedev.net
🔒 Locked

Which GUI?

Started by Ainokea Dec 3, 2004 at 9:42 PM 1 replies 450+ views
Original Post
Ainokea
Ainokea
I am going to work on a map editor and I have to choose a gui to use. Preferably it would be cross-platform and OO but thats not necassary. It must however work with Dev-C++. I tried to use wxWidgets a while ago but I had problems with it and no one could help. Just in case you where wondering the thread is here
______________With the flesh of a cow.
C-Junkie
C-Junkie
whoah. show an example program that generates those errors.
Ainokea
Ainokea
//main.h#ifndef _MAIN_H_#define _MAIN_H_#include <wx/wx.h>class MainApp : public wxApp{  public:    virtual bool OnInit(void);};class AppFrame : public wxFrame{  public:    AppFrame(const wxString &title, const wxPoint &pos, const wxSize &size);    // event handlers    void OnQuit(wxCommandEvent &event);    void OnAbout(wxCommandEvent &event);  private:    // any class wishing to process wxWindows events must use this macro    DECLARE_EVENT_TABLE()};enum{    // menu items    MainApp_Quit = 1,    MainApp_About};/********************************************************** * Event tables and other macros for wxWindows ********************************************************** * The event tables connect the wxWindows events with the * functions (event handlers) which process them. It can * be also done at run-time, but for the simple menu * events like this the static method is much simpler. * **********************************************************/BEGIN_EVENT_TABLE(AppFrame, wxFrame)    EVT_MENU(MainApp_Quit,  AppFrame::OnQuit)    EVT_MENU(MainApp_About, AppFrame::OnAbout)END_EVENT_TABLE()/***************************************************************** * Create a new application object: this macro will allow * wxWindows to create the application object during program * execution (it's better than using a static object for many * reasons) and also declares the accessor function wxGetApp() * which will return the reference of the right type (i.e. MyApp * and not wxApp) * *****************************************************************/IMPLEMENT_APP(MainApp)#endif _MAIN_H__


//main.cpp/******************** *  Implementation ********************/#include <wx/wx.h>#include "main.h"// program execution "starts" hereboolMainApp::OnInit(){    AppFrame *frame;    frame = new AppFrame("Application",                         wxPoint(50, 50), wxSize(450, 340));    frame->Show(TRUE);   /* success: wxApp::OnRun() will be called which will enter the main    * message loop and the application will run. If we returned FALSE    * here, the application would exit immediately.    */    return TRUE;}// frame constructorAppFrame::AppFrame(const wxString &title, const wxPoint &pos,  const wxSize& size)  : wxFrame ((wxFrame *) NULL, -1, title, pos, size){    wxMenuBar *menuBar;    wxMenu *fileMenu;    wxMenu *helpMenu;    /* "A" is the name of the application's main icon,     * as set by Dev-C++     */    SetIcon(wxICON(A));    // create menus    fileMenu = new wxMenu("", wxMENU_TEAROFF);    fileMenu->Append(MainApp_Quit, "E&xit\tCtrl-Q", "Quit this program");    helpMenu = new wxMenu;    helpMenu->Append(MainApp_About, "&About...\tCtrl-A", "Show about dialog");    menuBar = new wxMenuBar();    menuBar->Append(fileMenu, "&File");    menuBar->Append(helpMenu, "&Help");    SetMenuBar(menuBar);    // create a statusbar    CreateStatusBar(2);    SetStatusText("Ready.");}/***************** * event handlers *****************/voidAppFrame::OnQuit(wxCommandEvent &WXUNUSED(event)){    // TRUE is to force the frame to close    Close(TRUE);}voidAppFrame::OnAbout(wxCommandEvent &WXUNUSED(event)){    wxString msg;    msg.Printf("Application version 0.1");    wxMessageBox(msg, "About", wxOK | wxICON_INFORMATION, this);}

Well there we go.Hope it helps you help me.
______________With the flesh of a cow.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.