OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4DrawGLMac.mm
Go to the documentation of this file.
1 /*
2  * OpenClonk, http://www.openclonk.org
3  *
4  * Copyright (c) 2009-2016, The OpenClonk Team and contributors
5  *
6  * Distributed under the terms of the ISC license; see accompanying file
7  * "COPYING" for details.
8  *
9  * "Clonk" is a registered trademark of Matthes Bender, used with permission.
10  * See accompanying file "TRADEMARK" for details.
11  *
12  * To redistribute this file separately, substitute the full license texts
13  * for the above references.
14  */
15 
16 #include <GL/glew.h> // Somehow, C4Include manages to include gltypes.h on the autobuild hosts, which makes glew.h choke if not included first. I don't understand it, and I don't want to.
17 #include "C4Include.h"
18 #include "game/C4GraphicsSystem.h"
19 #include "gui/C4MouseControl.h"
20 #include "gui/C4Gui.h"
21 #include "game/C4Game.h"
22 #include "game/C4Viewport.h"
24 #include "editor/C4Console.h"
25 #include "game/C4FullScreen.h"
26 #include "player/C4PlayerList.h"
27 #include "gui/C4Gui.h"
28 #include "landscape/C4Landscape.h"
29 
30 #include "graphics/C4DrawGL.h"
31 
32 #import "graphics/C4DrawGLMac.h"
35 
36 #ifdef USE_COCOA
37 
38 @implementation C4OpenGLView
39 
40 @synthesize context;
41 
42 - (BOOL) isOpaque {return YES;}
43 
44 
45 - (id) initWithFrame:(NSRect)frameRect
46 {
47  self = [super initWithFrame:frameRect];
48  if (self != nil) {
49  [[NSNotificationCenter defaultCenter]
50  addObserver:self
51  selector:@selector(_surfaceNeedsUpdate:)
52  name:NSViewGlobalFrameDidChangeNotification
53  object:self];
54  }
55  return self;
56 }
57 
58 - (void) awakeFromNib
59 {
60  [self enableEvents];
61 }
62 
63 - (void) enableEvents
64 {
65  [[self window] makeFirstResponder:self];
66  [[self window] setAcceptsMouseMovedEvents:YES];
67 
68  [self registerForDraggedTypes:[NSArray arrayWithObjects:NSFilenamesPboardType, nil]];
69 }
70 
71 - (BOOL) acceptsFirstResponder {return YES;}
72 
73 - (void) resetCursorRects
74 {
75  [super resetCursorRects];
76  if ([self shouldHideMouseCursor])
77  {
78  static NSCursor* cursor;
79  if (!cursor)
80  {
81  cursor = [[NSCursor alloc] initWithImage:[[NSImage alloc] initWithSize:NSMakeSize(1, 1)] hotSpot:NSMakePoint(0, 0)];
82  }
83  [self addCursorRect:self.bounds cursor:cursor];
84  }
85 }
86 
87 - (void) _surfaceNeedsUpdate:(NSNotification*)notification
88 {
89  [self update];
90 }
91 
92 - (void) lockFocus
93 {
94  NSOpenGLContext* ctx = [self context];
95  [super lockFocus];
96  if ([ctx view] != self) {
97  [ctx setView:self];
98  }
99  [ctx makeCurrentContext];
100  if (!Application.isEditor)
101  {
102  /*int swapInterval = 1;
103  [ctx setValues:&swapInterval forParameter:NSOpenGLCPSwapInterval]; */
104  }
105 }
106 
107 - (void) viewDidMoveToWindow
108 {
109  [super viewDidMoveToWindow];
110  if ([self window] == nil)
111  [context clearDrawable];
112 }
113 
114 - (void) drawRect:(NSRect)rect
115 {
116  // better not to draw anything when the game has already finished
118  return;
119 
120 #ifdef __MAC_10_9
121  // don't draw if tab-switched away from fullscreen
122  if ([NSApp respondsToSelector:@selector(occlusionState)])
123  {
124  // Mavericks - query app occlusion state
125  if (([NSApp occlusionState] & NSApplicationOcclusionStateVisible) == 0)
126  return;
127  }
128 #endif
129 
130  if ([self.controller isFullScreenConsideringLionFullScreen] && ![NSApp isActive])
131  return;
132  if ([self.window isMiniaturized] || ![self.window isVisible])
133  return;
134 
135  C4Window* stdWindow = self.controller.stdWindow;
136 
137  if (stdWindow)
138  stdWindow->PerformUpdate();
139  else
140  glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
141 }
142 
143 - (C4WindowController*) controller {return (C4WindowController*)[self.window delegate];}
144 
145 int32_t mouseButtonFromEvent(NSEvent* event, DWORD* modifierFlags)
146 {
147  *modifierFlags = [event modifierFlags]; // should be compatible since MK_* constants mirror the NS* constants
148  if ([event modifierFlags] & NSCommandKeyMask)
149  {
150  // treat cmd and ctrl the same
151  *modifierFlags |= NSControlKeyMask;
152  }
153  switch (event.type)
154  {
155  case NSLeftMouseDown:
156  return [event clickCount] > 1 ? C4MC_Button_LeftDouble : C4MC_Button_LeftDown;
157  case NSLeftMouseUp:
158  return C4MC_Button_LeftUp;
159  case NSRightMouseDown:
160  return [event clickCount] > 1 ? C4MC_Button_RightDouble : C4MC_Button_RightDown;
161  case NSRightMouseUp:
162  return C4MC_Button_RightUp;
163  case NSLeftMouseDragged: case NSRightMouseDragged:
164  return C4MC_Button_None; // sending mouse downs all the time when dragging is not the right thing to do
165  case NSOtherMouseDown:
166  return C4MC_Button_MiddleDown;
167  case NSOtherMouseUp:
168  return C4MC_Button_MiddleUp;
169  case NSScrollWheel:
170  return C4MC_Button_Wheel;
171  default:
172  break;
173  }
174  return C4MC_Button_None;
175 }
176 
177 - (BOOL) shouldHideMouseCursor
178 {
179  return !Application.isEditor || (self.controller.viewport && Console.EditCursor.GetMode() == C4CNS_ModePlay && ValidPlr(self.controller.viewport->GetPlayer()));
180 }
181 
182 - (void) showCursor
183 {
184  if ([self shouldHideMouseCursor])
185  [NSCursor unhide];
186 }
187 
188 - (void) hideCursor
189 {
190  if ([self shouldHideMouseCursor])
191  [NSCursor hide];
192 }
193 
194 - (void) mouseEvent:(NSEvent*)event
195 {
196  DWORD flags = 0;
197  int32_t button = mouseButtonFromEvent(event, &flags);
198  int actualSizeX = Application.isEditor ? self.frame.size.width : ActualFullscreenX;
199  int actualSizeY = Application.isEditor ? self.frame.size.height : ActualFullscreenY;
200  CGPoint mouse = [self convertPoint:[self.window mouseLocationOutsideOfEventStream] fromView:nil];
201  if (!Application.isEditor)
202  {
203  mouse.x *= ActualFullscreenX/self.frame.size.width;
204  mouse.y *= ActualFullscreenY/self.frame.size.height;
205  }
206  mouse.x = fmin(fmax(mouse.x, 0), actualSizeX);
207  mouse.y = fmin(fmax(mouse.y, 0), actualSizeY);
208  int x = mouse.x;
209  int y = actualSizeY - mouse.y;
210 
211  C4Viewport* viewport = self.controller.viewport;
213  {
214  DWORD keyMask = flags;
215  if ([event type] == NSScrollWheel)
216  {
217  // TODO: We could evaluate the full smooth scrolling
218  // information, but zoom and inventory scrolling don't
219  // do very well with that at the moment.
220  if ([event deltaY] > 0)
221  keyMask |= (+32) << 16;
222  else
223  keyMask |= (-32) << 16;
224  }
225 
226  ::C4GUI::MouseMove(button, x, y, keyMask, Application.isEditor ? viewport : NULL);
227  }
228  else if (viewport)
229  {
230  switch (button)
231  {
233  Console.EditCursor.Move(viewport->GetViewX()+x/viewport->GetZoom(), viewport->GetViewY()+y/viewport->GetZoom(), viewport->GetZoom(), flags);
235  break;
236  case C4MC_Button_LeftUp:
238  break;
241  break;
242  case C4MC_Button_RightUp:
244  break;
245  case C4MC_Button_None:
246  Console.EditCursor.Move(viewport->GetViewX()+x/viewport->GetZoom(),viewport->GetViewY()+y/viewport->GetZoom(), viewport->GetZoom(), flags);
247  break;
248  }
249  }
250 
251 }
252 
253 - (void) magnifyWithEvent:(NSEvent *)event
254 {
255  if (Game.IsRunning && (event.modifierFlags & NSAlternateKeyMask) == 0)
256  {
257  C4Viewport* viewport = self.controller.viewport;
258  if (viewport)
259  {
260  viewport->SetZoom(viewport->GetZoom()+[event magnification], true);
261  }
262  }
263  else
264  {
265  if (lionAndBeyond())
266  [self.window toggleFullScreen:self];
267  else
268  [self.controller setFullscreen:[event magnification] > 0];
269  }
270 
271 }
272 
273 - (void) swipeWithEvent:(NSEvent*)event
274 {
275  // swiping left triggers going back in startup dialogs
276  if (event.deltaX > 0)
277  [C4AppDelegate.instance simulateKeyPressed:K_LEFT];
278  else
279  [C4AppDelegate.instance simulateKeyPressed:K_RIGHT];
280 }
281 
282 - (void)insertText:(id)insertString
283 {
284  if (::pGUI)
285  {
286  NSString* str = [insertString isKindOfClass:[NSAttributedString class]] ? [(NSAttributedString*)insertString string] : (NSString*)insertString;
287  const char* cstr = [str cStringUsingEncoding:NSUTF8StringEncoding];
288  ::pGUI->CharIn(cstr);
289  }
290 }
291 
292 - (void)doCommandBySelector:(SEL)selector
293 {
294  // ignore to not trigger the annoying beep sound
295 }
296 
297 - (void)keyEvent:(NSEvent*)event withKeyEventType:(C4KeyEventType)type
298 {
300  [event keyCode]+CocoaKeycodeOffset, // offset keycode by some value to distinguish between those special key defines
301  type,
302  [event modifierFlags] & NSAlternateKeyMask,
303  ([event modifierFlags] & NSControlKeyMask) || ([event modifierFlags] & NSCommandKeyMask),
304  [event modifierFlags] & NSShiftKeyMask,
305  false, NULL
306  );
307 
308  C4Window* stdWindow = self.controller.stdWindow;
309  if (stdWindow->eKind == C4ConsoleGUI::W_Viewport)
310  {
311  if (type == KEYEV_Down)
312  Console.EditCursor.KeyDown([event keyCode]+CocoaKeycodeOffset, [event modifierFlags]);
313  else
314  Console.EditCursor.KeyUp([event keyCode]+CocoaKeycodeOffset, [event modifierFlags]);
315  }
316 }
317 
318 - (void)keyDown:(NSEvent*)event
319 {
320  [self interpretKeyEvents:[NSArray arrayWithObject:event]]; // call this to route character input to insertText:
321  [self keyEvent:event withKeyEventType:KEYEV_Down];
322 }
323 
324 - (void)keyUp:(NSEvent*)event
325 {
326  [self keyEvent:event withKeyEventType:KEYEV_Up];
327 }
328 
329 - (void)flagsChanged:(NSEvent*)event
330 {
331  // Send keypress/release events for relevant modifier keys
332  // keyDown() is not called for modifier keys.
333  C4KeyCode key = (C4KeyCode)([event keyCode] + CocoaKeycodeOffset);
334  int modifier = 0;
335  if (key == K_SHIFT_L || key == K_SHIFT_R)
336  modifier = NSShiftKeyMask;
337  if (key == K_CONTROL_L || key == K_CONTROL_R)
338  modifier = NSControlKeyMask;
339  if (key == K_COMMAND_L || key == K_COMMAND_R)
340  modifier = NSCommandKeyMask;
341  if (key == K_ALT_L || key == K_ALT_R)
342  modifier = NSAlternateKeyMask;
343 
344  if (modifier != 0)
345  {
346  int modifierMask = [event modifierFlags];
347  if (modifierMask & modifier)
348  [self keyEvent:event withKeyEventType:KEYEV_Down];
349  else
350  [self keyEvent:event withKeyEventType:KEYEV_Up];
351  }
352 }
353 
354 - (NSDragOperation) draggingEntered:(id<NSDraggingInfo>)sender
355 {
356  return NSDragOperationCopy;
357 }
358 
359 - (NSDragOperation) draggingUpdated:(id<NSDraggingInfo>)sender
360 {
361  return NSDragOperationCopy;
362 }
363 
364 - (BOOL) prepareForDragOperation:(id<NSDraggingInfo>)sender
365 {
366  return YES;
367 }
368 
369 - (BOOL) performDragOperation:(id<NSDraggingInfo>)sender
370 {
371  NSPasteboard* pasteboard = [sender draggingPasteboard];
372  if ([[pasteboard types] containsObject:NSFilenamesPboardType])
373  {
374  NSArray* files = [pasteboard propertyListForType:NSFilenamesPboardType];
375  C4Viewport* viewport = self.controller.viewport;
376  if (viewport)
377  {
378  for (NSString* fileName in files)
379  {
380  auto loc = NSMakePoint([sender draggingLocation].x, self.bounds.size.height - [sender draggingLocation].y);
381  viewport->DropFile([fileName cStringUsingEncoding:NSUTF8StringEncoding], loc.x, loc.y);
382  }
383  }
384  }
385  return YES;
386 }
387 
388 - (void )concludeDragOperation:(id<NSDraggingInfo>)sender
389 {
390 }
391 
392 // respaghettisize :D
393 
394 - (void) scrollWheel:(NSEvent *)event
395 {
396  // Scroll viewport in editor mode
397  C4Viewport* viewport = self.controller.viewport;
398  if (Application.isEditor && viewport && !viewport->GetPlayerLock())
399  {
400  NSScrollView* scrollView = self.controller.scrollView;
401  NSPoint p = NSMakePoint(2*-[event deltaX]/abs(::Landscape.GetWidth()-viewport->ViewWdt), 2*-[event deltaY]/abs(::Landscape.GetHeight()-viewport->ViewHgt));
402  [scrollView.horizontalScroller setDoubleValue:scrollView.horizontalScroller.doubleValue+p.x];
403  [scrollView.verticalScroller setDoubleValue:scrollView.verticalScroller.doubleValue+p.y];
404  viewport->ViewPositionByScrollBars();
405  [self display];
406  }
407  else
408  {
409  // If player lock is enabled or fullscreen: handle scroll
410  // event in-game.
411  [self mouseEvent:event];
412  }
413 }
414 
415 - (void) mouseDown: (NSEvent *)event {[self mouseEvent:event];}
416 - (void) rightMouseDown: (NSEvent *)event {[self mouseEvent:event];}
417 - (void) rightMouseUp: (NSEvent *)event {[self mouseEvent:event];}
418 - (void) otherMouseDown: (NSEvent *)event {[self mouseEvent:event];}
419 - (void) otherMouseUp: (NSEvent *)event {[self mouseEvent:event];}
420 - (void) mouseUp: (NSEvent *)event {[self mouseEvent:event];}
421 - (void) mouseMoved: (NSEvent *)event {[self mouseEvent:event];}
422 - (void) mouseDragged: (NSEvent *)event {[self mouseEvent:event];}
423 - (void) rightMouseDragged:(NSEvent *)event {[self mouseEvent:event];}
424 
425 - (void) update
426 {
427  [context update];
428 }
429 
430 + (CGDirectDisplayID) displayID
431 {
432  return (CGDirectDisplayID)[[[[[NSApp keyWindow] screen] deviceDescription] valueForKey:@"NSScreenNumber"] intValue];
433 }
434 
435 + (void) enumerateMultiSamples:(std::vector<int>&)samples
436 {
437  CGDirectDisplayID displayID = self.displayID;
438  CGOpenGLDisplayMask displayMask = CGDisplayIDToOpenGLDisplayMask(displayID);
439  int numRenderers = 0;
440  CGLRendererInfoObj obj = NULL;
441  GLint sampleModes;
442 
443  CGLQueryRendererInfo(displayMask, &obj, &numRenderers);
444  CGLDescribeRenderer(obj, 0, kCGLRPSampleModes, &sampleModes);
445  CGLDestroyRendererInfo(obj);
446 
447  if (sampleModes & kCGLMultisampleBit)
448  {
449  samples.push_back(1);
450  samples.push_back(2);
451  samples.push_back(4);
452  }
453 }
454 
455 + (void) setSurfaceBackingSizeOf:(NSOpenGLContext*) context width:(int)wdt height:(int)hgt
456 {
457  if (context && !Application.isEditor)
458  {
459  // Make back buffer size fixed ( http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_contexts/opengl_contexts.html )
460  GLint dim[2] = {wdt, hgt};
461  CGLContextObj ctx = (CGLContextObj)context.CGLContextObj;
462  CGLSetParameter(ctx, kCGLCPSurfaceBackingSize, dim);
463  CGLEnable (ctx, kCGLCESurfaceBackingSize);
464  }
465 }
466 
467 - (void) setContextSurfaceBackingSizeToOwnDimensions
468 {
469  [C4OpenGLView setSurfaceBackingSizeOf:self.context width:self.frame.size.width height:self.frame.size.height];
470 }
471 
472 static NSOpenGLContext* MainContext;
473 
474 + (NSOpenGLContext*) mainContext
475 {
476  return MainContext;
477 }
478 
479 + (NSOpenGLContext*) createContext:(CStdGLCtx*) pMainCtx
480 {
481  std::vector<NSOpenGLPixelFormatAttribute> attribs;
482  attribs.push_back(NSOpenGLPFAOpenGLProfile);
483  attribs.push_back(NSOpenGLProfileVersion3_2Core);
484  attribs.push_back(NSOpenGLPFADepthSize);
485  attribs.push_back(16);
487  {
488  std::vector<int> samples;
489  [self enumerateMultiSamples:samples];
490  if (!samples.empty())
491  {
492  attribs.push_back(NSOpenGLPFAMultisample);
493  attribs.push_back(NSOpenGLPFASampleBuffers);
494  attribs.push_back(1);
495  attribs.push_back(NSOpenGLPFASamples);
496  attribs.push_back(Config.Graphics.MultiSampling);
497  }
498  }
499  attribs.push_back(NSOpenGLPFANoRecovery);
500  //attribs.push_back(NSOpenGLPFADoubleBuffer);
501  //attribs.push_back(NSOpenGLPFAWindow); // cannot create a core profile with this
502  attribs.push_back(0);
503  NSOpenGLPixelFormat* format = [[NSOpenGLPixelFormat alloc] initWithAttributes:&attribs[0]];
504  NSOpenGLContext* result = [[NSOpenGLContext alloc] initWithFormat:format shareContext:pMainCtx ? pMainCtx->objectiveCObject<NSOpenGLContext>() : nil];
505  if (!MainContext)
506  MainContext = result;
507  return result;
508 }
509 
510 - (IBAction) increaseZoom:(id)sender
511 {
512  if (Application.isEditor)
513  {
514  C4Viewport* v = self.controller.viewport;
515  v->SetZoom(v->GetZoom()*2, false);
516  }
517  else
519 }
520 
521 - (IBAction) decreaseZoom:(id)sender
522 {
523  if (Application.isEditor)
524  {
525  C4Viewport* v = self.controller.viewport;
526  v->SetZoom(v->GetZoom()/2, false);
527  }
528  else
530 }
531 
532 @end
533 
534 @implementation C4EditorOpenGLView
535 
536 - (void) copy:(id) sender
537 {
539 }
540 
541 - (void) delete:(id) sender
542 {
544 }
545 
546 - (IBAction) grabContents:(id) sender
547 {
549 }
550 
551 - (IBAction) resetZoom:(id) sender
552 {
553  self.controller.viewport->SetZoom(1, true);
554 }
555 
556 @end
557 
558 #pragma mark CStdGLCtx: Initialization
559 
560 CStdGLCtx::CStdGLCtx(): pWindow(0), this_context(contexts.end()) {}
561 
562 void CStdGLCtx::Clear(bool multisample_change)
563 {
564  Deselect();
565  setObjectiveCObject(nil);
566  pWindow = 0;
567 
568  if (this_context != contexts.end())
569  {
570  contexts.erase(this_context);
571  this_context = contexts.end();
572  }
573 }
574 
575 void C4Window::EnumerateMultiSamples(std::vector<int>& samples) const
576 {
577  [C4OpenGLView enumerateMultiSamples:samples];
578 }
579 
580 bool CStdGLCtx::Init(C4Window * pWindow, C4AbstractApp *)
581 {
582  // safety
583  if (!pGL) return false;
584  // store window
585  this->pWindow = pWindow;
586  // Create Context with sharing (if this is the main context, our ctx will be 0, so no sharing)
587  // try direct rendering first
588  NSOpenGLContext* ctx = [C4OpenGLView createContext:pGL->pMainCtx];
589  setObjectiveCObject(ctx);
590  // No luck at all?
591  if (!Select(true)) return pGL->Error(" gl: Unable to select context");
592  // init extensions
593  glewExperimental = GL_TRUE; // Init GL 3.0+ function pointers
594  GLenum err = glewInit();
595  if (GLEW_OK != err)
596  {
597  // Problem: glewInit failed, something is seriously wrong.
598  return pGL->Error(reinterpret_cast<const char*>(glewGetErrorString(err)));
599  }
600  // set the openglview's context
601  auto controller = pWindow->objectiveCObject<C4WindowController>();
602  if (controller && controller.openGLView)
603  {
604  [controller.openGLView setContext:ctx];
605  }
606 
607  this_context = contexts.insert(contexts.end(), this);
608  return true;
609 }
610 
611 #pragma mark CStdGLCtx: Select/Deselect
612 
613 bool CStdGLCtx::Select(bool verbose)
614 {
615  [objectiveCObject<NSOpenGLContext>() makeCurrentContext];
616  SelectCommon();
617  // update clipper - might have been done by UpdateSize
618  // however, the wrong size might have been assumed
619  if (!pGL->UpdateClipper())
620  {
621  if (verbose) pGL->Error(" gl: UpdateClipper failed");
622  return false;
623  }
624  // success
625  return true;
626 }
627 
628 void CStdGLCtx::Deselect()
629 {
630  if (pGL && pGL->pCurrCtx == this)
631  {
632  pGL->pCurrCtx = 0;
633  }
634 }
635 
636 bool CStdGLCtx::PageFlip()
637 {
638  // flush GL buffer
639  glFlush();
640  if (!pWindow) return false;
641  //SDL_GL_SwapBuffers();
642  return true;
643 }
644 
645 int ActualFullscreenX = 0, ActualFullscreenY = 0;
646 
647 #endif
C4EditCursor EditCursor
Definition: C4Console.h:90
bool IsRunning
Definition: C4Game.h:139
void SelectCommon()
Definition: C4DrawGLCtx.cpp:33
const int32_t C4MC_Button_MiddleUp
int32_t MultiSampling
Definition: C4Config.h:115
C4Config Config
Definition: C4Config.cpp:833
const int32_t C4MC_Button_LeftDown
virtual bool Select(bool verbose=false)
static std::list< CStdGLCtx * > contexts
Definition: C4DrawGL.h:135
C4Console Console
Definition: C4Globals.cpp:45
CStdGLCtx * pCurrCtx
Definition: C4DrawGL.h:179
C4Game Game
Definition: C4Globals.cpp:52
virtual void Deselect()
IBAction simulateKeyPressed:(C4KeyCode key)
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
bool ViewportZoomIn()
virtual void EnumerateMultiSamples(std::vector< int > &samples) const
Definition: C4AppT.cpp:102
C4MouseControl MouseControl
Definition: C4Globals.cpp:47
bool KeyDown(C4KeyCode KeyCode, DWORD dwKeyState)
virtual void PerformUpdate()
Definition: C4App.cpp:85
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 int32_t C4MC_Button_LeftDouble
float GetZoom()
Definition: C4Gui.h:2828
C4ConfigGraphics Graphics
Definition: C4Config.h:253
bool UpdateClipper() override
Definition: C4DrawGL.cpp:151
C4GUIScreen * pGUI
Definition: C4Gui.cpp:1191
std::list< CStdGLCtx * >::iterator this_context
Definition: C4DrawGL.h:136
const int32_t C4MC_Button_LeftUp
bool IsViewport(C4Viewport *pViewport)
bool LeftButtonUp(DWORD dwKeyState)
C4Landscape Landscape
void SetZoom(float zoomValue)
Definition: C4Viewport.cpp:495
const int C4CNS_ModePlay
Definition: C4Console.h:30
WindowKind eKind
Definition: C4Window.h:275
bool lionAndBeyond()
bool LeftButtonDown(DWORD dwKeyState)
const int32_t C4MC_Button_RightDown
bool fQuitMsgReceived
Definition: C4App.h:81
bool KeyUp(C4KeyCode KeyCode, DWORD dwKeyState)
virtual bool PageFlip()
virtual bool CharIn(const char *c)
Definition: C4Gui.cpp:779
const int32_t C4MC_Button_Wheel
C4Window * pWindow
Definition: C4DrawGL.h:127
bool Move(float iX, float iY, float zoom, DWORD dwKeyState)
C4KeyEventType
C4ViewportList Viewports
Definition: C4Viewport.cpp:841
float GetZoom()
Definition: C4Viewport.h:45
int32_t ValidPlr(int32_t plr)
virtual bool Init(C4Window *pWindow, C4AbstractApp *pApp)
const int32_t C4MC_Button_RightDouble
const int32_t C4MC_Button_None
bool RightButtonDown(DWORD dwKeyState)
bool Error(const char *szMsg) override
Definition: C4DrawGL.cpp:853
virtual void Clear(bool multisample_change=false)
CStdGL * pGL
Definition: C4DrawGL.cpp:905
void DropFile(const char *fileName, float x, float y)
Definition: C4Viewport.cpp:47
bool ViewportZoomOut()
const int32_t C4MC_Button_MiddleDown
bool RightButtonUp(DWORD dwKeyState)
uint32_t DWORD
float GetViewX()
Definition: C4Viewport.h:73
unsigned long C4KeyCode
C4Application Application
Definition: C4Globals.cpp:44
int32_t GetWidth() const
bool GetPlayerLock()
Definition: C4Viewport.h:62
int32_t GetMode()
bool ViewPositionByScrollBars()