Removed fonteditor, it was never ever used

This commit is contained in:
Sergii Pylypenko
2013-03-20 16:08:29 +02:00
parent 121a3ae133
commit aaefca9f02
12 changed files with 8 additions and 487 deletions

View File

@@ -19,6 +19,8 @@ CompatibilityHacksTextInputEmulatesHwKeyboard=n
CompatibilityHacksPreventAudioChopping=n
CompatibilityHacksAppIgnoresAudioBufferSize=n
CompatibilityHacksAdditionalPreloadedSharedLibraries=""
CompatibilityHacksSlowCompatibleEventQueue=n
CompatibilityHacksTouchscreenKeyboardSaveRestoreOpenGLState=
AppUsesMouse=y
AppNeedsTwoButtonMouse=y
ShowMouseCursor=n
@@ -29,11 +31,13 @@ AppUsesJoystick=y
AppUsesAccelerometer=y
AppUsesGyroscope=y
AppUsesMultitouch=y
AppRecordsAudio=n
NonBlockingSwapBuffers=n
RedefinedKeys="SPACE RETURN NO_REMAP NO_REMAP SPACE ESCAPE"
AppTouchscreenKeyboardKeysAmount=6
AppTouchscreenKeyboardKeysAmountAutoFire=0
RedefinedKeysScreenKb="0 1 2 3 4 5 6 7 8 9"
RedefinedKeysScreenKbNames="0 1 2 3 4 5 6 7 8 9"
StartupMenuButtonTimeout=3000
HiddenMenuOptions='OptionalDownloadConfig'
FirstStartMenuOptions=''
@@ -43,7 +47,7 @@ AppVersionCode=101
AppVersionName="1.01"
ResetSdlConfigForThisVersion=n
DeleteFilesOnUpgrade="%"
CompiledLibraries="sdl_mixer sdl_image"
CompiledLibraries="sdl_image"
CustomBuildScript=n
AppCflags='-O2 -finline-functions'
AppLdflags=''

View File

