OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4ConsoleQtViewport.cpp
Go to the documentation of this file.
1 /*
2 * OpenClonk, http://www.openclonk.org
3 *
4 * Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de/
5 * Copyright (c) 2013, The OpenClonk Team and contributors
6 *
7 * Distributed under the terms of the ISC license; see accompanying file
8 * "COPYING" for details.
9 *
10 * "Clonk" is a registered trademark of Matthes Bender, used with permission.
11 * See accompanying file "TRADEMARK" for details.
12 *
13 * To redistribute this file separately, substitute the full license texts
14 * for the above references.
15 */
16 
17 /* Player and editor viewports in console */
18 
19 #include "C4Include.h"
21 #include "script/C4Value.h"
22 #include "game/C4Viewport.h"
23 #include "object/C4Object.h"
24 #include "gui/C4MouseControl.h"
25 #include "landscape/C4Landscape.h"
26 #include "object/C4GameObjects.h"
27 #include "player/C4PlayerList.h"
28 #ifndef USE_CONSOLE
29 #include <GL/glew.h>
30 #endif
31 // See C4ConsoleQt.cpp on the include order
34 #include "editor/C4Console.h"
37 #include "editor/C4Console.h"
38 
39 /* Console viewports */
40 
41 C4ConsoleQtViewportView::C4ConsoleQtViewportView(class C4ConsoleQtViewportScrollArea *scrollarea)
42  : QOpenGLWidget(scrollarea->dock), dock(scrollarea->dock), cvp(scrollarea->cvp)
43 {
44  setAttribute(Qt::WA_ShowWithoutActivating, true);
45  setFocusPolicy(Qt::WheelFocus);
46  setMouseTracking(true);
47  setContextMenuPolicy(Qt::CustomContextMenu);
48  // Register for viewport
49  C4ViewportWindow *window = dock->cvp;
50  window->glwidget = this;
51  // Enable context menu
52  connect(this, &QWidget::customContextMenuRequested, this, &C4ConsoleQtViewportView::ShowContextMenu);
53 }
54 
55 bool C4ConsoleQtViewportView::IsPlayViewport() const
56 {
57  return (cvp && ::MouseControl.IsViewport(cvp)
59 }
60 
61 // On high-DPI screens, Qt's pixels are not equal to device pixels anymore. However, viewports
62 // still work with device pixels, so we have to adjust coordinates from Qt events.
63 qreal C4ConsoleQtViewportView::GetDevicePixelRatio()
64 {
65  // Find the screen the viewport is on to get its pixel ratio.
66  auto desktop = QApplication::desktop();
67  auto screenNumber = desktop->screenNumber(this);
68  // This can happen while moving to a different screen.
69  if (screenNumber == -1)
70  return 1;
71  auto screen = QApplication::screens()[screenNumber];
72  return screen->devicePixelRatio();
73 }
74 
75 void C4ConsoleQtViewportView::AddSelectObjectContextEntry(C4Object *obj, QMenu *menu)
76 {
77  // Add select object item for object and for all contents
78  if (!obj || !obj->Status) return;
79  int32_t object_number = obj->Number;
80  QAction *select_object_action = new QAction(QString("%1 #%2 (%3/%4)").arg(obj->GetName()).arg(object_number).arg(obj->GetX()).arg(obj->GetY()), menu);
81  connect(select_object_action, &QAction::triggered, menu, [object_number]() {
82  bool add = !!(QGuiApplication::keyboardModifiers() & Qt::ShiftModifier);
83  C4Object *obj = ::Objects.SafeObjectPointer(object_number);
84  if (obj) ::Console.EditCursor.DoContextObjsel(obj, !add);
85  });
86  menu->addAction(select_object_action);
87  if (obj->Contents.ObjectCount())
88  {
89  QMenu *submenu = menu->addMenu(FormatString(LoadResStr("IDS_CNS_SELECTCONTENTS"), obj->GetName()).getData());
90  for (C4Object *cobj : obj->Contents)
91  {
92  AddSelectObjectContextEntry(cobj, submenu);
93  }
94  }
95 }
96 
97 void C4ConsoleQtViewportView::ShowContextMenu(const QPoint &pos)
98 {
99  // Coordinates are in viewport (not adjusted by parent scroll window)
100  if (!IsPlayViewport())
101  {
102  // Show context menu in editor viewport
103  QMenu *menu = new QMenu(this);
104  // Show current object(s) as unselectable item
105  auto &ui = dock->main_window->GetConsoleState()->ui;
106  menu->addSection(ui.selectionInfoLabel->text());
107  // Object actions. Always shown but grayed out if no object is selected.
108  bool has_object = false;
109  int32_t contents_count = 0;
110  for (const C4Value &sel : ::Console.EditCursor.GetSelection())
111  {
112  C4Object *obj = sel.getObj();
113  if (obj)
114  {
115  has_object = true;
116  contents_count += obj->Contents.ObjectCount();
117  }
118  }
119  for (QAction *act : { ui.actionDeleteObject, ui.actionDuplicateObject, ui.actionEjectContents })
120  {
121  act->setEnabled(has_object);
122  menu->addAction(act);
123  }
124  if (!contents_count)
125  {
126  ui.actionEjectContents->setEnabled(false);
127  }
128  ui.actionEjectContents->setText(QString("%1 (%2)").arg(LoadResStr("IDS_MNU_CONTENTS")).arg((int)contents_count));
129  // Object selection section for overlapping objects
130  auto pr = GetDevicePixelRatio();
131  int32_t x = cvp->WindowToGameX(pr * pos.x()),
132  y = cvp->WindowToGameY(pr * pos.y());
133  auto pFOl = new C4FindObjectAtPoint(x, y); // freed by ~C4FindObjectAnd
134  auto pFOc = new C4FindObjectContainer(nullptr); // freed by ~C4FindObjectAnd
135  C4FindObject *pFO_conds[] = { pFOl , pFOc };
136  C4FindObjectAnd pFO(2, pFO_conds, false);
137  std::unique_ptr<C4ValueArray> atcursor(pFO.FindMany(::Objects, ::Objects.Sectors)); // needs freeing (single object ptr)
138  int itemcount = atcursor->GetSize();
139  if (itemcount)
140  {
141  menu->addSection(LoadResStr("IDS_CNS_SELECTNEARBYOBJECTS"));
142  for (int32_t i = 0; i < itemcount; ++i)
143  {
144  AddSelectObjectContextEntry(atcursor->GetItem(i).getObj(), menu);
145  }
146  }
147  menu->popup(mapToGlobal(pos));
148  }
149 }
150 
151 // Get Shift state as Win32 wParam
152 uint32_t GetShiftWParam(QKeyEvent * event = nullptr)
153 {
154  auto modifiers = event ? event->modifiers() : QGuiApplication::keyboardModifiers();
155  uint32_t result = 0;
156  if (modifiers & Qt::ShiftModifier) result |= MK_SHIFT;
157  if (modifiers & Qt::ControlModifier) result |= MK_CONTROL;
158  if (modifiers & Qt::AltModifier) result |= MK_ALT;
159  return result;
160 }
161 
162 void C4ConsoleQtViewportView::mouseMoveEvent(QMouseEvent *eventMove)
163 {
164  auto pr = GetDevicePixelRatio();
165  if (IsPlayViewport())
166  {
167  bool is_in_drawrange = (Inside<int32_t>(eventMove->x() - cvp->DrawX, 0, cvp->ViewWdt - 1)
168  && Inside<int32_t>(eventMove->y() - cvp->DrawY, 0, cvp->ViewHgt - 1));
169  this->setCursor(is_in_drawrange ? Qt::BlankCursor : Qt::CrossCursor);
170  C4GUI::MouseMove(C4MC_Button_None, eventMove->x() * pr, eventMove->y() * pr, GetShiftWParam(), cvp);
171  }
172  else
173  {
174  cvp->pWindow->EditCursorMove(eventMove->x() * pr, eventMove->y() * pr, GetShiftWParam());
175  UpdateCursor();
176  }
177 }
178 
179 void C4ConsoleQtViewportView::UpdateCursor()
180 {
181  Qt::CursorShape cursor;
183  cursor = Qt::SizeAllCursor;
184  else if (::Console.EditCursor.GetShapes()->HasDragCursor())
185  cursor = ::Console.EditCursor.GetShapes()->GetDragCursor();
186  else
187  cursor = Qt::CrossCursor;
188  this->setCursor(cursor);
189 }
190 
191 void C4ConsoleQtViewportView::mousePressEvent(QMouseEvent *eventPress)
192 {
193  auto pr = GetDevicePixelRatio();
194  if (IsPlayViewport())
195  {
196  int32_t btn = C4MC_Button_None;
197  switch (eventPress->button())
198  {
199  case Qt::LeftButton: btn = C4MC_Button_LeftDown; break;
200  case Qt::RightButton: btn = C4MC_Button_RightDown; break;
201  case Qt::MiddleButton: btn = C4MC_Button_MiddleDown; break;
202  case Qt::XButton1: btn = C4MC_Button_X1Down; break;
203  case Qt::XButton2: btn = C4MC_Button_X2Down; break;
204  }
205  C4GUI::MouseMove(btn, eventPress->x() * pr, eventPress->y() * pr, GetShiftWParam(), cvp);
206  }
207  else
208  {
209  // movement update needed before, so target is always up-to-date
210  cvp->pWindow->EditCursorMove(eventPress->x() * pr, eventPress->y() * pr, GetShiftWParam());
211  switch (eventPress->button())
212  {
213  case Qt::LeftButton: ::Console.EditCursor.LeftButtonDown(GetShiftWParam()); break;
214  case Qt::RightButton: ::Console.EditCursor.RightButtonDown(GetShiftWParam()); break;
215  }
216  }
217 }
218 
219 void C4ConsoleQtViewportView::mouseDoubleClickEvent(QMouseEvent *eventPress)
220 {
221  if (IsPlayViewport())
222  {
223  int32_t btn = C4MC_Button_None;
224  switch (eventPress->button())
225  {
226  case Qt::LeftButton: btn = C4MC_Button_LeftDouble; break;
227  case Qt::RightButton: btn = C4MC_Button_RightDouble; break;
228  case Qt::MiddleButton: btn = C4MC_Button_MiddleDouble; break;
229  case Qt::XButton1: btn = C4MC_Button_X1Double; break;
230  case Qt::XButton2: btn = C4MC_Button_X2Double; break;
231  }
232  auto pr = GetDevicePixelRatio();
233  C4GUI::MouseMove(btn, eventPress->x() * pr, eventPress->y() * pr, GetShiftWParam(), cvp);
234  }
235 }
236 
237 void C4ConsoleQtViewportView::mouseReleaseEvent(QMouseEvent *releaseEvent)
238 {
239  if (IsPlayViewport())
240  {
241  int32_t btn = C4MC_Button_None;
242  switch (releaseEvent->button())
243  {
244  case Qt::LeftButton: btn = C4MC_Button_LeftUp; break;
245  case Qt::RightButton: btn = C4MC_Button_RightUp; break;
246  case Qt::MiddleButton: btn = C4MC_Button_MiddleUp; break;
247  case Qt::XButton1: btn = C4MC_Button_X1Up; break;
248  case Qt::XButton2: btn = C4MC_Button_X2Up; break;
249  }
250  auto pr = GetDevicePixelRatio();
251  C4GUI::MouseMove(btn, releaseEvent->x() * pr, releaseEvent->y() * pr, GetShiftWParam(), cvp);
252  }
253  else
254  {
255  switch (releaseEvent->button())
256  {
257  case Qt::LeftButton: ::Console.EditCursor.LeftButtonUp(GetShiftWParam()); break;
258  case Qt::RightButton: ::Console.EditCursor.RightButtonUp(GetShiftWParam()); break;
259  }
260  }
261 }
262 
263 void C4ConsoleQtViewportView::wheelEvent(QWheelEvent *event)
264 {
265  if (IsPlayViewport())
266  {
267  int delta = event->delta() / 8;
268  if (!delta) delta = event->delta(); // abs(delta)<8?
269  uint32_t shift = (delta>0) ? (delta<<16) : uint32_t(delta<<16);
270  shift += GetShiftWParam();
271  auto pr = GetDevicePixelRatio();
272  C4GUI::MouseMove(C4MC_Button_Wheel, event->x() * pr, event->y() * pr, shift, cvp);
273  }
274  else
275  {
276  auto delta = event->angleDelta();
277  auto modifiers = QGuiApplication::keyboardModifiers();
278  // Zoom with Ctrl + mouse wheel, just like for player viewports.
279  if (modifiers & Qt::ControlModifier)
280  cvp->ChangeZoom(pow(C4GFX_ZoomStep, (float) delta.y() / 120));
281  else
282  {
283  // Viewport movement.
284  float x = -ViewportScrollSpeed * delta.x() / 120, y = -ViewportScrollSpeed * delta.y() / 120;
285  // Not everyone has a vertical scroll wheel...
286  if (modifiers & Qt::ShiftModifier)
287  std::swap(x, y);
288  cvp->ScrollView(x, y);
289  }
290  }
291  // Event has been handled - do not forward to scroll bars
292  event->accept();
293 }
294 
295 void C4ConsoleQtViewportView::focusInEvent(QFocusEvent * event)
296 {
297  dock->OnActiveChanged(true);
298  QWidget::focusInEvent(event);
299 }
300 
301 void C4ConsoleQtViewportView::focusOutEvent(QFocusEvent * event)
302 {
303  dock->OnActiveChanged(false);
304  QWidget::focusOutEvent(event);
305 }
306 
307 
308 
309 /* Keyboard scan code mapping from Qt to our keys */
310 
313 static C4KeyCode QtKeyToUnixScancode(const QKeyEvent &event)
314 {
315  //LogF("VK: %x SC: %x key: %x", event.nativeVirtualKey(), event.nativeScanCode(), event.key());
316  // Map some special keys
317  switch (event.key())
318  {
319  case Qt::Key_Home: return K_HOME;
320  case Qt::Key_End: return K_END;
321  case Qt::Key_PageUp: return K_PAGEUP;
322  case Qt::Key_PageDown: return K_PAGEDOWN;
323  case Qt::Key_Up: return K_UP;
324  case Qt::Key_Down: return K_DOWN;
325  case Qt::Key_Left: return K_LEFT;
326  case Qt::Key_Right: return K_RIGHT;
327  case Qt::Key_Clear: return K_CENTER;
328  case Qt::Key_Insert: return K_INSERT;
329  case Qt::Key_Delete: return K_DELETE;
330  case Qt::Key_Menu: return K_MENU;
331  case Qt::Key_Pause: return K_PAUSE;
332  case Qt::Key_Print: return K_PRINT;
333  case Qt::Key_NumLock: return K_NUM;
334  case Qt::Key_ScrollLock:return K_SCROLL;
335  default:
336  // Some native Win32 key mappings...
337 #ifdef USE_WIN32_WINDOWS
338  switch (event.nativeVirtualKey())
339  {
340  case VK_LWIN: return K_WIN_L;
341  case VK_RWIN: return K_WIN_R;
342  case VK_NUMPAD1: return K_NUM1;
343  case VK_NUMPAD2: return K_NUM2;
344  case VK_NUMPAD3: return K_NUM3;
345  case VK_NUMPAD4: return K_NUM4;
346  case VK_NUMPAD5: return K_NUM5;
347  case VK_NUMPAD6: return K_NUM6;
348  case VK_NUMPAD7: return K_NUM7;
349  case VK_NUMPAD8: return K_NUM8;
350  case VK_NUMPAD9: return K_NUM9;
351  case VK_NUMPAD0: return K_NUM0;
352  }
353  switch (event.nativeScanCode())
354  {
355  case 285: return K_CONTROL_R;
356  }
357 #endif
358  // Otherwise rely on native scan code to be the same on all platforms
359 #ifdef Q_OS_LINUX
360  return event.nativeScanCode() - 8;
361 #elif defined(Q_OS_DARWIN)
362  return event.nativeScanCode();
363 #else
364  return event.nativeScanCode();
365 #endif
366  }
367 }
368 
369 void C4ConsoleQtViewportView::keyPressEvent(QKeyEvent * event)
370 {
371  // Convert key to our internal mapping
372  C4KeyCode code = QtKeyToUnixScancode(*event);
373  // Viewport-only handling
374  bool handled = false;
375  if (code == K_SCROLL)
376  {
377  cvp->TogglePlayerLock();
378  handled = true;
379  }
380  // Handled if handled as player control or main editor
381  if (!handled) handled = Game.DoKeyboardInput(code, KEYEV_Down, !!(event->modifiers() & Qt::AltModifier), !!(event->modifiers() & Qt::ControlModifier), !!(event->modifiers() & Qt::ShiftModifier), event->isAutoRepeat(), nullptr);
382  if (!handled) handled = dock->main_window->HandleEditorKeyDown(event);
383  // Modifiers may update the cursor state; refresh
384  if (event->key() == Qt::Key_Shift || event->key() == Qt::Key_Control || event->key() == Qt::Key_Alt || event->key() == Qt::Key_AltGr)
385  {
387  UpdateCursor();
388  }
389  event->setAccepted(handled);
390 }
391 
392 void C4ConsoleQtViewportView::keyReleaseEvent(QKeyEvent * event)
393 {
394  // Convert key to our internal mapping
395  C4KeyCode code = QtKeyToUnixScancode(*event);
396  // Handled if handled as player control
397  bool handled = Game.DoKeyboardInput(code, KEYEV_Up, !!(event->modifiers() & Qt::AltModifier), !!(event->modifiers() & Qt::ControlModifier), !!(event->modifiers() & Qt::ShiftModifier), event->isAutoRepeat(), nullptr);
398  if (!handled) handled = dock->main_window->HandleEditorKeyUp(event);
399  // Modifiers may update the cursor state; refresh
400  if (event->key() == Qt::Key_Shift || event->key() == Qt::Key_Control || event->key() == Qt::Key_Alt || event->key() == Qt::Key_AltGr)
401  {
403  UpdateCursor();
404  }
405  event->setAccepted(handled);
406 }
407 
408 void C4ConsoleQtViewportView::enterEvent(QEvent *)
409 {
410  // TODO: This should better be managed by the viewport
411  // looks weird when there's multiple viewports open
412  // but for some reason, the EditCursor drawing stuff is not associated with the viewport (yet)
414 }
415 
416 void C4ConsoleQtViewportView::leaveEvent(QEvent *)
417 {
418  // TODO: This should better be managed by the viewport
420 }
421 
422 void C4ConsoleQtViewportView::initializeGL()
423 {
424  // init extensions
425  glewExperimental = GL_TRUE;
426  GLenum err = glewInit();
427  if (GLEW_OK != err)
428  {
429  // Problem: glewInit failed, something is seriously wrong.
430  LogF("glewInit: %s", reinterpret_cast<const char*>(glewGetErrorString(err)));
431  }
432 }
433 
434 void C4ConsoleQtViewportView::resizeGL(int w, int h)
435 {
436  auto pr = GetDevicePixelRatio();
437  cvp->UpdateOutputSize(w * pr, h * pr);
438 }
439 
440 void C4ConsoleQtViewportView::paintGL()
441 {
442  cvp->ScrollBarsByViewPosition();
443  cvp->Execute();
444 }
445 
446 
447 C4ConsoleQtViewportScrollArea::C4ConsoleQtViewportScrollArea(class C4ConsoleQtViewportDockWidget *dock)
448  : QAbstractScrollArea(dock), dock(dock), cvp(dock->cvp->cvp), is_updating_scrollbars(0)
449 {
450  cvp->scrollarea = this;
451  // No scroll bars by default. Neutral viewports will toggle this.
452  setScrollBarVisibility(false);
453 }
454 
455 void C4ConsoleQtViewportScrollArea::scrollContentsBy(int dx, int dy)
456 {
457  // Just use the absolute position in any case.
458  if (!is_updating_scrollbars)
459  {
460  cvp->SetViewX(horizontalScrollBar()->value());
461  cvp->SetViewY(verticalScrollBar()->value());
462  }
463 }
464 
465 bool C4ConsoleQtViewportScrollArea::viewportEvent(QEvent *e)
466 {
467  // Pass everything to the viewport.
468  return false;
469 }
470 
471 void C4ConsoleQtViewportScrollArea::setupViewport(QWidget *viewport)
472 {
473  // Don't steal focus from the viewport. This is necessary to make keyboard input work.
474  viewport->setFocusProxy(nullptr);
475  ScrollBarsByViewPosition();
476 }
477 
478 void C4ConsoleQtViewportScrollArea::ScrollBarsByViewPosition()
479 {
480  ++is_updating_scrollbars; // Do not shift view just from updating scroll bars
481  int x = viewport()->width() / cvp->GetZoom();
482  horizontalScrollBar()->setRange(0, ::Landscape.GetWidth() - x);
483  horizontalScrollBar()->setPageStep(x);
484  horizontalScrollBar()->setValue(cvp->GetViewX());
485 
486  int y = viewport()->height() / cvp->GetZoom();
487  verticalScrollBar()->setRange(0, ::Landscape.GetHeight() - y);
488  verticalScrollBar()->setPageStep(y);
489  verticalScrollBar()->setValue(cvp->GetViewY());
490  --is_updating_scrollbars;
491 }
492 
493 void C4ConsoleQtViewportScrollArea::setScrollBarVisibility(bool visible)
494 {
495  if (visible)
496  {
497  setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
498  setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
499  }
500  else
501  {
502  setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
503  setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
504  }
505 }
506 
507 C4ConsoleQtViewportDockWidget::C4ConsoleQtViewportDockWidget(C4ConsoleQtMainWindow *main_window, QMainWindow *parent, C4ViewportWindow *cvp)
508  : QDockWidget("", parent), main_window(main_window), cvp(cvp)
509 {
510  // Translated title or player name
511  C4Player *plr = ::Players.Get(cvp->cvp->GetPlayer());
512  setWindowTitle(plr ? plr->GetName() : LoadResStr("IDS_CNS_VIEWPORT"));
513  // Actual view container, wrapped in scrolling area
514  auto scrollarea = new C4ConsoleQtViewportScrollArea(this);
515  view = new C4ConsoleQtViewportView(scrollarea);
516  scrollarea->setViewport(view);
517  setWidget(scrollarea);
518  connect(this, SIGNAL(topLevelChanged(bool)), this, SLOT(TopLevelChanged(bool)));
519  // Register viewport widget for periodic rendering updates.
520  cvp->viewport_widget = view;
521 }
522 
523 void C4ConsoleQtViewportDockWidget::mousePressEvent(QMouseEvent *eventPress)
524 {
525  // Clicking the dock focuses the viewport
526  view->setFocus();
527  QDockWidget::mousePressEvent(eventPress);
528 }
529 
530 void C4ConsoleQtViewportDockWidget::OnActiveChanged(bool active)
531 {
532  // Title bar of the selected viewport should be drawn in highlight colors to show that keyboard input will now go to the viewport.
533  // Unfortunately, color and font of the title is not taken from QDockWidget::title but directly from QDockWidget.
534  // Provide them in both just in case Qt ever changes its definition.
535  QColor bgclr = QApplication::palette(this).color(QPalette::Highlight);
536  QColor fontclr = QApplication::palette(this).color(QPalette::HighlightedText);
537  if (active)
538  setStyleSheet(QString(
539  "QDockWidget::title { text-align: left; background: %1; padding-left: 3px; color: %2; font-weight: bold; } QDockWidget { color: %2; font-weight: bold; }").arg(bgclr.name(), fontclr.name()));
540  else
541  setStyleSheet(QString());
542 }
543 
544 void C4ConsoleQtViewportDockWidget::TopLevelChanged(bool is_floating)
545 {
546  // Ensure focus after undock and after re-docking floating viewport window
547  view->setFocus();
548 }
549 
550 void C4ConsoleQtViewportDockWidget::closeEvent(QCloseEvent * event)
551 {
552  QDockWidget::closeEvent(event);
553  if (event->isAccepted())
554  {
555  if (cvp)
556  {
557  // This causes "this" to be deleted:
558  cvp->Close();
559  }
560  else
561  {
562  deleteLater();
563  }
564  }
565 }
566 
567 bool C4ConsoleQtViewportDockWidget::event(QEvent *e)
568 {
569  // Focus on title bar click
570  if (e->type() == QEvent::NonClientAreaMouseButtonPress || e->type() == QEvent::MouseButtonPress) view->setFocus();
571  return QDockWidget::event(e);
572 }
C4EditCursor EditCursor
Definition: C4Console.h:90
int32_t GetY() const
Definition: C4Object.h:287
const int32_t C4MC_Button_MiddleUp
const int32_t C4MC_Button_LeftDown
C4Console Console
Definition: C4Globals.cpp:45
C4Viewport * cvp
C4Game Game
Definition: C4Globals.cpp:52
void MouseMove(int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam, class C4Viewport *pVP)
Definition: C4Gui.h:2829
const int32_t C4MC_Button_RightUp
C4EditCursorSelection & GetSelection()
Definition: C4EditCursor.h:104
const int32_t C4MC_Button_X2Down
bool HasTransformCursor() const
Definition: C4EditCursor.h:113
void DoContextObjsel(C4Object *, bool clear)
C4MouseControl MouseControl
Definition: C4Globals.cpp:47
const int32_t C4MC_Button_MiddleDouble
const int32_t C4MC_Button_X1Double
bool DoKeyboardInput(C4KeyCode vk_code, C4KeyEventType eEventType, bool fAlt, bool fCtrl, bool fShift, bool fRepeated, class C4GUI::Dialog *pForDialog=nullptr, bool fPlrCtrlOnly=false, int32_t iStrength=-1)
Definition: C4Game.cpp:1865
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
const int32_t C4MC_Button_LeftDouble
C4Player * Get(int iPlayer) const
const int32_t C4MC_Button_X2Double
C4NotifyingObjectList Contents
Definition: C4Object.h:152
const int32_t C4MC_Button_LeftUp
void SetMouseHover(bool h)
Definition: C4EditCursor.h:109
const int32_t C4MC_Button_X1Up
bool IsViewport(C4Viewport *pViewport)
bool LeftButtonUp(DWORD dwKeyState)
C4Landscape Landscape
virtual const char * GetName() const
Definition: C4PropList.cpp:649
const int C4CNS_ModePlay
Definition: C4Console.h:30
C4PlayerList Players
int32_t GetX() const
Definition: C4Object.h:286
int32_t Status
Definition: C4PropList.h:168
bool LeftButtonDown(DWORD dwKeyState)
const int32_t C4MC_Button_X1Down
const int32_t C4MC_Button_RightDown
C4LSectors Sectors
Definition: C4GameObjects.h:42
int32_t GetHeight() const
const int32_t C4MC_Button_Wheel
int ObjectCount(C4ID id=C4ID::None) const
bool Move(float iX, float iY, float zoom, DWORD dwKeyState)
const char * GetName() const
Definition: C4Player.h:151
int32_t GetPlayer()
Definition: C4Viewport.h:67
const float C4GFX_ZoomStep
void Close() override
C4Object * SafeObjectPointer(int32_t iNumber)
const int32_t C4MC_Button_RightDouble
const int32_t C4MC_Button_None
bool RightButtonDown(DWORD dwKeyState)
const int32_t C4MC_Button_MiddleDown
bool RightButtonUp(DWORD dwKeyState)
uint32_t GetShiftWParam(QKeyEvent *event=nullptr)
bool LogF(const char *strMessage,...)
Definition: C4Log.cpp:250
unsigned long C4KeyCode
int32_t GetWidth() const
int32_t GetMode()
C4GameObjects Objects
Definition: C4Globals.cpp:48
const int32_t C4MC_Button_X2Up
StdStrBuf FormatString(const char *szFmt,...)
Definition: StdBuf.cpp:270