1 /*
2  * Copyright (C) 2018 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 #ifndef ANDROID_GAMECORE_RENDERER_H
19 #define ANDROID_GAMECORE_RENDERER_H
20 
21 #include "circle.h"
22 
23 #include <EGL/egl.h>
24 #include <vector>
25 
26 namespace android {
27 namespace gamecore {
28 
29 class Renderer {
30 public:
31     struct Egl {
32         //struct android_app* app;
33         NativeWindowType window;
34         EGLDisplay display;
35         EGLSurface surface;
36         EGLContext context;
37         int32_t width;
38         int32_t height;
39         float left;
40         float right;
41         float top;
42         float bottom;
43     };
44 
45     struct State {
46         int numCircles;
47         std::vector<Circle> circles;
48         std::vector<Vec2> velocities;
49     };
50 
51     struct Egl egl;
52     struct State state;
53 
54     Renderer(int numCircles);
55     int initDisplay(NativeWindowType window);
56     void terminateDisplay();
57     void update();
58     void draw();
59 };
60 
61 } // end of namespace gamecore
62 } // end of namespace android
63 
64 #endif // ANDROID_GAMECORE_RENDERER_H
65