| 1 | // Implementation of OpenGL widget using Qt |
| 2 | // |
| 3 | // by James Hammons |
| 4 | // (C) 2010 Underground Software |
| 5 | |
| 6 | #ifndef __GLWIDGET_H__ |
| 7 | #define __GLWIDGET_H__ |
| 8 | |
| 9 | #include <QGLWidget> |
| 10 | #include <stdint.h> |
| 11 | |
| 12 | class GLWidget: public QGLWidget |
| 13 | { |
| 14 | Q_OBJECT |
| 15 | |
| 16 | public: |
| 17 | GLWidget(QWidget * parent = 0); |
| 18 | ~GLWidget(); |
| 19 | |
| 20 | void HandleMouseHiding(void); |
| 21 | void CheckAndRestoreMouseCursor(void); |
| 22 | // QSize minimumSizeHint() const; |
| 23 | // QSize sizeHint() const; |
| 24 | |
| 25 | // signals: |
| 26 | // void clicked(); |
| 27 | |
| 28 | protected: |
| 29 | void initializeGL(void); |
| 30 | void paintGL(void); |
| 31 | void resizeGL(int width, int height); |
| 32 | void mouseMoveEvent(QMouseEvent *); |
| 33 | // void mousePressEvent(QMouseEvent * event); |
| 34 | // void mouseReleaseEvent(QMouseEvent * event); |
| 35 | |
| 36 | private: |
| 37 | void CreateTextures(void); |
| 38 | |
| 39 | public: |
| 40 | GLuint texture; |
| 41 | int textureWidth, textureHeight; |
| 42 | |
| 43 | uint32_t * buffer; |
| 44 | unsigned rasterWidth, rasterHeight; |
| 45 | |
| 46 | bool synchronize; |
| 47 | unsigned filter; |
| 48 | int offset; |
| 49 | bool fullscreen; |
| 50 | int outputWidth; |
| 51 | int32_t hideMouseTimeout; |
| 52 | }; |
| 53 | |
| 54 | #endif // __GLWIDGET_H__ |