Skip to content

Commit fe586d7

Browse files
Added text clipping and gfx_GetSpriteChar()
Fun stuffs :) Also made sure to finally update the version :P
1 parent 69302f2 commit fe586d7

File tree

2 files changed

+392
-86
lines changed

2 files changed

+392
-86
lines changed

CEdev/include/lib/ce/graphx.h

+32-4
Original file line numberDiff line numberDiff line change
@@ -362,22 +362,33 @@ void gfx_PrintString(const char *string);
362362
* The current cursor position is updated.
363363
* No text clipping is performed.
364364
*/
365-
void gfx_PrintStringXY(const char *string, uint24_t x, uint8_t y);
365+
void gfx_PrintStringXY(const char *string, int x, int y);
366366

367367
/**
368368
* Returns the current text cursor X position
369369
*/
370-
uint24_t gfx_GetTextX(void);
370+
int gfx_GetTextX(void);
371371

372372
/**
373373
* Returns the current text cursor Y position
374374
*/
375-
uint8_t gfx_GetTextY(void);
375+
int gfx_GetTextY(void);
376376

377377
/**
378378
* Sets the text cursor XY position
379379
*/
380-
void gfx_SetTextXY(uint24_t x, uint8_t y);
380+
void gfx_SetTextXY(int x, int y);
381+
382+
/**
383+
* Sets the configuration for the text routines. The current options are:
384+
* GFX_TEXT_CLIP - Default, text routines do not clip (much faster)
385+
* GFX_TEXT_NOCLIP - Text routines will clip against the defined clip window
386+
*
387+
* Clipped text does not scale text
388+
*/
389+
void gfx_SetTextConfig(uint8_t config);
390+
#define GFX_TEXT_CLIP 1
391+
#define GFX_TEXT_NOCLIP 2
381392

382393
/**
383394
* Sets the text foreground (FG), background (BG), and transparent (TP) color indexes
@@ -432,6 +443,12 @@ gfx_image_t *gfx_RotateSpriteC(gfx_image_t *sprite_in, gfx_image_t *sprite_out);
432443
gfx_image_t *gfx_RotateSpriteCC(gfx_image_t *sprite_in, gfx_image_t *sprite_out);
433444
gfx_image_t *gfx_RotateSpriteHalf(gfx_image_t *sprite_in, gfx_image_t *sprite_out);
434445

446+
/**
447+
* Creates a temporary sprite for the character c. This may be useful for performing rotations and other
448+
* operations on characters? The sprite returned is always 8x8 pixels.
449+
*/
450+
gfx_image_t *gfx_GetSpriteChar(char c);
451+
435452
/**
436453
* Set the font routines to use the provided font, formated 8x8
437454
*/
@@ -483,6 +500,17 @@ void gfx_ShiftUp(uint8_t pixels);
483500
void gfx_ShiftLeft(uint24_t pixels);
484501
void gfx_ShiftRight(uint24_t pixels);
485502

503+
/**
504+
* The following routines are used to implement text clipping; which is
505+
* substantially slower than normal text. However, these may be useful.
506+
*/
507+
508+
/**
509+
* Outputs a string at the given XY coordinates.
510+
* The current cursor position is updated.
511+
*/
512+
void gfx_PrintStringXY_Clip(const char *string, int x, int y);
513+
486514
/**
487515
* Produces a random integer value
488516
*/

0 commit comments

Comments
 (0)