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