• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2014 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 
7 #ifndef SAMPLE_UTIL_SAMPLE_APPLICATION_H
8 #define SAMPLE_UTIL_SAMPLE_APPLICATION_H
9 
10 #include <stdint.h>
11 #include <list>
12 #include <memory>
13 #include <string>
14 
15 #include "util/EGLPlatformParameters.h"
16 #include "util/OSWindow.h"
17 #include "util/Timer.h"
18 #include "util/egl_loader_autogen.h"
19 
20 class EGLWindow;
21 
22 namespace angle
23 {
24 class Library;
25 }  // namespace angle
26 
27 class SampleApplication
28 {
29   public:
30     SampleApplication(std::string name,
31                       int argc,
32                       char **argv,
33                       EGLint glesMajorVersion = 2,
34                       EGLint glesMinorVersion = 0,
35                       uint32_t width          = 1280,
36                       uint32_t height         = 720);
37     virtual ~SampleApplication();
38 
39     virtual bool initialize();
40     virtual void destroy();
41 
42     virtual void step(float dt, double totalTime);
43     virtual void draw();
44 
45     virtual void swap();
46 
47     OSWindow *getWindow() const;
48     EGLConfig getConfig() const;
49     EGLDisplay getDisplay() const;
50     EGLSurface getSurface() const;
51     EGLContext getContext() const;
52 
53     bool popEvent(Event *event);
54 
55     int run();
56     void exit();
57 
58   private:
59     std::string mName;
60     uint32_t mWidth;
61     uint32_t mHeight;
62     bool mRunning;
63 
64     std::unique_ptr<Timer> mTimer;
65     EGLWindow *mEGLWindow;
66     OSWindow *mOSWindow;
67 
68     EGLPlatformParameters mPlatformParams;
69 
70     // Handle to the entry point binding library.
71     std::unique_ptr<angle::Library> mEntryPointsLib;
72 };
73 
74 #endif  // SAMPLE_UTIL_SAMPLE_APPLICATION_H
75