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);
}
Como agendar um backup automático do PostgreSQL no Cron evitando o problema de senha
Como preparar o Vim/Neovim para corrigir ortografia em português
Dark Web e Malwares na internet, quanto custa?
Configuração básica do Conky para mostrar informações sobre a sua máquina no Desktop
Como verificar o hash de um arquivo baixado da Internet e como criar um hash
Debian 12 - IPTABLES - removendo NFTABLES
OverWatch 2 - Abrindo portas do jogo no Iptables.
Como instalar o adaptador wifi USB Intelbras ACtion A1200 no Linux Mint
Como normalizar seus arquivos MP3 para que fiquem no mesmo volume
Erro no brave no Ubuntu 22.04.4 LTS (16)
Instalando e compilando o GCC/G++ erro (5)
WACOM Intuos no Ubuntu - muita dificuldades (1)
Instalação do Programa Imposto de Renda Pessoa Física 2023 [RESOLVIDO]... (6)
[C/C++] BRT - Bulk Renaming Tool
[Shell Script] Criação de Usuarios , Grupo e instalação do servidor de arquivos samba
[Shell Script] Tire screenshots com Scrot facilmente com Zscrot
[Shell Script] DioPSI - Script multidistro para instalar programas
[Shell Script] ARS Vídeos - Cortador de vídeos e webcam shooter