añadida utilidad builtinfont

This commit is contained in:
Gabriel Lorenzo 2005-01-25 13:23:16 +00:00
parent 757d0ac203
commit 0db3b3d55f
8 changed files with 344 additions and 23 deletions

View file

@ -1,7 +1,8 @@
/*
* eDiv Compiler
* Copyleft (C) 2000-2002 Sion Entertainment
* http://www.sion-e.com
* Copyleft (C) 2000-2003 Sion Ltd.
* Copyleft (C) 2005 eDIV Team
* http://ediv.divsite.net
*
* 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
@ -18,14 +19,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _WIN32
#error Este archivo aun NO ha sido portado a otras plataformas.
#endif
#include <windows.h>
#include <stdio.h>
#include <io.h>
#include <fcntl.h>
#include <stdlib.h>
#include <SDL/SDL.h>
@ -62,7 +57,7 @@ int main(int argc, char* argv[])
none[1] = *(px + 1);
none[2] = *(px + 2);
// Colo trasparente ( Fila 1, Columna1, corresponde al caracter 0 )
// Color transparente ( Fila 1, Columna1, corresponde al caracter 0 )
tras[0] = *(px + imagen->pitch + 3 + 0);
tras[1] = *(px + imagen->pitch + 3 + 1);
tras[2] = *(px + imagen->pitch + 3 + 2);

View file

@ -1,9 +1,10 @@
<?xml version="1.0" encoding = "Windows-1252"?>
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.00"
Version="7.10"
Name="bmp2fnt"
ProjectGUID="{CDA8C3EC-7C1F-4427-B7B2-DDAE02F18D52}"
RootNamespace="bmp2fnt"
Keyword="Win32Proj">
<Platforms>
<Platform
@ -22,7 +23,7 @@
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="5"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
@ -51,8 +52,14 @@
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
@ -97,10 +104,18 @@
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"

View file

@ -0,0 +1,138 @@
/*
* eDiv Compiler
* Copyleft (C) 2000-2003 Sion Ltd.
* Copyleft (C) 2005 eDIV Team
* http://ediv.divsite.net
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* @file builtinfont.c
* Convierte una fuente en bmp (8bpp) de 6x8 en un .h para poderse usar como
* fuente de sistema ( 0) en el stub.
* NOTA: Este programa es menos indulgente que el de Riseven leyendo los .bmp :p
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <SDL/SDL.h>
typedef unsigned char byte;
void ayuda()
{
printf("Modo de uso: builtinfont <fuente.bmp>\n");
exit(EXIT_FAILURE);
}
int main(int argc, char* argv[])
{
FILE *fp;
byte trans;
byte *px;
SDL_Surface *imagen ;
int i, x, y, pos=0;
unsigned char fuente[256*8];
char nombre[256];
char nombreh[256];
if(argc<2)
ayuda();
imagen = SDL_LoadBMP(argv[1]);
if(imagen==NULL) {
printf("No se ha podido abrir: %s\n",argv[1]);
ayuda();
}
SDL_LockSurface(imagen);
px = (byte*)imagen->pixels+imagen->pitch+1;
// Color transparente ( Fila 1, Columna1, corresponde al caracter 0 )
trans = *px;
for(i=0;i<256;i++) {
for(y=0;y<8;y++) {
fuente[pos]=0;
for(x=0;x<6;x++) {
if(*px!=trans)
fuente[pos]|=1<<x;
px++;
}
px+=imagen->pitch-6;
pos++;
}
px+=(-imagen->pitch*8)+7;
}
SDL_UnlockSurface( imagen );
SDL_FreeSurface(imagen);
// Descomentarizar esto para ver el resultado en la consola
/*pos=0;
for(i=0;i<256;i++) {
for(y=0;y<8;y++) {
for(x=0;x<6;x++) {
if(fuente[pos]&(1<<x))
printf("X");
else
printf(".");
}
printf("\n");
pos++;
}
getchar();
}
exit(EXIT_SUCCESS);*/
// Hace un bin2h de fuente[]
sscanf(argv[1],"%[^.]",nombre);
strcpy(nombreh,nombre);
strcat(nombreh,".h");
fp=fopen(nombreh,"w");
if(fp==NULL) {
printf("Error al crear %s\n",nombreh);
exit(EXIT_FAILURE);
}
fprintf(fp,"/**\n * @file %s\n * Definición de la fuente %s (generado por builtinfont)\n */\n\n",nombreh,nombre);
fprintf(fp,"#ifndef __EDIV__%s_h__\n#define __EDIV__%s_h__\n\n",nombre,nombre);
fprintf(fp,"static unsigned char %s[256*8] = {\n",nombre);
x=0;
for(i=0;i<256*8;i++) {
if(i<256*8-1)
fprintf(fp,"%d,",fuente[i]);
else
fprintf(fp,"%d",fuente[i]);
x++;
if(x==30) {
fprintf(fp,"\n");
x=0;
}
}
fprintf(fp,"\n};\n\n#endif /*__EDIV__%s_h__*/\n",nombre);
fclose(fp);
printf("Creado %s\n",nombreh);
exit (EXIT_SUCCESS);
}

