Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(582)

Side by Side Diff: examples/spinning_cube/spinning_cube.h

Issue 940293003: Add a Display and ContextProvider concept to mojom, use to recreate (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « examples/spinning_cube/gles2_client_impl.cc ('k') | examples/spinning_cube/spinning_cube.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef EXAMPLES_SPINNING_CUBE_SPINNING_CUBE_H_ 5 #ifndef EXAMPLES_SPINNING_CUBE_SPINNING_CUBE_H_
6 #define EXAMPLES_SPINNING_CUBE_SPINNING_CUBE_H_ 6 #define EXAMPLES_SPINNING_CUBE_SPINNING_CUBE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 11
12 namespace examples { 12 namespace examples {
13 13
14 class SpinningCube { 14 class SpinningCube {
15 public: 15 public:
16 SpinningCube(); 16 SpinningCube();
17 ~SpinningCube(); 17 ~SpinningCube();
18 18
19 void Init(uint32_t width, uint32_t height); 19 void Init();
20 void set_direction(int direction) { direction_ = direction; } 20 void set_direction(int direction) { direction_ = direction; }
21 void set_color(float r, float g, float b) { 21 void set_color(float r, float g, float b) {
22 color_[0] = r; 22 color_[0] = r;
23 color_[1] = g; 23 color_[1] = g;
24 color_[2] = b; 24 color_[2] = b;
25 } 25 }
26 void set_size(uint32_t width, uint32_t height) {
27 width_ = width;
28 height_ = height;
29 }
26 void SetFlingMultiplier(float drag_distance, float drag_time); 30 void SetFlingMultiplier(float drag_distance, float drag_time);
27 void UpdateForTimeDelta(float delta_time); 31 void UpdateForTimeDelta(float delta_time);
28 void UpdateForDragDistance(float distance); 32 void UpdateForDragDistance(float distance);
29 void Draw(); 33 void Draw();
30 34
31 void OnGLContextLost(); 35 void OnGLContextLost();
32 36
33 private: 37 private:
34 class GLState; 38 class GLState;
35 39
36 void Update(); 40 void Update();
37 41
38 bool initialized_; 42 bool initialized_;
39 uint32_t width_; 43 uint32_t width_;
40 uint32_t height_; 44 uint32_t height_;
41 scoped_ptr<GLState> state_; 45 scoped_ptr<GLState> state_;
42 float fling_multiplier_; 46 float fling_multiplier_;
43 int direction_; 47 int direction_;
44 float color_[3]; 48 float color_[3];
45 }; 49 };
46 50
47 } // namespace examples 51 } // namespace examples
48 52
49 #endif // EXAMPLES_SPINNING_CUBE_SPINNING_CUBE_H_ 53 #endif // EXAMPLES_SPINNING_CUBE_SPINNING_CUBE_H_
OLDNEW
« no previous file with comments | « examples/spinning_cube/gles2_client_impl.cc ('k') | examples/spinning_cube/spinning_cube.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698