1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| #include <irrlicht.h>
#include "interface.h"
#include <iostream>
using namespace gui;
using namespace core;
using namespace std;
interface::interface(): BouttonQuitter(0), BouttonConfiguration(0)
{
}
interface::~interface()
{
}
//Interface
void interface::menu_user(IrrlichtDevice* application, IGUIEnvironment* &interface_user)
{
//Recupération de l'interface de l'application en cours
interface_user = application->getGUIEnvironment();
//Ajout de l'interface
BouttonQuitter = interface_user->addButton(core::rect<int>(30,295,200,324),0,2, L"Quitter");
BouttonConfiguration = interface_user->addButton(core::rect<s32>(250,295,350,324),0,1,L"Configuration");
}
//Interaction avec l'interface
bool interface::OnEvent(const SEvent& event)
{
if (event.EventType == EET_GUI_EVENT)
{
s32 id = event.GUIEvent.Caller->getID();
switch(event.GUIEvent.EventType)
{
case EGET_BUTTON_CLICKED:
if (id == 2)
{
cout<<"test"<<endl;
return true;
}
break;
}
}
return false;
} |
Partager