Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Rubberduckycooly
GitHub Repository: Rubberduckycooly/RSDKv5-Decompilation
Path: blob/master/RSDKv5/RSDK/Graphics/GLFW/GLFWRenderDevice.hpp
1163 views
1
class RenderDevice : public RenderDeviceBase
2
{
3
public:
4
struct WindowInfo {
5
union {
6
struct {
7
int32 width;
8
int32 height;
9
int32 _pad[3];
10
int32 refresh_rate;
11
};
12
GLFWvidmode internal;
13
} * displays;
14
};
15
static WindowInfo displayInfo;
16
17
static bool Init();
18
static void CopyFrameBuffer();
19
static void FlipScreen();
20
static void Release(bool32 isRefresh);
21
22
static void RefreshWindow();
23
static void GetWindowSize(int32 *width, int32 *height);
24
25
static void SetupImageTexture(int32 width, int32 height, uint8 *imagePixels);
26
static void SetupVideoTexture_YUV420(int32 width, int32 height, uint8 *yPlane, uint8 *uPlane, uint8 *vPlane, int32 strideY, int32 strideU,
27
int32 strideV);
28
static void SetupVideoTexture_YUV422(int32 width, int32 height, uint8 *yPlane, uint8 *uPlane, uint8 *vPlane, int32 strideY, int32 strideU,
29
int32 strideV);
30
static void SetupVideoTexture_YUV444(int32 width, int32 height, uint8 *yPlane, uint8 *uPlane, uint8 *vPlane, int32 strideY, int32 strideU,
31
int32 strideV);
32
33
static bool ProcessEvents();
34
35
static void InitFPSCap();
36
static bool CheckFPSCap();
37
static void UpdateFPSCap();
38
39
static bool InitShaders();
40
static void LoadShader(const char *fileName, bool32 linear);
41
42
static inline void ShowCursor(bool32 shown) { glfwSetInputMode(window, GLFW_CURSOR, shown ? GLFW_CURSOR_NORMAL : GLFW_CURSOR_HIDDEN); }
43
static inline bool GetCursorPos(Vector2 *pos)
44
{
45
double cursorX, cursorY;
46
glfwGetCursorPos(window, &cursorX, &cursorY);
47
pos->x = (int32)cursorX;
48
pos->y = (int32)cursorY;
49
return true;
50
};
51
inline static void SetWindowTitle() { glfwSetWindowTitle(window, gameVerInfo.gameTitle); };
52
53
static GLFWwindow *window;
54
55
static GLuint screenTextures[SCREEN_COUNT];
56
static GLuint imageTexture;
57
58
private:
59
static bool SetupRendering();
60
static void InitVertexBuffer();
61
static bool InitGraphicsAPI();
62
63
static void GetDisplays();
64
65
static void ProcessKeyEvent(GLFWwindow *, int32 key, int32 scancode, int32 action, int32 mods);
66
static void ProcessFocusEvent(GLFWwindow *, int32 focused);
67
static void ProcessMouseEvent(GLFWwindow *, int32 button, int32 action, int32 mods);
68
static void ProcessJoystickEvent(int32 ID, int32 event);
69
static void ProcessMaximizeEvent(GLFWwindow *, int32 maximized);
70
71
static void SetLinear(bool32 linear);
72
73
static GLFWwindow *CreateGLFWWindow(void);
74
75
static int32 monitorIndex;
76
77
static GLuint VAO;
78
static GLuint VBO;
79
80
static double lastFrame;
81
static double targetFreq;
82
83
static uint32 *videoBuffer;
84
};
85
86
struct ShaderEntry : public ShaderEntryBase {
87
GLuint programID;
88
};
89
90