James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 1 | // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Przemyslaw Pietrzkiewicz | 6917151 | 2015-03-02 11:45:56 +0100 | [diff] [blame] | 5 | #ifndef EXAMPLES_SPINNING_CUBE_SPINNING_CUBE_H_ |
| 6 | #define EXAMPLES_SPINNING_CUBE_SPINNING_CUBE_H_ |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 7 | |
| 8 | #include <stdint.h> |
| 9 | |
| 10 | #include "base/memory/scoped_ptr.h" |
| 11 | |
| 12 | namespace examples { |
| 13 | |
Petr Hosek | 8ca6db9 | 2015-10-21 16:54:58 -0700 | [diff] [blame] | 14 | class GLInterface; |
| 15 | |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 16 | class SpinningCube { |
| 17 | public: |
| 18 | SpinningCube(); |
| 19 | ~SpinningCube(); |
| 20 | |
James Robinson | 187e1fa | 2015-03-04 15:49:53 -0800 | [diff] [blame] | 21 | void Init(); |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 22 | void set_direction(int direction) { direction_ = direction; } |
| 23 | void set_color(float r, float g, float b) { |
| 24 | color_[0] = r; |
| 25 | color_[1] = g; |
| 26 | color_[2] = b; |
| 27 | } |
James Robinson | 187e1fa | 2015-03-04 15:49:53 -0800 | [diff] [blame] | 28 | void set_size(uint32_t width, uint32_t height) { |
| 29 | width_ = width; |
| 30 | height_ = height; |
| 31 | } |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 32 | void SetFlingMultiplier(float drag_distance, float drag_time); |
| 33 | void UpdateForTimeDelta(float delta_time); |
| 34 | void UpdateForDragDistance(float distance); |
| 35 | void Draw(); |
| 36 | |
| 37 | void OnGLContextLost(); |
| 38 | |
| 39 | private: |
| 40 | class GLState; |
| 41 | |
| 42 | void Update(); |
| 43 | |
| 44 | bool initialized_; |
| 45 | uint32_t width_; |
| 46 | uint32_t height_; |
Petr Hosek | 8ca6db9 | 2015-10-21 16:54:58 -0700 | [diff] [blame] | 47 | scoped_ptr<GLInterface> gl_; |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 48 | scoped_ptr<GLState> state_; |
| 49 | float fling_multiplier_; |
| 50 | int direction_; |
| 51 | float color_[3]; |
| 52 | }; |
| 53 | |
| 54 | } // namespace examples |
| 55 | |
Przemyslaw Pietrzkiewicz | 6917151 | 2015-03-02 11:45:56 +0100 | [diff] [blame] | 56 | #endif // EXAMPLES_SPINNING_CUBE_SPINNING_CUBE_H_ |