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 5 #ifndef MOJO_EXAMPLES_SAMPLE_APP_SPINNING_CUBE_H_ 6 #define MOJO_EXAMPLES_SAMPLE_APP_SPINNING_CUBE_H_ 7 8 #include <stdint.h> 9 10 #include "base/memory/scoped_ptr.h" 11 12 namespace mojo { 13 namespace examples { 14 15 class SpinningCube { 16 public: 17 SpinningCube(); 18 ~SpinningCube(); 19 20 void Init(uint32_t width, uint32_t height); 21 void set_direction(int direction) { direction_ = direction; } 22 void SetFlingMultiplier(float drag_distance, float drag_time); 23 void UpdateForTimeDelta(float delta_time); 24 void UpdateForDragDistance(float distance); 25 void Draw(); 26 27 void OnGLContextLost(); 28 29 private: 30 class GLState; 31 32 void Update(); 33 34 bool initialized_; 35 uint32_t width_; 36 uint32_t height_; 37 scoped_ptr<GLState> state_; 38 float fling_multiplier_; 39 int direction_; 40 }; 41 42 } // namespace examples 43 } // namespace mojo 44 45 #endif // MOJO_EXAMPLES_SAMPLE_APP_SPINNING_CUBE_H_ 46