1//
2// Copyright (c) 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 <EGL/egl.h>
11#include <EGL/eglext.h>
12
13#include "OSWindow.h"
14#include "Timer.h"
15
16#include <string>
17#include <list>
18#include <cstdint>
19#include <memory>
20
21class EGLWindow;
22
23class SampleApplication
24{
25  public:
26    SampleApplication(const std::string& name, size_t width, size_t height,
27                      EGLint glesMajorVersion = 2, EGLint requestedRenderer = EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE);
28    virtual ~SampleApplication();
29
30    virtual bool initialize();
31    virtual void destroy();
32
33    virtual void step(float dt, double totalTime);
34    virtual void draw();
35
36    virtual void swap();
37
38    OSWindow *getWindow() const;
39    EGLConfig getConfig() const;
40    EGLDisplay getDisplay() const;
41    EGLSurface getSurface() const;
42    EGLContext getContext() const;
43
44    bool popEvent(Event *event);
45
46    int run();
47    void exit();
48
49  private:
50    std::string mName;
51    bool mRunning;
52
53    std::unique_ptr<Timer> mTimer;
54    std::unique_ptr<EGLWindow> mEGLWindow;
55    std::unique_ptr<OSWindow> mOSWindow;
56};
57
58#endif // SAMPLE_UTIL_SAMPLE_APPLICATION_H
59