Dev - C++ - ayuda fuentes modo grafico

 
Vista:

ayuda fuentes modo grafico

Publicado por Irvin (1 intervención) el 18/11/2014 19:50:03
hola lo que hice fue dibujar mis propias fuentes y ahora lo que necesito es que compare mis letras con caracteres y los exporte en un archivo txt.

ejemplo escribo AYUDA en modo grafico con mis fuentes y debe exportar en el txt AYUDA
aqui mi avance


#include <cstdlib>
#include <iostream>
#include <math.h>
#include <graphics.h>
#include <conio.h>
#include <stdio.h>
#include <string.h>
#include <fstream>
using namespace std;
void punto(int x, int y, int color)
{
putpixel(x,y,color);

}
void graficaletra (int x, int y, int color, char *abcd)
{

int i,k;
for (i=0;i<8;i++)
for(k=0;k<8;k++)
if (abcd[i]&1<<k)
punto(x+8-k,y+i,color);
}
void rec_letra(int x, int y, char *rc)
{
char letra [8]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};
int i,j, color;
for(j=0; j<8; j++)
for (i=0; i<8; i++)
{
color= getpixel(x+8-i, y+j);
if(color !=0)
letra[j]=letra[j]|(i<<i);
}
rc = letra;
}



void escribe ()
{

char abcd[]={ 0x30, 0x78, 0xCC, 0xCC, 0xFC, 0xCC, 0xCC, 0x00,0xFC, 0x66, 0x66, 0x7C, 0x66, 0x66, 0xFC, 0x00,0x3C, 0x66, 0xC0, 0xC0, 0xC0, 0x66, 0x3C, 0x00, 0xF8, 0x6C, 0x66, 0x66, 0x66, 0x6C, 0xF8, 0x00,0xFE, 0x62, 0x68, 0x78, 0x68, 0x62, 0xFE, 0x00,0xFE, 0x62, 0x68, 0x78, 0x68, 0x60, 0xF0, 0x00,0x3C, 0x66, 0xC0, 0xC0, 0xCE, 0x66, 0x3A, 0x00,0xCC, 0xCC, 0xCC, 0xFC, 0xCC, 0xCC, 0xCC, 0x00,0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00,0x1E, 0x0C, 0x0C, 0x0C, 0xCC, 0xCC, 0x78, 0x00,0xE6, 0x66, 0x6C, 0x78, 0x6C, 0x66, 0xE6, 0x00,0xF0, 0x60, 0x60, 0x60, 0x62, 0x66, 0xFE, 0x00,0xC6, 0xEE, 0xFE, 0xFE, 0xD6, 0xC6, 0xC6, 0x00,0xC6, 0xE6, 0xF6, 0xDE, 0xCE, 0xC6, 0xC6, 0x00,0x38, 0x6C, 0xC6, 0xC6, 0xC6, 0x6C, 0x38, 0x00,0xFC, 0x66, 0x66, 0x7C, 0x60, 0x60, 0xF0, 0x00,0x7C, 0xC6, 0xC6, 0xC6, 0xD6, 0x7C, 0x0E, 0x00,0xFC, 0x66, 0x66, 0x7C, 0x6C, 0x66, 0xE6, 0x00,0x7C, 0xC6, 0xE0, 0x78, 0x0E, 0xC6, 0x7C, 0x00,0xFC, 0xB4, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00,0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xFC, 0x00,0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x00,0xC6, 0xC6, 0xC6, 0xC6, 0xD6, 0xFE, 0x6C, 0x00,0xC6, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0xC6, 0x00,0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x30, 0x78, 0x00,0xFE, 0xC6, 0x8C, 0x18, 0x32, 0x66, 0xFE, 0x00,};
char t, temp[8];

int i,j=0;





do{
if(kbhit())
{


t=getch();
for(i=0;i<8;i++)
temp[i]=abcd[(t-65)*8+i];
graficaletra(100+8*j,100,15,temp);


j++;





}



}
while(t!=13);

}




int main(int argc, char *argv[])
{



initwindow(300,300);
outtextxy(80,20,"= INGRESA TEXTO =");
escribe();
system("PAUSE");
return EXIT_SUCCESS;







}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder