void PuyoGame::draw(Graphics& graphics) { if(falling_puyo) falling_puyo->draw(graphics, x_offset); draw_board(graphics); draw_borders(graphics); graphics.flip(); }
void Chat::draw(Session& sess, int num_lines, int start, int scroll) { // if current session is empty if (sess.messages.size() == 0) { print_starting_message("This is the beginning of your chat."); return; } start = std::min(start, (int)sess.messages.size() - 1); if (scroll) { wborder(win, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '); wscrl(win, scroll); } for (int i = 0; i < abs(num_lines) && i < sess.messages.size(); i++, start++) { int dim = sess.delta - sess.scrolled_back + start; bool sender = sess.messages.at(dim).sender; auto m = sess.messages.at(dim).content; if (sender) { wattron(win, A_BOLD); } mvwprintw(win, start + 1, 1, m.c_str()); wattroff(win, A_BOLD); } draw_borders(); }
void fractal_group::run( bool create_second_fractal ) { // initialize task scheduler tbb::task_scheduler_init init( num_threads ); // create contexts to manage fractal priorities context = new tbb::task_group_context[2]; set_priorities(); draw_borders(); // the second fractal is calculating on separated thread std::thread *fg_thread = 0; if ( create_second_fractal ) fg_thread = new std::thread( fg_thread_func, this ); // calculate the first fractal calc_fractal( 0 ); if ( fg_thread ) { // wait for second fractal fg_thread->join(); delete fg_thread; } delete[] context; }
//configuracoes iniciais void init(void){ initscr(); /* Start curses mode */ cbreak(); /* Line buffering disabled */ nodelay(stdscr, TRUE); keypad(stdscr, TRUE); /* We get F1, F2 etc.. */ noecho(); /* Don't echo() while we do getch */ curs_set(0); draw_borders(); }
void redraw() { erase(); draw_borders(); draw_ball(); draw_users(); draw_info(); refresh(); }
/** Completely draws the screen during game. * * The usleep() function interrupts the program for 'n' microseconds. * It was difficult to get a stable value for the game progression. * * @note This is the main function of this file because it shows * logically how the process of drawing the screen sould be */ void engine_show_screen () { draw_background (); draw_borders (); draw_fruit (); draw_player (); draw_fruit_bonus(); draw_score (); usleep (REFRESH_DELAY); refresh(); }
void main() { minf = compute_minf(); maxf = compute_maxf(); initialize_graphic_mode(); draw_borders(); print_usage_text(); scale_function(); initialize_left_area(); redraw_right_area(); get_user_input(); closegraph(); }
void Chat::print_starting_message(const std::string& mesg) { const std::string hello_mesg = "Welcome to slack++"; wclear(win); wattron(win, A_BOLD); mvwprintw(win, rows / 2 - 1, (cols - hello_mesg.length()) / 2, "%.*s", cols, hello_mesg.c_str()); int starting_col = cols - mesg.length(); if (starting_col < 0) { starting_col = 0; } mvwprintw(win, rows / 2 + 1, starting_col / 2, "%.*s", cols, mesg.c_str()); wattroff(win, A_BOLD); draw_borders(); }
void redraw_all(void) { // reset ncurses endwin(); refresh(); // clear screen clear(); // re-draw everything draw_borders(); draw_grid(); draw_logo(); draw_numbers(); // show cursor show_cursor(); }
void render_grid(t_game *game, int w, int h) { int i; int x; int y; t_point p; w = (w / game->size); h = (h / game->size); i = -1; while (++i < game->size * game->size) { p.x = (i % game->size); p.y = (i / game->size); x = p.x * w; y = p.y * h; draw_borders(x, y + 1, w, h); draw_value(game, &p, w, h); } }
void Input::fixed_print_input(const std::wstring& str, const int &column) { int col = 1, line = 1; // only reprints visible part of string (ie, at maximum (cols)*2 chars) int i = column - column % (cols); if (column >= cols) { i -= cols; } wclear(win); while (i < str.length()) { mvwprintw(win, line, col, "%lc", str[i]); i++; col++; if (col == cols + 1) { col = 1; line++; } } draw_borders(); highlight(column); }
void fractal_group::run( bool create_second_fractal ) { // initialize task scheduler tbb::task_scheduler_init init( num_threads ); // create contexts to manage fractal priorities context = new tbb::task_group_context[2]; set_priorities(); draw_borders(); tbb::task_arena arena; tbb::task_group gr; // the second fractal is calculating on separated thread if ( create_second_fractal ) { #if __TBB_CPP11_LAMBDAS_PRESENT arena.execute( [&] { gr.run( [&] { calc_fractal( 1 ); } ); } ); #else task_group_body tg_body( *this ); arena_body a_body( tg_body, gr ); arena.execute( a_body ); #endif } // calculate the first fractal calc_fractal( 0 ); if ( create_second_fractal ) { #if __TBB_CPP11_LAMBDAS_PRESENT // wait for second fractal arena.execute( [&] { gr.wait(); } ); #else arena.execute( arena_body_wait( gr ) ); #endif } delete[] context; }
void fractal_group::switch_priorities( int new_active ) { if( new_active!=-1 ) active = new_active; else active = 1-active; // assumes 'active' is only 0 or 1 set_priorities(); draw_borders(); }
void Input::clear() { curs_set(0); wclear(win); draw_borders(); }