mirror of
https://github.com/nishiowo/nishbox
synced 2025-04-21 12:14:39 +00:00
add more docs
This commit is contained in:
parent
01fecddffc
commit
b09f7fef4c
@ -1,3 +1,9 @@
|
||||
/**
|
||||
* @file
|
||||
* @~english
|
||||
* @brief OpenGL drawing driver
|
||||
*/
|
||||
|
||||
#define GF_EXPOSE_DRAW_DRIVER
|
||||
#define GF_EXPOSE_DRAW
|
||||
#define GF_EXPOSE_TEXTURE
|
||||
@ -24,11 +30,35 @@
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
/**
|
||||
* @~english
|
||||
* @brief White light
|
||||
*/
|
||||
GLfloat lightwht[] = {1.0, 1.0, 1.0, 1.0};
|
||||
|
||||
/**
|
||||
* @~english
|
||||
* @brief Gray light
|
||||
*/
|
||||
GLfloat lightgry[] = {0.6, 0.6, 0.6, 1.0};
|
||||
|
||||
/**
|
||||
* @~english
|
||||
* @brief Dim light
|
||||
*/
|
||||
GLfloat lightdim[] = {0.2, 0.2, 0.2, 1.0};
|
||||
|
||||
/**
|
||||
* @~english
|
||||
* @brief Black light
|
||||
*/
|
||||
GLfloat lightblk[] = {0.0, 0.0, 0.0, 1.0};
|
||||
|
||||
/**
|
||||
* @~english
|
||||
* @brief Calculate the nearest 2^n value to x
|
||||
* @param x Number
|
||||
*/
|
||||
#define NEAREST_POW2(x) pow((2), gf_math_log2((int)(x) + 1))
|
||||
|
||||
gf_draw_driver_texture_t* gf_draw_driver_register_texture(gf_draw_t* draw, int width, int height, int* iwidth, int* iheight, unsigned char* data) {
|
||||
|
@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file
|
||||
* @~english
|
||||
* @brief OpenGL graphic interface
|
||||
*/
|
||||
|
||||
#include <gf_macro.h>
|
||||
#define GF_EXPOSE_DRAW
|
||||
#define GF_EXPOSE_TEXTURE
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
/**
|
||||
* @file
|
||||
* @~english
|
||||
* @brief GLFW-dependent part of drawing driver
|
||||
*/
|
||||
|
||||
#define GF_EXPOSE_DRAW_PLATFORM
|
||||
#define GF_EXPOSE_DRAW
|
||||
|
||||
@ -28,6 +34,13 @@ void gf_draw_platform_begin(void) {
|
||||
|
||||
void gf_draw_platform_end(void) {}
|
||||
|
||||
/**
|
||||
* @~english
|
||||
* @brief GLFW resize handler
|
||||
* @param window GLFW window
|
||||
* @param w Width of window
|
||||
* @param h Height of window
|
||||
*/
|
||||
void gf_glfw_size(GLFWwindow* window, int w, int h) {
|
||||
gf_draw_t* draw = (gf_draw_t*)glfwGetWindowUserPointer(window);
|
||||
draw->width = w;
|
||||
|
@ -1,3 +1,9 @@
|
||||
/**
|
||||
* @file
|
||||
* @~english
|
||||
* @brief GLX-dependent part of drawing driver
|
||||
*/
|
||||
|
||||
#define GF_EXPOSE_DRAW_PLATFORM
|
||||
#define GF_EXPOSE_DRAW
|
||||
|
||||
@ -18,6 +24,7 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef DO_SWAP_INTERVAL
|
||||
#ifndef GLX_MESA_swap_control
|
||||
#define GLX_MESA_swap_control 1
|
||||
typedef int (*PFNGLXGETSWAPINTERVALMESAPROC)(void);
|
||||
@ -33,6 +40,7 @@ typedef void (*PFNGLXSWAPINTERVALEXTPROC)(Display*, GLXDrawable, int);
|
||||
#define GLX_SGI_swap_control 1
|
||||
typedef void (*PFNGLXSWAPINTERVALSGIPROC)(int);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void gf_draw_platform_begin(void) {}
|
||||
void gf_draw_platform_end(void) {}
|
||||
|
@ -1,3 +1,9 @@
|
||||
/**
|
||||
* @file
|
||||
* @~english
|
||||
* @brief WGL-dependent part of drawing driver
|
||||
*/
|
||||
|
||||
#define GF_EXPOSE_DRAW_PLATFORM
|
||||
#define GF_EXPOSE_DRAW
|
||||
|
||||
@ -19,11 +25,22 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef const char*(APIENTRY* PFNWGLGETEXTENSIONSSTRINGARB)(HDC);
|
||||
#ifdef DO_SWAP_INTERVAL
|
||||
typedef BOOL(APIENTRY* PFNWGLSWAPINTERVALPROC)(int);
|
||||
#endif
|
||||
|
||||
void gf_draw_platform_begin(void) {}
|
||||
void gf_draw_platform_end(void) {}
|
||||
|
||||
/**
|
||||
* @~english
|
||||
* @brief Win32 API event handler
|
||||
* @param hWnd Window
|
||||
* @param msg Message
|
||||
* @param wp Word parameter
|
||||
* @param lp Long parameter
|
||||
* @return Result
|
||||
*/
|
||||
LRESULT CALLBACK gf_draw_platform_proc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) {
|
||||
PAINTSTRUCT ps;
|
||||
RECT rect;
|
||||
@ -96,12 +113,14 @@ int gf_draw_platform_step(gf_draw_t* draw) {
|
||||
}
|
||||
|
||||
void gf_draw_platform_create(gf_draw_t* draw) {
|
||||
WNDCLASSEX wc;
|
||||
PIXELFORMATDESCRIPTOR desc;
|
||||
WNDCLASSEX wc;
|
||||
PIXELFORMATDESCRIPTOR desc;
|
||||
#ifdef DO_SWAP_INTERVAL
|
||||
PFNWGLSWAPINTERVALPROC wglSwapIntervalEXT;
|
||||
RECT rect;
|
||||
int fmt;
|
||||
DWORD style;
|
||||
#endif
|
||||
RECT rect;
|
||||
int fmt;
|
||||
DWORD style;
|
||||
|
||||
draw->platform = malloc(sizeof(*draw->platform));
|
||||
memset(draw->platform, 0, sizeof(*draw->platform));
|
||||
|
Loading…
x
Reference in New Issue
Block a user