blob: e493c0b5877cc4996c68c6060d0d6ac5abae1185 [file] [log] [blame]
James Robinson646469d2014-10-03 15:33:28 -07001// 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 Pietrzkiewicz69171512015-03-02 11:45:56 +01005#ifndef EXAMPLES_SPINNING_CUBE_SPINNING_CUBE_H_
6#define EXAMPLES_SPINNING_CUBE_SPINNING_CUBE_H_
James Robinson646469d2014-10-03 15:33:28 -07007
8#include <stdint.h>
9
10#include "base/memory/scoped_ptr.h"
11
12namespace examples {
13
Petr Hosek8ca6db92015-10-21 16:54:58 -070014class GLInterface;
15
James Robinson646469d2014-10-03 15:33:28 -070016class SpinningCube {
17 public:
18 SpinningCube();
19 ~SpinningCube();
20
James Robinson187e1fa2015-03-04 15:49:53 -080021 void Init();
James Robinson646469d2014-10-03 15:33:28 -070022 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 Robinson187e1fa2015-03-04 15:49:53 -080028 void set_size(uint32_t width, uint32_t height) {
29 width_ = width;
30 height_ = height;
31 }
James Robinson646469d2014-10-03 15:33:28 -070032 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 Hosek8ca6db92015-10-21 16:54:58 -070047 scoped_ptr<GLInterface> gl_;
James Robinson646469d2014-10-03 15:33:28 -070048 scoped_ptr<GLState> state_;
49 float fling_multiplier_;
50 int direction_;
51 float color_[3];
52};
53
54} // namespace examples
55
Przemyslaw Pietrzkiewicz69171512015-03-02 11:45:56 +010056#endif // EXAMPLES_SPINNING_CUBE_SPINNING_CUBE_H_