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 | #include "Window.h" |
| 8 | |
| 9 | Window::Window() |
| 10 | : mWidth(0), |
| 11 | mHeight(0) |
| 12 | { |
| 13 | } |
| 14 | |
| 15 | int Window::getWidth() const |
| 16 | { |
| 17 | return mWidth; |
| 18 | } |
| 19 | |
| 20 | int Window::getHeight() const |
| 21 | { |
| 22 | return mHeight; |
| 23 | } |
| 24 | |
| 25 | bool Window::popEvent(Event *event) |
| 26 | { |
| 27 | if (mEvents.size() > 0 && event) |
| 28 | { |
| 29 | *event = mEvents.front(); |
| 30 | mEvents.pop_front(); |
| 31 | return true; |
| 32 | } |
| 33 | else |
| 34 | { |
| 35 | return false; |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | void Window::pushEvent(Event event) |
| 40 | { |
| 41 | switch (event.Type) |
| 42 | { |
| 43 | case Event::EVENT_RESIZED: |
| 44 | mWidth = event.Size.Width; |
| 45 | mHeight = event.Size.Height; |
| 46 | break; |
| 47 | } |
| 48 | |
| 49 | mEvents.push_back(event); |
| 50 | } |