add ENDOOM support (from Chocolate Doom) (#184)

* add libtextscreen

* add doomkeys.h

* fix format string warnings

* delete all files unnecessary for ENDOOM

* add ENDOOM support

* show ENDOOM screen in the same window as the game

* add PWADs only option, add comments

* change PWADs->PWAD
This commit is contained in:
Roman Fomin 2021-11-04 14:54:49 +07:00 committed by GitHub
parent 040ebdc133
commit 19d3ab0ae8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 4792 additions and 4 deletions

View File

@ -279,5 +279,6 @@ add_subdirectory(data)
add_subdirectory(docs)
add_subdirectory(examples)
add_subdirectory(opl)
add_subdirectory(textscreen)
add_subdirectory(Source)
add_subdirectory(toolsrc)

View File

@ -28,6 +28,7 @@ set(WOOF_SOURCES
g_game.c g_game.h
hu_lib.c hu_lib.h
hu_stuff.c hu_stuff.h
i_endoom.c i_endoom.h
i_glob.c i_glob.h
i_main.c
i_net.c i_net.h
@ -96,6 +97,8 @@ set(WOOF_SOURCES
wi_stuff.c wi_stuff.h
z_zone.c z_zone.h)
list(APPEND WOOF_LIBRARIES textscreen)
if(WIN32)
list(APPEND
WOOF_SOURCES

77
Source/i_endoom.c Normal file
View File

@ -0,0 +1,77 @@
//
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Exit text-mode ENDOOM screen.
//
#include <stdio.h>
#include <string.h>
#include "config.h"
#include "doomtype.h"
#include "i_video.h"
#include "../textscreen/txt_main.h"
#define ENDOOM_W 80
#define ENDOOM_H 25
//
// Displays the text mode ending screen after the game quits
//
void I_Endoom(byte *endoom_data)
{
unsigned char *screendata;
int y;
int indent;
// Set up text mode screen
TXT_PreInit(I_GetSDLWindow(), I_GetSDLRenderer());
TXT_Init();
// Write the data to the screen memory
screendata = TXT_GetScreenData();
indent = (ENDOOM_W - TXT_SCREEN_W) / 2;
for (y=0; y<TXT_SCREEN_H; ++y)
{
memcpy(screendata + (y * TXT_SCREEN_W * 2),
endoom_data + (y * ENDOOM_W + indent) * 2,
TXT_SCREEN_W * 2);
}
// Wait for a keypress
while (true)
{
TXT_UpdateScreen();
if (TXT_GetChar() > 0)
{
break;
}
TXT_Sleep(0);
}
// Shut down text mode screen
TXT_Shutdown();
}

29
Source/i_endoom.h Normal file
View File

@ -0,0 +1,29 @@
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Exit text-mode ENDOOM screen.
//
#ifndef __I_ENDOOM__
#define __I_ENDOOM__
// Display the Endoom screen on shutdown. Pass a pointer to the
// ENDOOM lump.
void I_Endoom(byte *data);
#endif

View File

@ -72,6 +72,7 @@ int main(int argc, char **argv)
*/
Z_Init(); // 1/18/98 killough: start up memory stuff first
atexit(SDL_Quit);
atexit(I_Quit);
// 2/2/98 Stan

View File

@ -46,6 +46,7 @@
#include "w_wad.h"
#include "v_video.h"
#include "m_argv.h"
#include "i_endoom.h"
ticcmd_t *I_BaseTiccmd(void)
{
@ -147,8 +148,6 @@ void I_Shutdown(void)
SDL_SetModState(oldmod);
I_ShutdownJoystick();
SDL_Quit();
}
extern int usejoystick;
@ -385,10 +384,29 @@ void I_Error(const char *error, ...) // killough 3/20/98: add const
// killough 2/22/98: Add support for ENDBOOM, which is PC-specific
// killough 8/1/98: change back to ENDOOM
int show_endoom;
void I_EndDoom(void)
{
// haleyjd
puts("\n" PROJECT_NAME" exiting.\n");
int lumpnum;
byte *endoom;
// Don't show ENDOOM if we have it disabled.
if (!show_endoom)
{
return;
}
lumpnum = W_CheckNumForName("ENDOOM");
if (show_endoom == 2 && W_IsIWADLump(lumpnum))
{
return;
}
endoom = W_CacheLumpNum(lumpnum, PU_STATIC);
I_Endoom(endoom);
}
//----------------------------------------------------------------------------

View File

@ -69,6 +69,16 @@ char *window_position;
int video_display = 0;
int fullscreen_width = 0, fullscreen_height = 0; // [FG] exclusive fullscreen
void *I_GetSDLWindow(void)
{
return screen;
}
void *I_GetSDLRenderer(void)
{
return renderer;
}
/////////////////////////////////////////////////////////////////////////////
//
// JOYSTICK // phares 4/3/98

View File

@ -83,6 +83,9 @@ extern int fullscreen_width, fullscreen_height; // [FG] exclusive fullscreen
boolean I_WritePNGfile(char *filename); // [FG] screenshots in PNG format
void *I_GetSDLWindow(void);
void *I_GetSDLRenderer(void);
#endif
//----------------------------------------------------------------------------

View File

@ -3576,6 +3576,7 @@ enum {
general_corpse,
general_realtic,
general_comp,
general_endoom,
general_end
};
@ -3583,6 +3584,10 @@ static const char *default_compatibility_strings[] = {
"Vanilla", "Boom", "MBF", "MBF21", NULL
};
static const char *default_endoom_strings[] = {
"off", "on", "PWAD only", NULL
};
setup_menu_t gen_settings2[] = { // General Settings screen2
{"Input Devices" ,S_SKIP|S_TITLE, m_null, G_X, G_Y - 12},
@ -3624,6 +3629,9 @@ setup_menu_t gen_settings2[] = { // General Settings screen2
{"Default compatibility", S_CHOICE|S_LEVWARN, m_null, G_X,
G_Y4 + general_comp*8, {"default_complevel"}, 0, NULL, default_compatibility_strings},
{"Show ENDOOM screen", S_CHOICE, m_null, G_X,
G_Y4 + general_endoom*8, {"show_endoom"}, 0, NULL, default_endoom_strings},
{"<- PREV",S_SKIP|S_PREV, m_null, KB_PREV, KB_Y+20*8, {gen_settings1}},
// Final entry

View File

@ -88,6 +88,7 @@ extern boolean flipcorpses; // [crispy] randomly flip corpse, blood and death an
extern boolean ghost_monsters; // [crispy] resurrected pools of gore ("ghost monsters") are translucent
extern int cfg_mouse_acceleration;
extern int mouse_threshold;
extern int show_endoom;
extern char *chat_macros[], *wad_files[], *deh_files[]; // killough 10/98
@ -167,6 +168,13 @@ default_t defaults[] = {
"1 to enable flashing icon during disk IO"
},
{
"show_endoom",
(config_t *) &show_endoom, NULL,
{0}, {0,2}, number, ss_gen, wad_no,
"show ENDOOM 0=off, 1=on, 2=PWAD only"
},
{ // killough 2/21/98
"pitched_sounds",
(config_t *) &pitched_sounds, NULL,

14
textscreen/CMakeLists.txt Normal file
View File

@ -0,0 +1,14 @@
include(WoofSettings)
add_library(textscreen STATIC
textscreen.h
txt_main.h
txt_sdl.c txt_sdl.h
txt_utf8.c txt_utf8.h)
target_woof_settings(textscreen)
target_include_directories(textscreen
INTERFACE "."
PRIVATE "../Source/")
target_link_libraries(textscreen SDL2::SDL2)

154
textscreen/doomkeys.h Normal file
View File

@ -0,0 +1,154 @@
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Key definitions
//
#ifndef __DOOMKEYS__
#define __DOOMKEYS__
//
// DOOM keyboard definition.
// This is the stuff configured by Setup.Exe.
// Most key data are simple ascii (uppercased).
//
#define KEY_RIGHTARROW 0xae
#define KEY_LEFTARROW 0xac
#define KEY_UPARROW 0xad
#define KEY_DOWNARROW 0xaf
#define KEY_ESCAPE 27
#define KEY_ENTER 13
#define KEY_TAB 9
#define KEY_F1 (0x80+0x3b)
#define KEY_F2 (0x80+0x3c)
#define KEY_F3 (0x80+0x3d)
#define KEY_F4 (0x80+0x3e)
#define KEY_F5 (0x80+0x3f)
#define KEY_F6 (0x80+0x40)
#define KEY_F7 (0x80+0x41)
#define KEY_F8 (0x80+0x42)
#define KEY_F9 (0x80+0x43)
#define KEY_F10 (0x80+0x44)
#define KEY_F11 (0x80+0x57)
#define KEY_F12 (0x80+0x58)
#define KEY_BACKSPACE 0x7f
#define KEY_PAUSE 0xff
#define KEY_EQUALS 0x3d
#define KEY_MINUS 0x2d
#define KEY_RSHIFT (0x80+0x36)
#define KEY_RCTRL (0x80+0x1d)
#define KEY_RALT (0x80+0x38)
#define KEY_LALT KEY_RALT
// new keys:
#define KEY_CAPSLOCK (0x80+0x3a)
#define KEY_NUMLOCK (0x80+0x45)
#define KEY_SCRLCK (0x80+0x46)
#define KEY_PRTSCR (0x80+0x59)
#define KEY_HOME (0x80+0x47)
#define KEY_END (0x80+0x4f)
#define KEY_PGUP (0x80+0x49)
#define KEY_PGDN (0x80+0x51)
#define KEY_INS (0x80+0x52)
#define KEY_DEL (0x80+0x53)
#define KEYP_0 KEY_INS
#define KEYP_1 KEY_END
#define KEYP_2 KEY_DOWNARROW
#define KEYP_3 KEY_PGDN
#define KEYP_4 KEY_LEFTARROW
#define KEYP_5 (0x80+0x4c)
#define KEYP_6 KEY_RIGHTARROW
#define KEYP_7 KEY_HOME
#define KEYP_8 KEY_UPARROW
#define KEYP_9 KEY_PGUP
#define KEYP_DIVIDE '/'
#define KEYP_PLUS '+'
#define KEYP_MINUS '-'
#define KEYP_MULTIPLY '*'
#define KEYP_PERIOD 0
#define KEYP_EQUALS KEY_EQUALS
#define KEYP_ENTER KEY_ENTER
#define SCANCODE_TO_KEYS_ARRAY { \
0, 0, 0, 0, 'a', /* 0-9 */ \
'b', 'c', 'd', 'e', 'f', \
'g', 'h', 'i', 'j', 'k', /* 10-19 */ \
'l', 'm', 'n', 'o', 'p', \
'q', 'r', 's', 't', 'u', /* 20-29 */ \
'v', 'w', 'x', 'y', 'z', \
'1', '2', '3', '4', '5', /* 30-39 */ \
'6', '7', '8', '9', '0', \
KEY_ENTER, KEY_ESCAPE, KEY_BACKSPACE, KEY_TAB, ' ', /* 40-49 */ \
KEY_MINUS, KEY_EQUALS, '[', ']', '\\', \
0, ';', '\'', '`', ',', /* 50-59 */ \
'.', '/', KEY_CAPSLOCK, KEY_F1, KEY_F2, \
KEY_F3, KEY_F4, KEY_F5, KEY_F6, KEY_F7, /* 60-69 */ \
KEY_F8, KEY_F9, KEY_F10, KEY_F11, KEY_F12, \
KEY_PRTSCR, KEY_SCRLCK, KEY_PAUSE, KEY_INS, KEY_HOME, /* 70-79 */ \
KEY_PGUP, KEY_DEL, KEY_END, KEY_PGDN, KEY_RIGHTARROW, \
KEY_LEFTARROW, KEY_DOWNARROW, KEY_UPARROW, /* 80-89 */ \
KEY_NUMLOCK, KEYP_DIVIDE, \
KEYP_MULTIPLY, KEYP_MINUS, KEYP_PLUS, KEYP_ENTER, KEYP_1, \
KEYP_2, KEYP_3, KEYP_4, KEYP_5, KEYP_6, /* 90-99 */ \
KEYP_7, KEYP_8, KEYP_9, KEYP_0, KEYP_PERIOD, \
0, 0, 0, KEYP_EQUALS, /* 100-103 */ \
}
// Default names for keys, to use in English or as fallback.
#define KEY_NAMES_ARRAY { \
{ KEY_BACKSPACE, "BACKSP" }, { KEY_TAB, "TAB" }, \
{ KEY_INS, "INS" }, { KEY_DEL, "DEL" }, \
{ KEY_PGUP, "PGUP" }, { KEY_PGDN, "PGDN" }, \
{ KEY_ENTER, "ENTER" }, { KEY_ESCAPE, "ESC" }, \
{ KEY_F1, "F1" }, { KEY_F2, "F2" }, \
{ KEY_F3, "F3" }, { KEY_F4, "F4" }, \
{ KEY_F5, "F5" }, { KEY_F6, "F6" }, \
{ KEY_F7, "F7" }, { KEY_F8, "F8" }, \
{ KEY_F9, "F9" }, { KEY_F10, "F10" }, \
{ KEY_F11, "F11" }, { KEY_F12, "F12" }, \
{ KEY_HOME, "HOME" }, { KEY_END, "END" }, \
{ KEY_MINUS, "-" }, { KEY_EQUALS, "=" }, \
{ KEY_NUMLOCK, "NUMLCK" }, { KEY_SCRLCK, "SCRLCK" }, \
{ KEY_PAUSE, "PAUSE" }, { KEY_PRTSCR, "PRTSC" }, \
{ KEY_UPARROW, "UP" }, { KEY_DOWNARROW, "DOWN" }, \
{ KEY_LEFTARROW, "LEFT" }, { KEY_RIGHTARROW, "RIGHT" }, \
{ KEY_RALT, "ALT" }, { KEY_LALT, "ALT" }, \
{ KEY_RSHIFT, "SHIFT" }, { KEY_CAPSLOCK, "CAPS" }, \
{ KEY_RCTRL, "CTRL" }, { KEYP_5, "NUM5" }, \
{ ' ', "SPACE" }, \
{ 'a', "A" }, { 'b', "B" }, { 'c', "C" }, { 'd', "D" }, \
{ 'e', "E" }, { 'f', "F" }, { 'g', "G" }, { 'h', "H" }, \
{ 'i', "I" }, { 'j', "J" }, { 'k', "K" }, { 'l', "L" }, \
{ 'm', "M" }, { 'n', "N" }, { 'o', "O" }, { 'p', "P" }, \
{ 'q', "Q" }, { 'r', "R" }, { 's', "S" }, { 't', "T" }, \
{ 'u', "U" }, { 'v', "V" }, { 'w', "W" }, { 'x', "X" }, \
{ 'y', "Y" }, { 'z', "Z" }, { '0', "0" }, { '1', "1" }, \
{ '2', "2" }, { '3', "3" }, { '4', "4" }, { '5', "5" }, \
{ '6', "6" }, { '7', "7" }, { '8', "8" }, { '9', "9" }, \
{ '[', "[" }, { ']', "]" }, { ';', ";" }, { '`', "`" }, \
{ ',', "," }, { '.', "." }, { '/', "/" }, { '\\', "\\" }, \
{ '\'', "\'" }, \
}
#endif // __DOOMKEYS__

38
textscreen/fonts/README Normal file
View File

@ -0,0 +1,38 @@
This directory contains the fonts used by libtextscreen:
* normal.png is the standard DOS font, from the DOSbox project.
Copyright (C) 2002-2004 The DOSBox Team
* small.png contains a miniature, half-size font for low-resolution
displays. This is based on the Atari-Small font by Tom Fine. The
original font was standard ASCII only; this has been extended to the
full Extended ASCII range with scaled-down versions of the full-size
DOS font. Original copyright notice:
Copyright (c) 1999, Thomas A. Fine
License to copy, modify, and distribute for both commercial and
non-commercial use is herby granted, provided this notice
is preserved.
Email to my last name at head.cfa.harvard.edu
http://hea-www.harvard.edu/~fine/
* large.png is a scaled-up version of normal.png with extra detail
added; this is for use on modern high-resolution ("retina") displays.
All modifications and enhancements to the above fonts are:
Copyright (C) 2005-2016 Simon Howard
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

113
textscreen/fonts/codepage.h Normal file
View File

@ -0,0 +1,113 @@
//
// Copyright(C) 2017 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// This file contains a #define macro mapping from the characters
// in the CP437 code page to the equivalent Unicode characters. It
// therefore defines which Unicode characters can be represented on
// a text screen using such a code page.
//
// If you're changing the textscreen font to show a different code
// page, you should update the mapping in this file to match. The
// Wikipedia pages for DOS code pages are a good place to look for
// this information.
#define CODE_PAGE_TO_UNICODE { \
\
/* CP437 control codes: */ \
\
0x0000, 0x263a, 0x263b, 0x2665, /* 00 - 0f */ \
0x2666, 0x2663, 0x2660, 0x2022, \
0x25d8, 0x25cb, 0x25d9, 0x2642, \
0x2640, 0x266a, 0x266b, 0x263c, \
\
0x25ba, 0x25c4, 0x2195, 0x203c, /* 10 - 1f */ \
0x00b6, 0x00a7, 0x25ac, 0x21a8, \
0x2191, 0x2193, 0x2192, 0x2190, \
0x221f, 0x2194, 0x25b2, 0x25bc, \
\
/* Standard ASCII range: */ \
\
0x0020, 0x0021, 0x0022, 0x0023, /* 20 - 2f */ \
0x0024, 0x0025, 0x0026, 0x0027, \
0x0028, 0x0029, 0x002a, 0x002b, \
0x002c, 0x002d, 0x002e, 0x002f, \
\
0x0030, 0x0031, 0x0032, 0x0033, /* 30 - 3f */ \
0x0034, 0x0035, 0x0036, 0x0037, \
0x0038, 0x0039, 0x003a, 0x003b, \
0x003c, 0x003d, 0x003e, 0x003f, \
\
0x0040, 0x0041, 0x0042, 0x0043, /* 40 - 4f */ \
0x0044, 0x0045, 0x0046, 0x0047, \
0x0048, 0x0049, 0x004a, 0x004b, \
0x004c, 0x004d, 0x004e, 0x004f, \
\
0x0050, 0x0051, 0x0052, 0x0053, /* 50 - 5f */ \
0x0054, 0x0055, 0x0056, 0x0057, \
0x0058, 0x0059, 0x005a, 0x005b, \
0x005c, 0x005d, 0x005e, 0x005f, \
\
0x0060, 0x0061, 0x0062, 0x0063, /* 60 - 6f */ \
0x0064, 0x0065, 0x0066, 0x0067, \
0x0068, 0x0069, 0x006a, 0x006b, \
0x006c, 0x006d, 0x006e, 0x006f, \
\
0x0070, 0x0071, 0x0072, 0x0073, /* 70 - 7f */ \
0x0074, 0x0075, 0x0076, 0x0077, \
0x0078, 0x0079, 0x007a, 0x007b, \
0x007c, 0x007d, 0x007e, 0x2302, \
\
/* CP437 Extended ASCII range: */ \
\
0x00c7, 0x00fc, 0x00e9, 0x00e2, /* 80-8f */ \
0x00e4, 0x00e0, 0x00e5, 0x00e7, \
0x00ea, 0x00eb, 0x00e8, 0x00ef, \
0x00ee, 0x00ec, 0x00c4, 0x00c5, \
\
0x00c9, 0x00e6, 0x00c6, 0x00f4, /* 90-9f */ \
0x00f6, 0x00f2, 0x00fb, 0x00f9, \
0x00ff, 0x00d6, 0x00dc, 0x00a2, \
0x00a3, 0x00a5, 0x20a7, 0x0192, \
\
0x00e1, 0x00ed, 0x00f3, 0x00fa, /* a0-af */ \
0x00f1, 0x00d1, 0x00aa, 0x00ba, \
0x00bf, 0x2310, 0x00ac, 0x00bd, \
0x00bc, 0x00a1, 0x00ab, 0x00bb, \
\
0x2591, 0x2592, 0x2593, 0x2502, /* b0-bf */ \
0x2524, 0x2561, 0x2562, 0x2556, \
0x2555, 0x2563, 0x2551, 0x2557, \
0x255d, 0x255c, 0x255b, 0x2510, \
\
0x2514, 0x2534, 0x252c, 0x251c, /* c0-cf */ \
0x2500, 0x253c, 0x255e, 0x255f, \
0x255a, 0x2554, 0x2569, 0x2566, \
0x2560, 0x2550, 0x256c, 0x2567, \
\
0x2568, 0x2564, 0x2565, 0x2559, /* d0-df */ \
0x2558, 0x2552, 0x2553, 0x256b, \
0x256a, 0x2518, 0x250c, 0x2588, \
0x2584, 0x258c, 0x2590, 0x2580, \
\
0x03b1, 0x00df, 0x0393, 0x03c0, /* e0-ef */ \
0x03a3, 0x03c3, 0x00b5, 0x03c4, \
0x03a6, 0x0398, 0x03a9, 0x03b4, \
0x221e, 0x03c6, 0x03b5, 0x2229, \
\
0x2261, 0x00b1, 0x2265, 0x2264, /* f0-ff */ \
0x2320, 0x2321, 0x00f7, 0x2248, \
0x00b0, 0x2219, 0x00b7, 0x221a, \
0x207f, 0x00b2, 0x25a0, 0x00a0, \
}

View File

@ -0,0 +1,104 @@
#!/usr/bin/env python3
#
# Copyright(C) 2016 Simon Howard
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# Converts images into libtextscreen fonts.
#
import sys
import os
import re
GRID_COLUMNS = 16
GRID_ROWS = 16
try:
import Image
except ImportError:
try:
from PIL import Image
except ImportError:
print("WARNING: Could not update %s. "
"Please install the Python Imaging library or Pillow."
% sys.argv[3])
sys.exit(0)
def generate_font_data(filename):
"""Read font data from the given file.
Args:
filename: Image file to read.
Returns:
Tuple containing:
(width, height) dimensions of each font character.
Array of byte data for font.
"""
im = Image.open(filename)
width, height = im.size
assert (width % GRID_COLUMNS) == 0
assert (height % GRID_ROWS) == 0
char_w, char_h = width // GRID_COLUMNS, height // GRID_ROWS
font_data_len = (width * height) // 8
font_data = [0] * font_data_len
for y in range(height):
for x in range(width):
px = im.getpixel((x, y))
if px > (127, 127, 127):
char_x, char_y = x // char_w, y // char_h
x1, y1 = x % char_w, y % char_h
bit_index = (
(char_y * GRID_COLUMNS + char_x) * (char_w * char_h) +
(y1 * char_w) + x1)
font_data[bit_index // 8] |= 1 << (bit_index % 8)
return (char_w, char_h), font_data
def convert_image(font_prefix, filename, output_filename):
"""Convert the given image to a text output file.
Args:
font_prefix: Prefix string to attach to constants.
filename: Input image file to read.
output_filename: Header file to write.
"""
dimensions, data = generate_font_data(filename)
with open(output_filename, "w") as outfile:
outfile.write("/* Font data generated from %s; do not edit.\n"
" Please see textscreen/fonts/README for copyright\n"
" information. */\n\n" % filename)
outfile.write("static const uint8_t %s_font_data[] =\n{\n" %
font_prefix)
for index, b in enumerate(data):
if (index % 8) == 0:
outfile.write(" ")
outfile.write("0x%02x," % b)
if ((index + 1) % 8) == 0:
outfile.write("\n")
else:
outfile.write(" ")
outfile.write("};\n")
outfile.write("\n")
outfile.write("static const txt_font_t %s_font =\n{\n" % font_prefix)
outfile.write(" \"%s\", %s_font_data, %d, %d,\n" % (
font_prefix, font_prefix,
dimensions[0], dimensions[1]))
outfile.write("};\n")
convert_image(sys.argv[1], sys.argv[2], sys.argv[3])

2060
textscreen/fonts/large.h Normal file

File diff suppressed because it is too large Load Diff

BIN
textscreen/fonts/large.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

524
textscreen/fonts/normal.h Normal file
View File

@ -0,0 +1,524 @@
/* Font data generated from normal.png; do not edit.
Please see textscreen/fonts/README for copyright
information. */
static const uint8_t normal_font_data[] =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0x81, 0xbd,
0x99, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7e, 0xff, 0xdb, 0xff, 0xff, 0xc3,
0xe7, 0xff, 0xff, 0x7e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x36, 0x7f, 0x7f, 0x7f,
0x7f, 0x3e, 0x1c, 0x08, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0x1c, 0x3e, 0x7f,
0x3e, 0x1c, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0xe7, 0xe7,
0xe7, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff,
0x7e, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c,
0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xc3,
0xc3, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x42,
0x42, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xc3, 0x99, 0xbd,
0xbd, 0x99, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff,
0x00, 0x00, 0x78, 0x70, 0x58, 0x4c, 0x1e, 0x33,
0x33, 0x33, 0x33, 0x1e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c,
0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xfc, 0xcc, 0xfc, 0x0c, 0x0c, 0x0c,
0x0c, 0x0e, 0x0f, 0x07, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xfe, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6,
0xc6, 0xe6, 0xe7, 0x67, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0x18, 0xdb, 0x3c, 0xe7,
0x3c, 0xdb, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x7f, 0x1f,
0x0f, 0x07, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x40, 0x60, 0x70, 0x78, 0x7c, 0x7f, 0x7c,
0x78, 0x70, 0x60, 0x40, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18,
0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
0x66, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xfe, 0xdb, 0xdb, 0xdb, 0xde, 0xd8,
0xd8, 0xd8, 0xd8, 0xd8, 0x00, 0x00, 0x00, 0x00,
0x00, 0x3e, 0x63, 0x06, 0x1c, 0x36, 0x63, 0x63,
0x36, 0x1c, 0x30, 0x63, 0x3e, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18,
0x7e, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x30, 0x7f,
0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x06, 0x7f,
0x06, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03,
0x03, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x66, 0xff,
0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0x1c, 0x1c, 0x3e,
0x3e, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x3e, 0x3e,
0x1c, 0x1c, 0x08, 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, 0x3c, 0x18, 0x18,
0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x66, 0x66, 0x66, 0x24, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x36, 0x36, 0x7f, 0x36, 0x36,
0x36, 0x7f, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00,
0x18, 0x18, 0x3e, 0x63, 0x43, 0x03, 0x3e, 0x60,
0x60, 0x61, 0x63, 0x3e, 0x18, 0x18, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x43, 0x63, 0x30, 0x18,
0x0c, 0x06, 0x63, 0x61, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1c, 0x36, 0x36, 0x1c, 0x6e, 0x3b,
0x33, 0x33, 0x33, 0x6e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x0c, 0x0c, 0x0c, 0x06, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x0c,
0x0c, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30,
0x30, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0xff,
0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e,
0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x18, 0x18, 0x18, 0x0c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x40, 0x60, 0x30, 0x18,
0x0c, 0x06, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3c, 0x66, 0xc3, 0xc3, 0xdb, 0xdb,
0xc3, 0xc3, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x1c, 0x1e, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3e, 0x63, 0x60, 0x30, 0x18, 0x0c,
0x06, 0x03, 0x63, 0x7f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3e, 0x63, 0x60, 0x60, 0x3c, 0x60,
0x60, 0x60, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x30, 0x38, 0x3c, 0x36, 0x33, 0x7f,
0x30, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7f, 0x03, 0x03, 0x03, 0x3f, 0x60,
0x60, 0x60, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1c, 0x06, 0x03, 0x03, 0x3f, 0x63,
0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7f, 0x63, 0x60, 0x60, 0x30, 0x18,
0x0c, 0x0c, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3e, 0x63, 0x63, 0x63, 0x3e, 0x63,
0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3e, 0x63, 0x63, 0x63, 0x7e, 0x60,
0x60, 0x60, 0x30, 0x1e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
0x00, 0x18, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x0c, 0x06,
0x0c, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00,
0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60,
0x30, 0x18, 0x0c, 0x06, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3e, 0x63, 0x63, 0x30, 0x18, 0x18,
0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x3e, 0x63, 0x63, 0x7b, 0x7b,
0x7b, 0x3b, 0x03, 0x3e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x08, 0x1c, 0x36, 0x63, 0x63, 0x7f,
0x63, 0x63, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3f, 0x66, 0x66, 0x66, 0x3e, 0x66,
0x66, 0x66, 0x66, 0x3f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3c, 0x66, 0x43, 0x03, 0x03, 0x03,
0x03, 0x43, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1f, 0x36, 0x66, 0x66, 0x66, 0x66,
0x66, 0x66, 0x36, 0x1f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7f, 0x66, 0x46, 0x16, 0x1e, 0x16,
0x06, 0x46, 0x66, 0x7f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7f, 0x66, 0x46, 0x16, 0x1e, 0x16,
0x06, 0x06, 0x06, 0x0f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3c, 0x66, 0x43, 0x03, 0x03, 0x7b,
0x63, 0x63, 0x66, 0x5c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x63, 0x63, 0x63, 0x63, 0x7f, 0x63,
0x63, 0x63, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x78, 0x30, 0x30, 0x30, 0x30, 0x30,
0x33, 0x33, 0x33, 0x1e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x67, 0x66, 0x66, 0x36, 0x1e, 0x1e,
0x36, 0x66, 0x66, 0x67, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0f, 0x06, 0x06, 0x06, 0x06, 0x06,
0x06, 0x46, 0x66, 0x7f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc3, 0xe7, 0xff, 0xff, 0xdb, 0xc3,
0xc3, 0xc3, 0xc3, 0xc3, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x63, 0x67, 0x6f, 0x7f, 0x7b, 0x73,
0x63, 0x63, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3e, 0x63, 0x63, 0x63, 0x63, 0x63,
0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3f, 0x66, 0x66, 0x66, 0x3e, 0x06,
0x06, 0x06, 0x06, 0x0f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3e, 0x63, 0x63, 0x63, 0x63, 0x63,
0x63, 0x6b, 0x7b, 0x3e, 0x30, 0x70, 0x00, 0x00,
0x00, 0x00, 0x3f, 0x66, 0x66, 0x66, 0x3e, 0x36,
0x66, 0x66, 0x66, 0x67, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3e, 0x63, 0x63, 0x06, 0x1c, 0x30,
0x60, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0xdb, 0x99, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63,
0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3,
0xc3, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xdb,
0xdb, 0xff, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc3, 0xc3, 0x66, 0x3c, 0x18, 0x18,
0x3c, 0x66, 0xc3, 0xc3, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc3, 0xc3, 0xc3, 0x66, 0x3c, 0x18,
0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0xc3, 0x61, 0x30, 0x18, 0x0c,
0x06, 0x83, 0xc3, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
0x0c, 0x0c, 0x0c, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x0e, 0x1c,
0x38, 0x70, 0x60, 0x40, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30,
0x30, 0x30, 0x30, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x08, 0x1c, 0x36, 0x63, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00,
0x0c, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x30, 0x3e,
0x33, 0x33, 0x33, 0x6e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x07, 0x06, 0x06, 0x1e, 0x36, 0x66,
0x66, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x63, 0x03,
0x03, 0x03, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x38, 0x30, 0x30, 0x3c, 0x36, 0x33,
0x33, 0x33, 0x33, 0x6e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x63, 0x7f,
0x03, 0x03, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1c, 0x36, 0x26, 0x06, 0x0f, 0x06,
0x06, 0x06, 0x06, 0x0f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x33, 0x33,
0x33, 0x33, 0x33, 0x3e, 0x30, 0x33, 0x1e, 0x00,
0x00, 0x00, 0x07, 0x06, 0x06, 0x36, 0x6e, 0x66,
0x66, 0x66, 0x66, 0x67, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x18, 0x00, 0x1c, 0x18, 0x18,
0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x60, 0x60, 0x00, 0x70, 0x60, 0x60,
0x60, 0x60, 0x60, 0x60, 0x66, 0x66, 0x3c, 0x00,
0x00, 0x00, 0x07, 0x06, 0x06, 0x66, 0x36, 0x1e,
0x1e, 0x36, 0x66, 0x67, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1c, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0xff, 0xdb,
0xdb, 0xdb, 0xdb, 0xdb, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x63, 0x63,
0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x66, 0x66,
0x66, 0x66, 0x66, 0x3e, 0x06, 0x06, 0x0f, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x33, 0x33,
0x33, 0x33, 0x33, 0x3e, 0x30, 0x30, 0x78, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x6e, 0x66,
0x06, 0x06, 0x06, 0x0f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x63, 0x06,
0x1c, 0x30, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x08, 0x0c, 0x0c, 0x3f, 0x0c, 0x0c,
0x0c, 0x0c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x33, 0x33,
0x33, 0x33, 0x33, 0x6e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xc3, 0xc3,
0xc3, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xc3, 0xc3,
0xdb, 0xdb, 0xff, 0x66, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0x66, 0x3c,
0x18, 0x3c, 0x66, 0xc3, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x63, 0x63,
0x63, 0x63, 0x63, 0x7e, 0x60, 0x30, 0x1f, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x33, 0x18,
0x0c, 0x06, 0x63, 0x7f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x70, 0x18, 0x18, 0x18, 0x0e, 0x18,
0x18, 0x18, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18,
0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0e, 0x18, 0x18, 0x18, 0x70, 0x18,
0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x6e, 0x3b, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0x1c, 0x36, 0x63,
0x63, 0x63, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3c, 0x66, 0x43, 0x03, 0x03, 0x03,
0x43, 0x66, 0x3c, 0x30, 0x60, 0x3e, 0x00, 0x00,
0x00, 0x00, 0x33, 0x00, 0x00, 0x33, 0x33, 0x33,
0x33, 0x33, 0x33, 0x6e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x30, 0x18, 0x0c, 0x00, 0x3e, 0x63, 0x7f,
0x03, 0x03, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x08, 0x1c, 0x36, 0x00, 0x1e, 0x30, 0x3e,
0x33, 0x33, 0x33, 0x6e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x33, 0x00, 0x00, 0x1e, 0x30, 0x3e,
0x33, 0x33, 0x33, 0x6e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x06, 0x0c, 0x18, 0x00, 0x1e, 0x30, 0x3e,
0x33, 0x33, 0x33, 0x6e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x1c, 0x36, 0x1c, 0x00, 0x1e, 0x30, 0x3e,
0x33, 0x33, 0x33, 0x6e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x06, 0x06,
0x66, 0x3c, 0x30, 0x60, 0x3c, 0x00, 0x00, 0x00,
0x00, 0x08, 0x1c, 0x36, 0x00, 0x3e, 0x63, 0x7f,
0x03, 0x03, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x63, 0x00, 0x00, 0x3e, 0x63, 0x7f,
0x03, 0x03, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x06, 0x0c, 0x18, 0x00, 0x3e, 0x63, 0x7f,
0x03, 0x03, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x66, 0x00, 0x00, 0x1c, 0x18, 0x18,
0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x18, 0x3c, 0x66, 0x00, 0x1c, 0x18, 0x18,
0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x06, 0x0c, 0x18, 0x00, 0x1c, 0x18, 0x18,
0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x63, 0x00, 0x08, 0x1c, 0x36, 0x63, 0x63,
0x7f, 0x63, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00,
0x1c, 0x36, 0x1c, 0x00, 0x1c, 0x36, 0x63, 0x63,
0x7f, 0x63, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00,
0x18, 0x0c, 0x06, 0x00, 0x7f, 0x66, 0x06, 0x3e,
0x06, 0x06, 0x66, 0x7f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0xd8,
0x7e, 0x1b, 0x3b, 0xee, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7c, 0x36, 0x33, 0x33, 0x7f, 0x33,
0x33, 0x33, 0x33, 0x73, 0x00, 0x00, 0x00, 0x00,
0x00, 0x08, 0x1c, 0x36, 0x00, 0x3e, 0x63, 0x63,
0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x63, 0x00, 0x00, 0x3e, 0x63, 0x63,
0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x06, 0x0c, 0x18, 0x00, 0x3e, 0x63, 0x63,
0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x0c, 0x1e, 0x33, 0x00, 0x33, 0x33, 0x33,
0x33, 0x33, 0x33, 0x6e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x06, 0x0c, 0x18, 0x00, 0x33, 0x33, 0x33,
0x33, 0x33, 0x33, 0x6e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x63, 0x00, 0x00, 0x63, 0x63, 0x63,
0x63, 0x63, 0x63, 0x7e, 0x60, 0x30, 0x1e, 0x00,
0x00, 0x63, 0x00, 0x3e, 0x63, 0x63, 0x63, 0x63,
0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x63, 0x00, 0x63, 0x63, 0x63, 0x63, 0x63,
0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x18, 0x18, 0x7e, 0xc3, 0x03, 0x03, 0x03,
0xc3, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x1c, 0x36, 0x26, 0x06, 0x0f, 0x06, 0x06,
0x06, 0x06, 0x67, 0x3f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc3, 0x66, 0x3c, 0x18, 0xff, 0x18,
0xff, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x3f, 0x66, 0x66, 0x3e, 0x46, 0x66, 0xf6,
0x66, 0x66, 0x66, 0xcf, 0x00, 0x00, 0x00, 0x00,
0x00, 0x70, 0xd8, 0x18, 0x18, 0x18, 0x7e, 0x18,
0x18, 0x18, 0x18, 0x18, 0x1b, 0x0e, 0x00, 0x00,
0x00, 0x18, 0x0c, 0x06, 0x00, 0x1e, 0x30, 0x3e,
0x33, 0x33, 0x33, 0x6e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x30, 0x18, 0x0c, 0x00, 0x1c, 0x18, 0x18,
0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x18, 0x0c, 0x06, 0x00, 0x3e, 0x63, 0x63,
0x63, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x18, 0x0c, 0x06, 0x00, 0x33, 0x33, 0x33,
0x33, 0x33, 0x33, 0x6e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x6e, 0x3b, 0x00, 0x3b, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
0x6e, 0x3b, 0x00, 0x63, 0x67, 0x6f, 0x7f, 0x7b,
0x73, 0x63, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00,
0x00, 0x3c, 0x36, 0x36, 0x7c, 0x00, 0x7e, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x1c, 0x36, 0x36, 0x1c, 0x00, 0x3e, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0c, 0x0c, 0x00, 0x0c, 0x0c, 0x06,
0x03, 0x63, 0x63, 0x3e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x03,
0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x60,
0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x03, 0x03, 0x43, 0x63, 0x33, 0x18, 0x0c,
0x06, 0x73, 0xd9, 0x60, 0x30, 0xf8, 0x00, 0x00,
0x00, 0x03, 0x03, 0x43, 0x63, 0x33, 0x18, 0x0c,
0x66, 0x73, 0x69, 0x7c, 0x60, 0x60, 0x00, 0x00,
0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18,
0x3c, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x36, 0x1b,
0x36, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x36, 0x6c,
0x36, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22,
0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22,
0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55,
0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55,
0xbb, 0xee, 0xbb, 0xee, 0xbb, 0xee, 0xbb, 0xee,
0xbb, 0xee, 0xbb, 0xee, 0xbb, 0xee, 0xbb, 0xee,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6f,
0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f,
0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c,
0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x1f,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6f, 0x60, 0x6f,
0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c,
0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c,
0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x60, 0x6f,
0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c,
0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6f, 0x60, 0x7f,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x7f,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0xec,
0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c,
0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0xec, 0x0c, 0xfc,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x0c, 0xec,
0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c,
0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0xef, 0x00, 0xff,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xef,
0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c,
0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0xec, 0x0c, 0xec,
0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c,
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0xef, 0x00, 0xef,
0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c,
0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0xff,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0xff,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c,
0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0xfc,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0xf8,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc,
0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c,
0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0xff,
0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c,
0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0xff,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0,
0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x3b, 0x1b,
0x1b, 0x1b, 0x3b, 0x6e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1e, 0x33, 0x33, 0x33, 0x1b, 0x33,
0x63, 0x63, 0x63, 0x33, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x7f, 0x63, 0x63, 0x03, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x7f, 0x36, 0x36, 0x36,
0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x7f, 0x63, 0x06, 0x0c, 0x18,
0x0c, 0x06, 0x63, 0x7f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x1b, 0x1b,
0x1b, 0x1b, 0x1b, 0x0e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66,
0x66, 0x3e, 0x06, 0x06, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x6e, 0x3b, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x7e, 0x18, 0x3c, 0x66, 0x66,
0x66, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1c, 0x36, 0x63, 0x63, 0x7f,
0x63, 0x63, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1c, 0x36, 0x63, 0x63, 0x63, 0x36,
0x36, 0x36, 0x36, 0x77, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x78, 0x0c, 0x18, 0x30, 0x7c, 0x66,
0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xdb, 0xdb,
0xdb, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xc0, 0x60, 0x7e, 0xdb, 0xdb,
0xcf, 0x7e, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x38, 0x0c, 0x06, 0x06, 0x3e, 0x06,
0x06, 0x06, 0x0c, 0x38, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x3e, 0x63, 0x63, 0x63, 0x63,
0x63, 0x63, 0x63, 0x63, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x7f,
0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18,
0x18, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x60, 0x30,
0x18, 0x0c, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x30, 0x18, 0x0c, 0x06, 0x0c,
0x18, 0x30, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x70, 0xd8, 0xd8, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x1b, 0x1b, 0x1b, 0x0e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x7e,
0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x3b, 0x00,
0x6e, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x1c, 0x36, 0x36, 0x1c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xf0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x37,
0x36, 0x36, 0x3c, 0x38, 0x00, 0x00, 0x00, 0x00,
0x00, 0x1b, 0x36, 0x36, 0x36, 0x36, 0x36, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x0e, 0x1b, 0x0c, 0x06, 0x13, 0x1f, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3e, 0x3e, 0x3e, 0x3e,
0x3e, 0x3e, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static const txt_font_t normal_font =
{
"normal", normal_font_data, 8, 16,
};

BIN
textscreen/fonts/normal.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

140
textscreen/fonts/small.h Normal file
View File

@ -0,0 +1,140 @@
/* Font data generated from small.png; do not edit.
Please see textscreen/fonts/README for copyright
information. */
static const uint8_t small_font_data[] =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x4e, 0x00,
0xf6, 0xf5, 0xb1, 0x6f, 0x00, 0xea, 0x04, 0x00,
0x00, 0xe4, 0x04, 0x00, 0x40, 0xaa, 0xe4, 0x00,
0x40, 0xee, 0xe4, 0x00, 0x00, 0x60, 0x06, 0x00,
0xff, 0x9f, 0xf9, 0xff, 0x00, 0x96, 0x69, 0x00,
0xff, 0x69, 0x96, 0xff, 0xe0, 0x74, 0x75, 0x00,
0x60, 0x69, 0x6f, 0x06, 0xc0, 0x44, 0x74, 0x03,
0xe0, 0xaa, 0xba, 0x03, 0x22, 0x27, 0x27, 0x22,
0x10, 0x73, 0x13, 0x00, 0x80, 0xec, 0x8c, 0x00,
0x40, 0x4e, 0xe4, 0x04, 0xa0, 0xaa, 0xa0, 0x00,
0xf0, 0xb9, 0xaa, 0x00, 0x16, 0x96, 0x86, 0x06,
0x00, 0x00, 0xff, 0x00, 0x40, 0x4e, 0xe4, 0xf4,
0x40, 0x4e, 0x44, 0x04, 0x40, 0x44, 0xe4, 0x04,
0x20, 0xf4, 0x24, 0x00, 0x40, 0xf2, 0x42, 0x00,
0x00, 0x10, 0x07, 0x00, 0x00, 0xf5, 0x05, 0x00,
0x00, 0x72, 0x0f, 0x00, 0x00, 0x7f, 0x02, 0x00,
0x00, 0x00, 0x00, 0x00, 0x20, 0x22, 0x02, 0x02,
0x50, 0x05, 0x00, 0x00, 0x50, 0x57, 0x75, 0x05,
0x22, 0x25, 0x54, 0x22, 0x50, 0x24, 0x12, 0x05,
0x52, 0x52, 0x35, 0x06, 0x20, 0x02, 0x00, 0x00,
0x40, 0x22, 0x22, 0x04, 0x10, 0x22, 0x22, 0x01,
0x50, 0x72, 0x52, 0x00, 0x20, 0x72, 0x22, 0x00,
0x00, 0x00, 0x20, 0x12, 0x00, 0x70, 0x00, 0x00,
0x00, 0x00, 0x20, 0x02, 0x40, 0x24, 0x12, 0x01,
0x20, 0x75, 0x55, 0x02, 0x20, 0x23, 0x22, 0x07,
0x20, 0x45, 0x12, 0x07, 0x70, 0x24, 0x54, 0x02,
0x40, 0x56, 0x47, 0x04, 0x70, 0x31, 0x54, 0x02,
0x60, 0x31, 0x55, 0x02, 0x70, 0x44, 0x22, 0x02,
0x20, 0x25, 0x55, 0x02, 0x20, 0x55, 0x46, 0x03,
0x00, 0x02, 0x20, 0x00, 0x00, 0x02, 0x20, 0x01,
0x00, 0x24, 0x21, 0x04, 0x00, 0x07, 0x07, 0x00,
0x00, 0x21, 0x24, 0x01, 0x20, 0x45, 0x02, 0x02,
0x20, 0x55, 0x11, 0x06, 0x20, 0x55, 0x57, 0x05,
0x30, 0x35, 0x55, 0x03, 0x20, 0x15, 0x51, 0x02,
0x30, 0x55, 0x55, 0x03, 0x70, 0x71, 0x11, 0x07,
0x70, 0x71, 0x11, 0x01, 0x20, 0x15, 0x55, 0x02,
0x50, 0x75, 0x55, 0x05, 0x70, 0x22, 0x22, 0x07,
0x40, 0x44, 0x54, 0x02, 0x50, 0x35, 0x55, 0x05,
0x10, 0x11, 0x11, 0x07, 0x50, 0x57, 0x55, 0x05,
0x40, 0x75, 0x57, 0x01, 0x20, 0x55, 0x55, 0x02,
0x30, 0x55, 0x13, 0x01, 0x20, 0x55, 0x35, 0x06,
0x30, 0x55, 0x53, 0x05, 0x20, 0x25, 0x54, 0x02,
0x70, 0x22, 0x22, 0x02, 0x50, 0x55, 0x55, 0x07,
0x50, 0x55, 0x55, 0x02, 0x50, 0x55, 0x75, 0x05,
0x50, 0x25, 0x55, 0x05, 0x50, 0x25, 0x22, 0x02,
0x70, 0x24, 0x12, 0x07, 0x60, 0x22, 0x22, 0x06,
0x10, 0x21, 0x42, 0x04, 0x30, 0x22, 0x22, 0x03,
0x20, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0,
0x10, 0x02, 0x00, 0x00, 0x00, 0x43, 0x56, 0x06,
0x10, 0x31, 0x55, 0x03, 0x00, 0x16, 0x11, 0x06,
0x40, 0x64, 0x55, 0x06, 0x00, 0x52, 0x17, 0x06,
0x40, 0x72, 0x22, 0x02, 0x00, 0x56, 0x65, 0x34,
0x10, 0x31, 0x55, 0x05, 0x20, 0x30, 0x22, 0x07,
0x40, 0x60, 0x44, 0x34, 0x10, 0x51, 0x53, 0x05,
0x20, 0x22, 0x22, 0x02, 0x00, 0x75, 0x55, 0x05,
0x00, 0x53, 0x55, 0x05, 0x00, 0x52, 0x55, 0x02,
0x00, 0x53, 0x35, 0x11, 0x00, 0x56, 0x65, 0x44,
0x00, 0x16, 0x11, 0x01, 0x00, 0x16, 0x42, 0x03,
0x20, 0x72, 0x22, 0x02, 0x00, 0x55, 0x55, 0x07,
0x00, 0x55, 0x55, 0x02, 0x00, 0x55, 0x75, 0x05,
0x00, 0x55, 0x52, 0x05, 0x00, 0x55, 0x65, 0x34,
0x00, 0x47, 0x12, 0x07, 0x24, 0x12, 0x22, 0x04,
0x22, 0x02, 0x22, 0x02, 0x21, 0x42, 0x22, 0x01,
0xa0, 0x05, 0x00, 0x00, 0x20, 0x55, 0x75, 0x00,
0x20, 0x15, 0x51, 0x32, 0x05, 0x55, 0x55, 0x07,
0x12, 0x52, 0x17, 0x06, 0xa4, 0x43, 0x56, 0x06,
0x05, 0x43, 0x56, 0x06, 0x42, 0x43, 0x56, 0x06,
0x52, 0x42, 0x56, 0x06, 0x00, 0x16, 0x11, 0x36,
0x52, 0x52, 0x17, 0x06, 0x05, 0x52, 0x17, 0x06,
0x42, 0x52, 0x17, 0x06, 0x50, 0x30, 0x22, 0x07,
0x52, 0x30, 0x22, 0x07, 0x42, 0x30, 0x22, 0x07,
0x05, 0x52, 0x57, 0x05, 0x52, 0x52, 0x57, 0x05,
0x24, 0x17, 0x13, 0x07, 0x00, 0xad, 0x5e, 0x0e,
0xe0, 0xf5, 0x55, 0x0d, 0x52, 0x20, 0x55, 0x02,
0x05, 0x52, 0x55, 0x02, 0x42, 0x52, 0x55, 0x02,
0x52, 0x50, 0x55, 0x07, 0x42, 0x50, 0x55, 0x07,
0x05, 0x55, 0x65, 0x34, 0x05, 0x52, 0x55, 0x02,
0x05, 0x55, 0x55, 0x07, 0x20, 0x16, 0x61, 0x02,
0x2c, 0x72, 0x22, 0x0f, 0x50, 0x25, 0x27, 0x02,
0x30, 0x35, 0xd5, 0x05, 0x48, 0xe4, 0x54, 0x02,
0x24, 0x43, 0x56, 0x06, 0x24, 0x30, 0x22, 0x07,
0x12, 0x52, 0x55, 0x02, 0x24, 0x50, 0x55, 0x07,
0x5a, 0x30, 0x55, 0x05, 0x5a, 0x90, 0xdb, 0x09,
0x56, 0x0e, 0x0f, 0x00, 0x52, 0x02, 0x07, 0x00,
0x20, 0x20, 0x51, 0x02, 0x00, 0x70, 0x11, 0x00,
0x00, 0xe0, 0x88, 0x00, 0x11, 0x25, 0x8d, 0xc4,
0x11, 0x25, 0xa1, 0x8e, 0x20, 0x20, 0x22, 0x02,
0x00, 0xa0, 0xa5, 0x00, 0x00, 0x50, 0x5a, 0x00,
0x28, 0x28, 0x28, 0x28, 0x5a, 0x5a, 0x5a, 0x5a,
0xeb, 0xeb, 0xeb, 0xeb, 0x44, 0x44, 0x44, 0x44,
0x44, 0x74, 0x44, 0x44, 0x44, 0x47, 0x47, 0x44,
0xaa, 0xba, 0xaa, 0xaa, 0x00, 0xf0, 0xaa, 0xaa,
0x00, 0x47, 0x47, 0x44, 0xaa, 0x8b, 0xab, 0xaa,
0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x8f, 0xab, 0xaa,
0xaa, 0x8b, 0x0f, 0x00, 0xaa, 0xfa, 0x00, 0x00,
0x44, 0x47, 0x07, 0x00, 0x00, 0x70, 0x44, 0x44,
0x44, 0xc4, 0x00, 0x00, 0x44, 0xf4, 0x00, 0x00,
0x00, 0xf0, 0x44, 0x44, 0x44, 0xc4, 0x44, 0x44,
0x00, 0xf0, 0x00, 0x00, 0x44, 0xf4, 0x44, 0x44,
0x44, 0x4c, 0x4c, 0x44, 0xaa, 0xaa, 0xaa, 0xaa,
0xaa, 0x2a, 0x0e, 0x00, 0x00, 0x2e, 0xaa, 0xaa,
0xaa, 0x0b, 0x0f, 0x00, 0x00, 0x0f, 0xab, 0xaa,
0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x0f, 0x0f, 0x00,
0xaa, 0x0b, 0xab, 0xaa, 0x44, 0x0f, 0x0f, 0x00,
0xaa, 0xfa, 0x00, 0x00, 0x00, 0x0f, 0x4f, 0x44,
0x00, 0xf0, 0xaa, 0xaa, 0xaa, 0xea, 0x00, 0x00,
0x44, 0x4c, 0x0c, 0x00, 0x00, 0x4c, 0x4c, 0x44,
0x00, 0xe0, 0xaa, 0xaa, 0xaa, 0xfa, 0xaa, 0xaa,
0x44, 0x4f, 0x4f, 0x44, 0x44, 0x74, 0x00, 0x00,
0x00, 0xc0, 0x44, 0x44, 0xff, 0xff, 0xff, 0xff,
0x00, 0x00, 0xff, 0xff, 0x33, 0x33, 0x33, 0x33,
0xcc, 0xcc, 0xcc, 0xcc, 0xff, 0xff, 0x00, 0x00,
0x00, 0xa0, 0x55, 0x0a, 0x30, 0x35, 0x95, 0x05,
0xf0, 0x19, 0x11, 0x01, 0x00, 0x5f, 0x55, 0x05,
0x00, 0x17, 0x12, 0x07, 0x00, 0x5e, 0x55, 0x02,
0x00, 0xaa, 0x2e, 0x01, 0x00, 0x5a, 0x44, 0x04,
0x70, 0x52, 0x25, 0x07, 0x20, 0x75, 0x55, 0x02,
0x60, 0x99, 0x66, 0x0f, 0x60, 0x21, 0x55, 0x02,
0x00, 0xd6, 0x6b, 0x00, 0x80, 0x9f, 0xf9, 0x01,
0x60, 0x71, 0x11, 0x06, 0x20, 0x55, 0x55, 0x05,
0x70, 0x70, 0x70, 0x00, 0x20, 0x27, 0x70, 0x00,
0x10, 0x42, 0x12, 0x07, 0x40, 0x12, 0x42, 0x07,
0x80, 0x44, 0x44, 0x44, 0x44, 0x44, 0x25, 0x00,
0x00, 0x02, 0x07, 0x02, 0xa0, 0x05, 0x5a, 0x00,
0x52, 0x02, 0x00, 0x00, 0x00, 0x60, 0x06, 0x00,
0x00, 0x00, 0x02, 0x00, 0x4c, 0x54, 0x46, 0x00,
0x57, 0x55, 0x00, 0x00, 0x43, 0x72, 0x00, 0x00,
0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static const txt_font_t small_font =
{
"small", small_font_data, 4, 8,
};

BIN
textscreen/fonts/small.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

48
textscreen/textscreen.h Normal file
View File

@ -0,0 +1,48 @@
//
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
#ifndef TEXTSCREEN_H
#define TEXTSCREEN_H
#ifdef __cplusplus
extern "C" {
#endif
#include "../src/doomkeys.h"
#include "txt_main.h"
#include "txt_button.h"
#include "txt_checkbox.h"
#include "txt_conditional.h"
#include "txt_desktop.h"
#include "txt_dropdown.h"
#include "txt_fileselect.h"
#include "txt_inputbox.h"
#include "txt_label.h"
#include "txt_radiobutton.h"
#include "txt_scrollpane.h"
#include "txt_separator.h"
#include "txt_spinctrl.h"
#include "txt_strut.h"
#include "txt_table.h"
#include "txt_widget.h"
#include "txt_window_action.h"
#include "txt_window.h"
#ifdef __cplusplus
}
#endif
#endif /* #ifndef TEXTSCREEN_H */

201
textscreen/txt_main.h Normal file
View File

@ -0,0 +1,201 @@
//
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//
// Base interface that abstracts the text mode screen.
//
#ifndef TXT_MAIN_H
#define TXT_MAIN_H
// For the moment, txt_sdl.c is the only implementation of the base
// text mode screen API:
#include "txt_sdl.h"
// textscreen key values:
// Key values are difficult because we have to support multiple conflicting
// address spaces.
// First, Doom's key constants use 0-127 as ASCII and extra values from
// 128-255 to represent special keys. Second, mouse buttons are represented
// as buttons. Finally, we want to be able to support Unicode.
//
// So we define different ranges:
// 0-255: Doom key constants, including ASCII.
// 256-511: Mouse buttons and other reserved.
// >=512: Unicode values greater than 127 are offset up into this range.
// Special keypress values that correspond to mouse button clicks
#define TXT_MOUSE_BASE 256
#define TXT_MOUSE_LEFT (TXT_MOUSE_BASE + 0)
#define TXT_MOUSE_RIGHT (TXT_MOUSE_BASE + 1)
#define TXT_MOUSE_MIDDLE (TXT_MOUSE_BASE + 2)
#define TXT_MOUSE_SCROLLUP (TXT_MOUSE_BASE + 3)
#define TXT_MOUSE_SCROLLDOWN (TXT_MOUSE_BASE + 4)
#define TXT_MAX_MOUSE_BUTTONS 16
#define TXT_KEY_TO_MOUSE_BUTTON(x) \
( (x) >= TXT_MOUSE_BASE \
&& (x) < TXT_MOUSE_BASE + TXT_MAX_MOUSE_BUTTONS ? \
(x) - TXT_MOUSE_BASE : -1 )
// Unicode offset. Unicode values from 128 onwards are offset up into
// this range, so TXT_UNICODE_BASE = Unicode character #128, and so on.
#define TXT_UNICODE_BASE 512
// Convert a key value to a Unicode character:
#define TXT_KEY_TO_UNICODE(x) \
( (x) < 128 ? (x) : \
(x) >= TXT_UNICODE_BASE ? ((x) - TXT_UNICODE_BASE + 128) : 0 )
// Convert a Unicode character to a key value:
#define TXT_UNICODE_TO_KEY(u) \
( (u) < 128 ? (u) : ((u) - 128 + TXT_UNICODE_BASE) )
// Screen size
#define TXT_SCREEN_W 80
#define TXT_SCREEN_H 25
#define TXT_COLOR_BLINKING (1 << 3)
typedef enum
{
TXT_COLOR_BLACK,
TXT_COLOR_BLUE,
TXT_COLOR_GREEN,
TXT_COLOR_CYAN,
TXT_COLOR_RED,
TXT_COLOR_MAGENTA,
TXT_COLOR_BROWN,
TXT_COLOR_GREY,
TXT_COLOR_DARK_GREY,
TXT_COLOR_BRIGHT_BLUE,
TXT_COLOR_BRIGHT_GREEN,
TXT_COLOR_BRIGHT_CYAN,
TXT_COLOR_BRIGHT_RED,
TXT_COLOR_BRIGHT_MAGENTA,
TXT_COLOR_YELLOW,
TXT_COLOR_BRIGHT_WHITE,
} txt_color_t;
// Modifier keys.
typedef enum
{
TXT_MOD_SHIFT,
TXT_MOD_CTRL,
TXT_MOD_ALT,
TXT_NUM_MODIFIERS
} txt_modifier_t;
// Due to the way the SDL API works, we provide different ways of configuring
// how we read input events, each of which is useful in different scenarios.
typedef enum
{
// "Localized" output that takes software keyboard layout into account,
// but key shifting has no effect.
TXT_INPUT_NORMAL,
// "Raw" input; the keys correspond to physical keyboard layout and
// software keyboard layout has no effect.
TXT_INPUT_RAW,
// Used for full text input. Events are fully shifted and localized.
// However, not all keyboard keys will generate input.
// Setting this mode may activate the on-screen keyboard, depending on
// device and OS.
TXT_INPUT_TEXT,
} txt_input_mode_t;
#ifdef __GNUC__
#define PRINTF_ATTR(fmt, first) __attribute__((format(printf, fmt, first)))
#else // __GNUC__
#define PRINTF_ATTR(fmt, first)
#endif // __GNUC__
// Initialize the screen
// Returns 1 if successful, 0 if failed.
int TXT_Init(void);
// Shut down text mode emulation
void TXT_Shutdown(void);
// Get a pointer to the buffer containing the raw screen data.
unsigned char *TXT_GetScreenData(void);
// Update an area of the screen
void TXT_UpdateScreenArea(int x, int y, int w, int h);
// Update the whole screen
void TXT_UpdateScreen(void);
// Set the RGB value for a particular entry in the color palette:
void TXT_SetColor(txt_color_t color, int r, int g, int b);
// Read a character from the keyboard
int TXT_GetChar(void);
// Given a Unicode character, get a character that can be used to represent
// it on the code page being displayed on the screen. If the character cannot
// be represented, this returns -1.
int TXT_UnicodeCharacter(unsigned int c);
// Read the current state of modifier keys that are held down.
int TXT_GetModifierState(txt_modifier_t mod);
// Provides a short description of a key code, placing into the provided
// buffer. Note that the key is assumed to represent a physical key on the
// keyboard (like that returned by TXT_INPUT_RAW), and the resulting string
// takes keyboard layout into consideration. For example,
// TXT_GetKeyDescription('q') on a French keyboard returns "A".
// The contents of the filled buffer will be in UTF-8 format, but will never
// contain characters which can't be shown on the screen.
void TXT_GetKeyDescription(int key, char *buf, size_t buf_len);
// Retrieve the current position of the mouse
void TXT_GetMousePosition(int *x, int *y);
// Sleep until an event is received or the screen needs updating
// Optional timeout in ms (timeout == 0 : sleep forever)
void TXT_Sleep(int timeout);
// Change mode for text input.
void TXT_SetInputMode(txt_input_mode_t mode);
// Set the window title of the window containing the text mode screen
void TXT_SetWindowTitle(const char *title);
// Safe string copy.
void TXT_StringCopy(char *dest, const char *src, size_t dest_len);
// Safe string concatenate.
void TXT_StringConcat(char *dest, const char *src, size_t dest_len);
// Safe version of vsnprintf().
int TXT_vsnprintf(char *buf, size_t buf_len, const char *s, va_list args) PRINTF_ATTR(3, 0);
// Safe version of snprintf().
int TXT_snprintf(char *buf, size_t buf_len, const char *s, ...) PRINTF_ATTR(3, 4);
#endif /* #ifndef TXT_MAIN_H */

1011
textscreen/txt_sdl.c Normal file

File diff suppressed because it is too large Load Diff

43
textscreen/txt_sdl.h Normal file
View File

@ -0,0 +1,43 @@
//
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//
// Text mode emulation in SDL
//
#ifndef TXT_SDL_H
#define TXT_SDL_H
// The textscreen API itself doesn't need SDL; however, SDL needs its
// headers included where main() is defined.
#include "SDL.h"
// Event callback function type: a function of this type can be used
// to intercept events in the textscreen event processing loop.
// Returning 1 will cause the event to be eaten; the textscreen code
// will not see it.
typedef int (*TxtSDLEventCallbackFunc)(SDL_Event *event, void *user_data);
// Set a callback function to call in the SDL event loop. Useful for
// intercepting events. Pass callback=NULL to clear an existing
// callback function.
// user_data is a void pointer to be passed to the callback function.
void TXT_SDL_SetEventCallback(TxtSDLEventCallbackFunc callback, void *user_data);
void TXT_PreInit(SDL_Window *preset_window, SDL_Renderer *preset_renderer);
#endif /* #ifndef TXT_SDL_H */

154
textscreen/txt_utf8.c Normal file
View File

@ -0,0 +1,154 @@
//
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "txt_utf8.h"
// Encode a Unicode character as UTF-8, storing it in the buffer 'p'
// and returning the new, incremented position.
char *TXT_EncodeUTF8(char *p, unsigned int c)
{
if (c < 0x80) // 1 character (ASCII):
{
p[0] = c;
return p + 1;
}
else if (c < 0x800) // 2 character:
{
p[0] = 0xc0 | (c >> 6);
p[1] = 0x80 | (c & 0x3f);
return p + 2;
}
else if (c < 0x10000) // 3 chacater:
{
p[0] = 0xe0 | (c >> 12);
p[1] = 0x80 | ((c >> 6) & 0x3f);
p[2] = 0x80 | (c & 0x3f);
return p + 3;
}
else if (c < 0x200000) // 4 character:
{
p[0] = 0xf0 | (c >> 18);
p[1] = 0x80 | ((c >> 12) & 0x3f);
p[2] = 0x80 | ((c >> 6) & 0x3f);
p[3] = 0x80 | (c & 0x3f);
return p + 4;
}
else
{
// Too big!
return p;
}
}
// Decode UTF-8 character, incrementing *ptr over the decoded bytes.
unsigned int TXT_DecodeUTF8(const char **ptr)
{
const char *p = *ptr;
unsigned int c;
// UTF-8 decode.
if ((*p & 0x80) == 0) // 1 character (ASCII):
{
c = *p;
*ptr += 1;
}
else if ((p[0] & 0xe0) == 0xc0 // 2 character:
&& (p[1] & 0xc0) == 0x80)
{
c = ((p[0] & 0x1f) << 6)
| (p[1] & 0x3f);
*ptr += 2;
}
else if ((p[0] & 0xf0) == 0xe0 // 3 character:
&& (p[1] & 0xc0) == 0x80
&& (p[2] & 0xc0) == 0x80)
{
c = ((p[0] & 0x0f) << 12)
| ((p[1] & 0x3f) << 6)
| (p[2] & 0x3f);
*ptr += 3;
}
else if ((p[0] & 0xf8) == 0xf0 // 4 character:
&& (p[1] & 0xc0) == 0x80
&& (p[2] & 0xc0) == 0x80
&& (p[3] & 0xc0) == 0x80)
{
c = ((p[0] & 0x07) << 18)
| ((p[1] & 0x3f) << 12)
| ((p[2] & 0x3f) << 6)
| (p[3] & 0x3f);
*ptr += 4;
}
else
{
// Decode failure.
// Don't bother with 5/6 byte sequences.
c = 0;
}
return c;
}
// Count the number of characters in a UTF-8 string.
unsigned int TXT_UTF8_Strlen(const char *s)
{
const char *p;
unsigned int result = 0;
unsigned int c;
for (p = s; *p != '\0';)
{
c = TXT_DecodeUTF8(&p);
if (c == 0)
{
break;
}
++result;
}
return result;
}
// Skip past the first n characters in a UTF-8 string.
char *TXT_UTF8_SkipChars(const char *s, unsigned int n)
{
unsigned int i;
const char *p;
p = s;
for (i = 0; i < n; ++i)
{
if (TXT_DecodeUTF8(&p) == 0)
{
break;
}
}
return (char *) p;
}

26
textscreen/txt_utf8.h Normal file
View File

@ -0,0 +1,26 @@
//
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
#ifndef TXT_UTF8_H
#define TXT_UTF8_H
#include <stdarg.h>
char *TXT_EncodeUTF8(char *p, unsigned int c);
unsigned int TXT_DecodeUTF8(const char **ptr);
unsigned int TXT_UTF8_Strlen(const char *s);
char *TXT_UTF8_SkipChars(const char *s, unsigned int n);
#endif /* #ifndef TXT_UTF8_H */