Labyrinth
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
linuxlxs.hpp
1 //////////////////////////////
2 //
3 // File: platform/linux/linuxlxs.hpp
4 // Author: Maciej Kaminski
5 // E-mail: maciej.a.kaminski@gmail.com
6 // Website: maciejkaminski.pl
7 //
8 // File creation date: Oct 24 2012
9 // This file is part of Project Labyrinth
10 // This file is going to be released under terms of GNU GPL in near future
11 //
12 //////////////////////////////
13 
14 #ifndef __LINUX_LXS_HPP_
15 #define __LINUX_LXS_HPP_
16 #include <string>
17 #include <X11/Xlib.h>
18 #include <X11/X.h>
19 #define V_JS_AXES 4
20 namespace LxS
21 {
22  namespace System
23  {
24  //!@brief general class for Unix/X11 interfacing.
25  //!
26  //!This class is onot complete - with LxSGL2 it forms LinuxLxSGL2, final
27  //! class for Unix/X11/GL2 port w hile with LxSGLES it forms LinuxLxSGLES
28  //! - basis of Linux/X11/Mesa-GLES port
29  class LinuxLxS: public virtual LxS
30  {
31  protected:
32  //! window title
33  std::string title;
34  // message from window manager
35  //! atom messages (used for entering fullscreen mode, deleting window wtc)
36  Atom protocols[1];
37  //! command for window deletion
38  Atom wm_delete_window; // global variable
39  //! fullscreen mode
40  bool fullscreen;
41  //! default_width of the window (one with which win was created)
43  //! default_height of the window (one with which win was created)
45  //! x11 display handle
46  Display *x_display;
47  /// Window handle
49  //! window handle
50  ::Window hWnd;
51  //! create a window with given title
52  bool WinCreate(const char *title);
53  //! pass joystick to Root
54  void PassJoystick();
55  //! joystick axes
56  float js[V_JS_AXES]; // for joystick simulation
57  //! simulate joystick input
58  void SimulateJoystick(int Axis, float Direction);
59  public:
60  //! enter fullscreen mode (without altering resolution)
61  void GoFullScreen();
62  //! constructor
63  LinuxLxS(const char * _title, GLint _w, GLint h);
64  //! for X11 message loop
65  GLboolean userInterrupt();
66  };
67  }
68 }
69 #endif