Test text rendering APIs take floating point coordinates

This commit is contained in:
Sam Lantinga 2023-01-04 16:22:40 -08:00
parent 0901657278
commit 0bbf6cc379
9 changed files with 74 additions and 73 deletions

View file

@ -147,7 +147,7 @@ SDLTest_CommonState *SDLTest_CommonCreateState(char **argv, Uint32 flags);
*
* \returns the number of arguments processed (i.e. 1 for --fullscreen, 2 for --video [videodriver], or -1 on error.
*/
int SDLTest_CommonArg(SDLTest_CommonState * state, int index);
int SDLTest_CommonArg(SDLTest_CommonState *state, int index);
/**
@ -162,7 +162,7 @@ int SDLTest_CommonArg(SDLTest_CommonState * state, int index);
* \param argv0 argv[0], as passed to main/SDL_main.
* \param options an array of strings for application specific options. The last element of the array should be NULL.
*/
void SDLTest_CommonLogUsage(SDLTest_CommonState * state, const char *argv0, const char **options);
void SDLTest_CommonLogUsage(SDLTest_CommonState *state, const char *argv0, const char **options);
/**
* \brief Returns common usage information
@ -175,7 +175,7 @@ void SDLTest_CommonLogUsage(SDLTest_CommonState * state, const char *argv0, cons
* \param state The common state describing the test window to create.
* \returns a string with usage information
*/
const char *SDLTest_CommonUsage(SDLTest_CommonState * state);
const char *SDLTest_CommonUsage(SDLTest_CommonState *state);
/**
* \brief Open test window.
@ -184,7 +184,7 @@ const char *SDLTest_CommonUsage(SDLTest_CommonState * state);
*
* \returns SDL_TRUE if initialization succeeded, false otherwise
*/
SDL_bool SDLTest_CommonInit(SDLTest_CommonState * state);
SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state);
/**
* \brief Easy argument handling when test app doesn't need any custom args.
@ -195,7 +195,7 @@ SDL_bool SDLTest_CommonInit(SDLTest_CommonState * state);
*
* \returns SDL_FALSE if app should quit, true otherwise.
*/
SDL_bool SDLTest_CommonDefaultArgs(SDLTest_CommonState * state, const int argc, char **argv);
SDL_bool SDLTest_CommonDefaultArgs(SDLTest_CommonState *state, const int argc, char **argv);
/**
* \brief Common event handler for test windows.
@ -205,7 +205,7 @@ SDL_bool SDLTest_CommonDefaultArgs(SDLTest_CommonState * state, const int argc,
* \param done Flag indicating we are done.
*
*/
void SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done);
void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done);
/**
* \brief Close test window.
@ -213,7 +213,7 @@ void SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *do
* \param state The common state used to create test window.
*
*/
void SDLTest_CommonQuit(SDLTest_CommonState * state);
void SDLTest_CommonQuit(SDLTest_CommonState *state);
/**
* \brief Draws various window information (position, size, etc.) to the renderer.
@ -223,7 +223,7 @@ void SDLTest_CommonQuit(SDLTest_CommonState * state);
* \param usedHeight Returns the height used, so the caller can draw more below.
*
*/
void SDLTest_CommonDrawWindowInfo(SDL_Renderer * renderer, SDL_Window * window, int * usedHeight);
void SDLTest_CommonDrawWindowInfo(SDL_Renderer *renderer, SDL_Window *window, float *usedHeight);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus

View file

@ -79,7 +79,7 @@ extern "C" {
* \returns 0 for OK, -1 on error
*
*/
int SDLTest_Crc32Init(SDLTest_Crc32Context * crcContext);
int SDLTest_Crc32Init(SDLTest_Crc32Context *crcContext);
/**
@ -93,12 +93,12 @@ extern "C" {
* \returns 0 for OK, -1 on error
*
*/
int SDLTest_Crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32);
int SDLTest_Crc32Calc(SDLTest_Crc32Context *crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32);
/* Same routine broken down into three steps */
int SDLTest_Crc32CalcStart(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32);
int SDLTest_Crc32CalcEnd(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32);
int SDLTest_Crc32CalcBuffer(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32);
int SDLTest_Crc32CalcStart(SDLTest_Crc32Context *crcContext, CrcUint32 *crc32);
int SDLTest_Crc32CalcEnd(SDLTest_Crc32Context *crcContext, CrcUint32 *crc32);
int SDLTest_Crc32CalcBuffer(SDLTest_Crc32Context *crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32);
/**
@ -110,7 +110,7 @@ int SDLTest_Crc32CalcBuffer(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf,
*
*/
int SDLTest_Crc32Done(SDLTest_Crc32Context * crcContext);
int SDLTest_Crc32Done(SDLTest_Crc32Context *crcContext);
/* Ends C function definitions when using C++ */

