-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSpyFonts.h
123 lines (104 loc) · 2.32 KB
/
SpyFonts.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#pragma once
#include <stdio.h>
#define UNO 1 //Solo lee un byte de ancho cada font
#define DOS 2 //lee dos bytes de ancho
//define PIXELSIZE 2 //tamaño del pixel representado
#define UNDO_MAX 10
int pixelSize = 2;
const int screenWidth = 1024;
const int screenHeight = 600;
bool MainWindowActive = true;
bool HelpWindowActive = true;
typedef struct
{
int w; //ancho en bytes
int h; //alto
}fontattr_t;
typedef struct
{
long position;
long size;
FILE* fileHandle;
char name[128];
}file_t;
typedef struct
{
int position[UNDO_MAX];
unsigned char byte[UNDO_MAX];
int index;
}undo_t;
fontattr_t font = { UNO, 8 };
file_t file;
undo_t undo;
unsigned char *spyBuffer = NULL;
int nextscansize = 0;
bool editMode = false;
bool fileLoaded = false;
bool saveRequester = false;
bool modifiedFile = false;
bool checkQuit = false;
bool quit = false;
#define SEARCH(index, font, LSR) fontSearch[font][0] >> LSR == spyBuffer[index] &&\
fontSearch[font][1] >> LSR == spyBuffer[index+1] &&\
fontSearch[font][2] >> LSR == spyBuffer[index+2] &&\
fontSearch[font][3] >> LSR == spyBuffer[index+3] &&\
fontSearch[font][4] >> LSR == spyBuffer[index+4] &&\
fontSearch[font][5] >> LSR == spyBuffer[index+5] &&\
fontSearch[font][6] >> LSR == spyBuffer[index+6]
// Datos del font EXCLAMACION!
// Puede tener muchas variantes...
#define NUMFONTS 4
const unsigned char fontSearch[NUMFONTS][7] =
{
{
{0b01000000},
{0b11100000},
{0b11100000},
{0b01000000},
{0b01000000},
{0b00000000},
{0b01000000}
},
{
{0b01000000},
{0b01000000},
{0b01000000},
{0b01000000},
{0b01000000},
{0b00000000},
{0b01000000}
},
{
{0b01100000},
{0b01100000},
{0b01100000},
{0b01100000},
{0b01100000},
{0b00000000},
{0b01100000}
},
{
{0b01100000},
{0b01100000},
{0b01100000},
{0b01100000},
{0b00000000},
{0b00000000},
{0b01100000}
}
};
bool loadFile(const char* filename);
int saveFile();
void drawMap(int position, int size);
void drawChar(unsigned char *drawfont, int posx, int posy);
void checkInput();
int getRelativePos();
void rawEdit();
int gfxToBuffer(int mx, int my);
void newPosition(long newPosition);
void addUndo(int position, unsigned char byte);
void unDo();
void undoDisplace(undo_t* undo);
void drawGui();
bool autoSearch();
void limitPixelSize();