Jump to content
  • Advertisement
Sign in to follow this  
Ainokea

Unity Which GUI?

This topic is 4976 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement

//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" here
bool
MainApp::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 constructor
AppFrame::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
*****************/


void
AppFrame::OnQuit(wxCommandEvent &WXUNUSED(event))
{
// TRUE is to force the frame to close
Close(TRUE);
}


void
AppFrame::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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!