Tag
Hash :
752330a5
Author :
Thomas de Grivel
Date :
2024-08-08T17:20:11
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
/* kc3
* Copyright 2022,2023,2024 kmx.io <contact@kmx.io>
*
* Permission is hereby granted to use this software granted the above
* copyright notice and this permission paragraph are included in all
* copies and substantial portions of this software.
*
* THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
* PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
* AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
* THIS SOFTWARE.
*/
/** @file types.h
* @brief Module C3.Window.Cairo
*
* Struct for all GUI window Cairo graphics operations.
*/
#ifndef LIBKC3_WINDOW_CAIRO_TYPES_H
#define LIBKC3_WINDOW_CAIRO_TYPES_H
#include <cairo.h>
#include <cairo-ft.h>
#include <ft2build.h>
#include FT_FREETYPE_H
#include <png.h>
#include <libkc3/types.h>
#include "../types.h"
typedef struct cairo_font s_cairo_font;
typedef struct cairo_sprite s_cairo_sprite;
typedef struct rgb s_rgb;
typedef struct rgba s_rgba;
typedef struct window_cairo s_window_cairo;
/* return false to break event loop */
typedef bool (*f_window_cairo_button) (s_window_cairo *window,
u8 button, sw x, sw y);
/* return false to break event loop */
typedef bool (*f_window_cairo_key) (s_window_cairo *window, uw keysym);
/* return false to break event loop */
typedef bool (*f_window_cairo_load) (s_window_cairo *window);
/* return false to break event loop */
typedef bool (*f_window_cairo_motion) (s_window_cairo *window, sw x,
sw y);
/* return false to break event loop */
typedef bool (*f_window_cairo_render) (s_window_cairo *window);
/* return false to break event loop */
typedef bool (*f_window_cairo_resize) (s_window_cairo *window,
uw w, uw h);
typedef void (*f_window_cairo_unload) (s_window_cairo *window);
struct cairo_font {
cairo_font_face_t *cairo_font_face;
FT_Face ft_face;
s_str path;
s_str real_path;
};
struct cairo_sprite {
s_str path;
s_str real_path;
uw total_w;
uw total_h;
uw dim_x;
uw dim_y;
uw frame_count;
uw w;
uw h;
//ILuint *il_image;
cairo_surface_t **surface;
};
struct rgb {
double r;
double g;
double b;
};
struct rgba {
double r;
double g;
double b;
double a;
};
/* Subtype of s_window. See libkc3/window/types.h */
struct window_cairo {
sw x;
sw y;
uw w;
uw h;
bool fullscreen;
f_window_cairo_button button;
f_window_cairo_key key;
f_window_cairo_load load;
f_window_cairo_motion motion;
f_window_cairo_render render;
cairo_t *cr;
f_window_cairo_resize resize;
s_sequence *seq;
s_sequence *sequence;
uw sequence_count;
uw sequence_pos;
s_tag tag; // TODO: move sequence to tag
const char *title;
f_window_cairo_unload unload;
};
#endif /* LIBKC3_WINDOW_CAIRO_TYPES_H */