#include "SDL_config.h"
#include "SDL_test.h"
static unsigned char SDLTest_FontData[] = {
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x18,
0x3c,
0x3c,
0x18,
0x18,
0x00,
0x18,
0x00,
0x36,
0x36,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x36,
0x36,
0x7f,
0x36,
0x7f,
0x36,
0x36,
0x00,
0x0c,
0x3e,
0x03,
0x1e,
0x30,
0x1f,
0x0c,
0x00,
0x00,
0x63,
0x33,
0x18,
0x0c,
0x66,
0x63,
0x00,
0x1c,
0x36,
0x1c,
0x6e,
0x3b,
0x33,
0x6e,
0x00,
0x06,
0x06,
0x03,
0x00,
0x00,
0x00,
0x00,
0x00,
0x18,
0x0c,
0x06,
0x06,
0x06,
0x0c,
0x18,
0x00,
0x06,
0x0c,
0x18,
0x18,
0x18,
0x0c,
0x06,
0x00,
0x00,
0x66,
0x3c,
0xff,
0x3c,
0x66,
0x00,
0x00,
0x00,
0x0c,
0x0c,
0x3f,
0x0c,
0x0c,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x0c,
0x0c,
0x06,
0x00,
0x00,
0x00,
0x3f,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x0c,
0x0c,
0x00,
0x60,
0x30,
0x18,
0x0c,
0x06,
0x03,
0x01,
0x00,
0x3e,
0x63,
0x73,
0x7b,
0x6f,
0x67,
0x3e,
0x00,
0x0c,
0x0e,
0x0c,
0x0c,
0x0c,
0x0c,
0x3f,
0x00,
0x1e,
0x33,
0x30,
0x1c,
0x06,
0x33,
0x3f,
0x00,
0x1e,
0x33,
0x30,
0x1c,
0x30,
0x33,
0x1e,
0x00,
0x38,
0x3c,
0x36,
0x33,
0x7f,
0x30,
0x78,
0x00,
0x3f,
0x03,
0x1f,
0x30,
0x30,
0x33,
0x1e,
0x00,
0x1c,
0x06,
0x03,
0x1f,
0x33,
0x33,
0x1e,
0x00,
0x3f,
0x33,
0x30,
0x18,
0x0c,
0x0c,
0x0c,
0x00,
0x1e,
0x33,
0x33,
0x1e,
0x33,
0x33,
0x1e,
0x00,
0x1e,
0x33,
0x33,
0x3e,
0x30,
0x18,
0x0e,
0x00,
0x00,
0x0c,
0x0c,
0x00,
0x00,
0x0c,
0x0c,
0x00,
0x00,
0x0c,
0x0c,
0x00,
0x00,
0x0c,
0x0c,
0x06,
0x18,
0x0c,
0x06,
0x03,
0x06,
0x0c,
0x18,
0x00,
0x00,
0x00,
0x3f,
0x00,
0x00,
0x3f,
0x00,
0x00,
0x06,
0x0c,
0x18,
0x30,
0x18,
0x0c,
0x06,
0x00,
0x1e,
0x33,
0x30,
0x18,
0x0c,
0x00,
0x0c,
0x00,
0x3e,
0x63,
0x7b,
0x7b,
0x7b,
0x03,
0x1e,
0x00,
0x0c,
0x1e,
0x33,
0x33,
0x3f,
0x33,
0x33,
0x00,
0x3f,
0x66,
0x66,
0x3e,
0x66,
0x66,
0x3f,
0x00,
0x3c,
0x66,
0x03,
0x03,
0x03,
0x66,
0x3c,
0x00,
0x1f,
0x36,
0x66,
0x66,
0x66,
0x36,
0x1f,
0x00,
0x7f,
0x46,
0x16,
0x1e,
0x16,
0x46,
0x7f,
0x00,
0x7f,
0x46,
0x16,
0x1e,
0x16,
0x06,
0x0f,
0x00,
0x3c,
0x66,
0x03,
0x03,
0x73,
0x66,
0x7c,
0x00,
0x33,
0x33,
0x33,
0x3f,
0x33,
0x33,
0x33,
0x00,
0x1e,
0x0c,
0x0c,
0x0c,
0x0c,
0x0c,
0x1e,
0x00,
0x78,
0x30,
0x30,
0x30,
0x33,
0x33,
0x1e,
0x00,
0x67,
0x66,
0x36,
0x1e,
0x36,
0x66,
0x67,
0x00,
0x0f,
0x06,
0x06,
0x06,
0x46,
0x66,
0x7f,
0x00,
0x63,
0x77,
0x7f,
0x7f,
0x6b,
0x63,
0x63,
0x00,
0x63,
0x67,
0x6f,
0x7b,
0x73,
0x63,
0x63,
0x00,
0x1c,
0x36,
0x63,
0x63,
0x63,
0x36,
0x1c,
0x00,
0x3f,
0x66,
0x66,
0x3e,
0x06,
0x06,
0x0f,
0x00,
0x1e,
0x33,
0x33,
0x33,
0x3b,
0x1e,
0x38,
0x00,
0x3f,
0x66,
0x66,
0x3e,
0x36,
0x66,
0x67,
0x00,
0x1e,
0x33,
0x07,
0x0e,
0x38,
0x33,
0x1e,
0x00,
0x3f,
0x2d,
0x0c,
0x0c,
0x0c,
0x0c,
0x1e,
0x00,
0x33,
0x33,
0x33,
0x33,
0x33,
0x33,
0x3f,
0x00,
0x33,
0x33,
0x33,
0x33,
0x33,
0x1e,
0x0c,
0x00,
0x63,
0x63,
0x63,
0x6b,
0x7f,
0x77,
0x63,
0x00,
0x63,
0x63,
0x36,
0x1c,
0x1c,
0x36,
0x63,
0x00,
0x33,
0x33,
0x33,
0x1e,
0x0c,
0x0c,
0x1e,
0x00,
0x7f,
0x63,
0x31,
0x18,
0x4c,
0x66,
0x7f,
0x00,
0x1e,
0x06,
0x06,
0x06,
0x06,
0x06,
0x1e,
0x00,
0x03,
0x06,
0x0c,
0x18,
0x30,
0x60,
0x40,
0x00,
0x1e,
0x18,
0x18,
0x18,
0x18,
0x18,
0x1e,
0x00,
0x08,
0x1c,
0x36,
0x63,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0xff,
0x0c,
0x0c,
0x18,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x1e,
0x30,
0x3e,
0x33,
0x6e,
0x00,
0x07,
0x06,
0x06,
0x3e,
0x66,
0x66,
0x3b,
0x00,
0x00,
0x00,
0x1e,
0x33,
0x03,
0x33,
0x1e,
0x00,
0x38,
0x30,
0x30,
0x3e,
0x33,
0x33,
0x6e,
0x00,
0x00,
0x00,
0x1e,
0x33,
0x3f,
0x03,
0x1e,
0x00,
0x1c,
0x36,
0x06,
0x0f,
0x06,
0x06,
0x0f,
0x00,
0x00,
0x00,
0x6e,
0x33,
0x33,
0x3e,
0x30,
0x1f,
0x07,
0x06,
0x36,
0x6e,
0x66,
0x66,
0x67,
0x00,
0x0c,
0x00,
0x0e,
0x0c,
0x0c,
0x0c,
0x1e,
0x00,
0x30,
0x00,
0x30,
0x30,
0x30,
0x33,
0x33,
0x1e,
0x07,
0x06,
0x66,
0x36,
0x1e,
0x36,
0x67,
0x00,
0x0e,
0x0c,
0x0c,
0x0c,
0x0c,
0x0c,
0x1e,
0x00,
0x00,
0x00,
0x33,
0x7f,
0x7f,
0x6b,
0x63,
0x00,
0x00,
0x00,
0x1f,
0x33,
0x33,
0x33,
0x33,
0x00,
0x00,
0x00,
0x1e,
0x33,
0x33,
0x33,
0x1e,
0x00,
0x00,
0x00,
0x3b,
0x66,
0x66,
0x3e,
0x06,
0x0f,
0x00,
0x00,
0x6e,
0x33,
0x33,
0x3e,
0x30,
0x78,
0x00,
0x00,
0x3b,
0x6e,
0x66,
0x06,
0x0f,
0x00,
0x00,
0x00,
0x3e,
0x03,
0x1e,
0x30,
0x1f,
0x00,
0x08,
0x0c,
0x3e,
0x0c,
0x0c,
0x2c,
0x18,
0x00,
0x00,
0x00,
0x33,
0x33,
0x33,
0x33,
0x6e,
0x00,
0x00,
0x00,
0x33,
0x33,
0x33,
0x1e,
0x0c,
0x00,
0x00,
0x00,
0x63,
0x6b,
0x7f,
0x7f,
0x36,
0x00,
0x00,
0x00,
0x63,
0x36,
0x1c,
0x36,
0x63,
0x00,
0x00,
0x00,
0x33,
0x33,
0x33,
0x3e,
0x30,
0x1f,
0x00,
0x00,
0x3f,
0x19,
0x0c,
0x26,
0x3f,
0x00,
0x38,
0x0c,
0x0c,
0x07,
0x0c,
0x0c,
0x38,
0x00,
0x18,
0x18,
0x18,
0x00,
0x18,
0x18,
0x18,
0x00,
0x07,
0x0c,
0x0c,
0x38,
0x0c,
0x0c,
0x07,
0x00,
0x6e,
0x3b,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x18,
0x18,
0x00,
0x18,
0x18,
0x18,
0x18,
0x00,
0x18,
0x18,
0x7e,
0x03,
0x03,
0x7e,
0x18,
0x18,
0x1c,
0x36,
0x26,
0x0f,
0x06,
0x67,
0x3f,
0x00,
0x00,
0x00,
0x63,
0x3e,
0x36,
0x3e,
0x63,
0x00,
0x33,
0x33,
0x1e,
0x3f,
0x0c,
0x3f,
0x0c,
0x0c,
0x18,
0x18,
0x18,
0x00,
0x18,
0x18,
0x18,
0x00,
0x7c,
0xc6,
0x1c,
0x36,
0x36,
0x1c,
0x33,
0x1e,
0x33,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x3c,
0x42,
0x99,
0x85,
0x85,
0x99,
0x42,
0x3c,
0x3c,
0x36,
0x36,
0x7c,
0x00,
0x00,
0x00,
0x00,
0x00,
0xcc,
0x66,
0x33,
0x66,
0xcc,
0x00,
0x00,
0x00,
0x00,
0x00,
0x3f,
0x30,
0x30,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x3c,
0x42,
0x9d,
0xa5,
0x9d,
0xa5,
0x42,
0x3c,
0x7e,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x1c,
0x36,
0x36,
0x1c,
0x00,
0x00,
0x00,
0x00,
0x18,
0x18,
0x7e,
0x18,
0x18,
0x00,
0x7e,
0x00,
0x1c,
0x30,
0x18,
0x0c,
0x3c,
0x00,
0x00,
0x00,
0x1c,
0x30,
0x18,
0x30,
0x1c,
0x00,
0x00,
0x00,
0x18,
0x0c,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x66,
0x66,
0x66,
0x3e,
0x06,
0x03,
0xfe,
0xdb,
0xdb,
0xde,
0xd8,
0xd8,
0xd8,
0x00,
0x00,
0x00,
0x00,
0x18,
0x18,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x18,
0x30,
0x1e,
0x08,
0x0c,
0x08,
0x1c,
0x00,
0x00,
0x00,
0x00,
0x1c,
0x36,
0x36,
0x1c,
0x00,
0x00,
0x00,
0x00,
0x00,
0x33,
0x66,
0xcc,
0x66,
0x33,
0x00,
0x00,
0xc3,
0x63,
0x33,
0xbd,
0xec,
0xf6,
0xf3,
0x03,
0xc3,
0x63,
0x33,
0x7b,
0xcc,
0x66,
0x33,
0xf0,
0x03,
0xc4,
0x63,
0xb4,
0xdb,
0xac,
0xe6,
0x80,
0x0c,
0x00,
0x0c,
0x06,
0x03,
0x33,
0x1e,
0x00,
0x07,
0x00,
0x1c,
0x36,
0x63,
0x7f,
0x63,
0x00,
0x70,
0x00,
0x1c,
0x36,
0x63,
0x7f,
0x63,
0x00,
0x1c,
0x36,
0x00,
0x3e,
0x63,
0x7f,
0x63,
0x00,
0x6e,
0x3b,
0x00,
0x3e,
0x63,
0x7f,
0x63,
0x00,
0x63,
0x1c,
0x36,
0x63,
0x7f,
0x63,
0x63,
0x00,
0x0c,
0x0c,
0x00,
0x1e,
0x33,
0x3f,
0x33,
0x00,
0x7c,
0x36,
0x33,
0x7f,
0x33,
0x33,
0x73,
0x00,
0x1e,
0x33,
0x03,
0x33,
0x1e,
0x18,
0x30,
0x1e,
0x07,
0x00,
0x3f,
0x06,
0x1e,
0x06,
0x3f,
0x00,
0x38,
0x00,
0x3f,
0x06,
0x1e,
0x06,
0x3f,
0x00,
0x0c,
0x12,
0x3f,
0x06,
0x1e,
0x06,
0x3f,
0x00,
0x36,
0x00,
0x3f,
0x06,
0x1e,
0x06,
0x3f,
0x00,
0x07,
0x00,
0x1e,
0x0c,
0x0c,
0x0c,
0x1e,
0x00,
0x38,
0x00,
0x1e,
0x0c,
0x0c,
0x0c,
0x1e,
0x00,
0x0c,
0x12,
0x00,
0x1e,
0x0c,
0x0c,
0x1e,
0x00,
0x33,
0x00,
0x1e,
0x0c,
0x0c,
0x0c,
0x1e,
0x00,
0x3f,
0x66,
0x6f,
0x6f,
0x66,
0x66,
0x3f,
0x00,
0x3f,
0x00,
0x33,
0x37,
0x3f,
0x3b,
0x33,
0x00,
0x0e,
0x00,
0x18,
0x3c,
0x66,
0x3c,
0x18,
0x00,
0x70,
0x00,
0x18,
0x3c,
0x66,
0x3c,
0x18,
0x00,
0x3c,
0x66,
0x18,
0x3c,
0x66,
0x3c,
0x18,
0x00,
0x6e,
0x3b,
0x00,
0x3e,
0x63,
0x63,
0x3e,
0x00,
0xc3,
0x18,
0x3c,
0x66,
0x66,
0x3c,
0x18,
0x00,
0x00,
0x36,
0x1c,
0x08,
0x1c,
0x36,
0x00,
0x00,
0x5c,
0x36,
0x73,
0x7b,
0x6f,
0x36,
0x1d,
0x00,
0x0e,
0x00,
0x66,
0x66,
0x66,
0x66,
0x3c,
0x00,
0x70,
0x00,
0x66,
0x66,
0x66,
0x66,
0x3c,
0x00,
0x3c,
0x66,
0x00,
0x66,
0x66,
0x66,
0x3c,
0x00,
0x33,
0x00,
0x33,
0x33,
0x33,
0x33,
0x1e,
0x00,
0x70,
0x00,
0x66,
0x66,
0x3c,
0x18,
0x18,
0x00,
0x0f,
0x06,
0x3e,
0x66,
0x66,
0x3e,
0x06,
0x0f,
0x00,
0x1e,
0x33,
0x1f,
0x33,
0x1f,
0x03,
0x03,
0x07,
0x00,
0x1e,
0x30,
0x3e,
0x33,
0x7e,
0x00,
0x38,
0x00,
0x1e,
0x30,
0x3e,
0x33,
0x7e,
0x00,
0x7e,
0xc3,
0x3c,
0x60,
0x7c,
0x66,
0xfc,
0x00,
0x6e,
0x3b,
0x1e,
0x30,
0x3e,
0x33,
0x7e,
0x00,
0x33,
0x00,
0x1e,
0x30,
0x3e,
0x33,
0x7e,
0x00,
0x0c,
0x0c,
0x1e,
0x30,
0x3e,
0x33,
0x7e,
0x00,
0x00,
0x00,
0xfe,
0x30,
0xfe,
0x33,
0xfe,
0x00,
0x00,
0x00,
0x1e,
0x03,
0x03,
0x1e,
0x30,
0x1c,
0x07,
0x00,
0x1e,
0x33,
0x3f,
0x03,
0x1e,
0x00,
0x38,
0x00,
0x1e,
0x33,
0x3f,
0x03,
0x1e,
0x00,
0x7e,
0xc3,
0x3c,
0x66,
0x7e,
0x06,
0x3c,
0x00,
0x33,
0x00,
0x1e,
0x33,
0x3f,
0x03,
0x1e,
0x00,
0x07,
0x00,
0x0e,
0x0c,
0x0c,
0x0c,
0x1e,
0x00,
0x1c,
0x00,
0x0e,
0x0c,
0x0c,
0x0c,
0x1e,
0x00,
0x3e,
0x63,
0x1c,
0x18,
0x18,
0x18,
0x3c,
0x00,
0x33,
0x00,
0x0e,
0x0c,
0x0c,
0x0c,
0x1e,
0x00,
0x1b,
0x0e,
0x1b,
0x30,
0x3e,
0x33,
0x1e,
0x00,
0x00,
0x1f,
0x00,
0x1f,
0x33,
0x33,
0x33,
0x00,
0x00,
0x07,
0x00,
0x1e,
0x33,
0x33,
0x1e,
0x00,
0x00,
0x38,
0x00,
0x1e,
0x33,
0x33,
0x1e,
0x00,
0x1e,
0x33,
0x00,
0x1e,
0x33,
0x33,
0x1e,
0x00,
0x6e,
0x3b,
0x00,
0x1e,
0x33,
0x33,
0x1e,
0x00,
0x00,
0x33,
0x00,
0x1e,
0x33,
0x33,
0x1e,
0x00,
0x18,
0x18,
0x00,
0x7e,
0x00,
0x18,
0x18,
0x00,
0x00,
0x60,
0x3c,
0x76,
0x7e,
0x6e,
0x3c,
0x06,
0x00,
0x07,
0x00,
0x33,
0x33,
0x33,
0x7e,
0x00,
0x00,
0x38,
0x00,
0x33,
0x33,
0x33,
0x7e,
0x00,
0x1e,
0x33,
0x00,
0x33,
0x33,
0x33,
0x7e,
0x00,
0x00,
0x33,
0x00,
0x33,
0x33,
0x33,
0x7e,
0x00,
0x00,
0x38,
0x00,
0x33,
0x33,
0x3e,
0x30,
0x1f,
0x00,
0x00,
0x06,
0x3e,
0x66,
0x3e,
0x06,
0x00,
0x00,
0x33,
0x00,
0x33,
0x33,
0x3e,
0x30,
0x1f,
};
struct SDLTest_CharTextureCache {
SDL_Renderer* renderer;
SDL_Texture* charTextureCache[256];
struct SDLTest_CharTextureCache* next;
};
static struct SDLTest_CharTextureCache *SDLTest_CharTextureCacheList;
int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, Uint32 c)
{
const Uint32 charWidth = FONT_CHARACTER_SIZE;
const Uint32 charHeight = FONT_CHARACTER_SIZE;
const Uint32 charSize = FONT_CHARACTER_SIZE;
SDL_Rect srect;
SDL_Rect drect;
int result;
Uint32 ix, iy;
const unsigned char *charpos;
Uint32 *curpos;
Uint8 *linepos;
Uint32 pitch;
SDL_Surface *character;
Uint32 ci;
Uint8 r, g, b, a;
struct SDLTest_CharTextureCache *cache;
srect.x = 0;
srect.y = 0;
srect.w = charWidth;
srect.h = charHeight;
drect.x = x;
drect.y = y;
drect.w = charWidth;
drect.h = charHeight;
ci = c;
for (cache = SDLTest_CharTextureCacheList; cache != NULL; cache = cache->next) {
if (cache->renderer == renderer) {
break;
}
}
if (cache == NULL) {
cache = (struct SDLTest_CharTextureCache*)SDL_calloc(1, sizeof(struct SDLTest_CharTextureCache));
cache->renderer = renderer;
cache->next = SDLTest_CharTextureCacheList;
SDLTest_CharTextureCacheList = cache;
}
if (cache->charTextureCache[ci] == NULL) {
character = SDL_CreateRGBSurface(SDL_SWSURFACE,
charWidth, charHeight, 32,
0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF);
if (character == NULL) {
return (-1);
}
charpos = SDLTest_FontData + ci * charSize;
linepos = (Uint8 *)character->pixels;
pitch = character->pitch;
for (iy = 0; iy < charWidth; iy++) {
curpos = (Uint32 *)linepos;
for (ix = 0; ix < charWidth; ix++) {
if ((*charpos) & (1 << ix)) {
*curpos = 0xffffffff;
} else {
*curpos = 0;
}
++curpos;
}
linepos += pitch;
++charpos;
}
cache->charTextureCache[ci] = SDL_CreateTextureFromSurface(renderer, character);
SDL_FreeSurface(character);
if (cache->charTextureCache[ci] == NULL) {
return (-1);
}
}
result = 0;
result |= SDL_GetRenderDrawColor(renderer, &r, &g, &b, &a);
result |= SDL_SetTextureColorMod(cache->charTextureCache[ci], r, g, b);
result |= SDL_SetTextureAlphaMod(cache->charTextureCache[ci], a);
result |= SDL_RenderCopy(renderer, cache->charTextureCache[ci], &srect, &drect);
return (result);
}
#define UNKNOWN_UNICODE 0xFFFD
static Uint32 UTF8_getch(const char *src, size_t srclen, int *inc)
{
const Uint8 *p = (const Uint8 *)src;
size_t left = 0;
size_t save_srclen = srclen;
SDL_bool overlong = SDL_FALSE;
SDL_bool underflow = SDL_FALSE;
Uint32 ch = UNKNOWN_UNICODE;
if (srclen == 0) {
return UNKNOWN_UNICODE;
}
if (p[0] >= 0xFC) {
if ((p[0] & 0xFE) == 0xFC) {
if (p[0] == 0xFC && (p[1] & 0xFC) == 0x80) {
overlong = SDL_TRUE;
}
ch = (Uint32) (p[0] & 0x01);
left = 5;
}
} else if (p[0] >= 0xF8) {
if ((p[0] & 0xFC) == 0xF8) {
if (p[0] == 0xF8 && (p[1] & 0xF8) == 0x80) {
overlong = SDL_TRUE;
}
ch = (Uint32) (p[0] & 0x03);
left = 4;
}
} else if (p[0] >= 0xF0) {
if ((p[0] & 0xF8) == 0xF0) {
if (p[0] == 0xF0 && (p[1] & 0xF0) == 0x80) {
overlong = SDL_TRUE;
}
ch = (Uint32) (p[0] & 0x07);
left = 3;
}
} else if (p[0] >= 0xE0) {
if ((p[0] & 0xF0) == 0xE0) {
if (p[0] == 0xE0 && (p[1] & 0xE0) == 0x80) {
overlong = SDL_TRUE;
}
ch = (Uint32) (p[0] & 0x0F);
left = 2;
}
} else if (p[0] >= 0xC0) {
if ((p[0] & 0xE0) == 0xC0) {
if ((p[0] & 0xDE) == 0xC0) {
overlong = SDL_TRUE;
}
ch = (Uint32) (p[0] & 0x1F);
left = 1;
}
} else {
if ((p[0] & 0x80) == 0x00) {
ch = (Uint32) p[0];
}
}
--srclen;
while (left > 0 && srclen > 0) {
++p;
if ((p[0] & 0xC0) != 0x80) {
ch = UNKNOWN_UNICODE;
break;
}
ch <<= 6;
ch |= (p[0] & 0x3F);
--srclen;
--left;
}
if (left > 0) {
underflow = SDL_TRUE;
}
if (overlong || underflow ||
(ch >= 0xD800 && ch <= 0xDFFF) ||
(ch == 0xFFFE || ch == 0xFFFF) || ch > 0x10FFFF) {
ch = UNKNOWN_UNICODE;
}
*inc = (int)(save_srclen - srclen);
return ch;
}
#define UTF8_IsTrailingByte(c) ((c) >= 0x80 && (c) <= 0xBF)
int SDLTest_DrawString(SDL_Renderer * renderer, int x, int y, const char *s)
{
const Uint32 charWidth = FONT_CHARACTER_SIZE;
int result = 0;
int curx = x;
int cury = y;
size_t len = SDL_strlen(s);
while (len > 0 && !result) {
int advance = 0;
Uint32 ch = UTF8_getch(s, len, &advance);
if (ch < 256) {
result |= SDLTest_DrawCharacter(renderer, curx, cury, ch);
}
curx += charWidth;
s += advance;
len -= advance;
}
return (result);
}
SDLTest_TextWindow *SDLTest_TextWindowCreate(int x, int y, int w, int h)
{
SDLTest_TextWindow *textwin = (SDLTest_TextWindow *)SDL_malloc(sizeof(*textwin));
if ( !textwin ) {
return NULL;
}
textwin->rect.x = x;
textwin->rect.y = y;
textwin->rect.w = w;
textwin->rect.h = h;
textwin->current = 0;
textwin->numlines = (h / FONT_LINE_HEIGHT);
textwin->lines = (char **)SDL_calloc(textwin->numlines, sizeof(*textwin->lines));
if ( !textwin->lines ) {
SDL_free(textwin);
return NULL;
}
return textwin;
}
void SDLTest_TextWindowDisplay(SDLTest_TextWindow *textwin, SDL_Renderer *renderer)
{
int i, y;
for ( y = textwin->rect.y, i = 0; i < textwin->numlines; ++i, y += FONT_LINE_HEIGHT ) {
if ( textwin->lines[i] ) {
SDLTest_DrawString(renderer, textwin->rect.x, y, textwin->lines[i]);
}
}
}
void SDLTest_TextWindowAddText(SDLTest_TextWindow *textwin, const char *fmt, ...)
{
char text[1024];
va_list ap;
va_start(ap, fmt);
SDL_vsnprintf(text, sizeof(text), fmt, ap);
va_end(ap);
SDLTest_TextWindowAddTextWithLength(textwin, text, SDL_strlen(text));
}
void SDLTest_TextWindowAddTextWithLength(SDLTest_TextWindow *textwin, const char *text, size_t len)
{
size_t existing;
SDL_bool newline = SDL_FALSE;
char *line;
if ( len > 0 && text[len - 1] == '\n' ) {
--len;
newline = SDL_TRUE;
}
if ( textwin->lines[textwin->current] ) {
existing = SDL_strlen(textwin->lines[textwin->current]);
} else {
existing = 0;
}
if ( *text == '\b' ) {
if ( existing ) {
while (existing > 1 && UTF8_IsTrailingByte((Uint8)textwin->lines[textwin->current][existing - 1])) {
--existing;
}
--existing;
textwin->lines[textwin->current][existing] = '\0';
} else if (textwin->current > 0) {
SDL_free(textwin->lines[textwin->current]);
textwin->lines[textwin->current] = NULL;
--textwin->current;
}
return;
}
line = (char *)SDL_realloc(textwin->lines[textwin->current], existing + len + 1);
if ( line ) {
SDL_memcpy(&line[existing], text, len);
line[existing + len] = '\0';
textwin->lines[textwin->current] = line;
if ( newline ) {
if (textwin->current == textwin->numlines - 1) {
SDL_free(textwin->lines[0]);
SDL_memcpy(&textwin->lines[0], &textwin->lines[1], (textwin->numlines-1) * sizeof(textwin->lines[1]));
textwin->lines[textwin->current] = NULL;
} else {
++textwin->current;
}
}
}
}
void SDLTest_TextWindowClear(SDLTest_TextWindow *textwin)
{
int i;
for ( i = 0; i < textwin->numlines; ++i )
{
if ( textwin->lines[i] ) {
SDL_free(textwin->lines[i]);
textwin->lines[i] = NULL;
}
}
textwin->current = 0;
}
void SDLTest_TextWindowDestroy(SDLTest_TextWindow *textwin)
{
if ( textwin ) {
SDLTest_TextWindowClear(textwin);
SDL_free(textwin->lines);
SDL_free(textwin);
}
}
void SDLTest_CleanupTextDrawing(void)
{
unsigned int i;
struct SDLTest_CharTextureCache* cache, *next;
cache = SDLTest_CharTextureCacheList;
while (cache) {
for (i = 0; i < SDL_arraysize(cache->charTextureCache); ++i) {
if (cache->charTextureCache[i]) {
SDL_DestroyTexture(cache->charTextureCache[i]);
cache->charTextureCache[i] = NULL;
}
}
next = cache->next;
SDL_free(cache);
cache = next;
}
SDLTest_CharTextureCacheList = NULL;
}