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);
}
Customizar a Instalação do Linux Debian com Preseed
Atualizando o Passado: Linux no Lenovo G460 em 2025
aaPanel - Um Painel de Hospedagem Gratuito e Poderoso
Um modo leve de ouvir/ver áudio/vídeo da internet em máquinas pererecas
Resolver algumas mensagens de erro do SSH
Instalar módulo de segurança do Banco do Brasil Warsaw do tipo .run
Instalação de Certificados .Cer no Ubuntu 24.04 (0)
O que você está ouvindo agora? [2] (193)
Procrastinação e autossabotagem são problemas muito comuns na sociedad... (8)