summaryrefslogtreecommitdiff
path: root/spinning_cube.h
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.com>2018-09-05 21:46:55 +0300
committerEvgeny Zinoviev <me@ch1p.com>2018-09-05 21:46:55 +0300
commit9fcc074af39f0c88313179eacc3b2a8dd32e94f3 (patch)
treed7422e669f584414f2d9274745206141fb93272d /spinning_cube.h
initial
Diffstat (limited to 'spinning_cube.h')
-rw-r--r--spinning_cube.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/spinning_cube.h b/spinning_cube.h
new file mode 100644
index 0000000..8e9fd62
--- /dev/null
+++ b/spinning_cube.h
@@ -0,0 +1,37 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_EXAMPLES_GLES2_SPINNING_CUBE_SPINNING_CUBE_H_
+
+#define PPAPI_EXAMPLES_GLES2_SPINNING_CUBE_SPINNING_CUBE_H_
+#include "ppapi/c/pp_stdint.h"
+
+class SpinningCube {
+public:
+ SpinningCube();
+ ~SpinningCube();
+ void Init(uint32_t width, uint32_t height);
+ void set_direction(int direction) { direction_ = direction; }
+ void SetFlingMultiplier(float drag_distance, float drag_time);
+ void UpdateForTimeDelta(float delta_time);
+ void UpdateForDragDistance(float distance);
+ void Draw();
+ void OnGLContextLost();
+
+private:
+ class GLState;
+ // Disallow copy and assign.
+ SpinningCube(const SpinningCube& other);
+ SpinningCube& operator=(const SpinningCube& other);
+ void Update();
+ bool initialized_;
+ uint32_t width_;
+ uint32_t height_;
+ // Owned ptr.
+ GLState* state_;
+ float fling_multiplier_;
+ int direction_;
+};
+
+#endif // PPAPI_EXAMPLES_GLES2_SPINNING_CUBE_SPINNING_CUBE_H_