Path: blob/master/RSDKv5/RSDK/Graphics/GLFW/GLFWRenderDevice.hpp
1163 views
class RenderDevice : public RenderDeviceBase1{2public:3struct WindowInfo {4union {5struct {6int32 width;7int32 height;8int32 _pad[3];9int32 refresh_rate;10};11GLFWvidmode internal;12} * displays;13};14static WindowInfo displayInfo;1516static bool Init();17static void CopyFrameBuffer();18static void FlipScreen();19static void Release(bool32 isRefresh);2021static void RefreshWindow();22static void GetWindowSize(int32 *width, int32 *height);2324static void SetupImageTexture(int32 width, int32 height, uint8 *imagePixels);25static void SetupVideoTexture_YUV420(int32 width, int32 height, uint8 *yPlane, uint8 *uPlane, uint8 *vPlane, int32 strideY, int32 strideU,26int32 strideV);27static void SetupVideoTexture_YUV422(int32 width, int32 height, uint8 *yPlane, uint8 *uPlane, uint8 *vPlane, int32 strideY, int32 strideU,28int32 strideV);29static void SetupVideoTexture_YUV444(int32 width, int32 height, uint8 *yPlane, uint8 *uPlane, uint8 *vPlane, int32 strideY, int32 strideU,30int32 strideV);3132static bool ProcessEvents();3334static void InitFPSCap();35static bool CheckFPSCap();36static void UpdateFPSCap();3738static bool InitShaders();39static void LoadShader(const char *fileName, bool32 linear);4041static inline void ShowCursor(bool32 shown) { glfwSetInputMode(window, GLFW_CURSOR, shown ? GLFW_CURSOR_NORMAL : GLFW_CURSOR_HIDDEN); }42static inline bool GetCursorPos(Vector2 *pos)43{44double cursorX, cursorY;45glfwGetCursorPos(window, &cursorX, &cursorY);46pos->x = (int32)cursorX;47pos->y = (int32)cursorY;48return true;49};50inline static void SetWindowTitle() { glfwSetWindowTitle(window, gameVerInfo.gameTitle); };5152static GLFWwindow *window;5354static GLuint screenTextures[SCREEN_COUNT];55static GLuint imageTexture;5657private:58static bool SetupRendering();59static void InitVertexBuffer();60static bool InitGraphicsAPI();6162static void GetDisplays();6364static void ProcessKeyEvent(GLFWwindow *, int32 key, int32 scancode, int32 action, int32 mods);65static void ProcessFocusEvent(GLFWwindow *, int32 focused);66static void ProcessMouseEvent(GLFWwindow *, int32 button, int32 action, int32 mods);67static void ProcessJoystickEvent(int32 ID, int32 event);68static void ProcessMaximizeEvent(GLFWwindow *, int32 maximized);6970static void SetLinear(bool32 linear);7172static GLFWwindow *CreateGLFWWindow(void);7374static int32 monitorIndex;7576static GLuint VAO;77static GLuint VBO;7879static double lastFrame;80static double targetFreq;8182static uint32 *videoBuffer;83};8485struct ShaderEntry : public ShaderEntryBase {86GLuint programID;87};888990