In my GameMain.cpp:
Code: Select all
int main()
{
//run the menu
MenuMain::RunMenu();
}Then i have the MenuMain.cpp that holds the main GUI code:
Code: Select all
void MenuMain::RunMenu()
{
//fullscreen variable
bool fullscreen = true;
//create the device - ogl and fullscreen
device = createDevice(video::EDT_OPENGL,
core::dimension2d<s32>(1024, 768), 32, fullscreen);
//set the window caption
device->setWindowCaption(L"Made Man");
//set the driver and gui environment
video::IVideoDriver* driver = device->getVideoDriver();
IGUIEnvironment* env = device->getGUIEnvironment();
gui::IGUIContextMenu* menu = device->getGUIEnvironment()->addContextMenu(r, 0, 45);
//add the buttons
menu->addButton(rect<s32>(10,170,100,240), 0, 101, L"New Game");
menu->addButton(rect<s32>(10,190,100,290), 0, 102, L"Load Game");
menu->addButton(rect<s32>(10,210,100,340), 0, 103, L"Save Game");
menu->addButton(rect<s32>(10,230,100,390), 0, 104, L"Multiplayer");
menu->addButton(rect<s32>(10,250,100,440), 0, 105, L"Options");
menu->addButton(rect<s32>(10,270,100,490), 0, 106, L"Quit");
//set the font
IGUIFont* font = env->getFont("../../media/fonthaettenschweiler.bmp");
//set the logo
IGUIImage* logo = env->addImage(rect<int>(10,10,98,41));
logo->setImage(driver->getTexture("../../media/mademan.jpg"));
//set the background image
IGUIImage* bground = env->addImage(rect<int>(10,10,98,41));
bground->setImage(driver->getTexture("../../media/mademan_back.jpg"));
//draw everything
while(device->run() && driver)
if (device->isWindowActive())
{
driver->beginScene(true, true, SColor(0,122,65,171));
env->drawAll();
driver->endScene();
}
device->drop();
}Then I have the header file:
Code: Select all
/include the headers
#include <irrlicht.h>
//set up the namespace
using namespace irr;
class MenuMain : public IEventReceiver
{
public:
//run menu function
void RunMenu();
private:
//fullscreen variable
bool fullscreen;
};and i have include MenuMain.h in my main cpp file. Can somebody at least point me in the right direction at how to fix this?30 C:\GameDemo\GameMain.cpp cannot call member function `void MenuMain::RunMenu()' without object