@@ -553,6 +553,8 @@ int main(int argc, char* argv[])
memset(screenjoy, 0, sizeof(screenjoy));
memset(gamepads, 0, sizeof(gamepads));
__android_log_print(ANDROID_LOG_INFO, "Ballfield", "sizeof(int) %d long %d long long %d size_t %d", sizeof(int), sizeof(long), sizeof(long long), sizeof(size_t));
while(1)
{
SDL_Rect r;

View File

@@ -1,2 +0,0 @@
editor

View File

@@ -1,9 +0,0 @@
all: editor editor.exe
editor: *.cpp
g++ -g3 -o $@ $? `sdl-config --cflags` `sdl-config --libs`
editor.exe: *.cpp
i586-mingw32msvc-g++ -o $@ $? -I ../sdl-1.2/include -L. -lSDL
i586-mingw32msvc-strip $@

Binary file not shown.

View File

@@ -1,344 +0,0 @@
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <SDL.h>
#include <vector>
#include <algorithm>
#include <string>
const char * fname = "touchscreenfont.h";
struct font_line_t { Uint8 x1, y1, x2, y2; };
std::vector< std::vector<font_line_t> > font;
enum { DRAWAREA = 512, BORDERAREA = 10 };
int currentChar = 0;
int drawX, drawY, drawStarted = 0;
void load()
{
FILE * ff = fopen(fname, "r");
if(!ff)
return;
std::string s;
char buf[32];
int readed = 0;
while( ( readed = fread(buf, 1, sizeof(buf), ff) ) > 0 )
{
s.append(buf, readed);
}
fclose(ff);
font.clear();
std::string::size_type f;
f = s.find("FONT_MAX_LINES_PER_CHAR =");
f = s.find("=", f) + 1;
int maxLines = atoi(s.c_str() + f);
f = s.find("font_line_t font[", f);
f = s.find("[", f) + 1;
int numChars = atoi(s.c_str() + f);
for(int i = 0; i < numChars; i++)
{
font.push_back( std::vector<font_line_t>() );
for( int ii = 0; ii < maxLines; ii++ )
{
font_line_t line;
f = s.find("\t\t{ ", f) + 4;
line.x1 = atoi(s.c_str() + f);
f = s.find(",", f) + 1;
line.y1 = atoi(s.c_str() + f);
f = s.find(",", f) + 1;
line.x2 = atoi(s.c_str() + f);
f = s.find(",", f) + 1;
line.y2 = atoi(s.c_str() + f);
if( line.x1 > 0 && line.y1 > 0 && line.x2 > 0 && line.y2 > 0 )
font.back().push_back(line);
};
};
if(font.size() == 0)
font.resize(1);
}
void save()
{
FILE * ff = fopen(fname, "w");
fprintf(ff, "/* This file should be edited using Touchscreen Editor utility */\n");
fprintf(ff, "#ifndef _TOUCHSCREENFONT_H_\n#define _TOUCHSCREENFONT_H_\n");
fprintf(ff, "#include <SDL_types.h>\n");
fprintf(ff, "typedef struct font_line_t { Uint8 x1, y1, x2, y2; } font_line_t;\n");
int maxLines = 0;
for( size_t i = 0; i < font.size(); i++ )
if( maxLines < font[i].size() )
maxLines = font[i].size();
fprintf(ff, "enum { FONT_MAX_LINES_PER_CHAR = %i };\n", maxLines);
fprintf(ff, "static font_line_t font[%d][FONT_MAX_LINES_PER_CHAR] = {\n", (int)font.size());
for( size_t i = 0; i < font.size(); i++ )
{
fprintf(ff, "\t{\n");
for( size_t ii = 0; ii < maxLines; ii++ )
{
fprintf(ff, "\t\t{ ");
if( ii < font[i].size() )
fprintf(ff, "%3d, %3d, %3d, %3d",
(int)font[i][ii].x1,
(int)font[i][ii].y1,
(int)font[i][ii].x2,
(int)font[i][ii].y2 );
else
fprintf(ff, " 0, 0, 0, 0");
fprintf(ff, " }%s\n", ii + 1 < maxLines ? "," : "" );
}
fprintf(ff, "\t}%s\n", i + 1 < font.size() ? "," : "" );
}
fprintf(ff, "};\n");
fprintf(ff, "#endif\n");
fclose(ff);
}
void DrawLine(SDL_Surface * bmp, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint32 color)
{
int dx = x2-x1;
int dy = y2-y1;
int i1, i2;
int x, y;
int dd;
Uint16 d = color;
#define proc( bmp, x, y, d ) * (Uint16 *)( ((Uint8 *)bmp->pixels) + bmp->pitch * (y) + (x) * 2 ) = d
/* worker macro */
#define DO_LINE(pri_sign, pri_c, pri_cond, sec_sign, sec_c, sec_cond) \
{ \
if (d##pri_c == 0) { \
proc(bmp, x1, y1, d); \
return; \
} \
\
i1 = 2 * d##sec_c; \
dd = i1 - (sec_sign (pri_sign d##pri_c)); \
i2 = dd - (sec_sign (pri_sign d##pri_c)); \
\
x = x1; \
y = y1; \
\
while (pri_c pri_cond pri_c##2) { \
proc(bmp, x, y, d); \
\
if (dd sec_cond 0) { \
sec_c sec_sign##= 1; \
dd += i2; \
} \
else \
dd += i1; \
\
pri_c pri_sign##= 1; \
} \
}
if (dx >= 0) {
if (dy >= 0) {
if (dx >= dy) {
/* (x1 <= x2) && (y1 <= y2) && (dx >= dy) */
DO_LINE(+, x, <=, +, y, >=);
}
else {
/* (x1 <= x2) && (y1 <= y2) && (dx < dy) */
DO_LINE(+, y, <=, +, x, >=);
}
}
else {
if (dx >= -dy) {
/* (x1 <= x2) && (y1 > y2) && (dx >= dy) */
DO_LINE(+, x, <=, -, y, <=);
}
else {
/* (x1 <= x2) && (y1 > y2) && (dx < dy) */
DO_LINE(-, y, >=, +, x, >=);
}
}
}
else {
if (dy >= 0) {
if (-dx >= dy) {
/* (x1 > x2) && (y1 <= y2) && (dx >= dy) */
DO_LINE(-, x, >=, +, y, >=);
}
else {
/* (x1 > x2) && (y1 <= y2) && (dx < dy) */
DO_LINE(+, y, <=, -, x, <=);
}
}
else {
if (-dx >= -dy) {
/* (x1 > x2) && (y1 > y2) && (dx >= dy) */
DO_LINE(-, x, >=, -, y, <=);
}
else {
/* (x1 > x2) && (y1 > y2) && (dx < dy) */
DO_LINE(-, y, >=, -, x, <=);
}
}
}
#undef DO_LINE
};
void draw()
{
SDL_FillRect(SDL_GetVideoSurface(), NULL, 0);
SDL_LockSurface(SDL_GetVideoSurface());
if( font.size() > currentChar )
{
for( int i = 0; i < font[currentChar].size(); i++ )
{
DrawLine( SDL_GetVideoSurface(), font[currentChar][i].x1 * 2, font[currentChar][i].y1 * 2,
font[currentChar][i].x2 * 2, font[currentChar][i].y2 * 2, 0xffff );
}
}
if( drawStarted )
{
int x, y;
SDL_GetMouseState(&x, &y);
if( x/2 < DRAWAREA && y/2 < DRAWAREA )
DrawLine( SDL_GetVideoSurface(), (x/2)*2, (y/2)*2, drawX*2, drawY*2, 0x9999 );
}
DrawLine( SDL_GetVideoSurface(), DRAWAREA, 0, DRAWAREA, DRAWAREA, 0x4444 );
for( int i = 0; i < font.size(); i++ )
{
DrawLine( SDL_GetVideoSurface(), DRAWAREA, i * 4,
DRAWAREA + ( font[i].size() < BORDERAREA - 1 ? font[i].size() : BORDERAREA - 1 ), i * 4, 0x7777 );
}
DrawLine( SDL_GetVideoSurface(), DRAWAREA, currentChar * 4, DRAWAREA + BORDERAREA - 1, currentChar * 4, 0xAAAA );
DrawLine( SDL_GetVideoSurface(), DRAWAREA, currentChar * 4 + 1, DRAWAREA + BORDERAREA - 1, currentChar * 4 + 1, 0xAAAA );
DrawLine( SDL_GetVideoSurface(), DRAWAREA, font.size() * 4, DRAWAREA + BORDERAREA - 1, font.size() * 4, 0x5555 );
SDL_UnlockSurface(SDL_GetVideoSurface());
SDL_Flip(SDL_GetVideoSurface());
}
int
main(int argc, char *argv[])
{
int width = DRAWAREA + BORDERAREA;
int height = DRAWAREA;
SDL_Surface *screen;
int done;
Uint8 *keys;
SDL_Init(SDL_INIT_VIDEO);
screen = SDL_SetVideoMode(width, height, 16, SDL_DOUBLEBUF);
if ( ! screen ) {
fprintf(stderr, "Couldn't set video mode: %s\n", SDL_GetError());
SDL_Quit();
exit(2);
}
SDL_WM_SetCaption("Touchscreen keyboard font editor", "Touchscreen keyboard font editor");
if(font.size() == 0)
font.resize(1);
load();
done = 0;
while ( ! done ) {
SDL_Event event;
while ( SDL_PollEvent(&event) ) {
switch(event.type) {
case SDL_QUIT:
done = 1;
break;
case SDL_MOUSEBUTTONDOWN:
if( event.button.x < DRAWAREA )
{
if (event.button.button == SDL_BUTTON_LEFT)
{
if( !drawStarted )
{
drawStarted = 1;
drawX = event.button.x/2;
drawY = event.button.y/2;
}
else
{
drawStarted = 0;
font_line_t line;
line.x1 = drawX;
line.y1 = drawY;
line.x2 = event.button.x/2;
line.y2 = event.button.y/2;
font[currentChar].push_back(line);
}
}
else
{
if(font[currentChar].size() > 0)
font[currentChar].pop_back();
}
}
else
{
if (event.button.button == SDL_BUTTON_LEFT)
{
currentChar = event.button.y / 4;
if(font.size() <= currentChar)
font.resize(currentChar + 1);
}
else
{
currentChar = event.button.y / 4;
font.resize(currentChar + 1);
}
}
break;
}
}
#if SDL_VERSION_ATLEAST(1,3,0)
keys = SDL_GetKeyboardState(NULL);
if ( keys[SDL_SCANCODE_ESCAPE] ) {
done = 1;
}
#else
keys = SDL_GetKeyState(NULL);
if ( keys[SDLK_ESCAPE] ) {
done = 1;
}
#endif
draw();
};
save();
SDL_Quit();
return 0;
}
#ifdef WIN32
#include <windows.h>
int CALLBACK WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow
)
{
return main(0, NULL);
};
#endif

Binary file not shown.

Binary file not shown.

View File

@@ -1,41 +0,0 @@
# libSDL.la - a libtool library file
# Generated by ltmain.sh (GNU libtool) 2.2.6
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname='../bin/SDL.dll'
# Names of this library.
library_names='libSDL.dll.a'
# The name of the static archive.
old_library='libSDL.a'
# Linker flags that can not go in dependency_libs.
inherited_linker_flags=''
# Libraries that this one depends upon.
dependency_libs=' -luser32 -lgdi32 -lwinmm -ldxguid'
# Names of additional weak libraries provided by this library
weak_library_names=''
# Version information for libSDL.
current=11
age=11
revision=3
# Is this an already installed library?
installed=yes
# Should we warn about portability when linking against -modules?
shouldnotlink=no
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='/usr/local/lib'

View File

@@ -1,3 +0,0 @@
Left-click puts line, right-click removes last line.
Click on the right side of editor window to select different symbol to edit.

View File

@@ -1,86 +0,0 @@
/* This file should be edited using Touchscreen Editor utility */
#ifndef _TOUCHSCREENFONT_H_
#define _TOUCHSCREENFONT_H_
#include <SDL_types.h>
typedef struct font_line_t { Uint8 x1, y1, x2, y2; } font_line_t;
enum { FONT_MAX_LINES_PER_CHAR = 5 };
static font_line_t font[11][FONT_MAX_LINES_PER_CHAR] = {
{
{ 27, 136, 182, 136 },
{ 27, 136, 94, 104 },
{ 27, 136, 89, 162 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 }
},
{
{ 192, 123, 61, 123 },
{ 150, 103, 192, 123 },
{ 192, 123, 155, 144 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 }
},
{
{ 118, 43, 118, 188 },
{ 118, 43, 131, 88 },
{ 118, 43, 104, 87 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 }
},
{
{ 122, 45, 122, 200 },
{ 122, 200, 138, 156 },
{ 122, 200, 106, 158 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 }
},
{
{ 75, 78, 201, 183 },
{ 198, 66, 86, 193 },
{ 61, 135, 220, 128 },
{ 135, 59, 145, 199 },
{ 0, 0, 0, 0 }
},
{
{ 60, 200, 126, 50 },
{ 126, 50, 172, 199 },
{ 172, 199, 46, 85 },
{ 46, 85, 199, 85 },
{ 199, 85, 60, 200 }
},
{
{ 77, 204, 132, 64 },
{ 132, 64, 175, 200 },
{ 175, 200, 76, 204 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 }
},
{
{ 74, 190, 74, 73 },
{ 74, 73, 189, 74 },
{ 189, 74, 189, 180 },
{ 189, 180, 74, 190 },
{ 0, 0, 0, 0 }
},
{
{ 127, 56, 127, 116 },
{ 69, 119, 186, 115 },
{ 94, 140, 161, 138 },
{ 114, 162, 138, 161 },
{ 0, 0, 0, 0 }
},
{
{ 121, 77, 81, 126 },
{ 81, 126, 119, 178 },
{ 119, 178, 160, 127 },
{ 160, 127, 121, 77 },
{ 0, 0, 0, 0 }
},
{
{ 185, 81, 75, 81 },
{ 75, 81, 124, 158 },
{ 124, 158, 185, 81 },
{ 180, 158, 74, 158 },
{ 0, 0, 0, 0 }
}
};
#endif