Panda3D
tinySDLGraphicsWindow.cxx
1 // Filename: tinySDLGraphicsWindow.cxx
2 // Created by: drose (24Apr08)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "pandabase.h"
16 
17 #ifdef HAVE_SDL
18 
19 #include "tinySDLGraphicsWindow.h"
20 #include "tinyGraphicsStateGuardian.h"
21 #include "config_tinydisplay.h"
22 #include "tinySDLGraphicsPipe.h"
23 #include "mouseButton.h"
24 #include "keyboardButton.h"
25 #include "graphicsPipe.h"
26 
27 TypeHandle TinySDLGraphicsWindow::_type_handle;
28 
29 ////////////////////////////////////////////////////////////////////
30 // Function: TinySDLGraphicsWindow::Constructor
31 // Access: Public
32 // Description:
33 ////////////////////////////////////////////////////////////////////
34 TinySDLGraphicsWindow::
35 TinySDLGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe,
36  const string &name,
37  const FrameBufferProperties &fb_prop,
38  const WindowProperties &win_prop,
39  int flags,
41  GraphicsOutput *host) :
42  GraphicsWindow(engine, pipe, name, fb_prop, win_prop, flags, gsg, host)
43 {
44  _screen = NULL;
45  _frame_buffer = NULL;
46  _pitch = 0;
47  update_pixel_factor();
48 
51  add_input_device(device);
52 }
53 
54 ////////////////////////////////////////////////////////////////////
55 // Function: TinySDLGraphicsWindow::Destructor
56 // Access: Public, Virtual
57 // Description:
58 ////////////////////////////////////////////////////////////////////
59 TinySDLGraphicsWindow::
60 ~TinySDLGraphicsWindow() {
61 }
62 
63 ////////////////////////////////////////////////////////////////////
64 // Function: TinySDLGraphicsWindow::begin_frame
65 // Access: Public, Virtual
66 // Description: This function will be called within the draw thread
67 // before beginning rendering for a given frame. It
68 // should do whatever setup is required, and return true
69 // if the frame should be rendered, or false if it
70 // should be skipped.
71 ////////////////////////////////////////////////////////////////////
72 bool TinySDLGraphicsWindow::
73 begin_frame(FrameMode mode, Thread *current_thread) {
74  begin_frame_spam(mode);
75  if (_gsg == (GraphicsStateGuardian *)NULL) {
76  return false;
77  }
78 
80  DCAST_INTO_R(tinygsg, _gsg, false);
81 
82  tinygsg->_current_frame_buffer = _frame_buffer;
83  tinygsg->reset_if_new();
84 
85  _gsg->set_current_properties(&get_fb_properties());
86  return _gsg->begin_frame(current_thread);
87 }
88 
89 ////////////////////////////////////////////////////////////////////
90 // Function: TinySDLGraphicsWindow::end_frame
91 // Access: Public, Virtual
92 // Description: This function will be called within the draw thread
93 // after rendering is completed for a given frame. It
94 // should do whatever finalization is required.
95 ////////////////////////////////////////////////////////////////////
96 void TinySDLGraphicsWindow::
97 end_frame(FrameMode mode, Thread *current_thread) {
98  end_frame_spam(mode);
99  nassertv(_gsg != (GraphicsStateGuardian *)NULL);
100 
101  if (mode == FM_render) {
102  // end_render_texture();
103  copy_to_textures();
104  }
105 
106  _gsg->end_frame(current_thread);
107 
108  if (mode == FM_render) {
109  trigger_flip();
110  }
111 }
112 
113 ////////////////////////////////////////////////////////////////////
114 // Function: TinySDLGraphicsWindow::end_flip
115 // Access: Public, Virtual
116 // Description: This function will be called within the draw thread
117 // after begin_flip() has been called on all windows, to
118 // finish the exchange of the front and back buffers.
119 //
120 // This should cause the window to wait for the flip, if
121 // necessary.
122 ////////////////////////////////////////////////////////////////////
123 void TinySDLGraphicsWindow::
124 end_flip() {
125  if (!_flip_ready) {
127  return;
128  }
129 
130  int fb_xsize = get_fb_x_size();
131  int fb_ysize = get_fb_y_size();
132 
133  if (fb_xsize == _frame_buffer->xsize) {
134  // No zooming is necessary--copy directly to the screen.
135  if (SDL_MUSTLOCK(_screen)) {
136  if (SDL_LockSurface(_screen) < 0) {
137  tinydisplay_cat.error()
138  << "Can't lock screen: " << SDL_GetError() << "\n";
139  }
140  }
141  ZB_copyFrameBuffer(_frame_buffer, _screen->pixels, _pitch);
142 
143  if (SDL_MUSTLOCK(_screen)) {
144  SDL_UnlockSurface(_screen);
145  }
146 
147  } else {
148  // Copy to another surface, then scale it onto the screen.
149  SDL_Surface *temp =
150  SDL_CreateRGBSurfaceFrom(_frame_buffer->pbuf, _frame_buffer->xsize, _frame_buffer->ysize,
151  32, _frame_buffer->linesize, 0xff0000, 0x00ff00, 0x0000ff, 0xff000000);
152  SDL_SetAlpha(temp, SDL_RLEACCEL, 0);
153  SDL_BlitSurface(temp, NULL, _screen, NULL);
154  SDL_FreeSurface(temp);
155  }
156 
157  SDL_Flip(_screen);
159 }
160 
161 ////////////////////////////////////////////////////////////////////
162 // Function: TinySDLGraphicsWindow::process_events
163 // Access: Public, Virtual
164 // Description: Do whatever processing is necessary to ensure that
165 // the window responds to user events. Also, honor any
166 // requests recently made via request_properties()
167 //
168 // This function is called only within the window
169 // thread.
170 ////////////////////////////////////////////////////////////////////
171 void TinySDLGraphicsWindow::
172 process_events() {
174 
175  if (_screen == NULL) {
176  return;
177  }
178 
179  WindowProperties properties;
180 
181  SDL_Event evt;
182  ButtonHandle button;
183  while (SDL_PollEvent(&evt)) {
184  switch(evt.type) {
185  case SDL_KEYDOWN:
186  if (evt.key.keysym.unicode) {
187  _input_devices[0].keystroke(evt.key.keysym.unicode);
188  }
189  button = get_keyboard_button(evt.key.keysym.sym);
190  if (button != ButtonHandle::none()) {
191  _input_devices[0].button_down(button);
192  }
193  break;
194 
195  case SDL_KEYUP:
196  button = get_keyboard_button(evt.key.keysym.sym);
197  if (button != ButtonHandle::none()) {
198  _input_devices[0].button_up(button);
199  }
200  break;
201 
202  case SDL_MOUSEBUTTONDOWN:
203  button = get_mouse_button(evt.button.button);
204  _input_devices[0].set_pointer_in_window(evt.button.x, evt.button.y);
205  _input_devices[0].button_down(button);
206  break;
207 
208  case SDL_MOUSEBUTTONUP:
209  button = get_mouse_button(evt.button.button);
210  _input_devices[0].set_pointer_in_window(evt.button.x, evt.button.y);
211  _input_devices[0].button_up(button);
212  break;
213 
214  case SDL_MOUSEMOTION:
215  _input_devices[0].set_pointer_in_window(evt.motion.x, evt.motion.y);
216  break;
217 
218  case SDL_VIDEORESIZE:
219  properties.set_size(evt.resize.w, evt.resize.h);
220  system_changed_properties(properties);
221  _screen = SDL_SetVideoMode(_properties.get_x_size(), _properties.get_y_size(), 32, _flags);
222  ZB_resize(_frame_buffer, NULL, _properties.get_x_size(), _properties.get_y_size());
223  _pitch = _screen->pitch * 32 / _screen->format->BitsPerPixel;
224  break;
225 
226  case SDL_QUIT:
227  // The window was closed by the user.
228  close_window();
229  properties.set_open(false);
230  system_changed_properties(properties);
231  break;
232  }
233  }
234 }
235 
236 ////////////////////////////////////////////////////////////////////
237 // Function: TinySDLGraphicsWindow::set_properties_now
238 // Access: Public, Virtual
239 // Description: Applies the requested set of properties to the
240 // window, if possible, for instance to request a change
241 // in size or minimization status.
242 //
243 // The window properties are applied immediately, rather
244 // than waiting until the next frame. This implies that
245 // this method may *only* be called from within the
246 // window thread.
247 //
248 // The return value is true if the properties are set,
249 // false if they are ignored. This is mainly useful for
250 // derived classes to implement extensions to this
251 // function.
252 ////////////////////////////////////////////////////////////////////
253 void TinySDLGraphicsWindow::
254 set_properties_now(WindowProperties &properties) {
256  if (!properties.is_any_specified()) {
257  // The base class has already handled this case.
258  return;
259  }
260 }
261 
262 ////////////////////////////////////////////////////////////////////
263 // Function: TinySDLGraphicsWindow::supports_pixel_zoom
264 // Access: Published, Virtual
265 // Description: Returns true if a call to set_pixel_zoom() will be
266 // respected, false if it will be ignored. If this
267 // returns false, then get_pixel_factor() will always
268 // return 1.0, regardless of what value you specify for
269 // set_pixel_zoom().
270 //
271 // This may return false if the underlying renderer
272 // doesn't support pixel zooming, or if you have called
273 // this on a DisplayRegion that doesn't have both
274 // set_clear_color() and set_clear_depth() enabled.
275 ////////////////////////////////////////////////////////////////////
276 bool TinySDLGraphicsWindow::
277 supports_pixel_zoom() const {
278  return true;
279 }
280 
281 ////////////////////////////////////////////////////////////////////
282 // Function: TinySDLGraphicsWindow::close_window
283 // Access: Protected, Virtual
284 // Description: Closes the window right now. Called from the window
285 // thread.
286 ////////////////////////////////////////////////////////////////////
287 void TinySDLGraphicsWindow::
288 close_window() {
289  GraphicsWindow::close_window();
290 }
291 
292 ////////////////////////////////////////////////////////////////////
293 // Function: TinySDLGraphicsWindow::open_window
294 // Access: Protected, Virtual
295 // Description: Opens the window right now. Called from the window
296 // thread. Returns true if the window is successfully
297 // opened, or false if there was a problem.
298 ////////////////////////////////////////////////////////////////////
299 bool TinySDLGraphicsWindow::
300 open_window() {
301 
302  // GSG Creation/Initialization
303  TinyGraphicsStateGuardian *tinygsg;
304  if (_gsg == 0) {
305  // There is no old gsg. Create a new one.
306  tinygsg = new TinyGraphicsStateGuardian(_engine, _pipe, NULL);
307  _gsg = tinygsg;
308 
309  } else {
310  DCAST_INTO_R(tinygsg, _gsg, false);
311  }
312 
313  _flags = SDL_SWSURFACE;
314  if (_properties.get_fullscreen()) {
315  _flags |= SDL_FULLSCREEN;
316  }
317  if (!_properties.get_fixed_size()) {
318  _flags |= SDL_RESIZABLE;
319  }
320  if (_properties.get_undecorated()) {
321  _flags |= SDL_NOFRAME;
322  }
323  _screen = SDL_SetVideoMode(_properties.get_x_size(), _properties.get_y_size(), 32, _flags);
324 
325  if (_screen == NULL) {
326  tinydisplay_cat.error()
327  << "Video mode set failed.\n";
328  return false;
329  }
330 
331  create_frame_buffer();
332  if (_frame_buffer == NULL) {
333  tinydisplay_cat.error()
334  << "Could not create frame buffer.\n";
335  return false;
336  }
337 
338  tinygsg->_current_frame_buffer = _frame_buffer;
339 
340  // Now that we have made the context current to a window, we can
341  // reset the GSG state if this is the first time it has been used.
342  // (We can't just call reset() when we construct the GSG, because
343  // reset() requires having a current context.)
344  tinygsg->reset_if_new();
345 
346  return true;
347 }
348 
349 ////////////////////////////////////////////////////////////////////
350 // Function: TinySDLGraphicsWindow::create_frame_buffer
351 // Access: Private
352 // Description: Creates a suitable frame buffer for the current
353 // window size.
354 ////////////////////////////////////////////////////////////////////
355 void TinySDLGraphicsWindow::
356 create_frame_buffer() {
357  if (_frame_buffer != NULL) {
358  ZB_close(_frame_buffer);
359  _frame_buffer = NULL;
360  }
361 
362  int mode;
363  switch (_screen->format->BitsPerPixel) {
364  case 8:
365  tinydisplay_cat.error()
366  << "SDL Palettes are currently not supported.\n";
367  return;
368 
369  case 16:
370  mode = ZB_MODE_5R6G5B;
371  break;
372  case 24:
373  mode = ZB_MODE_RGB24;
374  break;
375  case 32:
376  mode = ZB_MODE_RGBA;
377  break;
378 
379  default:
380  return;
381  }
382 
383  _frame_buffer = ZB_open(_properties.get_x_size(), _properties.get_y_size(), mode, 0, 0, 0, 0);
384 
385  _pitch = _screen->pitch * 32 / _screen->format->BitsPerPixel;
386 }
387 
388 ////////////////////////////////////////////////////////////////////
389 // Function: TinySDLGraphicsWindow::get_keyboard_button
390 // Access: Private, Static
391 // Description: Maps from an SDL keysym to the corresponding Panda
392 // ButtonHandle.
393 ////////////////////////////////////////////////////////////////////
394 ButtonHandle TinySDLGraphicsWindow::
395 get_keyboard_button(SDLKey sym) {
396  switch (sym) {
397  case SDLK_BACKSPACE: return KeyboardButton::backspace();
398  case SDLK_TAB: return KeyboardButton::tab();
399  // case SDLK_CLEAR: return KeyboardButton::clear();
400  case SDLK_RETURN: return KeyboardButton::enter();
401  // case SDLK_PAUSE: return KeyboardButton::pause();
402  case SDLK_ESCAPE: return KeyboardButton::escape();
403  case SDLK_SPACE: return KeyboardButton::space();
404  case SDLK_EXCLAIM: return KeyboardButton::ascii_key('!');
405  case SDLK_QUOTEDBL: return KeyboardButton::ascii_key('"');
406  case SDLK_HASH: return KeyboardButton::ascii_key('#');
407  case SDLK_DOLLAR: return KeyboardButton::ascii_key('$');
408  case SDLK_AMPERSAND: return KeyboardButton::ascii_key('&');
409  case SDLK_QUOTE: return KeyboardButton::ascii_key('\'');
410  case SDLK_LEFTPAREN: return KeyboardButton::ascii_key('(');
411  case SDLK_RIGHTPAREN: return KeyboardButton::ascii_key(')');
412  case SDLK_ASTERISK: return KeyboardButton::ascii_key('*');
413  case SDLK_PLUS: return KeyboardButton::ascii_key('+');
414  case SDLK_COMMA: return KeyboardButton::ascii_key(',');
415  case SDLK_MINUS: return KeyboardButton::ascii_key('-');
416  case SDLK_PERIOD: return KeyboardButton::ascii_key('.');
417  case SDLK_SLASH: return KeyboardButton::ascii_key('/');
418  case SDLK_0: return KeyboardButton::ascii_key('0');
419  case SDLK_1: return KeyboardButton::ascii_key('1');
420  case SDLK_2: return KeyboardButton::ascii_key('2');
421  case SDLK_3: return KeyboardButton::ascii_key('3');
422  case SDLK_4: return KeyboardButton::ascii_key('4');
423  case SDLK_5: return KeyboardButton::ascii_key('5');
424  case SDLK_6: return KeyboardButton::ascii_key('6');
425  case SDLK_7: return KeyboardButton::ascii_key('7');
426  case SDLK_8: return KeyboardButton::ascii_key('8');
427  case SDLK_9: return KeyboardButton::ascii_key('9');
428  case SDLK_COLON: return KeyboardButton::ascii_key(':');
429  case SDLK_SEMICOLON: return KeyboardButton::ascii_key(';');
430  case SDLK_LESS: return KeyboardButton::ascii_key('<');
431  case SDLK_EQUALS: return KeyboardButton::ascii_key('=');
432  case SDLK_GREATER: return KeyboardButton::ascii_key('>');
433  case SDLK_QUESTION: return KeyboardButton::ascii_key('?');
434  case SDLK_AT: return KeyboardButton::ascii_key('@');
435  case SDLK_LEFTBRACKET: return KeyboardButton::ascii_key('[');
436  case SDLK_BACKSLASH: return KeyboardButton::ascii_key('\\');
437  case SDLK_RIGHTBRACKET: return KeyboardButton::ascii_key(']');
438  case SDLK_CARET: return KeyboardButton::ascii_key('^');
439  case SDLK_UNDERSCORE: return KeyboardButton::ascii_key('_');
440  case SDLK_BACKQUOTE: return KeyboardButton::ascii_key('`');
441  case SDLK_a: return KeyboardButton::ascii_key('a');
442  case SDLK_b: return KeyboardButton::ascii_key('b');
443  case SDLK_c: return KeyboardButton::ascii_key('c');
444  case SDLK_d: return KeyboardButton::ascii_key('d');
445  case SDLK_e: return KeyboardButton::ascii_key('e');
446  case SDLK_f: return KeyboardButton::ascii_key('f');
447  case SDLK_g: return KeyboardButton::ascii_key('g');
448  case SDLK_h: return KeyboardButton::ascii_key('h');
449  case SDLK_i: return KeyboardButton::ascii_key('i');
450  case SDLK_j: return KeyboardButton::ascii_key('j');
451  case SDLK_k: return KeyboardButton::ascii_key('k');
452  case SDLK_l: return KeyboardButton::ascii_key('l');
453  case SDLK_m: return KeyboardButton::ascii_key('m');
454  case SDLK_n: return KeyboardButton::ascii_key('n');
455  case SDLK_o: return KeyboardButton::ascii_key('o');
456  case SDLK_p: return KeyboardButton::ascii_key('p');
457  case SDLK_q: return KeyboardButton::ascii_key('q');
458  case SDLK_r: return KeyboardButton::ascii_key('r');
459  case SDLK_s: return KeyboardButton::ascii_key('s');
460  case SDLK_t: return KeyboardButton::ascii_key('t');
461  case SDLK_u: return KeyboardButton::ascii_key('u');
462  case SDLK_v: return KeyboardButton::ascii_key('v');
463  case SDLK_w: return KeyboardButton::ascii_key('w');
464  case SDLK_x: return KeyboardButton::ascii_key('x');
465  case SDLK_y: return KeyboardButton::ascii_key('y');
466  case SDLK_z: return KeyboardButton::ascii_key('z');
467  case SDLK_DELETE: return KeyboardButton::del();
468  case SDLK_KP0: return KeyboardButton::ascii_key('0');
469  case SDLK_KP1: return KeyboardButton::ascii_key('1');
470  case SDLK_KP2: return KeyboardButton::ascii_key('2');
471  case SDLK_KP3: return KeyboardButton::ascii_key('3');
472  case SDLK_KP4: return KeyboardButton::ascii_key('4');
473  case SDLK_KP5: return KeyboardButton::ascii_key('5');
474  case SDLK_KP6: return KeyboardButton::ascii_key('6');
475  case SDLK_KP7: return KeyboardButton::ascii_key('7');
476  case SDLK_KP8: return KeyboardButton::ascii_key('8');
477  case SDLK_KP9: return KeyboardButton::ascii_key('9');
478  case SDLK_KP_PERIOD: return KeyboardButton::ascii_key('.');
479  case SDLK_KP_DIVIDE: return KeyboardButton::ascii_key('/');
480  case SDLK_KP_MULTIPLY: return KeyboardButton::ascii_key('*');
481  case SDLK_KP_MINUS: return KeyboardButton::ascii_key('-');
482  case SDLK_KP_PLUS: return KeyboardButton::ascii_key('+');
483  case SDLK_KP_ENTER: return KeyboardButton::enter();
484  case SDLK_KP_EQUALS: return KeyboardButton::ascii_key('=');
485  case SDLK_UP: return KeyboardButton::up();
486  case SDLK_DOWN: return KeyboardButton::down();
487  case SDLK_RIGHT: return KeyboardButton::right();
488  case SDLK_LEFT: return KeyboardButton::left();
489  case SDLK_INSERT: return KeyboardButton::insert();
490  case SDLK_HOME: return KeyboardButton::home();
491  case SDLK_END: return KeyboardButton::end();
492  case SDLK_PAGEUP: return KeyboardButton::page_up();
493  case SDLK_PAGEDOWN: return KeyboardButton::page_down();
494  case SDLK_F1: return KeyboardButton::f1();
495  case SDLK_F2: return KeyboardButton::f2();
496  case SDLK_F3: return KeyboardButton::f3();
497  case SDLK_F4: return KeyboardButton::f4();
498  case SDLK_F5: return KeyboardButton::f5();
499  case SDLK_F6: return KeyboardButton::f6();
500  case SDLK_F7: return KeyboardButton::f7();
501  case SDLK_F8: return KeyboardButton::f8();
502  case SDLK_F9: return KeyboardButton::f9();
503  case SDLK_F10: return KeyboardButton::f10();
504  case SDLK_F11: return KeyboardButton::f11();
505  case SDLK_F12: return KeyboardButton::f12();
506  case SDLK_F13: return KeyboardButton::f13();
507  case SDLK_F14: return KeyboardButton::f14();
508  case SDLK_F15: return KeyboardButton::f15();
509  // case SDLK_NUMLOCK: return KeyboardButton::numlock();
510  // case SDLK_CAPSLOCK: return KeyboardButton::capslock();
511  // case SDLK_SCROLLOCK: return KeyboardButton::scrollock();
512  case SDLK_RSHIFT: return KeyboardButton::rshift();
513  case SDLK_LSHIFT: return KeyboardButton::lshift();
514  case SDLK_RCTRL: return KeyboardButton::rcontrol();
515  case SDLK_LCTRL: return KeyboardButton::lcontrol();
516  case SDLK_RALT: return KeyboardButton::ralt();
517  case SDLK_LALT: return KeyboardButton::lalt();
518  case SDLK_RMETA: return KeyboardButton::ralt();
519  case SDLK_LMETA: return KeyboardButton::lalt();
520  // case SDLK_LSUPER: return KeyboardButton::left();
521  // case SDLK_RSUPER: return KeyboardButton::right();
522  // case SDLK_MODE: return KeyboardButton::mode();
523  case SDLK_HELP: return KeyboardButton::help();
524  // case SDLK_PRINT: return KeyboardButton::print-screen();
525  // case SDLK_SYSREQ: return KeyboardButton::SysRq();
526  // case SDLK_BREAK: return KeyboardButton::break();
527  // case SDLK_MENU: return KeyboardButton::menu();
528  // case SDLK_POWER: return KeyboardButton::power();
529  // case SDLK_EURO: return KeyboardButton::euro();
530  }
531  tinydisplay_cat.info()
532  << "unhandled keyboard button " << sym << "\n";
533 
534  return ButtonHandle::none();
535 }
536 
537 ////////////////////////////////////////////////////////////////////
538 // Function: TinySDLGraphicsWindow::get_mouse_button
539 // Access: Private, Static
540 // Description: Maps from an SDL mouse button index to the
541 // corresponding Panda ButtonHandle.
542 ////////////////////////////////////////////////////////////////////
543 ButtonHandle TinySDLGraphicsWindow::
544 get_mouse_button(Uint8 button) {
545  switch (button) {
546  case SDL_BUTTON_LEFT:
547  return MouseButton::one();
548 
549  case SDL_BUTTON_MIDDLE:
550  return MouseButton::two();
551 
552  case SDL_BUTTON_RIGHT:
553  return MouseButton::three();
554 
555  case SDL_BUTTON_WHEELUP:
556  return MouseButton::wheel_up();
557 
558  case SDL_BUTTON_WHEELDOWN:
559  return MouseButton::wheel_down();
560  }
561  tinydisplay_cat.info()
562  << "unhandled mouse button " << button << "\n";
563 
564  return ButtonHandle::none();
565 }
566 
567 #endif // HAVE_SDL
static GraphicsWindowInputDevice pointer_and_keyboard(GraphicsWindow *host, const string &name)
This named constructor returns an input device that has both a keyboard and pointer.
bool is_any_specified() const
Returns true if any properties have been specified, false otherwise.
virtual void process_events()
Do whatever processing is necessary to ensure that the window responds to user events.
static ButtonHandle none()
Returns a special zero-valued ButtonHandle that is used to indicate no button.
Definition: buttonHandle.I:205
static ButtonHandle three()
Returns the ButtonHandle associated with the third mouse button.
Definition: mouseButton.cxx:72
static ButtonHandle two()
Returns the ButtonHandle associated with the second mouse button.
Definition: mouseButton.cxx:61
virtual void end_flip()
This function will be called within the draw thread after begin_flip() has been called on all windows...
virtual void set_properties_now(WindowProperties &properties)
Applies the requested set of properties to the window, if possible, for instance to request a change ...
bool reset_if_new()
Calls reset() to initialize the GSG, but only if it hasn&#39;t been called yet.
static ButtonHandle one()
Returns the ButtonHandle associated with the first mouse button.
Definition: mouseButton.cxx:50
void set_size(const LVector2i &size)
Specifies the requested size of the window, in pixels.
A window, fullscreen or on a desktop, into which a graphics device sends its output for interactive d...
A ButtonHandle represents a single button from any device, including keyboard buttons and mouse butto...
Definition: buttonHandle.h:28
A container for the various kinds of properties we might ask to have on a graphics window before we o...
static ButtonHandle wheel_down()
Returns the ButtonHandle generated when the mouse wheel is rolled one notch downwards.
An object to create GraphicsOutputs that share a particular 3-D API.
Definition: graphicsPipe.h:58
This is a structure representing a single input device that may be associated with a window...
This is a base class for the various different classes that represent the result of a frame of render...
A thread; that is, a lightweight process.
Definition: thread.h:51
Encapsulates all the communication with a particular instance of a given rendering backend...
This class is the main interface to controlling the render process.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...
static ButtonHandle ascii_key(char ascii_equivalent)
Returns the ButtonHandle associated with the particular ASCII character, if there is one...
void set_open(bool open)
Specifies whether the window should be open.
An interface to the TinyPanda software rendering code within this module.
static ButtonHandle wheel_up()
Returns the ButtonHandle generated when the mouse wheel is rolled one notch upwards.