View file

@ -51,7 +51,7 @@ extern "C" {
*
* \returns 0 on success, -1 on failure.
*/
int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, Uint32 c);
int SDLTest_DrawCharacter(SDL_Renderer *renderer, float x, float y, Uint32 c);
/**
* \brief Draw a UTF-8 string in the currently set font.
@ -65,14 +65,14 @@ int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, Uint32 c);
*
* \returns 0 on success, -1 on failure.
*/
int SDLTest_DrawString(SDL_Renderer *renderer, int x, int y, const char *s);
int SDLTest_DrawString(SDL_Renderer *renderer, float x, float y, const char *s);
/**
* \brief Data used for multi-line text output
*/
typedef struct SDLTest_TextWindow
{
SDL_Rect rect;
SDL_FRect rect;
int current;
int numlines;
char **lines;
@ -90,7 +90,7 @@ typedef struct SDLTest_TextWindow
*
* \since This function is available since SDL 2.24.0
*/
SDLTest_TextWindow *SDLTest_TextWindowCreate(int x, int y, int w, int h);
SDLTest_TextWindow *SDLTest_TextWindowCreate(float x, float y, float w, float h);
/**
* \brief Display a multi-line text output window

View file

@ -338,7 +338,7 @@ Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max);
*
* \returns a newly allocated random string; or NULL if length was invalid or string could not be allocated.
*/
char * SDLTest_RandomAsciiString(void);
char *SDLTest_RandomAsciiString(void);
/**
@ -352,7 +352,7 @@ char * SDLTest_RandomAsciiString(void);
*
* \returns a newly allocated random string; or NULL if maxLength was invalid or string could not be allocated.
*/
char * SDLTest_RandomAsciiStringWithMaximumLength(int maxLength);
char *SDLTest_RandomAsciiStringWithMaximumLength(int maxLength);
/**
@ -366,7 +366,7 @@ char * SDLTest_RandomAsciiStringWithMaximumLength(int maxLength);
*
* \returns a newly allocated random string; or NULL if size was invalid or string could not be allocated.
*/
char * SDLTest_RandomAsciiStringOfSize(int size);
char *SDLTest_RandomAsciiStringOfSize(int size);
/**
* Get the invocation count for the fuzzer since last ...FuzzerInit.

View file

@ -86,7 +86,7 @@ extern "C" {
* mdContext. Call before each new use of the context -
* all fields are set to zero.
*/
void SDLTest_Md5Init(SDLTest_Md5Context * mdContext);
void SDLTest_Md5Init(SDLTest_Md5Context *mdContext);
/**
@ -101,7 +101,7 @@ extern "C" {
* in the message whose digest is being computed.
*/
void SDLTest_Md5Update(SDLTest_Md5Context * mdContext, unsigned char *inBuf,
void SDLTest_Md5Update(SDLTest_Md5Context *mdContext, unsigned char *inBuf,
unsigned int inLen);
@ -115,7 +115,7 @@ extern "C" {
* Always call before using the digest[] variable.
*/
void SDLTest_Md5Final(SDLTest_Md5Context * mdContext);
void SDLTest_Md5Final(SDLTest_Md5Context *mdContext);
/* Ends C function definitions when using C++ */

View file

@ -78,8 +78,7 @@ extern "C" {
* \param ci integer that defines the random sequence
*
*/
void SDLTest_RandomInit(SDLTest_RandomContext * rndContext, unsigned int xi,
unsigned int ci);
void SDLTest_RandomInit(SDLTest_RandomContext *rndContext, unsigned int xi, unsigned int ci);
/**
* \brief Initialize random number generator based on current system time.