-
Notifications
You must be signed in to change notification settings - Fork 1
/
event.cpp
561 lines (489 loc) · 25 KB
/
event.cpp
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
#include "Event.h"
#include "iostream"
#include <Shlobj.h>
CEventReceiver::CEventReceiver(Editor* editor){
this->current_editor = editor;
this->custom_gui = this->current_editor->getMainPointer()->gui;
}
bool CEventReceiver::OnEvent(const irr::SEvent &event){
if(current_editor != NULL){ //On verifie que le pointeur est ok
if(event.EventType == irr::EET_KEY_INPUT_EVENT && event.KeyInput.PressedDown == true){
irr::core::vector3df position = current_editor->getMainPointer()->camera->getPosition();
irr::core::vector3df rotation = current_editor->getMainPointer()->camera->getRotation();
irr::core::vector3df target = current_editor->getMainPointer()->camera->getTarget();
int focus_id = -1;
if(current_editor->getMainPointer()->gui->getGUIEnvironment()->getFocus() != NULL){
focus_id = current_editor->getMainPointer()->gui->getGUIEnvironment()->getFocus()->getID();
}
bool hasfocus = false;
bool exist = (current_editor->getMainPointer()->gui->getGUIEnvironment()->getRootGUIElement()->getElementFromId(GUI_ID_OBJECT_WINDOW_OBJECT_NAME, true) != NULL);
if(focus_id >= GUI_ID_OBJECT_WINDOW && focus_id <= GUI_ID_OBJECT_WINDOW_GROUP_COMBO_BOX){
hasfocus = true;
}
if(!exist || !hasfocus){
switch(event.KeyInput.Key){
case irr::KEY_ESCAPE: //Ferme le programme
current_editor->getMainPointer()->device->closeDevice();
return true;
case irr::KEY_DELETE: //Supprime l'objet selectionne
current_editor->getCurrentZone()->removeObject(current_editor->getCurrentZone()->getSelectedObject());
return true;
case irr::KEY_KEY_O: //Camera vers le haut
if(rotation.X > -80){
rotation.X -= 10;
current_editor->getMainPointer()->camera->setRotation(rotation);
}
return true;
case irr::KEY_KEY_L: //Camera vers le bas
if(rotation.X < 80){
rotation.X += 10;
current_editor->getMainPointer()->camera->setRotation(rotation);
}
return true;
case irr::KEY_KEY_Q: //Camera vers la gauche
angleCameraRight();
return true;
case irr::KEY_KEY_D: //Camera vers la droite
angleCameraLeft();
return true;
case irr::KEY_KEY_Z: //Camera avance
forwardCamera();
return true;
case irr::KEY_KEY_S: //Camera recule
backwardCamera();
return true;
case irr::KEY_LEFT: //Camera vers la gauche
angleCameraRight();
return true;
case irr::KEY_RIGHT: //Camera vers la droite
angleCameraLeft();
return true;
case irr::KEY_UP: //Camera avance
forwardCamera();
return true;
case irr::KEY_DOWN: //Camera recule
backwardCamera();
return true;
case irr::KEY_KEY_I: //Camera monte
position.Y += 5;
target.Y += 5;
current_editor->getMainPointer()->camera->setPosition(position);
current_editor->getMainPointer()->camera->bindTargetAndRotation(false); //Sinon la rotation ce fait mal
current_editor->getMainPointer()->camera->setTarget(target);
current_editor->getMainPointer()->camera->bindTargetAndRotation(true);
this->custom_gui->updateInformation(this->current_editor->getMainPointer()->camera->getPosition());
return true;
case irr::KEY_KEY_K: //Camera descend
position.Y -= 5;
target.Y -= 5;
current_editor->getMainPointer()->camera->setPosition(position);
current_editor->getMainPointer()->camera->bindTargetAndRotation(false); //Sinon la rotation ce fait mal
current_editor->getMainPointer()->camera->setTarget(target);
current_editor->getMainPointer()->camera->bindTargetAndRotation(true);
this->custom_gui->updateInformation(this->current_editor->getMainPointer()->camera->getPosition());
return true;
}
}
}else if (event.EventType == irr::EET_GUI_EVENT){
irr::s32 id = event.GUIEvent.Caller->getID();
switch(event.GUIEvent.EventType)
{
case irr::gui::EGET_MENU_ITEM_SELECTED: // a menu item was clicked
OnMenuItemSelected((irr::gui::IGUIContextMenu*)event.GUIEvent.Caller );
break;
case irr::gui::EGET_BUTTON_CLICKED:{
if(id <= GUI_ID_OBJECT_WINDOW_GROUP_COMBO_BOX && id >= GUI_ID_OBJECT_WINDOW_OBJECT_NAME){
this->OnToolBoxItemSelected(id, event.GUIEvent.Caller);
}else if(id >= GUI_ID_INFORMATIONS && id <= GUI_ID_INFORMATIONS_DELETE_ZONE){
this->OnInformationItemSelected(id, event.GUIEvent.Caller);
}else{
this->OnObjectCreation(id);
}}
break;
case irr::gui::EGET_COMBO_BOX_CHANGED:
OnObjectSelected((irr::gui::IGUIComboBox*)event.GUIEvent.Caller);
return true;
break;
case irr::gui::EGET_EDITBOX_ENTER:
OnValueChanged((irr::gui::IGUIEditBox*)event.GUIEvent.Caller);
return true;
break;
}
}else if(event.EventType == irr::EET_MOUSE_INPUT_EVENT){
if(event.MouseInput.isLeftPressed() == true){ //Si on clique sur un objet a l'ecran il est selectionne
irr::core::vector2di position = irr::core::vector2di(event.MouseInput.X, event.MouseInput.Y);
if(!this->current_editor->getMainPointer()->gui->isInWindow(position)){ //Si le clic est en dehors de la fenetre outil
//boucler dans la zone et les groupes
if(current_editor->getCurrentZone()->setSelectedSingleObject(current_editor->getMainPointer()->scene->getSceneCollisionManager()->getSceneNodeFromScreenCoordinatesBB(irr::core::position2di(event.MouseInput.X, event.MouseInput.Y), -1, false, this->current_editor->getCurrentZone()->getMeshPointer()))){
current_editor->getMainPointer()->gui->updateWindow(this->current_editor->getCurrentZone()->getSelectedObject());
return true;
}else{
for(int i=0; i<this->current_editor->getCurrentZone()->getGroupObjectVector()->size(); i++){
if(current_editor->getCurrentZone()->setSelectedSingleObject(current_editor->getMainPointer()->scene->getSceneCollisionManager()->getSceneNodeFromScreenCoordinatesBB(irr::core::position2di(event.MouseInput.X, event.MouseInput.Y), -1, false, this->current_editor->getCurrentZone()->getGroupObjectVector()->at(i)->getSceneNode()))){
current_editor->getMainPointer()->gui->updateWindow(this->current_editor->getCurrentZone()->getSelectedObject());
return true;
}
}
}
}
}
}
}
return false;
}
void CEventReceiver::OnObjectSelected(irr::gui::IGUIComboBox* combo ){ //Appele lors de la maj de la combo box
switch(combo->getID()){
case GUI_ID_SINGLE_OBJECT_COMBO_BOX:
current_editor->getCurrentZone()->setSelectedSingleObject(combo->getSelected());
current_editor->getMainPointer()->gui->updateWindow(this->current_editor->getCurrentZone()->getSelectedObject());
break;
case GUI_ID_GROUP_OBJECT_COMBO_BOX:
current_editor->getCurrentZone()->setSelectedGroupObject(combo->getSelected());
current_editor->getMainPointer()->gui->updateWindow(this->current_editor->getCurrentZone()->getSelectedObject());
break;
case GUI_ID_ZONE_COMBO_BOX:
current_editor->setCurrentZone(combo->getSelected());
break;
default:
break;
}
}
void CEventReceiver::OnMenuItemSelected(irr::gui::IGUIContextMenu* menu) {
irr::s32 id = menu->getItemCommandId(menu->getSelectedItem());
switch(id)
{
case GUI_ID_QUIT:
current_editor->getMainPointer()->device->closeDevice();
//current_editor->getMainPointer()->device->drop();
delete current_editor;
current_editor->getMainPointer()->device->run();
break;
case GUI_ID_TOOLBOX:
this->current_editor->getMainPointer()->gui->updateWindow(this->current_editor->getCurrentZone()->getSelectedObject());
break;
case GUI_ID_INFO:
this->current_editor->getMainPointer()->gui->updateInformation(this->current_editor->getMainPointer()->camera->getPosition());
break;
case GUI_ID_SKYBOX:
menu->setItemChecked(menu->getSelectedItem(), !menu->isItemChecked(menu->getSelectedItem()));
this->current_editor->getMainPointer()->gui->getSkybox()->setVisible(!this->current_editor->getMainPointer()->gui->getSkybox()->isVisible());
break;
case GUI_ID_NEW_ZONE:
this->current_editor->createZone();
break;
case GUI_ID_NEW_GROUP:
this->current_editor->getCurrentZone()->createGroupObject();
break;
case GUI_ID_ABOUT:{
irr::core::stringw MessageText = L"Réalisé par :\nCorentin BEAL\nMatthieu CHIAPPINI\nGuillaume ORIOL\nArnaud ROCHE\nEtienne STHEME DE JUBECOURT\nJulien GARDET\n\nContact :\[email protected]\n\n@copyright 2015";
irr::core::stringw Caption = L"Message - Chargement";
this->current_editor->getMainPointer()->gui->getGUIEnvironment()->addMessageBox(
Caption.c_str(),
MessageText.c_str());
break;}
case GUI_ID_LOAD:
if(this->current_editor->importData()){
this->custom_gui->updateWindow(this->current_editor->getCurrentZone()->getSelectedObject());
this->custom_gui->updateInformation(this->current_editor->getMainPointer()->camera->getPosition());
}
break;
case GUI_ID_SAVE:
this->current_editor->exportData();
break;
case GUI_ID_DOC:
irr::core::stringw MessageText = L"Cette fonctionnalité n'est pas encore présente sur cette version du logiciel";
irr::core::stringw Caption = L"Message - En chantier";
this->current_editor->getMainPointer()->gui->getGUIEnvironment()->addMessageBox(
Caption.c_str(),
MessageText.c_str());
//ShellExecute(NULL, "open", "ressources\\documentation\\Documentation.pdf", NULL, NULL, SW_SHOW);
break;
}
}
void CEventReceiver::OnToolBoxItemSelected(irr::s32 id, irr::gui::IGUIElement* item) {
Object* target = this->current_editor->getMainPointer()->gui->getTargetObject();
if(target != NULL){
irr::core::vector3df modification = irr::core::vector3df();
if(id <= GUI_ID_OBJECT_WINDOW_POSITION_Z_DOWN && id >= GUI_ID_OBJECT_WINDOW_POSITION_X_UP){
switch(id){
case GUI_ID_OBJECT_WINDOW_POSITION_X_UP:
modification.X = 1;
break;
case GUI_ID_OBJECT_WINDOW_POSITION_X_DOWN:
modification.X = -1;
break;
case GUI_ID_OBJECT_WINDOW_POSITION_Y_UP:
modification.Y = 1;
break;
case GUI_ID_OBJECT_WINDOW_POSITION_Y_DOWN:
modification.Y = -1;
break;
case GUI_ID_OBJECT_WINDOW_POSITION_Z_UP:
modification.Z = 1;
break;
case GUI_ID_OBJECT_WINDOW_POSITION_Z_DOWN:
modification.Z = -1;
break;
}
target->modifyPositionBy(modification);
this->custom_gui->updateWindow();
}else if(id <= GUI_ID_OBJECT_WINDOW_ROTATION_Z_DOWN && id >= GUI_ID_OBJECT_WINDOW_ROTATION_X_UP){
switch(id){
case GUI_ID_OBJECT_WINDOW_ROTATION_X_UP:
modification.X = 15;
break;
case GUI_ID_OBJECT_WINDOW_ROTATION_X_DOWN:
modification.X = -15;
break;
case GUI_ID_OBJECT_WINDOW_ROTATION_Y_UP:
modification.Y = 15;
break;
case GUI_ID_OBJECT_WINDOW_ROTATION_Y_DOWN:
modification.Y = -15;
break;
case GUI_ID_OBJECT_WINDOW_ROTATION_Z_UP:
modification.Z = 15;
break;
case GUI_ID_OBJECT_WINDOW_ROTATION_Z_DOWN:
modification.Z = -15;
break;
}
target->modifyRotationBy(modification);
this->custom_gui->updateWindow();
}else if(id <= GUI_ID_OBJECT_WINDOW_SCALE_TOTAL_DOWN && id >= GUI_ID_OBJECT_WINDOW_SCALE_X_UP){
switch(id){
case GUI_ID_OBJECT_WINDOW_SCALE_X_UP:
modification.X = 1.1;
break;
case GUI_ID_OBJECT_WINDOW_SCALE_X_DOWN:
modification.X = -1.1;
break;
case GUI_ID_OBJECT_WINDOW_SCALE_Y_UP:
modification.Y = 1.1;
break;
case GUI_ID_OBJECT_WINDOW_SCALE_Y_DOWN:
modification.Y = -1.1;
break;
case GUI_ID_OBJECT_WINDOW_SCALE_Z_UP:
modification.Z = 1.1;
break;
case GUI_ID_OBJECT_WINDOW_SCALE_Z_DOWN:
modification.Z = -1.1;
break;
case GUI_ID_OBJECT_WINDOW_SCALE_TOTAL_UP:
modification.X = 1.1;
modification.Y = 1.1;
modification.Z = 1.1;
break;
case GUI_ID_OBJECT_WINDOW_SCALE_TOTAL_DOWN:
modification.X = -1.1;
modification.Y = -1.1;
modification.Z = -1.1;
break;
}
target->modifyScaleBy(modification);
this->custom_gui->updateWindow();
}else{
switch(id){
case GUI_ID_OBJECT_WINDOW_REMOVE_FROM_GROUP:{
SingleObject* single = static_cast<SingleObject*>(target);
if(single->hasParent()){
GroupObject* group_object = static_cast<GroupObject*>(single->getParent());
group_object->removeMember(single);
this->custom_gui->updateWindow();
}
break;
}
case GUI_ID_OBJECT_WINDOW_ADD_TO_GROUP:
irr::gui::IGUIElement* window = item->getParent();
irr::gui::IGUIElement* combo = window->getElementFromId(GUI_ID_OBJECT_WINDOW_GROUP_COMBO_BOX, true);
irr::gui::IGUIComboBox* group_box = static_cast<irr::gui::IGUIComboBox*>(combo);
int index = group_box->getSelected();
this->current_editor->getCurrentZone()->addToGroup(index);
this->custom_gui->updateWindow();
break;
}
}
}
}
void CEventReceiver::OnInformationItemSelected(irr::s32 id, irr::gui::IGUIElement* item) {
switch(id){
case GUI_ID_INFORMATIONS_RESET_CAMERA:
this->current_editor->getCurrentZone()->loadCamera();
break;
case GUI_ID_INFORMATIONS_DELETE_ZONE:
this->current_editor->removeZone(this->current_editor->getCurrentZone());
this->current_editor->setCurrentZone(this->current_editor->getNumberOfZones()-1);
break;
}
}
void CEventReceiver::OnValueChanged(irr::gui::IGUIEditBox* editbox) {
int id = editbox->getID();
irr::core::vector3df modification = irr::core::vector3df();
Object* target = this->current_editor->getMainPointer()->gui->getTargetObject();
irr::gui::IGUIElement* root = this->custom_gui->getGUIEnvironment()->getRootGUIElement();
irr::core::stringc s = root->getElementFromId(id, true)->getText();
if(id <= GUI_ID_OBJECT_WINDOW_POSITION_Z_VALUE && id >= GUI_ID_OBJECT_WINDOW_POSITION_X_VALUE){
irr::f32 value = (irr::f32)atof(s.c_str());
modification = target->getPosition();
switch(id){
case GUI_ID_OBJECT_WINDOW_POSITION_X_VALUE:
modification.X = value;
break;
case GUI_ID_OBJECT_WINDOW_POSITION_Y_VALUE:
modification.Y = value;
break;
case GUI_ID_OBJECT_WINDOW_POSITION_Z_VALUE:
modification.Z = value;
break;
}
target->setPosition(modification);
this->custom_gui->updateWindow();
}else if(id <= GUI_ID_OBJECT_WINDOW_ROTATION_Z_VALUE && id >= GUI_ID_OBJECT_WINDOW_ROTATION_X_VALUE){
irr::f32 value = (irr::f32)atof(s.c_str());
modification = target->getRotation();
switch(id){
case GUI_ID_OBJECT_WINDOW_ROTATION_X_VALUE:
modification.X = value;
break;
case GUI_ID_OBJECT_WINDOW_ROTATION_Y_VALUE:
modification.Y = value;
break;
case GUI_ID_OBJECT_WINDOW_ROTATION_Z_VALUE:
modification.Z = value;
break;
}
target->setRotation(modification);
this->custom_gui->updateWindow();
}else if(id <= GUI_ID_OBJECT_WINDOW_SCALE_Z_VALUE && id >= GUI_ID_OBJECT_WINDOW_SCALE_X_VALUE){
irr::f32 value = (irr::f32)atof(s.c_str());
modification = target->getScale();
switch(id){
case GUI_ID_OBJECT_WINDOW_SCALE_X_VALUE:
modification.X = value;
break;
case GUI_ID_OBJECT_WINDOW_SCALE_Y_VALUE:
modification.Y = value;
break;
case GUI_ID_OBJECT_WINDOW_SCALE_Z_VALUE:
modification.Z = value;
break;
}
target->setScale(modification);
this->custom_gui->updateWindow();
}else if(id == GUI_ID_OBJECT_WINDOW_OBJECT_NAME){
std::string value = s.c_str();
irr::core::stringw Caption = L"Message";
irr::core::stringw MessageText = L"Le nom est déjà pris";
if(target->getClassType() == "SingleObject"){
if(this->current_editor->getCurrentZone()->isSingleObjectNameTaken(value)){
this->current_editor->getMainPointer()->gui->getGUIEnvironment()->addMessageBox(
Caption.c_str(), MessageText.c_str());
}else{
this->current_editor->getCurrentZone()->getSelectedObject()->setName(value);
this->current_editor->getCurrentZone()->sendSingleObjectUpdate();
}
}else{
if(this->current_editor->getCurrentZone()->isGroupObjectNameTaken(value)){
this->current_editor->getMainPointer()->gui->getGUIEnvironment()->addMessageBox(
Caption.c_str(), MessageText.c_str());
}else{
this->current_editor->getCurrentZone()->getSelectedObject()->setName(value);
this->current_editor->getCurrentZone()->sendSingleObjectUpdate();
}
}
}
current_editor->getMainPointer()->gui->updateWindow(this->current_editor->getCurrentZone()->getSelectedObject());
}
void CEventReceiver::OnObjectCreation(irr::s32 id) {
irr::core::vector3df position = current_editor->getMainPointer()->camera->getPosition();
irr::core::vector3df target = current_editor->getMainPointer()->camera->getTarget();
irr::core::vector3df direction;
irr::core::vector3df direction_mvnt;
direction_mvnt.X = target.X - position.X;
direction_mvnt.Y = 0;
direction_mvnt.Z = target.Z - position.Z;
direction_mvnt.normalize();
direction.X = 18*cos(acos(direction_mvnt.X));
direction.Z = 18*sin(asin(direction_mvnt.Z));
position.X += direction.X;
position.Z += direction.Z;
position.Y = 0;
switch(id){ //Creation d'objets
case GUI_ID_CUBE:
current_editor->getCurrentZone()->createSingleObject(cube);
break;
case GUI_ID_CIRCLE:
current_editor->getCurrentZone()->createSingleObject(circle);
break;
case GUI_ID_SPHERE:
current_editor->getCurrentZone()->createSingleObject(sphere);
break;
case GUI_ID_CYLINDER:
current_editor->getCurrentZone()->createSingleObject(cylinder);
break;
case GUI_ID_SQUARE:
current_editor->getCurrentZone()->createSingleObject(rectangle);
break;
case GUI_ID_LINE:
current_editor->getCurrentZone()->createSingleObject(line);
break;
case GUI_ID_TRAPEZE:
current_editor->getCurrentZone()->createSingleObject(trapeze);
break;
case GUI_ID_PYRAMID:
current_editor->getCurrentZone()->createSingleObject(pyramid);
break;
}
current_editor->getCurrentZone()->getSingleObjectPointer(current_editor->getCurrentZone()->getObjectCount()-1)->setPosition(position.X, position.Y, position.Z);
}
void CEventReceiver::angleCameraRight(){
irr::core::vector3df rotation = current_editor->getMainPointer()->camera->getRotation();
rotation.Y -= 10;
current_editor->getMainPointer()->camera->setRotation(rotation);
}
void CEventReceiver::angleCameraLeft(){
irr::core::vector3df rotation = current_editor->getMainPointer()->camera->getRotation();
rotation.Y += 10;
current_editor->getMainPointer()->camera->setRotation(rotation);
}
void CEventReceiver::forwardCamera(){
irr::core::vector3df rotation = current_editor->getMainPointer()->camera->getRotation();
irr::core::vector3df position = current_editor->getMainPointer()->camera->getPosition();
irr::core::vector3df target = current_editor->getMainPointer()->camera->getTarget();
irr::core::vector3df direction;
irr::core::vector3df direction_mvnt;
direction_mvnt.X = target.X - position.X;
direction_mvnt.Y = 0;
direction_mvnt.Z = target.Z - position.Z;
direction_mvnt.normalize();
position.X += direction_mvnt.X;
position.Z += direction_mvnt.Z;
target.X += direction_mvnt.X;
target.Z += direction_mvnt.Z;
current_editor->getMainPointer()->camera->setPosition(position);
current_editor->getMainPointer()->camera->bindTargetAndRotation(false);
current_editor->getMainPointer()->camera->setTarget(target);
current_editor->getMainPointer()->camera->bindTargetAndRotation(true);
this->custom_gui->updateInformation(this->current_editor->getMainPointer()->camera->getPosition());
}
void CEventReceiver::backwardCamera(){
irr::core::vector3df rotation = current_editor->getMainPointer()->camera->getRotation();
irr::core::vector3df position = current_editor->getMainPointer()->camera->getPosition();
irr::core::vector3df target = current_editor->getMainPointer()->camera->getTarget();
irr::core::vector3df direction;
irr::core::vector3df direction_mvnt;
direction_mvnt.X = target.X - position.X;
direction_mvnt.Y = 0;
direction_mvnt.Z = target.Z - position.Z;
direction_mvnt.normalize();
position.X -= direction_mvnt.X;
position.Z -= direction_mvnt.Z;
target.X -= direction_mvnt.X;
target.Z -= direction_mvnt.Z;
current_editor->getMainPointer()->camera->setPosition(position);
current_editor->getMainPointer()->camera->bindTargetAndRotation(false);
current_editor->getMainPointer()->camera->setTarget(target);
current_editor->getMainPointer()->camera->bindTargetAndRotation(true);
this->custom_gui->updateInformation(this->current_editor->getMainPointer()->camera->getPosition());
}