Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/angle
Path: blob/main_old/samples/sample_util/SampleApplication.h
1695 views
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 "common/system_utils.h"
16
#include "util/EGLPlatformParameters.h"
17
#include "util/OSWindow.h"
18
#include "util/Timer.h"
19
#include "util/egl_loader_autogen.h"
20
21
class EGLWindow;
22
class GLWindowBase;
23
24
namespace angle
25
{
26
class Library;
27
} // namespace angle
28
29
class SampleApplication
30
{
31
public:
32
SampleApplication(std::string name,
33
int argc,
34
char **argv,
35
EGLint glesMajorVersion = 2,
36
EGLint glesMinorVersion = 0,
37
uint32_t width = 1280,
38
uint32_t height = 720);
39
virtual ~SampleApplication();
40
41
virtual bool initialize();
42
virtual void destroy();
43
44
virtual void step(float dt, double totalTime);
45
virtual void draw();
46
47
virtual void swap();
48
49
virtual void onKeyUp(const Event::KeyEvent &keyEvent);
50
virtual void onKeyDown(const Event::KeyEvent &keyEvent);
51
52
OSWindow *getWindow() const;
53
EGLConfig getConfig() const;
54
EGLDisplay getDisplay() const;
55
EGLSurface getSurface() const;
56
EGLContext getContext() const;
57
58
int run();
59
void exit();
60
61
private:
62
bool popEvent(Event *event);
63
64
std::string mName;
65
uint32_t mWidth;
66
uint32_t mHeight;
67
bool mRunning;
68
69
Timer mTimer;
70
uint32_t mFrameCount;
71
GLWindowBase *mGLWindow;
72
EGLWindow *mEGLWindow;
73
OSWindow *mOSWindow;
74
angle::GLESDriverType mDriverType;
75
76
EGLPlatformParameters mPlatformParams;
77
78
// Handle to the entry point binding library.
79
std::unique_ptr<angle::Library> mEntryPointsLib;
80
};
81
82
#endif // SAMPLE_UTIL_SAMPLE_APPLICATION_H
83
84