Ejemplo n.º 1
0
/* draw the bar and the percentage following it */
void draw_window()
{
    std::string bat_percent_string;
    int bat_percent;
    int pair_n;

    bat_percent_string = get_bat_percent();
    bat_percent = std::stoi(bat_percent_string);
    erase();
    draw_battery(bat_percent);
    printw(bat_percent_string.c_str());
    addch('%');
    if (!battery_charging)
        // add a full block of red color that scrolls down from the last full bar
        // to the first full bar, if the battery is discharging
    {
        for (int i = full_bars - 2; i >= 0; i--)
        {
            pair_n = (bat_percent == 100 ? cyan : red);
            // if the battery is full, the block that scrolls down is
            // cyan. Otherwise it is red
            erase();
            draw_battery(bat_percent);
            printw(bat_percent_string.c_str());
            addch('%');
            mvdelch(0,i);
            attron(COLOR_PAIR(pair_n));
            add_wchar(block_solid);
            attroff(COLOR_PAIR(pair_n));
            refresh();
            usleep(sleep_time / full_bars - 1);
        }
    }
    else
        // blink the last full bar and one over if the battery is charging
    {
        for (int i = 0; i < 10; i++)
        {
            int color = (i % 2 == 0 ? white : cyan);
            int last_bar = full_bars;
            if (last_bar >= bars - 1)
            {
                last_bar --;
            }
            erase();
            draw_battery(bat_percent);
            printw(bat_percent_string.c_str());
            addch('%');
            mvdelch(0, last_bar);
            attron(COLOR_PAIR(color));
            add_wchar(block_solid);
            attroff(COLOR_PAIR(color));
            refresh();
            usleep(sleep_time / 10);
        }
    }
}
Ejemplo n.º 2
0
static void print_raumschiff(int x) {
    mvdelch(9, x + 2);
    mvdelch(9, x + 1);
    mvdelch(9, x);
    mvdelch(9, x - 1);
    mvdelch(9, x - 2);
    
    mvaddch(10, x - 1, ACS_LLCORNER);
    mvaddch(10, x + 1, ACS_LRCORNER);
    mvaddch(10, x, ACS_TTEE);
}
Ejemplo n.º 3
0
static void print_raumschiff(int x) {
    mvdelch(9, x + 2);
    mvdelch(9, x + 1);
    mvdelch(9, x);
    mvdelch(9, x - 1);
    mvdelch(9, x - 2);
    
    attrset(A_BOLD | COLOR_PAIR(2));
    mvaddch(10, x - 1, ACS_LLCORNER);
    mvaddch(10, x + 1, ACS_LRCORNER);
    attrset(A_BOLD | COLOR_PAIR(3));
    mvaddch(10, x, ACS_TTEE);
}
Ejemplo n.º 4
0
static void DELETE_A_CHAR(void)
{
    int x, y;
    getsyx(y, x);
    x -= 1;
    mvdelch(y,x);
}
Ejemplo n.º 5
0
void Window::erase(int x, int y) {

	mvdelch(y, x);//move to the correct position and delete the characters

	refresh();//will delete the character


}
Ejemplo n.º 6
0
cell pp_curs_mvdelch(cell x) {
	char	name[] = "curs:mvdelch";

	if (!Running) return UNSPECIFIC;
	mvdelch(integer_value(name, car(x)),
		integer_value(name, cadr(x)));
	return UNSPECIFIC;
}
Ejemplo n.º 7
0
	/************** ERASING FUNCTIONS **********/
void Window::erase_section(vector<Coordinate *>coordinates) {


	// initiate the delete here by sending to the buffer
	for (int i = coordinates.size() -1; i >= 0; i--) //reverse for loop
		mvdelch(coordinates[i]->y, coordinates[i]->x);//move to the correct position and delete it

	refresh();//clear section

}
Ejemplo n.º 8
0
int main (void) {
    initscr();

    mvprintw(5, 5, "Diese Zeile enthaelt einen Fehhler");
    mvprintw(6, 5, "Taste druecken fuer Korrektur");
    getch();
    
    mvdelch(5, 34);
    mvprintw(7, 5, "Fehler wurde korrigiert! Bitte Taste druecken!");
    getch();
    
    endwin();
    
    return 0;
}
Ejemplo n.º 9
0
int main(void)
{
    char text[] = "Elvis found alive *** Stock market tops 20,000 *** Rocky XII big box office hit *** Congressman indicted *** ";
    char *t;

    initscr();
    noecho();
    nodelay(stdscr,TRUE);

    t = text;
    while( getch() == ERR )
    {
        if( *t == '\0') t = text;
        mvinsch(Y,X2,*t);
        mvdelch(Y,X1);
        refresh();
        napms(DELAY);
        t++;
    }

    endwin();
    return 0;
}