Tiny Graphics Interfaces
载入中...
搜索中...
未找到
tgi.h
浏览该文件的文档.
1
9#ifndef TGI_H
10#define TGI_H
11
12#include <stdarg.h>
13
14#define TGIAPI __stdcall
15#define TGICB TGIAPI
16
21typedef enum TGI_Backend
22{
28
34typedef enum TGI_Encoding
35{
46
59typedef struct TGI_Application
60{
61 const struct vtable_TGI_Application_t *vptr;
63
85typedef struct TGI_Window
86{
87 const struct vtable_TGI_Window_t *vptr;
99typedef enum TGI_WindowStyle
100{
131
156typedef struct TGI_Graphics
157{
158 const struct vtable_TGI_Graphics_t *vptr;
160
171typedef struct TGI_Image
172{
173 const struct vtable_TGI_Image_t *vptr;
175
183typedef struct TGI_Font
184{
185 const struct vtable_TGI_Font_t *vptr;
195typedef enum TGI_FontStyle
196{
226typedef enum TGI_TextAlign
227{
249
255typedef struct TGI_Timer
256{
257 const struct vtable_TGI_Timer_t *vptr;
259
264typedef unsigned int TGI_Color;
273#define TGI_COLOR(a, r, g, b) \
274 ((((TGI_Color)(a)) << 24) | (((TGI_Color)(r)) << 16) | (((TGI_Color)(g)) << 8) | ((TGI_Color)(b)))
279static inline TGI_Color TGIAPI tgi_color(unsigned char a, unsigned char r, unsigned char g, unsigned char b)
280{
281 return TGI_COLOR(a, r, g, b);
282}
283
287typedef struct TGI_Point
288{
289 float x, y;
291
295typedef struct TGI_Rect
296{
297 float left, right, top, bottom;
299
304typedef struct TGI_KeyEvent
305{
311 enum
312 {
330 char *key;
336typedef struct TGI_MouseEvent
337{
341 enum
342 {
363 enum
364 {
381 float x, y;
383
388{
389 void(TGIAPI *free)(TGI_Application *self);
390 void(TGIAPI *exec)(TGI_Application *self);
391 int(TGIAPI *exec_once)(TGI_Application *self);
392 TGI_Window *(TGIAPI *create_window)(TGI_Application *self);
393 TGI_Image *(TGIAPI *create_image)(TGI_Application *self, int width, int height);
394 TGI_Image *(TGIAPI *create_image_from_file)(TGI_Application *self, const char *filename);
395 TGI_Font *(TGIAPI *create_font)(TGI_Application *self, const char *name, float size, TGI_FontStyle style);
396 TGI_Timer *(TGIAPI *create_timer)(TGI_Application *self, unsigned int delay, int type,
397 void TGIAPI callback(TGI_Timer *timer));
398};
403static inline void TGIAPI tgi_application_free(TGI_Application *self)
404{
405 self->vptr->free(self);
406}
411static inline void TGIAPI tgi_application_exec(TGI_Application *self)
412{
413 self->vptr->exec(self);
414}
420static inline int TGIAPI tgi_application_exec_once(TGI_Application *self)
421{
422 return self->vptr->exec_once(self);
423}
431{
432 return self->vptr->create_window(self);
433}
443static inline TGI_Image *TGIAPI tgi_application_create_image(TGI_Application *self, int width, int height)
444{
445 return self->vptr->create_image(self, width, height);
446}
456static inline TGI_Image *TGIAPI tgi_application_create_image_from_file(TGI_Application *self, const char *filename)
457{
458 return self->vptr->create_image_from_file(self, filename);
459}
468static inline TGI_Font *TGIAPI tgi_application_create_font(TGI_Application *self, const char *name, float size,
469 TGI_FontStyle style)
470{
471 return self->vptr->create_font(self, name, size, style);
472}
483static inline TGI_Timer *TGIAPI tgi_application_create_timer(TGI_Application *self, unsigned int delay, int type,
484 void TGIAPI callback(TGI_Timer *timer))
485{
486 return self->vptr->create_timer(self, delay, type, callback);
487}
488
493{
494 void(TGIAPI *free)(TGI_Window *self);
495 void(TGIAPI *on_close)(TGI_Window *self, int TGIAPI callback(TGI_Window *self));
496 void(TGIAPI *on_paint)(TGI_Window *self, void TGIAPI callback(TGI_Window *self));
497 void(TGIAPI *on_size)(TGI_Window *self, void TGIAPI callback(TGI_Window *self, float new_width, float new_height));
498 void(TGIAPI *on_key)(TGI_Window *self, void TGIAPI callback(TGI_Window *self, TGI_KeyEvent *event));
499 void(TGIAPI *on_mouse)(TGI_Window *self, void TGIAPI callback(TGI_Window *self, TGI_MouseEvent *event));
500 int(TGIAPI *is_key_down)(TGI_Window *self, char key);
501 void(TGIAPI *show)(TGI_Window *self);
502 void(TGIAPI *paint)(TGI_Window *self);
503 int(TGIAPI *set_style)(TGI_Window *self, TGI_WindowStyle style);
504 int(TGIAPI *set_size)(TGI_Window *self, int width, int height);
505 int(TGIAPI *get_size)(TGI_Window *self, TGI_Rect *rect);
506 int(TGIAPI *set_min_size)(TGI_Window *self, int width, int height);
507 int(TGIAPI *set_max_size)(TGI_Window *self, int width, int height);
508 int(TGIAPI *set_title)(TGI_Window *self, const char *title);
509 TGI_Graphics *(TGIAPI *create_graphics)(TGI_Window *self);
510 TGI_Image *(TGIAPI *create_image)(TGI_Window *self);
511};
516static inline void TGIAPI tgi_window_free(TGI_Window *self)
517{
518 self->vptr->free(self);
519}
526static inline void TGIAPI tgi_window_on_close(TGI_Window *self, int TGIAPI callback(TGI_Window *self))
527{
528 self->vptr->on_close(self, callback);
529}
535static inline void TGIAPI tgi_window_on_paint(TGI_Window *self, void TGIAPI callback(TGI_Window *self))
536{
537 self->vptr->on_paint(self, callback);
538}
544static inline void TGIAPI tgi_window_on_size(TGI_Window *self,
545 void TGIAPI callback(TGI_Window *self, float new_width, float new_height))
546{
547 self->vptr->on_size(self, callback);
548}
554static inline void TGIAPI tgi_window_on_key(TGI_Window *self,
555 void TGIAPI callback(TGI_Window *self, TGI_KeyEvent *event))
556{
557 self->vptr->on_key(self, callback);
558}
564static inline void TGIAPI tgi_window_on_mouse(TGI_Window *self,
565 void TGIAPI callback(TGI_Window *self, TGI_MouseEvent *event))
566{
567 self->vptr->on_mouse(self, callback);
568}
575static inline int TGIAPI tgi_window_is_key_down(TGI_Window *self, char key)
576{
577 return self->vptr->is_key_down(self, key);
578}
583static inline void TGIAPI tgi_window_show(TGI_Window *self)
584{
585 self->vptr->show(self);
586}
591static inline void TGIAPI tgi_window_paint(TGI_Window *self)
592{
593 self->vptr->paint(self);
594}
601static inline int TGIAPI tgi_window_set_style(TGI_Window *self, TGI_WindowStyle style)
602{
603 return self->vptr->set_style(self, style);
604}
612static inline int TGIAPI tgi_window_set_size(TGI_Window *self, int width, int height)
613{
614 return self->vptr->set_size(self, width, height);
615}
623static inline int TGIAPI tgi_window_get_size(TGI_Window *self, TGI_Rect *rect)
624{
625 return self->vptr->get_size(self, rect);
626}
634static inline int TGIAPI tgi_window_set_min_size(TGI_Window *self, int width, int height)
635{
636 return self->vptr->set_min_size(self, width, height);
637}
645static inline int TGIAPI tgi_window_set_max_size(TGI_Window *self, int width, int height)
646{
647 return self->vptr->set_max_size(self, width, height);
648}
655static inline int TGIAPI tgi_window_set_title(TGI_Window *self, const char *title)
656{
657 return self->vptr->set_title(self, title);
658}
667{
668 return self->vptr->create_graphics(self);
669}
677static inline TGI_Image *TGIAPI tgi_window_create_image(TGI_Window *self)
678{
679 return self->vptr->create_image(self);
680}
681
686{
687 void(TGIAPI *free)(TGI_Graphics *self);
688 int(TGIAPI *clear)(TGI_Graphics *self, TGI_Color color);
689 int(TGIAPI *set_color)(TGI_Graphics *self, TGI_Color color);
690 int(TGIAPI *set_width)(TGI_Graphics *self, float width);
691 int(TGIAPI *draw_line)(TGI_Graphics *self, float x1, float y1, float x2, float y2);
692 int(TGIAPI *draw_arc)(TGI_Graphics *self, float x, float y, float width, float height, float start_angle,
693 float sweep_angle);
694 int(TGIAPI *draw_rect)(TGI_Graphics *self, float x, float y, float width, float height);
695 int(TGIAPI *draw_ellipse)(TGI_Graphics *self, float x, float y, float width, float height);
696 int(TGIAPI *draw_pie)(TGI_Graphics *self, float x, float y, float width, float height, float start_angle,
697 float sweep_angle);
698 int(TGIAPI *draw_polygon)(TGI_Graphics *self, const TGI_Point *points, int count);
699 int(TGIAPI *fill_rect)(TGI_Graphics *self, float x, float y, float width, float height);
700 int(TGIAPI *fill_ellipse)(TGI_Graphics *self, float x, float y, float width, float height);
701 int(TGIAPI *fill_pie)(TGI_Graphics *self, float x, float y, float width, float height, float start_angle,
702 float sweep_angle);
703 int(TGIAPI *fill_polygon)(TGI_Graphics *self, const TGI_Point *points, int count);
704 int(TGIAPI *draw_image)(TGI_Graphics *self, const TGI_Image *image, float x, float y);
705 int(TGIAPI *draw_image_rect)(TGI_Graphics *self, const TGI_Image *image, float x, float y, float width,
706 float height);
707 int(TGIAPI *draw_image_ex)(TGI_Graphics *self, const TGI_Image *image, float x, float y, float src_x, float src_y,
708 float src_width, float src_height);
709 int(TGIAPI *draw_image_rect_ex)(TGI_Graphics *self, const TGI_Image *image, float x, float y, float width,
710 float height, float src_x, float src_y, float src_width, float src_height);
711 int(TGIAPI *draw_text)(TGI_Graphics *self, const char *text, const TGI_Font *font, float x, float y);
712 int(TGIAPI *draw_text_rect)(TGI_Graphics *self, const char *text, const TGI_Font *font, float x, float y,
713 float width, float height);
714};
719static inline void TGIAPI tgi_graphics_free(TGI_Graphics *self)
720{
721 self->vptr->free(self);
722}
729static inline int TGIAPI tgi_graphics_clear(TGI_Graphics *self, TGI_Color color)
730{
731 return self->vptr->clear(self, color);
732}
739static inline int TGIAPI tgi_graphics_set_color(TGI_Graphics *self, TGI_Color color)
740{
741 return self->vptr->set_color(self, color);
742}
749static inline int TGIAPI tgi_graphics_set_width(TGI_Graphics *self, float width)
750{
751 return self->vptr->set_width(self, width);
752}
762static inline int TGIAPI tgi_graphics_draw_line(TGI_Graphics *self, float x1, float y1, float x2, float y2)
763{
764 return self->vptr->draw_line(self, x1, y1, x2, y2);
765}
777static inline int TGIAPI tgi_graphics_draw_arc(TGI_Graphics *self, float x, float y, float width, float height,
778 float start_angle, float sweep_angle)
779{
780 return self->vptr->draw_arc(self, x, y, width, height, start_angle, sweep_angle);
781}
791static inline int TGIAPI tgi_graphics_draw_rect(TGI_Graphics *self, float x, float y, float width, float height)
792{
793 return self->vptr->draw_rect(self, x, y, width, height);
794}
804static inline int TGIAPI tgi_graphics_draw_ellipse(TGI_Graphics *self, float x, float y, float width, float height)
805{
806 return self->vptr->draw_ellipse(self, x, y, width, height);
807}
819static inline int TGIAPI tgi_graphics_draw_pie(TGI_Graphics *self, float x, float y, float width, float height,
820 float start_angle, float sweep_angle)
821{
822 return self->vptr->draw_pie(self, x, y, width, height, start_angle, sweep_angle);
823}
831static inline int TGIAPI tgi_graphics_draw_polygon(TGI_Graphics *self, const TGI_Point *points, int count)
832{
833 return self->vptr->draw_polygon(self, points, count);
834}
844static inline int TGIAPI tgi_graphics_fill_rect(TGI_Graphics *self, float x, float y, float width, float height)
845{
846 return self->vptr->fill_rect(self, x, y, width, height);
847}
857static inline int TGIAPI tgi_graphics_fill_ellipse(TGI_Graphics *self, float x, float y, float width, float height)
858{
859 return self->vptr->fill_ellipse(self, x, y, width, height);
860}
872static inline int TGIAPI tgi_graphics_fill_pie(TGI_Graphics *self, float x, float y, float width, float height,
873 float start_angle, float sweep_angle)
874{
875 return self->vptr->fill_pie(self, x, y, width, height, start_angle, sweep_angle);
876}
884static inline int TGIAPI tgi_graphics_fill_polygon(TGI_Graphics *self, const TGI_Point *points, int count)
885{
886 return self->vptr->fill_polygon(self, points, count);
887}
896static inline int TGIAPI tgi_graphics_draw_image(TGI_Graphics *self, const TGI_Image *image, float x, float y)
897{
898 return self->vptr->draw_image(self, image, x, y);
899}
911static inline int TGIAPI tgi_graphics_draw_image_rect(TGI_Graphics *self, const TGI_Image *image, float x, float y,
912 float width, float height)
913{
914 return self->vptr->draw_image_rect(self, image, x, y, width, height);
915}
928static inline int TGIAPI tgi_graphics_draw_image_ex(TGI_Graphics *self, const TGI_Image *image, float x, float y,
929 float src_x, float src_y, float src_width, float src_height)
930{
931 return self->vptr->draw_image_ex(self, image, x, y, src_x, src_y, src_width, src_height);
932}
948static inline int TGIAPI tgi_graphics_draw_image_rect_ex(TGI_Graphics *self, const TGI_Image *image, float x, float y,
949 float width, float height, float src_x, float src_y,
950 float src_width, float src_height)
951{
952 return self->vptr->draw_image_rect_ex(self, image, x, y, width, height, src_x, src_y, src_width, src_height);
953}
963static inline int TGIAPI tgi_graphics_draw_text(TGI_Graphics *self, const char *text, const TGI_Font *font, float x,
964 float y)
965{
966 return self->vptr->draw_text(self, text, font, x, y);
967}
979static inline int TGIAPI tgi_graphics_draw_text_rect(TGI_Graphics *self, const char *text, const TGI_Font *font,
980 float x, float y, float width, float height)
981{
982 return self->vptr->draw_text_rect(self, text, font, x, y, width, height);
983}
984
989{
990 void(TGIAPI *free)(TGI_Image *self);
991 TGI_Image *(TGIAPI *clone)(TGI_Image *self);
992 int(TGIAPI *get_size)(TGI_Image *self, TGI_Rect *rect);
993 TGI_Graphics *(TGIAPI *create_graphics)(TGI_Image *self);
994};
999static inline void TGIAPI tgi_image_free(TGI_Image *self)
1000{
1001 self->vptr->free(self);
1002}
1009static inline TGI_Image *TGIAPI tgi_image_clone(TGI_Image *self)
1010{
1011 return self->vptr->clone(self);
1012}
1020static inline int TGIAPI tgi_image_get_size(TGI_Image *self, TGI_Rect *rect)
1021{
1022 return self->vptr->get_size(self, rect);
1023}
1032{
1033 return self->vptr->create_graphics(self);
1034}
1035
1040{
1041 void(TGIAPI *free)(TGI_Font *self);
1042 int(TGIAPI *set_align)(TGI_Font *self, TGI_TextAlign align);
1043 int(TGIAPI *set_vertical_align)(TGI_Font *self, TGI_TextAlign align);
1044};
1049static inline void TGIAPI tgi_font_free(TGI_Font *self)
1050{
1051 self->vptr->free(self);
1052}
1059static inline int TGIAPI tgi_font_set_align(TGI_Font *self, TGI_TextAlign align)
1060{
1061 return self->vptr->set_align(self, align);
1062}
1069static inline int TGIAPI tgi_font_set_vertical_align(TGI_Font *self, TGI_TextAlign align)
1070{
1071 return self->vptr->set_vertical_align(self, align);
1072}
1073
1078{
1079 void(TGIAPI *free)(TGI_Timer *self);
1080};
1085static inline void tgi_timer_free(TGI_Timer *self)
1086{
1087 self->vptr->free(self);
1088}
1089
1090#ifdef __cplusplus
1091extern "C"
1092{
1093#endif
1104
1105#ifdef __cplusplus
1106}
1107#endif
1108
1109#endif
应用对象类型
Definition tgi.h:60
字体对象类型
Definition tgi.h:184
图形对象类型
Definition tgi.h:157
图像对象类型
Definition tgi.h:172
键盘事件类型
Definition tgi.h:305
@ TGI_KEYEVENT_DOWN
按键按下事件
Definition tgi.h:316
@ TGI_KEYEVENT_INPUT
输入事件
Definition tgi.h:324
@ TGI_KEYEVENT_UP
按键抬起事件
Definition tgi.h:320
enum TGI_KeyEvent::@0 type
事件类型
char * key
当事件类型为 TGI_KEYEVENT_DOWN 或 TGI_KEYEVENT_UP 时,指向一个字符,表示按下按键的ASCII码
Definition tgi.h:330
鼠标事件类型
Definition tgi.h:337
enum TGI_MouseEvent::@2 buttom
按键类型
enum TGI_MouseEvent::@1 type
事件类型
@ TGI_MOUSEEVENT_LEFT
左键
Definition tgi.h:368
@ TGI_MOUSEEVENT_RIGHT
右键
Definition tgi.h:376
@ TGI_MOUSEEVENT_MIDDLE
中键
Definition tgi.h:372
float x
鼠标相对窗口的位置
Definition tgi.h:381
@ TGI_MOUSEEVENT_DOUBLE
双击
Definition tgi.h:354
@ TGI_MOUSEEVENT_DOWN
按键按下
Definition tgi.h:346
@ TGI_MOUSEEVENT_UP
按键抬起
Definition tgi.h:350
@ TGI_MOUSEEVENT_MOVE
移动
Definition tgi.h:358
点(坐标)类型
Definition tgi.h:288
矩形类型
Definition tgi.h:296
计时器对象类型
Definition tgi.h:256
窗口对象类型
Definition tgi.h:86
应用对象的虚函数表(正常使用无需了解)
Definition tgi.h:388
字体对象的虚函数表(正常使用无需了解)
Definition tgi.h:1040
图形对象的虚函数表(正常使用无需了解)
Definition tgi.h:686
图片对象的虚函数表(正常使用无需了解)
Definition tgi.h:989
计时器对象的虚函数表(正常使用无需了解)
Definition tgi.h:1078
窗口对象的虚函数表(正常使用无需了解)
Definition tgi.h:493
static int TGIAPI tgi_graphics_draw_text(TGI_Graphics *self, const char *text, const TGI_Font *font, float x, float y)
在指定位置绘制文字
Definition tgi.h:963
TGI_FontStyle
字体样式类型
Definition tgi.h:196
@ TGI_FONTSTYLE_UNDERLINE
下划线
Definition tgi.h:212
@ TGI_FONTSTYLE_REGULAR
标准
Definition tgi.h:200
@ TGI_FONTSTYLE_ITALIC
斜体
Definition tgi.h:208
@ TGI_FONTSTYLE_STRIKEOUT
删除线
Definition tgi.h:216
@ TGI_FONTSTYLE_BOLD
加粗
Definition tgi.h:204
static int TGIAPI tgi_window_is_key_down(TGI_Window *self, char key)
判断键盘按键是否按下
Definition tgi.h:575
static int TGIAPI tgi_graphics_draw_image_ex(TGI_Graphics *self, const TGI_Image *image, float x, float y, float src_x, float src_y, float src_width, float src_height)
在指定的位置绘制图片的部分
Definition tgi.h:928
static TGI_Graphics *TGIAPI tgi_image_create_graphics(TGI_Image *self)
开始在图片上绘图
Definition tgi.h:1031
static int TGIAPI tgi_image_get_size(TGI_Image *self, TGI_Rect *rect)
获取图片大小
Definition tgi.h:1020
static void TGIAPI tgi_window_on_size(TGI_Window *self, void TGIAPI callback(TGI_Window *self, float new_width, float new_height))
设置窗口改变大小时将会调用的函数
Definition tgi.h:544
static int TGIAPI tgi_graphics_set_color(TGI_Graphics *self, TGI_Color color)
设置画笔颜色
Definition tgi.h:739
TGI_TextAlign
字体对齐方法类型
Definition tgi.h:227
@ TGI_TEXTALIGN_RIGHT
靠右
Definition tgi.h:239
@ TGI_TEXTALIGN_TOP
靠上
Definition tgi.h:243
@ TGI_TEXTALIGN_BOTTOM
靠下
Definition tgi.h:247
@ TGI_TEXTALIGN_CENTER
居中
Definition tgi.h:235
@ TGI_TEXTALIGN_LEFT
靠左
Definition tgi.h:231
static void TGIAPI tgi_window_on_mouse(TGI_Window *self, void TGIAPI callback(TGI_Window *self, TGI_MouseEvent *event))
设置出现鼠标事件时将会调用的函数
Definition tgi.h:564
static TGI_Image *TGIAPI tgi_window_create_image(TGI_Window *self)
创建与窗口关联的图像对象
Definition tgi.h:677
static int TGIAPI tgi_font_set_vertical_align(TGI_Font *self, TGI_TextAlign align)
设置竖直方向的文本对齐方式
Definition tgi.h:1069
static int TGIAPI tgi_graphics_fill_polygon(TGI_Graphics *self, const TGI_Point *points, int count)
填充一个多边形
Definition tgi.h:884
static int TGIAPI tgi_graphics_set_width(TGI_Graphics *self, float width)
设置画笔宽度
Definition tgi.h:749
static void TGIAPI tgi_image_free(TGI_Image *self)
释放图片资源
Definition tgi.h:999
static int TGIAPI tgi_graphics_draw_line(TGI_Graphics *self, float x1, float y1, float x2, float y2)
绘制一条从(x1, y1)到(x2,y2)的直线
Definition tgi.h:762
static TGI_Image *TGIAPI tgi_application_create_image(TGI_Application *self, int width, int height)
创建一个图片
Definition tgi.h:443
static TGI_Color TGIAPI tgi_color(unsigned char a, unsigned char r, unsigned char g, unsigned char b)
创建一个ARGB颜色
Definition tgi.h:279
TGI_Backend
图形后端类型
Definition tgi.h:22
@ TGI_BACKEND_GDI
GDI/GDI+ 图形后端,支持 Windows XP 及以上的操作系统
Definition tgi.h:26
static int TGIAPI tgi_graphics_draw_pie(TGI_Graphics *self, float x, float y, float width, float height, float start_angle, float sweep_angle)
绘制一个扇形
Definition tgi.h:819
static int TGIAPI tgi_graphics_fill_pie(TGI_Graphics *self, float x, float y, float width, float height, float start_angle, float sweep_angle)
填充一个扇形
Definition tgi.h:872
static int TGIAPI tgi_window_set_title(TGI_Window *self, const char *title)
设置窗口的标题
Definition tgi.h:655
static int TGIAPI tgi_window_set_style(TGI_Window *self, TGI_WindowStyle style)
设置窗口风格
Definition tgi.h:601
static int TGIAPI tgi_graphics_draw_image(TGI_Graphics *self, const TGI_Image *image, float x, float y)
在指定的位置绘制一个图片
Definition tgi.h:896
TGI_Application *TGIAPI tgi_application_create(TGI_Backend backend, TGI_Encoding encoding)
创建使用指定绘图后端的应用
static void TGIAPI tgi_window_show(TGI_Window *self)
激活窗口并以当前大小和位置显示窗口
Definition tgi.h:583
TGI_Encoding
文本编码类型
Definition tgi.h:35
@ TGI_ENCODING_UTF8
UTF-8 编码
Definition tgi.h:39
@ TGI_ENCODING_ANSI
ANSI 编码
Definition tgi.h:44
static int TGIAPI tgi_graphics_fill_ellipse(TGI_Graphics *self, float x, float y, float width, float height)
填充一个椭圆
Definition tgi.h:857
static int TGIAPI tgi_graphics_draw_ellipse(TGI_Graphics *self, float x, float y, float width, float height)
绘制一个椭圆
Definition tgi.h:804
static void TGIAPI tgi_window_on_key(TGI_Window *self, void TGIAPI callback(TGI_Window *self, TGI_KeyEvent *event))
设置出现键盘事件时将会调用的函数
Definition tgi.h:554
static int TGIAPI tgi_application_exec_once(TGI_Application *self)
处理一次应用事件
Definition tgi.h:420
static int TGIAPI tgi_graphics_clear(TGI_Graphics *self, TGI_Color color)
绘制背景颜色
Definition tgi.h:729
static int TGIAPI tgi_window_set_min_size(TGI_Window *self, int width, int height)
设置窗口的最大小大小
Definition tgi.h:634
static int TGIAPI tgi_graphics_draw_arc(TGI_Graphics *self, float x, float y, float width, float height, float start_angle, float sweep_angle)
绘制一条弧线
Definition tgi.h:777
static TGI_Font *TGIAPI tgi_application_create_font(TGI_Application *self, const char *name, float size, TGI_FontStyle style)
创建一个字体
Definition tgi.h:468
static void tgi_timer_free(TGI_Timer *self)
关闭计时器并释放资源
Definition tgi.h:1085
static void TGIAPI tgi_window_free(TGI_Window *self)
关闭窗口并释放资源
Definition tgi.h:516
static TGI_Image *TGIAPI tgi_image_clone(TGI_Image *self)
复制图片
Definition tgi.h:1009
static int TGIAPI tgi_graphics_draw_polygon(TGI_Graphics *self, const TGI_Point *points, int count)
绘制一个多边形
Definition tgi.h:831
static TGI_Image *TGIAPI tgi_application_create_image_from_file(TGI_Application *self, const char *filename)
从文件创建一个图片
Definition tgi.h:456
static void TGIAPI tgi_graphics_free(TGI_Graphics *self)
结束绘图并释放资源
Definition tgi.h:719
static void TGIAPI tgi_font_free(TGI_Font *self)
释放字体资源
Definition tgi.h:1049
static int TGIAPI tgi_font_set_align(TGI_Font *self, TGI_TextAlign align)
设置横向的文本对齐方式
Definition tgi.h:1059
static int TGIAPI tgi_window_set_max_size(TGI_Window *self, int width, int height)
设置窗口的最大大小
Definition tgi.h:645
static int TGIAPI tgi_window_set_size(TGI_Window *self, int width, int height)
设置窗口的大小
Definition tgi.h:612
static void TGIAPI tgi_window_on_paint(TGI_Window *self, void TGIAPI callback(TGI_Window *self))
设置窗口需要绘制时将会调用的函数
Definition tgi.h:535
static TGI_Window *TGIAPI tgi_application_create_window(TGI_Application *self)
创建一个窗口
Definition tgi.h:430
static void TGIAPI tgi_application_exec(TGI_Application *self)
启动应用的事件循环
Definition tgi.h:411
static void TGIAPI tgi_window_paint(TGI_Window *self)
调用设置的 on_paint 回调函数
Definition tgi.h:591
static void TGIAPI tgi_application_free(TGI_Application *self)
关闭应用并释放资源
Definition tgi.h:403
static int TGIAPI tgi_graphics_draw_image_rect(TGI_Graphics *self, const TGI_Image *image, float x, float y, float width, float height)
在指定的矩形内绘制一个图片
Definition tgi.h:911
TGI_WindowStyle
窗口风格类型
Definition tgi.h:100
@ TGI_WINDOWSTYLE_MAXIMIZEBOX
有最大化按钮
Definition tgi.h:124
@ TGI_WINDOWSTYLE_MINIMIZEBOX
有最小化按钮
Definition tgi.h:120
@ TGI_WINDOWSTYLE_BORDER
有边框
Definition tgi.h:108
@ TGI_WINDOWSTYLE_DEFAULT
默认
Definition tgi.h:128
@ TGI_WINDOWSTYLE_CAPTION
有标题
Definition tgi.h:112
@ TGI_WINDOWSTYLE_RESIZE
可调节大小
Definition tgi.h:116
@ TGI_WINDOWSTYLE_WINDOW
基础
Definition tgi.h:104
static int TGIAPI tgi_graphics_draw_image_rect_ex(TGI_Graphics *self, const TGI_Image *image, float x, float y, float width, float height, float src_x, float src_y, float src_width, float src_height)
在指定的位置绘制图片的部分
Definition tgi.h:948
static void TGIAPI tgi_window_on_close(TGI_Window *self, int TGIAPI callback(TGI_Window *self))
设置窗口关闭时将会调用的函数
Definition tgi.h:526
static TGI_Graphics *TGIAPI tgi_window_create_graphics(TGI_Window *self)
创建绘图对象
Definition tgi.h:666
unsigned int TGI_Color
颜色类型
Definition tgi.h:264
static TGI_Timer *TGIAPI tgi_application_create_timer(TGI_Application *self, unsigned int delay, int type, void TGIAPI callback(TGI_Timer *timer))
创建一个计时器
Definition tgi.h:483
static int TGIAPI tgi_graphics_draw_text_rect(TGI_Graphics *self, const char *text, const TGI_Font *font, float x, float y, float width, float height)
在指定矩形绘制文字
Definition tgi.h:979
static int TGIAPI tgi_graphics_draw_rect(TGI_Graphics *self, float x, float y, float width, float height)
绘制一个矩形
Definition tgi.h:791
static int TGIAPI tgi_graphics_fill_rect(TGI_Graphics *self, float x, float y, float width, float height)
填充一个矩形
Definition tgi.h:844
#define TGI_COLOR(a, r, g, b)
创建一个ARGB颜色
Definition tgi.h:273
static int TGIAPI tgi_window_get_size(TGI_Window *self, TGI_Rect *rect)
获取窗口大小
Definition tgi.h:623