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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
#include <Engine/Entity/MainMenu.hpp>
#include <Engine/Kernel/Tasks/InputTask.hpp>
// Constructor
MainMenu::MainMenu()
{
}
// Destructor
MainMenu::~MainMenu()
{
InputTask::UnRegisterEvent(113,"Key","Quiter",m_Id);
InputTask::UnRegisterEvent(1,"Mouse","New",m_Id);
}
// Init the menu's data
void MainMenu::Init()
{
InputEvent E ;
E.m_Condition = 113 ;
E.m_Name = "Quiter" ;
E.m_Owner = this ;
E.m_ConditionType = "Key";
E.m_ConditionState = PUSHED ;
InputTask::RegisterEvent(E);
InputEvent Ee ;
Ee.m_Condition = 1 ;
Ee.m_Name = "New" ;
Ee.m_Owner = this ;
Ee.m_ConditionType = "Mouse";
Ee.m_ConditionState = PUSHED ;
InputTask::RegisterEvent(Ee);
/* InputEvent Ea ;
Ea.m_Condition = 0 ;
Ea.m_Name = "Bouge" ;
Ea.m_Owner = this ;
Ea.m_ConditionType = "MouseMotion";
Ea.m_ConditionState = 0 ;
InputTask::RegisterEvent(Ea);*/
}
// Update the menu (animation?)
void MainMenu::Update()
{
}
// Render the Menu on the screen
void MainMenu::Render()
{
/* on affiche un repere */
glBegin(GL_LINES);
/* l'axe des x */
glColor3d(1.0, 0.0, 0.0);
glVertex3d(0.0,0.0,0.0);
glVertex3d(1.0,0.0,0.0);
/* l'axe des y */
glColor3d(0.0, 1.0, 0.0);
glVertex3d(0.0,0.0,0.0);
glVertex3d(0.0,1.0,0.0);
/* l'axe des z */
glColor3d(0.0, 0.0, 1.0);
glVertex3d(0.0,0.0,0.0);
glVertex3d(0.0,0.0,1.0);
glEnd();
}
// Process every event recieved
void MainMenu::ProcessInputEvent(InputEvent & InputEventRecieved)
{
Log(LOG_ALL,LOG_MISC) << "InputEvent recived by " << m_Id << " is : " << InputEventRecieved.m_Name << ". Keystate : " << InputEventRecieved.m_ConditionState
<< " MouseX: " << InputEventRecieved.m_MouseX << " MouseY: " << InputEventRecieved.m_MouseY ;
} |
Partager