View file

@ -0,0 +1,133 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="builtinfont"
ProjectGUID="{9D6375EE-E50C-4C9D-81EE-B92E51D7C2AD}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="../../bin"
IntermediateDirectory="Debug"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="sdlmain.lib sdl.lib"
OutputFile="$(OutDir)/builtinfont.exe"
LinkIncremental="2"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/builtinfont.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="4"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/builtinfont.exe"
LinkIncremental="1"
GenerateDebugInformation="TRUE"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath=".\builtinfont.c">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -284,7 +284,7 @@ void situame(char* actual, char* ant, char* sig, char* sup)
}
if(!sw) {
printf("Error: no se encuentra directiva <%index%> en index.dok\n");
printf("Error: no se encuentra directiva <%%index%%> en index.dok\n");
exit(16);
}
@ -508,7 +508,7 @@ void procesa_subindice(char* actual)
}
if(!sw) {
printf("Error: no se encuentra directiva <%index%> en index.dok\n");
printf("Error: no se encuentra directiva <%%index%%> en index.dok\n");
exit(22);
}

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding = "Windows-1252"?>
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.00"
Version="7.10"
Name="doku"
ProjectGUID="{729B5997-F7D8-446A-AE12-6E4E801B323D}"
Keyword="Win32Proj">
@ -49,8 +49,14 @@
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
@ -94,10 +100,18 @@
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding = "Windows-1252"?>
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.00"
Version="7.10"
Name="iconchanger"
ProjectGUID="{97770962-E34D-47AB-AD97-F1BECDD66601}"
Keyword="Win32Proj">
@ -49,8 +49,14 @@
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
@ -94,10 +100,18 @@
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"

View file

@ -1,16 +1,24 @@
Microsoft Visual Studio Solution File, Format Version 7.00
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bmp2fnt", "..\bmp2fnt\win32\bmp2fnt.vcproj", "{CDA8C3EC-7C1F-4427-B7B2-DDAE02F18D52}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "doku", "..\doku\win32\doku.vcproj", "{729B5997-F7D8-446A-AE12-6E4E801B323D}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "iconchanger", "..\iconchanger\win32\iconchanger.vcproj", "{97770962-E34D-47AB-AD97-F1BECDD66601}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "builtinfont", "..\builtinfont\builtinfont.vcproj", "{9D6375EE-E50C-4C9D-81EE-B92E51D7C2AD}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
ConfigName.0 = Debug
ConfigName.1 = Release
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
Debug = Debug
Release = Release
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{CDA8C3EC-7C1F-4427-B7B2-DDAE02F18D52}.Debug.ActiveCfg = Debug|Win32
@ -25,6 +33,10 @@ Global
{97770962-E34D-47AB-AD97-F1BECDD66601}.Debug.Build.0 = Debug|Win32
{97770962-E34D-47AB-AD97-F1BECDD66601}.Release.ActiveCfg = Release|Win32
{97770962-E34D-47AB-AD97-F1BECDD66601}.Release.Build.0 = Release|Win32
{9D6375EE-E50C-4C9D-81EE-B92E51D7C2AD}.Debug.ActiveCfg = Debug|Win32
{9D6375EE-E50C-4C9D-81EE-B92E51D7C2AD}.Debug.Build.0 = Debug|Win32
{9D6375EE-E50C-4C9D-81EE-B92E51D7C2AD}.Release.ActiveCfg = Release|Win32
{9D6375EE-E50C-4C9D-81EE-B92E51D7C2AD}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection