1// Copyright 2014 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 PPAPI_EXAMPLES_GLES2_SPINNING_CUBE_SPINNING_CUBE_H_ 6#define PPAPI_EXAMPLES_GLES2_SPINNING_CUBE_SPINNING_CUBE_H_ 7 8#include "ppapi/c/pp_stdint.h" 9 10class SpinningCube { 11 public: 12 SpinningCube(); 13 ~SpinningCube(); 14 15 void Init(uint32_t width, uint32_t height); 16 void set_direction(int direction) { direction_ = direction; } 17 void SetFlingMultiplier(float drag_distance, float drag_time); 18 void UpdateForTimeDelta(float delta_time); 19 void UpdateForDragDistance(float distance); 20 void Draw(); 21 22 void OnGLContextLost(); 23 24 private: 25 class GLState; 26 27 // Disallow copy and assign. 28 SpinningCube(const SpinningCube& other); 29 SpinningCube& operator=(const SpinningCube& other); 30 31 void Update(); 32 33 bool initialized_; 34 uint32_t width_; 35 uint32_t height_; 36 // Owned ptr. 37 GLState* state_; 38 float fling_multiplier_; 39 int direction_; 40}; 41 42#endif // PPAPI_EXAMPLES_GLES2_SPINNING_CUBE_SPINNING_CUBE_H_ 43