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
12namespace examples {
13
14class SpinningCube {
15 public:
16  SpinningCube();
17  ~SpinningCube();
18
19  void Init(uint32_t width, uint32_t height);
20  void set_direction(int direction) { direction_ = direction; }
21  void set_color(float r, float g, float b) {
22    color_[0] = r;
23    color_[1] = g;
24    color_[2] = b;
25  }
26  void SetFlingMultiplier(float drag_distance, float drag_time);
27  void UpdateForTimeDelta(float delta_time);
28  void UpdateForDragDistance(float distance);
29  void Draw();
30
31  void OnGLContextLost();
32
33 private:
34  class GLState;
35
36  void Update();
37
38  bool initialized_;
39  uint32_t width_;
40  uint32_t height_;
41  scoped_ptr<GLState> state_;
42  float fling_multiplier_;
43  int direction_;
44  float color_[3];
45};
46
47}  // namespace examples
48
49#endif  // MOJO_EXAMPLES_SAMPLE_APP_SPINNING_CUBE_H_
50