initial commit

This commit is contained in:
Carter Essen committed 2026-11-09 17:35:03 -05:00
commit cff2a21efc
550 files changed
+154887

No files matched your search

@@ -0,0 +1,108 @@
/**
* @file lv_glfw_window.h
*
*/
#ifndef LV_GLFW_WINDOW_H
#define LV_GLFW_WINDOW_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../lv_conf_internal.h"
#if LV_USE_OPENGLES
#include "../../misc/lv_types.h"
#include "../../display/lv_display.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a GLFW window with no textures and initialize OpenGL
* @param hor_res width in pixels of the window
* @param ver_res height in pixels of the window
* @param use_mouse_indev send pointer indev input to LVGL display textures
* @return the new GLFW window handle
*/
lv_glfw_window_t * lv_glfw_window_create(int32_t hor_res, int32_t ver_res, bool use_mouse_indev);
/**
* Delete a GLFW window. If it is the last one, the process will exit
* @param window GLFW window to delete
*/
void lv_glfw_window_delete(lv_glfw_window_t * window);
/**
* Add a texture to the GLFW window. It can be an LVGL display texture, or any OpenGL texture
* @param window GLFW window
* @param texture_id OpenGL texture ID
* @param w width in pixels of the texture
* @param h height in pixels of the texture
* @return the new texture handle
*/
lv_glfw_texture_t * lv_glfw_window_add_texture(lv_glfw_window_t * window, unsigned int texture_id, int32_t w,
int32_t h);
/**
* Remove a texture from its GLFW window and delete it
* @param texture handle of a GLFW window texture
*/
void lv_glfw_texture_remove(lv_glfw_texture_t * texture);
/**
* Set the x position of a texture within its GLFW window
* @param texture handle of a GLFW window texture
* @param x new x position of the texture
*/
void lv_glfw_texture_set_x(lv_glfw_texture_t * texture, int32_t x);
/**
* Set the y position of a texture within its GLFW window
* @param texture handle of a GLFW window texture
* @param y new y position of the texture
*/
void lv_glfw_texture_set_y(lv_glfw_texture_t * texture, int32_t y);
/**
* Set the opacity of a texture in a GLFW window
* @param texture handle of a GLFW window texture
* @param opa new opacity of the texture
*/
void lv_glfw_texture_set_opa(lv_glfw_texture_t * texture, lv_opa_t opa);
/**
* Get the mouse indev associated with a texture in a GLFW window, if it exists
* @param texture handle of a GLFW window texture
* @return the indev or `NULL`
* @note there will only be an indev if the texture is based on an
* LVGL display texture and the window was created with
* `use_mouse_indev` as `true`
*/
lv_indev_t * lv_glfw_texture_get_mouse_indev(lv_glfw_texture_t * texture);
/**********************
* MACROS
**********************/
#endif /* LV_USE_OPENGLES */
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* LV_GLFW_WINDOW_H */
@@ -0,0 +1,70 @@
/**
* @file lv_glfw_window_private.h
*
*/
#ifndef LV_GLFW_WINDOW_PRIVATE_H
#define LV_GLFW_WINDOW_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_glfw_window.h"
#if LV_USE_OPENGLES
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include "../../misc/lv_area.h"
#include "../../display/lv_display.h"
#include "../../indev/lv_indev.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
struct _lv_glfw_window_t {
GLFWwindow * window;
int32_t hor_res;
int32_t ver_res;
lv_ll_t textures;
lv_point_t mouse_last_point;
lv_indev_state_t mouse_last_state;
uint8_t use_indev : 1;
uint8_t closing : 1;
};
struct _lv_glfw_texture_t {
lv_glfw_window_t * window;
unsigned int texture_id;
lv_area_t area;
lv_opa_t opa;
lv_indev_t * indev;
lv_point_t indev_last_point;
lv_indev_state_t indev_last_state;
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /*LV_USE_OPENGLES*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_GLFW_WINDOW_PRIVATE_H*/
@@ -0,0 +1,40 @@
/**
* @file lv_opengles_debug.h
*
*/
#ifndef LV_OPENGLES_DEBUG_H
#define LV_OPENGLES_DEBUG_H
#ifdef __cplusplus
extern "C" {
#endif
#include "../../lv_conf_internal.h"
#if LV_USE_OPENGLES
#include <stdbool.h>
#include <GL/glew.h>
#include <GLFW/glfw3.h>
void GLClearError(void);
void GLLogCall(const char * function, const char * file, int line);
#if LV_USE_OPENGLES_DEBUG
#define GL_CALL(x) do {\
GLClearError();\
x;\
GLLogCall(#x, __FILE__, __LINE__);\
} while(0)
#else
#define GL_CALL(x) x
#endif
#endif /* LV_USE_OPENGLES */
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* LV_OPENGLES_DEBUG_H */
@@ -0,0 +1,92 @@
/**
* @file lv_opengles_driver.h
*
*/
#ifndef LV_OPENGLES_DRIVER_H
#define LV_OPENGLES_DRIVER_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../lv_conf_internal.h"
#if LV_USE_OPENGLES
#include "../../misc/lv_area.h"
#include "../../misc/lv_color.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Initialize OpenGL
* @note it is not necessary to call this if you use `lv_glfw_window_create`
*/
void lv_opengles_init(void);
/**
* Deinitialize OpenGL
* @note it is not necessary to call this if you use `lv_glfw_window_create`
*/
void lv_opengles_deinit(void);
/**
* Render a texture
* @param texture OpenGL texture ID
* @param texture_area the area in the window to render the texture in
* @param opa opacity to blend the texture with existing contents
* @param disp_w width of the window/framebuffer being rendered to
* @param disp_h height of the window/framebuffer being rendered to
*/
void lv_opengles_render_texture(unsigned int texture, const lv_area_t * texture_area, lv_opa_t opa, int32_t disp_w,
int32_t disp_h, const lv_area_t * texture_clip_area, bool flip);
/**
* Render a fill
* @param color the color of the fill
* @param area the area in the window to render the fill
* @param opa opacity to blend the fill with existing contents
* @param disp_w width of the window/framebuffer being rendered to
* @param disp_h height of the window/framebuffer being rendered to
*/
void lv_opengles_render_fill(lv_color_t color, const lv_area_t * area, lv_opa_t opa, int32_t disp_w, int32_t disp_h);
/**
* Clear the window/display
*/
void lv_opengles_render_clear(void);
/**
* Set the OpenGL viewport
* @param x x position of the viewport
* @param y y position of the viewport
* @param w width of the viewport
* @param h height of the viewport
*/
void lv_opengles_viewport(int32_t x, int32_t y, int32_t w, int32_t h);
/**********************
* MACROS
**********************/
#endif /* LV_USE_OPENGLES */
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* LV_OPENGLES_DRIVER_H */
@@ -0,0 +1,66 @@
/**
* @file lv_opengles_texture.h
*
*/
#ifndef LV_OPENGLES_TEXTURE_H
#define LV_OPENGLES_TEXTURE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../lv_conf_internal.h"
#if LV_USE_OPENGLES
#include "../../display/lv_display.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a display that flushes to an OpenGL texture
* @param w width in pixels of the texture
* @param h height in pixels of the texture
* @return the new display
*/
lv_display_t * lv_opengles_texture_create(int32_t w, int32_t h);
/**
* Get the OpenGL texture ID of the display
* @param disp display
* @return texture ID
*/
unsigned int lv_opengles_texture_get_texture_id(lv_display_t * disp);
/**
* Get the display of an OpenGL texture if it is associated with one
* @param texture_id OpenGL texture ID
* @return display or `NULL` if there no display with that texture ID
*/
lv_display_t * lv_opengles_texture_get_from_texture_id(unsigned int texture_id);
/**********************
* MACROS
**********************/
#endif /* LV_USE_OPENGLES */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_OPENGLES_TEXTURE_H*/