Enviado em 14/11/2018 - 20:17h
Olá pessoal !
void Draw (EDITOR *o) {
int pos_x = o->r.x + 10;
int pos_y = o->r.y + 10;
int line_top = 0;
if (key == SDLK_UP && o->line_top > 0) {
o->line_top--;
}
else
if (key == SDLK_DOWN && o->line_top < o->line_count-1) {
o->line_top++;
}
state = STATE_DEFAULT;
// NO DRAW ... find the first line displayed:
str = o->text;
while (*str) {
if (line_top == o->line_top)
break;
if (*str == '\n') { // <-- new line
line_top++;
}
SetTextColor();
str++;
}
//
// HERE DRAW: DrawChar (...);
//
SDL_FillRect (screen, &o->r, 8); // bg blue
while (*str) {
// size h:
if (pos_y > (o->r.y + o->r.h)-LINE_DISTANCE)
break;
SetTextColor();
// Draw char in area of editor
if (pos_x < o->r.x+o->r.w-8) {
if (state == STATE_DEFAULT) {
if (isperator(*str)) {
color = COLOR_WHITE;
}
else
if (!is_reserved_word && !iswordchar(str[-1])) {
if ((*str >= 'a' && *str <= 'g') || *str=='i' || *str=='l' || *str=='o' || (*str >= 'r' && *str <= 'v') || *str=='w') {
// COLORIZE WORD: void
//
if (str[0]=='v' && str[1]=='o' && str[2]=='i' && str[3]=='d' && !iswordchar(str[4])) {
is_reserved_word = 4;
}
else
// COLORIZE WORD: int
if (str[0]=='i' && str[1]=='n' && str[2]=='t' && !iswordchar(str[3])) {
is_reserved_word = 3;
}
else
// COLORIZE WORD: return
if (str[0]=='r' && str[1]=='e' && str[2]=='t' && str[3]=='u' && str[4]=='r' && str[5]=='n' && !iswordchar(str[6])) {
is_reserved_word = 6;
}
}
}// if (!is_reserved_word && !iswordchar(str[-1]))
if (is_reserved_word) {
color = C_WORD; // Torn color of sintax
is_reserved_word--;
}
} // if (state == STATE_DEFAULT)
DrawChar (screen, *str, pos_x, pos_y, color);
}
pos_x += 8;
if (*str == '\n') {
pos_x = o->r.x + 10;
pos_y += LINE_DISTANCE;
}
str++;
}
SDL_UpdateRect (screen, o->r.x, o->r.y, o->r.w, o->r.h);
}
Passkeys: A Evolução da Autenticação Digital
Instalação de distro Linux em computadores, netbooks, etc, em rede com o Clonezilla
Título: Descobrindo o IP externo da VPN no Linux
Armazenando a senha de sua carteira Bitcoin de forma segura no Linux
Enviar mensagem ao usuário trabalhando com as opções do php.ini
Instalando Brave Browser no Linux Mint 22
vídeo pra quem quer saber como funciona Proteção de Memória:
Encontre seus arquivos facilmente com o Drill
Mouse Logitech MX Ergo Advanced Wireless Trackball no Linux
Compartilhamento de Rede com samba em modo Público/Anônimo de forma simples, rápido e fácil
Programa duplicado no "Abrir com" e na barra de pesquisa do ... (1)
VMs e Interfaces de Rede desapareceram (13)
Como abrir o pycharm no linux [RESOLVIDO] (4)