-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathege.h
More file actions
5203 lines (4668 loc) · 193 KB
/
ege.h
File metadata and controls
5203 lines (4668 loc) · 193 KB
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*********************************************************
* EGE (Easy Graphics Engine) 24.04
* FileName: ege.h
* Website: https://xege.org
* Community: https://club.xege.org
* GitHub: https://github.com/wysaid/xege
* GitHub: https://github.com/Easy-Graphics-Engine
* Gitee: https://gitee.com/xege/xege
* Blog: https://blog.csdn.net/qq_39151563/article/details/125688290
* E-Mail: this@xege.org
*
*********************************************************/
#ifndef EGE_H
#define EGE_H
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
#pragma once
#endif
// Easy Graphics Engine Version
// Calendar Versioning, format: YY.0M.PatchNumber (If the PatchNumber equals 0, the YY.0M format is used.)
#define EGE_VERSION "24.04"
#define EGE_VERSION_MAJOR 24
#define EGE_VERSION_MINOR 4
#define EGE_VERSION_PATCH 0
#define EGE_MAKE_VERSION_NUMBER(major, minor, patch) ((major) * 10000L + (minor) * 100L + (patch))
#define EGE_VERSION_NUMBER EGE_MAKE_VERSION_NUMBER(EGE_VERSION_MAJOR, EGE_VERSION_MINOR, EGE_VERSION_PATCH)
#ifndef __cplusplus
#error You must use a C++ compiler and ensure that your source files is named with the '.cpp' suffix.
#endif
#if defined(_INC_CONIO) || defined(_CONIO_H_)
#error You cannot include "conio.h" before "graphics.h".
#endif
#if defined(_MSC_VER)
# pragma warning(disable: 4355)
# ifndef _ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH
# define _ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH
# endif
# ifndef _ALLOW_RUNTIME_LIBRARY_MISMATCH
# define _ALLOW_RUNTIME_LIBRARY_MISMATCH
# endif
#endif
#if !defined(EGE_GRAPH_LIB_BUILD) && !defined(EGE_GRAPH_NO_LIB)
# ifdef _MSC_VER
# pragma comment(lib,"gdiplus.lib")
# ifdef _WIN64 // 64 bit libs
# pragma comment(lib,"graphics.lib")
# else // 32 bit libs
# pragma comment(lib,"graphics.lib")
# endif
# endif
#endif
#if !defined(EGE_GRAPH_LIB_BUILD) && !defined(EGE_GRAPH_NO_LIB)
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#ifndef _CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_DEPRECATE
#endif
#ifndef _CRT_NON_CONFORMING_SWPRINTFS
#define _CRT_NON_CONFORMING_SWPRINTFS
#endif
#endif
#include "ege/stdint.h"
#if defined(EGE_FOR_AUTO_CODE_COMPLETETION_ONLY)
#include <windef.h>
#include <winuser.h>
#include <wingdi.h>
#else
#include <windows.h>
#endif
#if defined(_MSC_VER) && (_MSC_VER <= 1300)
#define EGE_COMPILERINFO_VC6
#endif
#if defined(_MSC_VER) && _MSC_VER <= 1200 && !defined(SetWindowLongPtr)
# define SetWindowLongPtrW SetWindowLongW
# define GetWindowLongPtrW GetWindowLongW
# define GWLP_USERDATA GWL_USERDATA
# define GWLP_WNDPROC GWL_WNDPROC
#endif
#ifndef WM_MOUSEWHEEL
#define WM_MOUSEWHEEL 0x020A
#endif
#ifndef EGE_CDECL
# if __STDC__
# define EGE_CDECL __cdecl
# else
# define EGE_CDECL __cdecl
# endif
#endif
#ifdef _MSC_VER
# if defined(_WIN64)
# define EGEAPI
# else
# define EGEAPI EGE_CDECL
# endif
#else
# if defined(__WORDSIZE)
# if __WORDSIZE > 32
# define EGEAPI
# else
# define EGEAPI EGE_CDECL
# endif
# else
# define EGEAPI
# endif
#endif
#ifndef EGE_DEPRECATE
# ifdef _MSC_VER
# ifdef _CRT_DEPRECATE_TEXT
# define EGE_DEPRECATE(function, msg) _CRT_DEPRECATE_TEXT("This function is deprecated. " msg " For more information, visit https://xege.org .")
# else
# define EGE_DEPRECATE(function, msg)
# endif
# elif ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)))
# define EGE_DEPRECATE(function, msg) __attribute__((deprecated(msg " For more information, visit https://xege.org .")))
# else
# define EGE_DEPRECATE(function, msg) __attribute__((deprecated))
# endif
#endif
#define EGE_GDIPLUS
#define EGERGBA(r, g, b, a) ((::ege::color_t)(((r) << 16) | ((g) << 8) | (b) | ((a) << 24)))
#define EGERGB(r, g, b) EGERGBA(r, g, b, 0xFF)
#define EGEARGB(a, r, g, b) EGERGBA(r, g, b, a)
#define EGEACOLOR(a, color) ((::ege::color_t)(((color) & 0xFFFFFF) | ((a) << 24)))
#define EGECOLORA(color, a) EGEACOLOR(a, color)
#define EGEGET_R(c) (((c) >> 16) & 0xFF)
#define EGEGET_G(c) (((c) >> 8) & 0xFF)
#define EGEGET_B(c) (((c)) & 0xFF)
#define EGEGET_A(c) (((c) >> 24) & 0xFF)
#define EGEGRAY(gray) EGERGB(gray, gray, gray)
#define EGEGRAYA(gray, a) EGERGBA(gray, gray, gray, a)
#define EGEAGRAY(a, gray) EGEGRAYA(gray, a)
/* you can also use 932 as shift-jis, 950 as big5 ... */
/* see https://learn.microsoft.com/en-us/windows/win32/intl/code-page-identifiers */
#define EGE_CODEPAGE_GB2312 936
#define EGE_CODEPAGE_UTF8 65001
#define EGE_CODEPAGE_ANSI 0
namespace ege
{
const double PI = 3.1415926535897932384626;
/* define graphics drivers */
enum graphics_drivers
{
DETECT = 0, /* requests autodetection */
CGA, MCGA, EGA, EGA64, EGAMONO, IBM8514,/* 1 - 6 */
HERCMONO, ATT400, VGA, PC3270, /* 7 - 10 */
TRUECOLOR, TRUECOLORSIZE,
CURRENT_DRIVER = -1
};
/* graphics modes for each driver */
enum graphics_modes
{
CGAC0 = 0, /* 320x200 palette 0; 1 page */
CGAC1 = 1, /* 320x200 palette 1; 1 page */
CGAC2 = 2, /* 320x200 palette 2: 1 page */
CGAC3 = 3, /* 320x200 palette 3; 1 page */
CGAHI = 4, /* 640x200 1 page */
MCGAC0 = 0, /* 320x200 palette 0; 1 page */
MCGAC1 = 1, /* 320x200 palette 1; 1 page */
MCGAC2 = 2, /* 320x200 palette 2; 1 page */
MCGAC3 = 3, /* 320x200 palette 3; 1 page */
MCGAMED = 4, /* 640x200 1 page */
MCGAHI = 5, /* 640x480 1 page */
EGALO = 0, /* 640x200 16 color 4 pages */
EGAHI = 1, /* 640x350 16 color 2 pages */
EGA64LO = 0, /* 640x200 16 color 1 page */
EGA64HI = 1, /* 640x350 4 color 1 page */
EGAMONOHI = 0, /* 640x350 64K on card, 1 page - 256K on card, 4 pages */
HERCMONOHI = 0, /* 720x348 2 pages */
ATT400C0 = 0, /* 320x200 palette 0; 1 page */
ATT400C1 = 1, /* 320x200 palette 1; 1 page */
ATT400C2 = 2, /* 320x200 palette 2; 1 page */
ATT400C3 = 3, /* 320x200 palette 3; 1 page */
ATT400MED = 4, /* 640x200 1 page */
ATT400HI = 5, /* 640x400 1 page */
VGALO = 0, /* 640x200 16 color 4 pages */
VGAMED = 1, /* 640x350 16 color 2 pages */
VGAHI = 2, /* 640x480 16 color 1 page */
PC3270HI = 0, /* 720x350 1 page */
IBM8514LO = 0, /* 640x480 256 colors */
IBM8514HI = 1 /*1024x768 256 colors */
};
enum initmode_flag
{
INIT_DEFAULT = 0x0, ///< Default mode
INIT_NOBORDER = 0x1, ///< Borderless window
INIT_CHILD = 0x2, ///< Child window mode
INIT_TOPMOST = 0x4, ///< Topmost window
INIT_RENDERMANUAL = 0x8, ///< Manual rendering mode
INIT_NOFORCEEXIT = 0x10, ///< Don't force exit program when closing window, only set internal flag, is_run() can get the flag
INIT_UNICODE = 0x20, ///< Unicode character messages (equivalent to setunicodecharmessage(true))
INIT_HIDE = 0x40, ///< Hidden window
INIT_WITHLOGO = 0x100, ///< Show EGE Logo animation on startup (not shown by default in Debug version)
INIT_EVENTLOOP = 0x200, ///< Event loop
INIT_ANIMATION = INIT_DEFAULT | INIT_RENDERMANUAL | INIT_NOFORCEEXIT ///< Animation mode
};
/**
* @enum rendermode_e
* @brief Rendering mode
*/
enum rendermode_e
{
RENDER_AUTO, ///< Automatic rendering
RENDER_MANUAL ///< Manual rendering
};
/**
* @enum graphics_errors
* @brief Graphics operation error codes
*
* Defines various error codes that can be returned by graphics operations
*/
enum graphics_errors
{
grOk = 0, ///< Operation successful
grNoInitGraph = -1, ///< Graphics system not initialized
grNotDetected = -2, ///< Graphics device not detected
grFileNotFound = -3, ///< File not found
grInvalidDriver = -4, ///< Invalid driver
grNoLoadMem = -5, ///< Memory loading failed
grNoScanMem = -6, ///< Scan memory failed
grNoFloodMem = -7, ///< Fill memory failed
grFontNotFound = -8, ///< Font not found
grNoFontMem = -9, ///< Insufficient font memory
grInvalidMode = -10, ///< Invalid mode
grError = -11, ///< General error
grIOerror = -12, ///< I/O error
grInvalidFont = -13, ///< Invalid font
grInvalidFontNum = -14, ///< Invalid font number
grInvalidVersion = -18, ///< Version incompatible
grException = 16, ///< EGE exception
grParamError = 17, ///< Parameter error
grInvalidRegion = 18, ///< Invalid region
grOutOfMemory = 19, ///< Out of memory
grNullPointer = 20, ///< Null pointer
grAllocError = 21, ///< Allocation error
grInvalidFileFormat = 22, ///< Invalid file format
grUnsupportedFormat = 23, ///< Unsupported format
grInvalidMemory = 0xCDCDCDCD ///< Invalid memory(-842150451)
};
/**
* @enum message_event
* @brief Message event types
*
* Defines event types for mouse and keyboard messages, used for message handling
*/
enum message_event
{
MSG_EVENT_UP = 0x00, ///< Key/mouse button release event
MSG_EVENT_DOWN = 0x01, ///< Key/mouse button press event
MSG_EVENT_CLICK = 0x01, ///< Mouse click event (equivalent to DOWN)
MSG_EVENT_DBCLICK = 0x02, ///< Mouse double-click event
MSG_EVENT_MOVE = 0x04, ///< Mouse move event
MSG_EVENT_WHEEL = 0x10 ///< Mouse wheel event
};
/**
* @enum message_mouse
* @brief Mouse button identifiers
*
* Defines different mouse buttons, can be combined using bitwise OR operations
*/
enum message_mouse
{
MSG_MOUSE_LEFT = 0x01, ///< Left mouse button
MSG_MOUSE_RIGHT = 0x02, ///< Right mouse button
MSG_MOUSE_MID = 0x04 ///< Middle mouse button (wheel button)
};
#ifndef EGE_COLOR_T_TYPEDEF
#define EGE_COLOR_T_TYPEDEF
/// @brief Color type definition, uses 32-bit unsigned integer to represent ARGB color
typedef uint32_t color_t;
#endif
/**
* @enum alpha_type
* @brief Alpha channel types
*
* Defines different handling methods for image alpha channels
*/
enum alpha_type
{
ALPHATYPE_STRAIGHT = 0, ///< Straight alpha (non-premultiplied alpha)
ALPHATYPE_PREMULTIPLIED = 1 ///< Premultiplied alpha
};
/**
* @struct ege_point
* @brief Floating-point coordinate point structure
*
* Used to represent a point in 2D space with floating-point coordinates
*/
struct ege_point
{
float x; ///< x coordinate
float y; ///< y coordinate
};
/**
* @struct ege_rect
* @brief Rectangle area structure
*
* Used to represent a rectangular area, including position and size information
*/
struct ege_rect
{
float x; ///< Rectangle top-left x coordinate
float y; ///< Rectangle top-left y coordinate
float w; ///< Rectangle width
float h; ///< Rectangle height
};
/**
* @struct ege_colpoint
* @brief Coordinate point structure with color
*
* Used to represent a 2D coordinate point with color information, commonly used for gradient effects
*/
struct ege_colpoint
{
float x; ///< x coordinate
float y; ///< y coordinate
color_t color; ///< Color value of this point
};
/**
* @enum COLORS
* @brief Predefined color constants
*
* Provides commonly used color constants, defined based on web-safe color standards
* Color values use RGB format and can be used directly in drawing functions
*/
enum COLORS
{
ALICEBLUE = EGERGB(0xF0, 0xF8, 0xFF),
ANTIQUEWHITE = EGERGB(0xFA, 0xEB, 0xD7),
AQUA = EGERGB(0x00, 0xFF, 0xFF),
AQUAMARINE = EGERGB(0x7F, 0xFF, 0xD4),
AZURE = EGERGB(0xF0, 0xFF, 0xFF),
BEIGE = EGERGB(0xF5, 0xF5, 0xDC),
BISQUE = EGERGB(0xFF, 0xE4, 0xC4),
BLACK = EGERGB(0x00, 0x00, 0x00),
BLANCHEDALMOND = EGERGB(0xFF, 0xEB, 0xCD),
BLUE = EGERGB(0x00, 0x00, 0xFF),
BLUEVIOLET = EGERGB(0x8A, 0x2B, 0xE2),
BROWN = EGERGB(0xA5, 0x2A, 0x2A),
BURLYWOOD = EGERGB(0xDE, 0xB8, 0x87),
CADETBLUE = EGERGB(0x5F, 0x9E, 0xA0),
CHARTREUSE = EGERGB(0x7F, 0xFF, 0x00),
CHOCOLATE = EGERGB(0xD2, 0x69, 0x1E),
CORAL = EGERGB(0xFF, 0x7F, 0x50),
CORNFLOWERBLUE = EGERGB(0x64, 0x95, 0xED),
CORNSILK = EGERGB(0xFF, 0xF8, 0xDC),
CRIMSON = EGERGB(0xDC, 0x14, 0x3C),
CYAN = EGERGB(0x00, 0xFF, 0xFF),
DARKBLUE = EGERGB(0x00, 0x00, 0x8B),
DARKCYAN = EGERGB(0x00, 0x8B, 0x8B),
DARKGOLDENROD = EGERGB(0xB8, 0x86, 0x0B),
DARKGRAY = EGERGB(0xA9, 0xA9, 0xA9),
DARKGREEN = EGERGB(0x00, 0x64, 0x00),
DARKKHAKI = EGERGB(0xBD, 0xB7, 0x6B),
DARKMAGENTA = EGERGB(0x8B, 0x00, 0x8B),
DARKOLIVEGREEN = EGERGB(0x55, 0x6B, 0x2F),
DARKORANGE = EGERGB(0xFF, 0x8C, 0x00),
DARKORCHID = EGERGB(0x99, 0x32, 0xCC),
DARKRED = EGERGB(0x8B, 0x00, 0x00),
DARKSALMON = EGERGB(0xE9, 0x96, 0x7A),
DARKSEAGREEN = EGERGB(0x8F, 0xBC, 0x8F),
DARKSLATEBLUE = EGERGB(0x48, 0x3D, 0x8B),
DARKSLATEGRAY = EGERGB(0x2F, 0x4F, 0x4F),
DARKTURQUOISE = EGERGB(0x00, 0xCE, 0xD1),
DARKVIOLET = EGERGB(0x94, 0x00, 0xD3),
DEEPPINK = EGERGB(0xFF, 0x14, 0x93),
DEEPSKYBLUE = EGERGB(0x00, 0xBF, 0xFF),
DIMGRAY = EGERGB(0x69, 0x69, 0x69),
DODGERBLUE = EGERGB(0x1E, 0x90, 0xFF),
FIREBRICK = EGERGB(0xB2, 0x22, 0x22),
FLORALWHITE = EGERGB(0xFF, 0xFA, 0xF0),
FORESTGREEN = EGERGB(0x22, 0x8B, 0x22),
FUCHSIA = EGERGB(0xFF, 0x00, 0xFF),
GAINSBORO = EGERGB(0xDC, 0xDC, 0xDC),
GHOSTWHITE = EGERGB(0xF8, 0xF8, 0xFF),
GOLD = EGERGB(0xFF, 0xD7, 0x00),
GOLDENROD = EGERGB(0xDA, 0xA5, 0x20),
GRAY = EGERGB(0x80, 0x80, 0x80),
GREEN = EGERGB(0x00, 0x80, 0x00),
GREENYELLOW = EGERGB(0xAD, 0xFF, 0x2F),
HONEYDEW = EGERGB(0xF0, 0xFF, 0xF0),
HOTPINK = EGERGB(0xFF, 0x69, 0xB4),
INDIANRED = EGERGB(0xCD, 0x5C, 0x5C),
INDIGO = EGERGB(0x4B, 0x00, 0x82),
IVORY = EGERGB(0xFF, 0xFF, 0xF0),
KHAKI = EGERGB(0xF0, 0xE6, 0x8C),
LAVENDER = EGERGB(0xE6, 0xE6, 0xFA),
LAVENDERBLUSH = EGERGB(0xFF, 0xF0, 0xF5),
LAWNGREEN = EGERGB(0x7C, 0xFC, 0x00),
LEMONCHIFFON = EGERGB(0xFF, 0xFA, 0xCD),
LIGHTBLUE = EGERGB(0xAD, 0xD8, 0xE6),
LIGHTCORAL = EGERGB(0xF0, 0x80, 0x80),
LIGHTCYAN = EGERGB(0xE0, 0xFF, 0xFF),
LIGHTGOLDENRODYELLOW = EGERGB(0xFA, 0xFA, 0xD2),
LIGHTGRAY = EGERGB(0xD3, 0xD3, 0xD3),
LIGHTGREEN = EGERGB(0x90, 0xEE, 0x90),
LIGHTPINK = EGERGB(0xFF, 0xB6, 0xC1),
LIGHTSALMON = EGERGB(0xFF, 0xA0, 0x7A),
LIGHTSEAGREEN = EGERGB(0x20, 0xB2, 0xAA),
LIGHTSKYBLUE = EGERGB(0x87, 0xCE, 0xFA),
LIGHTSLATEGRAY = EGERGB(0x77, 0x88, 0x99),
LIGHTSTEELBLUE = EGERGB(0xB0, 0xC4, 0xDE),
LIGHTYELLOW = EGERGB(0xFF, 0xFF, 0xE0),
LIGHTRED = EGERGB(0xFC, 0x54, 0x54),
LIGHTMAGENTA = EGERGB(0xFC, 0x54, 0xFC),
LIME = EGERGB(0x00, 0xFF, 0x00),
LIMEGREEN = EGERGB(0x32, 0xCD, 0x32),
LINEN = EGERGB(0xFA, 0xF0, 0xE6),
MAGENTA = EGERGB(0xFF, 0x00, 0xFF),
MAROON = EGERGB(0x80, 0x00, 0x00),
MEDIUMAQUAMARINE = EGERGB(0x66, 0xCD, 0xAA),
MEDIUMBLUE = EGERGB(0x00, 0x00, 0xCD),
MEDIUMORCHID = EGERGB(0xBA, 0x55, 0xD3),
MEDIUMPURPLE = EGERGB(0x93, 0x70, 0xDB),
MEDIUMSEAGREEN = EGERGB(0x3C, 0xB3, 0x71),
MEDIUMSLATEBLUE = EGERGB(0x7B, 0x68, 0xEE),
MEDIUMSPRINGGREEN = EGERGB(0x00, 0xFA, 0x9A),
MEDIUMTURQUOISE = EGERGB(0x48, 0xD1, 0xCC),
MEDIUMVIOLETRED = EGERGB(0xC7, 0x15, 0x85),
MIDNIGHTBLUE = EGERGB(0x19, 0x19, 0x70),
MINTCREAM = EGERGB(0xF5, 0xFF, 0xFA),
MISTYROSE = EGERGB(0xFF, 0xE4, 0xE1),
MOCCASIN = EGERGB(0xFF, 0xE4, 0xB5),
NAVAJOWHITE = EGERGB(0xFF, 0xDE, 0xAD),
NAVY = EGERGB(0x00, 0x00, 0x80),
OLDLACE = EGERGB(0xFD, 0xF5, 0xE6),
OLIVE = EGERGB(0x80, 0x80, 0x00),
OLIVEDRAB = EGERGB(0x6B, 0x8E, 0x23),
ORANGE = EGERGB(0xFF, 0xA5, 0x00),
ORANGERED = EGERGB(0xFF, 0x45, 0x00),
ORCHID = EGERGB(0xDA, 0x70, 0xD6),
PALEGOLDENROD = EGERGB(0xEE, 0xE8, 0xAA),
PALEGREEN = EGERGB(0x98, 0xFB, 0x98),
PALETURQUOISE = EGERGB(0xAF, 0xEE, 0xEE),
PALEVIOLETRED = EGERGB(0xDB, 0x70, 0x93),
PAPAYAWHIP = EGERGB(0xFF, 0xEF, 0xD5),
PEACHPUFF = EGERGB(0xFF, 0xDA, 0xB9),
PERU = EGERGB(0xCD, 0x85, 0x3F),
PINK = EGERGB(0xFF, 0xC0, 0xCB),
PLUM = EGERGB(0xDD, 0xA0, 0xDD),
POWDERBLUE = EGERGB(0xB0, 0xE0, 0xE6),
PURPLE = EGERGB(0x80, 0x00, 0x80),
RED = EGERGB(0xFF, 0x00, 0x00),
ROSYBROWN = EGERGB(0xBC, 0x8F, 0x8F),
ROYALBLUE = EGERGB(0x41, 0x69, 0xE1),
SADDLEBROWN = EGERGB(0x8B, 0x45, 0x13),
SALMON = EGERGB(0xFA, 0x80, 0x72),
SANDYBROWN = EGERGB(0xF4, 0xA4, 0x60),
SEAGREEN = EGERGB(0x2E, 0x8B, 0x57),
SEASHELL = EGERGB(0xFF, 0xF5, 0xEE),
SIENNA = EGERGB(0xA0, 0x52, 0x2D),
SILVER = EGERGB(0xC0, 0xC0, 0xC0),
SKYBLUE = EGERGB(0x87, 0xCE, 0xEB),
SLATEBLUE = EGERGB(0x6A, 0x5A, 0xCD),
SLATEGRAY = EGERGB(0x70, 0x80, 0x90),
SNOW = EGERGB(0xFF, 0xFA, 0xFA),
SPRINGGREEN = EGERGB(0x00, 0xFF, 0x7F),
STEELBLUE = EGERGB(0x46, 0x82, 0xB4),
TAN = EGERGB(0xD2, 0xB4, 0x8C),
TEAL = EGERGB(0x00, 0x80, 0x80),
THISTLE = EGERGB(0xD8, 0xBF, 0xD8),
TOMATO = EGERGB(0xFF, 0x63, 0x47),
TURQUOISE = EGERGB(0x40, 0xE0, 0xD0),
VIOLET = EGERGB(0xEE, 0x82, 0xEE),
WHEAT = EGERGB(0xF5, 0xDE, 0xB3),
WHITE = EGERGB(0xFF, 0xFF, 0xFF),
WHITESMOKE = EGERGB(0xF5, 0xF5, 0xF5),
YELLOW = EGERGB(0xFF, 0xFF, 0x00),
YELLOWGREEN = EGERGB(0x9A, 0xCD, 0x32)
};
/**
* @enum line_styles
* @brief Line styles
*
* Defines different styles that can be used when drawing lines
*/
enum line_styles
{
SOLID_LINE = PS_SOLID, ///< Solid line
CENTER_LINE = PS_DASH, ///< Center line (dashed line)
DOTTED_LINE = PS_DOT, ///< Dotted line
DASHED_LINE = PS_DASHDOT, ///< Dash-dot line
NULL_LINE = PS_NULL, ///< Null line (no drawing)
USERBIT_LINE = PS_USERSTYLE ///< User-defined line style
};
/**
* @struct line_style_type
* @brief Line style structure
*
* Describes detailed style attributes of lines
*/
struct line_style_type
{
int linestyle; ///< Line style
unsigned short upattern; ///< User-defined line pattern
int thickness; ///< Line thickness
};
/**
* @enum line_cap_type
* @brief Line cap styles
*
* Defines the drawing styles for line endpoints
*/
enum line_cap_type
{
LINECAP_FLAT = 0, ///< Flat cap
LINECAP_SQUARE, ///< Square cap
LINECAP_ROUND ///< Round cap
};
/**
* @enum line_join_type
* @brief Line join styles
*
* Defines the drawing styles for line connection points
*/
enum line_join_type
{
LINEJOIN_MITER = 0, ///< Miter join
LINEJOIN_BEVEL, ///< Bevel join
LINEJOIN_ROUND ///< Round join
};
/**
* @enum fill_patterns
* @brief Fill patterns
*
* Defines different pattern styles that can be used when filling geometric shapes
*/
enum fill_patterns
{
EMPTY_FILL, ///< No fill
SOLID_FILL, ///< Solid fill (fill with fill color)
LINE_FILL, ///< Horizontal line fill ---
LTSLASH_FILL, ///< Light slash fill "///"
SLASH_FILL, ///< Heavy slash fill "///"
BKSLASH_FILL, ///< Heavy backslash fill "\\\"
LTBKSLASH_FILL, ///< Light backslash fill "\\\"
HATCH_FILL, ///< Light grid fill
XHATCH_FILL, ///< Heavy cross grid fill
INTERLEAVE_FILL, ///< Interleaved line fill
WIDE_DOT_FILL, ///< Sparse dot fill
CLOSE_DOT_FILL, ///< Dense dot fill
USER_FILL ///< User-defined fill
};
/**
* @enum fill_mode
* @brief Fill modes
*
* Defines filling algorithms for complex graphics
*/
enum fill_mode
{
FILLMODE_DEFAULT = 0, ///< Default fill mode
FILLMODE_ALTERNATE = 1, ///< Alternate fill mode
FILLMODE_WINDING = 2 ///< Winding fill mode
};
/**
* @enum text_just
* @brief Text alignment methods
*
* Defines horizontal and vertical alignment methods for text
*/
enum text_just
{
LEFT_TEXT = 0, ///< Left align
CENTER_TEXT = 1, ///< Center align
RIGHT_TEXT = 2, ///< Right align
TOP_TEXT = 0, ///< Top align
/* CENTER_TEXT = 1, Already defined above */
BOTTOM_TEXT = 2 ///< Bottom align
};
/**
* @struct textsettingstype
* @brief Text settings structure
*
* Contains text settings such as font, direction, size and alignment
*/
struct textsettingstype
{
int font; ///< Font type
int direction; ///< Text direction
int charsize; ///< Character size
int horiz; ///< Horizontal alignment
int vert; ///< Vertical alignment
};
/**
* @enum font_styles
* @brief Font styles
*
* Defines various font styles, can be combined using bitwise OR operations
*/
enum font_styles
{
FONTSTYLE_BOLD = 1, ///< Bold
FONTSTYLE_ITALIC = 2, ///< Italic
FONTSTYLE_UNDERLINE = 4, ///< Underline
FONTSTYLE_STRIKEOUT = 8 ///< Strikeout
};
/**
* @enum music_state_flag
* @brief Music playback state flags
*
* Defines various states of the music player
*/
enum music_state_flag
{
MUSIC_MODE_NOT_OPEN = 0x0, ///< Not opened state
MUSIC_MODE_NOT_READY = 0x20C, ///< Not ready state
MUSIC_MODE_PAUSE = 0x211, ///< Paused state
MUSIC_MODE_PLAY = 0x20E, ///< Playing state
MUSIC_MODE_STOP = 0x20D, ///< Stopped state
MUSIC_MODE_OPEN = 0x212, ///< Opened state
MUSIC_MODE_SEEK = 0x210 ///< Seeking state
};
/// @brief Music operation error code
#define MUSIC_ERROR 0xFFFFFFFF
/**
* @enum key_msg_flag
* @brief Key message flags
*
* Defines types and state flags for key messages
*/
enum key_msg_flag
{
KEYMSG_CHAR_FLAG = 2, ///< Character message flag
KEYMSG_DOWN_FLAG = 1, ///< Key down message flag
KEYMSG_UP_FLAG = 1, ///< Key up message flag
KEYMSG_CHAR = 0x40000, ///< Character message
KEYMSG_DOWN = 0x10000, ///< Key down message
KEYMSG_UP = 0x20000, ///< Key up message
KEYMSG_FIRSTDOWN = 0x80000 ///< First key down message
};
/**
* @enum key_code_e
* @brief Keyboard and mouse key codes
*
* Defines key code values for all detectable keyboard keys and mouse buttons
* Key code values are based on Windows Virtual Key Codes
*/
enum key_code_e
{
// Mouse buttons
key_mouse_l = 0x01, ///< Left mouse button
key_mouse_r = 0x02, ///< Right mouse button
key_mouse_m = 0x04, ///< Middle mouse button
key_mouse_x1 = 0x05, ///< Mouse X1 button
key_mouse_x2 = 0x06, ///< Mouse X2 button
// Special function keys
key_back = 0x08, ///< Backspace key
key_tab = 0x09, ///< Tab key
key_enter = 0x0d, ///< Enter key
key_shift = 0x10, ///< Shift key
key_control = 0x11, ///< Ctrl key
key_menu = 0x12, ///< Alt key
key_pause = 0x13, ///< Pause key
key_capslock = 0x14, ///< Caps Lock key
key_esc = 0x1b, ///< Escape key
key_space = 0x20, ///< Space key
// Navigation keys
key_pageup = 0x21, ///< Page Up key
key_pagedown = 0x22, ///< Page Down key
key_end = 0x23, ///< End key
key_home = 0x24, ///< Home key
// Arrow keys
key_left = 0x25, ///< Left arrow key
key_up = 0x26, ///< Up arrow key
key_right = 0x27, ///< Right arrow key
key_down = 0x28, ///< Down arrow key
// Editing keys
key_print = 0x2a, ///< Print key
key_snapshot = 0x2c, ///< Print Screen key
key_insert = 0x2d, ///< Insert key
key_delete = 0x2e, ///< Delete key
// Number keys (main keyboard)
key_0 = 0x30, ///< Number key 0
key_1 = 0x31, ///< Number key 1
key_2 = 0x32, ///< Number key 2
key_3 = 0x33, ///< Number key 3
key_4 = 0x34, ///< Number key 4
key_5 = 0x35, ///< Number key 5
key_6 = 0x36, ///< Number key 6
key_7 = 0x37, ///< Number key 7
key_8 = 0x38, ///< Number key 8
key_9 = 0x39, ///< Number key 9
// Letter keys
key_A = 0x41, ///< Letter key A
key_B = 0x42, ///< Letter key B
key_C = 0x43, ///< Letter key C
key_D = 0x44, ///< Letter key D
key_E = 0x45, ///< Letter key E
key_F = 0x46, ///< Letter key F
key_G = 0x47, ///< Letter key G
key_H = 0x48, ///< Letter key H
key_I = 0x49, ///< Letter key I
key_J = 0x4a, ///< Letter key J
key_K = 0x4b, ///< Letter key K
key_L = 0x4c, ///< Letter key L
key_M = 0x4d, ///< Letter key M
key_N = 0x4e, ///< Letter key N
key_O = 0x4f, ///< Letter key O
key_P = 0x50, ///< Letter key P
key_Q = 0x51, ///< Letter key Q
key_R = 0x52, ///< Letter key R
key_S = 0x53, ///< Letter key S
key_T = 0x54, ///< Letter key T
key_U = 0x55, ///< Letter key U
key_V = 0x56, ///< Letter key V
key_W = 0x57, ///< Letter key W
key_X = 0x58, ///< Letter key X
key_Y = 0x59, ///< Letter key Y
key_Z = 0x5a, ///< Letter key Z
// Windows keys
key_win_l = 0x5b, ///< Left Windows key
key_win_r = 0x5c, ///< Right Windows key
key_sleep = 0x5f, ///< Sleep key
// Numeric keypad
key_num0 = 0x60, ///< Numeric keypad 0
key_num1 = 0x61, ///< Numeric keypad 1
key_num2 = 0x62, ///< Numeric keypad 2
key_num3 = 0x63, ///< Numeric keypad 3
key_num4 = 0x64, ///< Numeric keypad 4
key_num5 = 0x65, ///< Numeric keypad 5
key_num6 = 0x66, ///< Numeric keypad 6
key_num7 = 0x67, ///< Numeric keypad 7
key_num8 = 0x68, ///< Numeric keypad 8
key_num9 = 0x69, ///< Numeric keypad 9
// Numeric keypad operators
key_multiply = 0x6a, ///< Numeric keypad multiply (*)
key_add = 0x6b, ///< Numeric keypad add (+)
key_separator = 0x6c, ///< Numeric keypad separator
key_subtract = 0x6d, ///< Numeric keypad subtract (-)
key_decimal = 0x6e, ///< Numeric keypad decimal point (.)
key_divide = 0x6f, ///< Numeric keypad divide (/)
// Function keys
key_f1 = 0x70, ///< F1 function key
key_f2 = 0x71, ///< F2 function key
key_f3 = 0x72, ///< F3 function key
key_f4 = 0x73, ///< F4 function key
key_f5 = 0x74, ///< F5 function key
key_f6 = 0x75, ///< F6 function key
key_f7 = 0x76, ///< F7 function key
key_f8 = 0x77, ///< F8 function key
key_f9 = 0x78, ///< F9 function key
key_f10 = 0x79, ///< F10 function key
key_f11 = 0x7a, ///< F11 function key
key_f12 = 0x7b, ///< F12 function key
// Lock keys
key_numlock = 0x90, ///< Num Lock key
key_scrolllock = 0x91, ///< Scroll Lock key
// Left/right distinguished modifier keys
key_shift_l = 0xa0, ///< Left Shift key
key_shift_r = 0xa1, ///< Right Shift key
key_control_l = 0xa2, ///< Left Ctrl key
key_control_r = 0xa3, ///< Right Ctrl key
key_menu_l = 0xa4, ///< Left Alt key
key_menu_r = 0xa5, ///< Right Alt key
// Punctuation keys
key_semicolon = 0xba, ///< Semicolon key (;)
key_plus = 0xbb, ///< Equals/plus key (=)
key_comma = 0xbc, ///< Comma key (,)
key_minus = 0xbd, ///< Minus/underscore key (-)
key_period = 0xbe, ///< Period key (.)
key_slash = 0xbf, ///< Slash key (/)
key_tilde = 0xc0, ///< Tilde key (~)
key_lbrace = 0xdb, ///< Left bracket key ([)
key_backslash = 0xdc, ///< Backslash key (\)
key_rbrace = 0xdd, ///< Right bracket key (])
key_quote = 0xde, ///< Quote key (')
key_ime_process = 0xe5 ///< IME process key
};
/**
* @enum key_msg_e
* @brief Key message types
*
* Defines specific types of key events
*/
enum key_msg_e
{
key_msg_down = 1, ///< Key press message
key_msg_up = 2, ///< Key release message
key_msg_char = 4 ///< Character input message
};
/**
* @enum key_flag_e
* @brief Key state flags
*
* Defines modifier key states and special flags for key events
*/
enum key_flag_e
{
key_flag_shift = 0x100, ///< Shift key is pressed
key_flag_ctrl = 0x200, ///< Ctrl key is pressed
key_flag_first_down = 0x80000 ///< First press flag
};
/**
* @struct key_msg
* @brief Key message structure
*
* Contains complete key event information
*/
struct key_msg
{
int key; ///< Key code
key_msg_e msg; ///< Message type
unsigned int flags; ///< State flags
};
/**
* @enum mouse_msg_e
* @brief Mouse message types
*
* Defines specific types of mouse events
*/
enum mouse_msg_e
{
mouse_msg_down = 0x10, ///< Mouse button press message
mouse_msg_up = 0x20, ///< Mouse button release message
mouse_msg_move = 0x40, ///< Mouse move message
mouse_msg_wheel = 0x80 ///< Mouse wheel message
};
/**
* @enum mouse_flag_e
* @brief Mouse state flags
*
* Defines the states of various mouse buttons and modifier keys in mouse events
*/
enum mouse_flag_e
{
mouse_flag_left = 0x0001, ///< Left mouse button is pressed
mouse_flag_right = 0x0002, ///< Right mouse button is pressed
mouse_flag_mid = 0x0004, ///< Middle mouse button is pressed
mouse_flag_x1 = 0x0008, ///< Mouse X1 button is pressed
mouse_flag_x2 = 0x0010, ///< Mouse X2 button is pressed
mouse_flag_shift = 0x0100, ///< Shift key is pressed
mouse_flag_ctrl = 0x0200, ///< Ctrl key is pressed
mouse_flag_doubleclick = 0x1000 ///< Double click.
};
/**
* @struct mouse_msg
* @brief Mouse message structure
*
* Contains complete mouse event information with convenient state query methods
*/
struct mouse_msg
{
int x; ///< Mouse x coordinate
int y; ///< Mouse y coordinate
mouse_msg_e msg; ///< Message type
unsigned int flags; ///< State flags
int wheel; ///< Wheel scroll delta
/// @brief Check if it's a left mouse button event
bool is_left() const {return (flags & mouse_flag_left) != 0;}
/// @brief Check if it's a right mouse button event
bool is_right() const {return (flags & mouse_flag_right) != 0;}
/// @brief Check if it's a middle mouse button event
bool is_mid() const {return (flags & mouse_flag_mid) != 0;}
/// @brief Check if it's a mouse X1 button event
bool is_x1() const {return (flags & mouse_flag_x1) != 0;}
/// @brief Check if it's a mouse X2 button event
bool is_x2() const {return (flags & mouse_flag_x2) != 0;}
/// @brief Check if it's a button press event
bool is_down() const {return msg == mouse_msg_down; }
/// @brief Check if it's a button release event
bool is_up() const {return msg == mouse_msg_up; }
/// @brief Check if it's a mouse move event
bool is_move() const {return msg == mouse_msg_move; }
/// @brief Check if it's a wheel event
bool is_wheel() const {return msg == mouse_msg_wheel;}
/// @brief Check if it's a double-click event
bool is_doubleclick() const {return (flags & mouse_flag_doubleclick) != 0;}
};
/**
* @struct MOUSEMSG
* @brief Legacy mouse message structure (compatibility)
*
* Provides mouse message format compatible with older versions
*/
struct MOUSEMSG
{
UINT uMsg; ///< Windows message ID
bool mkCtrl; ///< Ctrl key state
bool mkShift; ///< Shift key state
bool mkLButton; ///< Left button state
bool mkMButton; ///< Middle button state
bool mkRButton; ///< Right button state
bool mkXButton1; ///< X1 button state
bool mkXButton2; ///< X2 button state
short x; ///< x coordinate
short y; ///< y coordinate
short wheel; ///< Wheel delta
};
/**
* @struct viewporttype
* @brief Viewport type structure
*
* Defines the boundary rectangle of the drawing viewport
*/
/**
* @struct viewporttype
* @brief Viewport type structure
*
* Defines the boundary rectangle of the drawing viewport
*/
struct viewporttype
{
int left; ///< Left boundary
int top; ///< Top boundary
int right; ///< Right boundary
int bottom; ///< Bottom boundary
int clipflag; ///< Clipping flag
};
/**
* @struct ege_transform_matrix
* @brief 2D transformation matrix
*
* 3x2 matrix for 2D graphics transformations, supports translation, rotation, scaling, etc.
*/
struct ege_transform_matrix
{
float m11, m12; ///< First row: [m11, m12]
float m21, m22; ///< Second row: [m21, m22]