1 /** 2 * @file lv_glfw_window.h 3 * 4 */ 5 6 #ifndef LV_GLFW_WINDOW_H 7 #define LV_GLFW_WINDOW_H 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 /********************* 14 * INCLUDES 15 *********************/ 16 17 #include "../../lv_conf_internal.h" 18 #if LV_USE_OPENGLES 19 20 #include "../../misc/lv_types.h" 21 #include "../../display/lv_display.h" 22 23 /********************* 24 * DEFINES 25 *********************/ 26 27 /********************** 28 * TYPEDEFS 29 **********************/ 30 31 /********************** 32 * GLOBAL PROTOTYPES 33 **********************/ 34 35 /** 36 * Create a GLFW window with no textures and initialize OpenGL 37 * @param hor_res width in pixels of the window 38 * @param ver_res height in pixels of the window 39 * @param use_mouse_indev send pointer indev input to LVGL display textures 40 * @return the new GLFW window handle 41 */ 42 lv_glfw_window_t * lv_glfw_window_create(int32_t hor_res, int32_t ver_res, bool use_mouse_indev); 43 44 /** 45 * Delete a GLFW window. If it is the last one, the process will exit 46 * @param window GLFW window to delete 47 */ 48 void lv_glfw_window_delete(lv_glfw_window_t * window); 49 50 /** 51 * Add a texture to the GLFW window. It can be an LVGL display texture, or any OpenGL texture 52 * @param window GLFW window 53 * @param texture_id OpenGL texture ID 54 * @param w width in pixels of the texture 55 * @param h height in pixels of the texture 56 * @return the new texture handle 57 */ 58 lv_glfw_texture_t * lv_glfw_window_add_texture(lv_glfw_window_t * window, unsigned int texture_id, int32_t w, 59 int32_t h); 60 61 /** 62 * Remove a texture from its GLFW window and delete it 63 * @param texture handle of a GLFW window texture 64 */ 65 void lv_glfw_texture_remove(lv_glfw_texture_t * texture); 66 67 /** 68 * Set the x position of a texture within its GLFW window 69 * @param texture handle of a GLFW window texture 70 * @param x new x position of the texture 71 */ 72 void lv_glfw_texture_set_x(lv_glfw_texture_t * texture, int32_t x); 73 74 /** 75 * Set the y position of a texture within its GLFW window 76 * @param texture handle of a GLFW window texture 77 * @param y new y position of the texture 78 */ 79 void lv_glfw_texture_set_y(lv_glfw_texture_t * texture, int32_t y); 80 81 /** 82 * Set the opacity of a texture in a GLFW window 83 * @param texture handle of a GLFW window texture 84 * @param opa new opacity of the texture 85 */ 86 void lv_glfw_texture_set_opa(lv_glfw_texture_t * texture, lv_opa_t opa); 87 88 /** 89 * Get the mouse indev associated with a texture in a GLFW window, if it exists 90 * @param texture handle of a GLFW window texture 91 * @return the indev or `NULL` 92 * @note there will only be an indev if the texture is based on an 93 * LVGL display texture and the window was created with 94 * `use_mouse_indev` as `true` 95 */ 96 lv_indev_t * lv_glfw_texture_get_mouse_indev(lv_glfw_texture_t * texture); 97 98 /********************** 99 * MACROS 100 **********************/ 101 102 #endif /* LV_USE_OPENGLES */ 103 104 #ifdef __cplusplus 105 } /* extern "C" */ 106 #endif 107 108 #endif /* LV_GLFW_WINDOW_H */ 109