forked from libcg/gLib2D
-
Notifications
You must be signed in to change notification settings - Fork 0
/
glib2d.h
817 lines (742 loc) · 21.8 KB
/
glib2d.h
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
/** \mainpage gLib2D Documentation
*
* \section intro Introduction
*
* gLib2D by Geecko - A simple, fast, light-weight 2D graphics library. \n\n
* This library has been designed to replace the old graphics.c library
* and to simplify the use of pspgu.\n
* The goals : keep it simple, keep it small, keep it fast.
*
* \section limits Known limitations
*
* - Draw & display buffers can't actually be used as real textures. Just a way
* to get the vram pointer.
* - No support for multiples contexts (e.g. sharing coordinates beetween
* textures using some gBegin calls at a time).
* - Manipulating textures (clear, get pixel info...) is not possible.
* - When some 512*512 rotated, colorized and scaled textures are rendered
* at a time, the framerate *could* go under 60 fps.
*
* \section install Installation
*
* - Simply put glib2d.c and glib2d.h in your source directory. \n
* - Then add glib2d.o and link "-lpng -ljpeg -lz -lpspgu -lm -lpspvram"
* in your Makefile.
* - You're done !
*
* \section copyright License
*
* This work is licensed under the LGPLv3 License. \n
* See the LICENSE file for more details. \n
* You can support the library by marking your homebrew with
* "Using gLib2D by Geecko".
*
* \section contact Contact
*
* Please report bugs or submit ideas at : \n [email protected] \n\n
* Get the full documentation on : \n http://geecko.dev.free.fr \n\n
* Also stay tuned on... \n
* https://github.com/GeeckoDev (contributors would be a plus!) \n
* http://twitter.com/GeeckoDev
*/
/**
* \file glib2d.h
* \brief gLib2D Header
* \version Beta 5
*/
#ifndef GLIB2D_H
#define GLIB2D_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h>
/**
* \def USE_PNG
* \brief Choose if the PNG support is enabled.
*
* Otherwise, this part will be not compiled to gain some space.
* Enable this to get PNG support, disable to avoid compilation errors
* when libpng is not linked in the Makefile.
*/
/**
* \def USE_JPEG
* \brief Choose if the JPEG support is enabled.
*
* Otherwise, this part will be not compiled to gain some space.
* Enable this to get JPEG support, disable to avoid compilation errors
* when libjpeg is not linked in the Makefile.
*/
/**
* \def USE_VFPU
* \brief Choose if the VFPU support is enabled.
*
* Otherwise, this part will be not compiled to use the standard math library.
* Enable this to greatly improve performance with 2d rotations. You SHOULD use
* PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU) to avoid crashes.
*/
#define USE_PNG
#define USE_JPEG
//#define USE_VFPU
/**
* \def G2D_SCR_W
* \brief Screen width constant, in pixels.
*/
/**
* \def G2D_SCR_H
* \brief Screen height constant, in pixels.
*/
/**
* \def G2D_VOID
* \brief Generic constant, equals to 0 (do nothing).
*/
#define G2D_SCR_W (480)
#define G2D_SCR_H (272)
#define G2D_VOID (0)
/**
* \def G2D_RGBA(r,g,b,a)
* \brief Create a g2dColor.
*
* This macro creates a g2dColor from 4 values, red, green, blue and alpha.
* Input range is from 0 to 255.
*/
#define G2D_RGBA(r, g, b, a) ((r)|((g)<<8)|((b)<<16)|((a)<<24))
/**
* \def G2D_GET_R(color)
* \brief Get red channel value from a g2dColor.
*/
/**
* \def G2D_GET_G(color)
* \brief Get green channel value from a g2dColor.
*/
/**
* \def G2D_GET_B(color)
* \brief Get blue channel value from a g2dColor.
*/
/**
* \def G2D_GET_A(color)
* \brief Get alpha channel value from a g2dColor.
*/
#define G2D_GET_R(color) (((color) ) & 0xFF)
#define G2D_GET_G(color) (((color) >> 8) & 0xFF)
#define G2D_GET_B(color) (((color) >> 16) & 0xFF)
#define G2D_GET_A(color) (((color) >> 24) & 0xFF)
/**
* \def G2D_MODULATE(color,luminance,alpha)
* \brief g2dColor modulation.
*
* This macro modulates the luminance & alpha of a g2dColor.
* Input range is from 0 to 255.
*/
#define G2D_MODULATE(color,luminance,alpha) \
G2D_RGBA((int)(luminance) * G2D_GET_R(color) / 255, \
(int)(luminance) * G2D_GET_G(color) / 255, \
(int)(luminance) * G2D_GET_B(color) / 255, \
(int)(alpha ) * G2D_GET_A(color) / 255)
/**
* \enum g2dColors
* \brief Colors enumeration.
*
* Primary, secondary, tertiary and grayscale colors are defined.
*/
enum g2dColors
{
// Primary colors
RED = 0xFF0000FF,
GREEN = 0xFF00FF00,
BLUE = 0xFFFF0000,
// Secondary colors
CYAN = 0xFFFFFF00,
MAGENTA = 0xFFFF00FF,
YELLOW = 0xFF00FFFF,
// Tertiary colors
AZURE = 0xFFFF7F00,
VIOLET = 0xFFFF007F,
ROSE = 0xFF7F00FF,
ORANGE = 0xFF007FFF,
CHARTREUSE = 0xFF00FF7F,
SPRING_GREEN = 0xFF7FFF00,
// Grayscale
WHITE = 0xFFFFFFFF,
LITEGRAY = 0xFFBFBFBF,
GRAY = 0xFF7F7F7F,
DARKGRAY = 0xFF3F3F3F,
BLACK = 0xFF000000
};
/**
* \enum g2dCoord_Mode
* \brief Coordinates modes enumeration.
*
* Choose where the coordinates correspond in the object.
* Can only be used with g2dSetCoordMode.
*/
/**
* \enum g2dLine_Mode
* \brief Line modes enumeration.
*
* Change line draw properties.
* Can only be used with g2dBeginLines.
*/
/**
* \enum g2dFlip_Mode
* \brief Flip modes enumeration.
*
* Change flip properties.
* Can only be used with g2dFlip.
*/
/**
* \enum g2dTex_Mode
* \brief Texture modes enumeration.
*
* Change texture properties.
* Can only be used with g2dTexLoad.
*/
typedef enum
{
G2D_UP_LEFT,
G2D_UP_RIGHT,
G2D_DOWN_RIGHT,
G2D_DOWN_LEFT,
G2D_CENTER
} g2dCoord_Mode;
typedef enum
{
G2D_STRIP = 1 /**< Make a line strip. */
} g2dLine_Mode;
typedef enum
{
G2D_VSYNC = 1 /**< Limit the FPS to 60 (synchronized with the screen).
Better quality and less power consumption. */
} g2dFlip_Mode;
typedef enum
{
G2D_SWIZZLE = 1 /**< Recommended. Use it to speedup rendering. */
} g2dTex_Mode;
/**
* \var g2dAlpha
* \brief Alpha type.
*/
/**
* \var g2dColor
* \brief Color type.
*/
typedef int g2dAlpha;
typedef unsigned int g2dColor;
/**
* \struct g2dTexture
* \brief Texture structure.
*/
typedef struct
{
int tw; /**< Real texture width. A power of two. */
int th; /**< Real texture height. A power of two. */
int w; /**< Texture width, as seen when drawing. */
int h; /**< Texture height, as seen when drawing. */
float ratio; /**< Width/height ratio. */
bool swizzled; /**< Is the texture swizzled ? */
g2dColor *data; /**< Pointer to raw data. */
} g2dTexture;
/**
* \var g2d_draw_buffer
* \brief The current draw buffer as a texture.
*/
/**
* \var g2d_disp_buffer
* \brief The current display buffer as a texture.
*/
extern g2dTexture g2d_draw_buffer;
extern g2dTexture g2d_disp_buffer;
/**
* \brief Initializes the library.
*
* This function will create a GU context and setup the display buffers.
* Automatically called by the other functions.
*/
void g2dInit();
/**
* \brief Shutdowns the library.
*
* This function will destroy the GU context.
*/
void g2dTerm();
/**
* \brief Clears screen & depth buffer.
* @param color Screen clear color
*
* This function clears the screen, and clears the zbuffer if depth coordinate
* is used in the loop. Will automatically init the GU if needed.
*/
void g2dClear(g2dColor color);
/**
* \brief Clears depth buffer.
*
* This function clears the zbuffer to zero (z range 0-65535).
* Will automatically init the GU if needed.
*/
void g2dClearZ();
/**
* \brief Begins rectangles rendering.
* @param tex Pointer to a texture, pass NULL to get a colored rectangle.
*
* This function begins object rendering. Resets all properties.
* One g2dAdd() call per object.
* Only one texture can be used, but multiple objects can be rendered at a time.
* g2dBegin*() / g2dEnd() couple can be called multiple times in the loop,
* to render multiple textures.
*/
void g2dBeginRects(g2dTexture *tex);
/**
* \brief Begins lines rendering.
* @param line_mode A g2dLine_Mode constant.
*
* This function begins object rendering. Calls g2dReset().
* Two g2dAdd() calls per object.
* Pass G2D_LINE_STRIP to make a line strip (two calls, then one per object).
*/
void g2dBeginLines(g2dLine_Mode mode);
/**
* \brief Begins quads rendering.
* @param tex Pointer to a texture, pass NULL to get a colored quad.
*
* This function begins object rendering. Resets all properties.
* Four g2dAdd() calls per object, first for the up left corner, then clockwise.
* Only one texture can be used, but multiple objects can be rendered at a time.
* g2dBegin*() / g2dEnd() couple can be called multiple times in the loop,
* to render multiple textures.
*/
void g2dBeginQuads(g2dTexture *tex);
/**
* \brief Begins points rendering.
*
* This function begins object rendering. Resets all properties.
* One g2dAdd() call per object.
*/
void g2dBeginPoints();
/**
* \brief Ends object rendering.
*
* This function ends object rendering. Must be called after g2dBegin*() to add
* objects to the display list. Automatically adapts pspgu functionnalities
* to get the best performance possible.
*/
void g2dEnd();
/**
* \brief Resets current transformation and attribution.
*
* This function must be called during object rendering.
* Calls g2dResetCoord(), g2dResetRotation(), g2dResetScale(),
* g2dResetColor(), g2dResetAlpha(), g2dResetCrop() and g2dResetTex().
*/
void g2dReset();
/**
* \brief Flips the screen.
* @param flip_mode A g2dFlip_Mode constant.
*
* This function must be called at the end of the loop.
* Renders the whole display list to the draw buffer.
* Inverts framebuffers to display the whole thing.
*/
void g2dFlip(g2dFlip_Mode mode);
/**
* \brief Pushes the current transformation & attribution to a new object.
*
* This function must be called during object rendering.
*/
void g2dAdd();
/**
* \brief Saves the current transformation to stack.
*
* This function must be called during object rendering.
* The stack is 64 saves high.
* Use it like the OpenGL one.
*/
void g2dPush();
/**
* \brief Restore the current transformation from stack.
*
* This function must be called during object rendering.
* The stack is 64 saves high.
* Use it like the OpenGL one.
*/
void g2dPop();
/**
* \brief Creates a new blank texture.
* @param w Width of the texture.
* @param h Height of the texture.
*
* This function returns NULL on allocation fail.
*/
g2dTexture* g2dTexCreate(int w, int h);
/**
* \brief Frees a texture & set its pointer to NULL.
* @param tex Pointer to the variable which contains the texture pointer.
*
* This function is used to gain memory when a texture is useless.
* Must pass the pointer to the variable which contains the pointer,
* to set it to NULL (passing NULL to a g2dBegin* function is safe).
*/
void g2dTexFree(g2dTexture **tex);
/**
* \brief Loads an image.
* @param path Path to the file.
* @param tex_mode A g2dTex_Mode constant.
* @returns Pointer to the generated texture.
*
* This function loads an image file. There is support for PNG & JPEG files
* (if USE_PNG and USE_JPEG are defined). Swizzling is enabled only for 16*16+
* textures (useless on small textures), pass G2D_SWIZZLE to enable it.
* Texture supported up to 512*512 in size only (hardware limitation).
*/
g2dTexture* g2dTexLoad(char path[], g2dTex_Mode mode);
/**
* \brief Resets the current coordinates.
*
* This function must be called during object rendering.
* Sets g2dSetCoordMode() to G2D_UP_LEFT and g2dSetCoordXYZ() to (0,0,0).
*/
void g2dResetCoord();
/**
* \brief Set coordinate mode.
* @param coord_mode A gCoord_Mode.
*
* This function must be called during object rendering.
* Defines where the coordinates correspond in the object.
*/
void g2dSetCoordMode(g2dCoord_Mode mode);
/**
* \brief Gets the current position.
* @param x Pointer to save the current x (in pixels).
* @param y Pointer to save the current y (in pixels).
* @param z Pointer to save the current z (in pixels).
*
* This function must be called during object rendering.
* Parameters are pointers to float, not int !
* Pass NULL if not needed.
*/
void g2dGetCoordXYZ(float *x, float *y, float *z);
/**
* \brief Sets the new position.
* @param x New x, in pixels.
* @param y New y, in pixels.
*
* This function must be called during object rendering.
*/
void g2dSetCoordXY(float x, float y);
/**
* \brief Sets the new position, with depth support.
* @param x New x, in pixels.
* @param y New y, in pixels.
* @param z New z, in pixels. (front 0-65535 back)
*
* This function must be called during object rendering.
*/
void g2dSetCoordXYZ(float x, float y, float z);
/**
* \brief Sets the new position, relative to the current.
* @param x New x increment, in pixels.
* @param y New y increment, in pixels.
*
* This function must be called during object rendering.
*/
void g2dSetCoordXYRelative(float x, float y);
/**
* \brief Sets the new position, with depth support, relative to the current.
* @param x New x increment, in pixels.
* @param y New y increment, in pixels.
* @param z New z increment, in pixels.
*
* This function must be called during object rendering.
*/
void g2dSetCoordXYZRelative(float x, float y, float z);
/**
* \brief Use integer coordinates.
* @param use false to desactivate (better look, by default),
true to activate (can be useful when you have glitches).
*
* This function must be called during object rendering.
*/
void g2dSetCoordInteger(bool use);
/**
* \brief Resets the global scale.
*
* This function resets the global scale to 1.f.
* Translations and scales are multiplied by this factor.
*/
void g2dResetGlobalScale();
/**
* \brief Resets the current scale.
*
* This function must be called during object rendering.
* Sets the scale to the current texture size or (10,10).
*/
void g2dResetScale();
/**
* \brief Gets the global scale.
* @param scale Pointer to save the global scale (factor).
*
* Pass NULL if not needed.
*/
void g2dGetGlobalScale(float *scale);
/**
* \brief Gets the current scale.
* @param w Pointer to save the current width (in pixels).
* @param h Pointer to save the current height (in pixels).
*
* This function must be called during object rendering.
* Parameters are pointers to float, not int !
* Pass NULL if not needed.
*/
void g2dGetScaleWH(float *w, float *h);
/**
* \brief Sets the global scale.
*
* Translations and scales are multiplied by this factor.
*/
void g2dSetGlobalScale(float scale);
/**
* \brief Sets the new scale.
* @param w Width scale factor.
* @param h Height scale factor.
*
* This function must be called during object rendering.
* g2dResetScale() is called, then width & height scale are
* multiplied by these values.
* Negative values can be passed to invert the texture.
*/
void g2dSetScale(float w, float h);
/**
* \brief Sets the new scale, in pixels.
* @param w New width, in pixels.
* @param h New height, in pixels.
*
* This function must be called during object rendering.
* Negative values can be passed to invert the texture.
*/
void g2dSetScaleWH(float w, float h);
/**
* \brief Sets the new scale, relative to the current.
* @param w Width scale factor.
* @param h Height scale factor.
*
* This function must be called during object rendering.
* Current width & height scale are multiplied by these values.
* Negative values can be passed to invert the texture.
*/
void g2dSetScaleRelative(float w, float h);
/**
* \brief Sets the new scale, in pixels, relative to the current.
* @param w New width to increment, in pixels.
* @param h New height to increment, in pixels.
*
* This function must be called during object rendering.
* Negative values can be passed to invert the texture.
*/
void g2dSetScaleWHRelative(float w, float h);
/**
* \brief Resets the current color.
*
* This function must be called during object rendering.
* Sets g2dSetColor() to WHITE.
*/
void g2dResetColor();
/**
* \brief Resets the current alpha.
*
* This function must be called during object rendering.
* Sets g2dSetAlpha() to 255.
*/
void g2dResetAlpha();
/**
* \brief Gets the current alpha.
* @param alpha Pointer to save the current alpha (0-255).
*
* This function must be called during object rendering.
* Pass NULL if not needed.
*/
void g2dGetAlpha(g2dAlpha *alpha);
/**
* \brief Sets the new color.
* @param color The new color.
*
* This function must be called during object rendering.
* Can be used to colorize any object.
*/
void g2dSetColor(g2dColor color);
/**
* \brief Sets the new alpha.
* @param alpha The new alpha (0-255).
*
* This function must be called during object rendering.
* Can be used to make any object transparent.
*/
void g2dSetAlpha(g2dAlpha alpha);
/**
* \brief Sets the new alpha, relative to the current alpha.
* @param alpha The new alpha increment.
*
* This function must be called during object rendering.
* Can be used to make any object transparent.
*/
void g2dSetAlphaRelative(int alpha);
/**
* \brief Resets the current rotation.
*
* This function must be called during object rendering.
* Sets g2dSetRotation() to 0°.
*/
void g2dResetRotation();
/**
* \brief Gets the current rotation, in radians.
* @param radians Pointer to save the current rotation.
*
* This function must be called during object rendering.
* Pass NULL if not needed.
*/
void g2dGetRotationRad(float *radians);
/**
* \brief Gets the current rotation, in degrees.
* @param degrees Pointer to save the current rotation.
*
* This function must be called during object rendering.
* Pass NULL if not needed.
*/
void g2dGetRotation(float *degrees);
/**
* \brief Sets the new rotation, in radians.
* @param radians The new angle.
*
* This function must be called during object rendering.
* The rotation center is the actual coordinates.
*/
void g2dSetRotationRad(float radians);
/**
* \brief Sets the new rotation, in degrees.
* @param degrees The new angle.
*
* This function must be called during object rendering.
* The rotation center is the actual coordinates.
*/
void g2dSetRotation(float degrees);
/**
* \brief Sets the new rotation, relative to the current, in radians.
* @param radians The new angle increment.
*
* This function must be called during object rendering.
* The rotation center is the actual coordinates.
*/
void g2dSetRotationRadRelative(float radians);
/**
* \brief Sets the new rotation, relative to the current, in degrees.
* @param degrees The new angle increment.
*
* This function must be called during object rendering.
* The rotation center is the actual coordinates.
*/
void g2dSetRotationRelative(float degrees);
/**
* \brief Resets the current crop.
*
* This function must be called during object rendering.
* Sets g2dSetCropXY() to (0;0) and g2dSetCropWH() to (tex->w,tex->h).
*/
void g2dResetCrop();
/**
* \brief Gets the current crop position.
* @param x Pointer to save the current crop x.
* @param y Pointer to save the current crop y.
*
* This function must be called during object rendering.
* Pass NULL if not needed.
*/
void g2dGetCropXY(int *x, int *y);
/**
* \brief Gets the current crop scale.
* @param w Pointer to save the current crop width.
* @param h Pointer to save the current crop height.
*
* This function must be called during object rendering.
* Pass NULL if not needed.
*/
void g2dGetCropWH(int *w, int *h);
/**
* \brief Sets the new crop position.
* @param x New x, in pixels.
* @param y New y, in pixels.
*
* This function must be called during object rendering. Defines crop position.
* If the rectangle is larger or next to the texture, it will be repeated
* when g2dSetTexRepeat is enabled. Useful for a tileset.
*/
void g2dSetCropXY(int x, int y);
/**
* \brief Sets the new crop size.
* @param w New width, in pixels.
* @param h New height, in pixels.
*
* This function must be called during object rendering. Defines crop size.
* If the rectangle is larger or next to the texture, it will be repeated
* when g2dSetTexRepeat is enabled. Useful for a tileset.
*/
void g2dSetCropWH(int w, int h);
/**
* \brief Sets the new crop position, relative to the current.
* @param x New x increment, in pixels.
* @param y New y increment, in pixels.
*
* This function must be called during object rendering. Defines crop position.
* If the rectangle is larger or next to the texture, texture will be repeated
* when g2dSetTexRepeat is enabled. Useful for a tileset.
*/
void g2dSetCropXYRelative(int x, int y);
/**
* \brief Sets the new crop size, relative to the current.
* @param w New width increment, in pixels.
* @param h New height increment, in pixels.
*
* This function must be called during object rendering. Defines crop size.
* If the rectangle is larger or next to the texture, texture will be repeated
* when g2dSetTexRepeat is enabled. Useful for a tileset.
*/
void g2dSetCropWHRelative(int w, int h);
/**
* \brief Resets texture properties.
*
* This function must be called during object rendering.
*/
void g2dResetTex();
/**
* \brief Set texture wrap.
* @param use true to repeat, false to clamp (by default).
*
* This function must be called during object rendering.
*/
void g2dSetTexRepeat(bool use);
/**
* \brief Use the bilinear filter with the texture.
* @param use true to activate (better look, by default).
false to desactivate (better performance).
*
* This function must be called during object rendering.
* Only useful when scaling.
*/
void g2dSetTexLinear(bool use);
/**
* \brief Resets the draw zone to the entire screen.
*
* This function can be called everywhere in the loop.
*/
void g2dResetScissor();
/**
* \brief Sets the draw zone.
* @param x New x position.
* @param y New y position.
* @param w New width.
* @param h New height.
*
* This function can be called everywhere in the loop.
* Pixel draw will be skipped outside this rectangle.
*/
void g2dSetScissor(int x, int y, int w, int h);
#ifdef __cplusplus
}
#endif
#endif