Geoff Lang | 49be2ad | 2014-02-28 13:05:51 -0500 | [diff] [blame] | 1 | // |
| 2 | // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved. |
| 3 | // Use of this source code is governed by a BSD-style license that can be |
| 4 | // found in the LICENSE file. |
| 5 | // |
| 6 | |
| 7 | #ifndef SAMPLE_UTIL_WINDOW_H |
| 8 | #define SAMPLE_UTIL_WINDOW_H |
| 9 | |
| 10 | #include "Event.h" |
| 11 | |
| 12 | #include <EGL/egl.h> |
| 13 | #include <EGL/eglext.h> |
| 14 | #include <list> |
| 15 | |
Jamie Madill | 1cfaaf8 | 2014-08-21 10:04:04 -0400 | [diff] [blame] | 16 | class OSWindow |
Geoff Lang | 49be2ad | 2014-02-28 13:05:51 -0500 | [diff] [blame] | 17 | { |
| 18 | public: |
Jamie Madill | 1cfaaf8 | 2014-08-21 10:04:04 -0400 | [diff] [blame] | 19 | OSWindow(); |
Jamie Madill | 4477109 | 2014-08-28 09:21:35 -0400 | [diff] [blame] | 20 | virtual ~OSWindow(); |
Geoff Lang | 49be2ad | 2014-02-28 13:05:51 -0500 | [diff] [blame] | 21 | |
Geoff Lang | f0955f1 | 2014-06-20 16:07:07 -0400 | [diff] [blame] | 22 | virtual bool initialize(const std::string &name, size_t width, size_t height) = 0; |
Geoff Lang | 49be2ad | 2014-02-28 13:05:51 -0500 | [diff] [blame] | 23 | virtual void destroy() = 0; |
| 24 | |
| 25 | int getWidth() const; |
| 26 | int getHeight() const; |
Geoff Lang | 49be2ad | 2014-02-28 13:05:51 -0500 | [diff] [blame] | 27 | |
Geoff Lang | 49be2ad | 2014-02-28 13:05:51 -0500 | [diff] [blame] | 28 | virtual EGLNativeWindowType getNativeWindow() const = 0; |
| 29 | virtual EGLNativeDisplayType getNativeDisplay() const = 0; |
| 30 | |
| 31 | virtual void messageLoop() = 0; |
| 32 | |
| 33 | bool popEvent(Event *event); |
Jamie Madill | 9e16d40 | 2014-09-08 17:36:33 -0400 | [diff] [blame] | 34 | virtual void pushEvent(Event event); |
Geoff Lang | 49be2ad | 2014-02-28 13:05:51 -0500 | [diff] [blame] | 35 | |
Jamie Madill | 1cfaaf8 | 2014-08-21 10:04:04 -0400 | [diff] [blame] | 36 | virtual void setMousePosition(int x, int y) = 0; |
Jamie Madill | 25f0e5e | 2014-08-22 14:50:41 -0400 | [diff] [blame] | 37 | virtual bool resize(int width, int height) = 0; |
Jamie Madill | 83da0ec | 2014-08-22 14:50:42 -0400 | [diff] [blame] | 38 | virtual bool setVisible(bool isVisible) = 0; |
Jamie Madill | 1cfaaf8 | 2014-08-21 10:04:04 -0400 | [diff] [blame] | 39 | |
Jamie Madill | 25f0e5e | 2014-08-22 14:50:41 -0400 | [diff] [blame] | 40 | protected: |
Geoff Lang | 49be2ad | 2014-02-28 13:05:51 -0500 | [diff] [blame] | 41 | int mWidth; |
| 42 | int mHeight; |
| 43 | |
| 44 | std::list<Event> mEvents; |
| 45 | }; |
| 46 | |
Jamie Madill | 1cfaaf8 | 2014-08-21 10:04:04 -0400 | [diff] [blame] | 47 | OSWindow *CreateOSWindow(); |
Geoff Lang | 8def9aa | 2014-08-05 11:39:15 -0400 | [diff] [blame] | 48 | |
Geoff Lang | 49be2ad | 2014-02-28 13:05:51 -0500 | [diff] [blame] | 49 | #endif // SAMPLE_UTIL_WINDOW_H |