static void handle_keypress(int key, camera *camera) { switch(key) { case SDLK_LEFT: move_camera(camera, -arrows_camera_delta * ZOOM_LEVEL, 0); break; case SDLK_RIGHT: move_camera(camera, arrows_camera_delta * ZOOM_LEVEL, 0); break; case SDLK_UP: move_camera(camera, 0, -arrows_camera_delta * ZOOM_LEVEL); break; case SDLK_DOWN: move_camera(camera, 0, arrows_camera_delta * ZOOM_LEVEL); break; case SDLK_PAGEUP: zoom_in(camera); update_background(); break; case SDLK_PAGEDOWN: zoom_out(camera); update_background(); break; case SDLK_p: toggle_pause(); } }
void help_menu(WINDOW* screen, struct Ball* ball, struct Paddle* paddle, int max_x, int max_y) { clear(); refresh(); Timer* timer = sgl_timer_new(); move_ball_xy(ball, ball->x, max_y / 2); int key; while ((key = getch()) != 'q'){ //Move and bound ball if (sgl_timer_elapsed_milliseconds(timer) > 20){ sgl_timer_reset(timer); update_background(ball, paddle, max_x, max_y - 4); draw_background(screen, ball, paddle); } draw_strings(screen, 1, max_x / 2 - strlen(help_title[0]), help_title, 6); draw_strings(screen, 8, 3, help_text, 6); wrefresh(screen); } clear(); }
void exposure_picker_t::paintEvent( QPaintEvent *event) { QPainter painter( this); if( event->rect().intersects(contentsRect())) painter.setClipRegion( event->region().intersect(contentsRect())); if( !valid_background_) { update_background(); valid_background_ = true; } painter.drawImage( contentsRect().topLeft(), background_); int xpos = ( exposure_ / ( 2.0 * max_exposure()) + 0.5) * ( width() - 1); QPen pen; pen.setWidth( 1); pen.setColor( QColor( 255, 255, 255)); painter.setPen( pen); painter.drawLine( xpos, 0, xpos, height()); ++xpos; pen.setColor( QColor( 0, 0, 0)); painter.setPen( pen); painter.drawLine( xpos, 0, xpos, height()); }
void update_time(WatchFace *wf, int32_t local_gmt_offset) { static char date_format[14] = "%a %b %e, %Y"; time_t time_in_secs = time(NULL); time_in_secs = (time_in_secs - local_gmt_offset) + wf->gmt_sec_offset; struct tm *local_time = localtime(&time_in_secs); strftime(wf->time_text, sizeof(wf->time_text), wf->time_format, local_time); if ((!clock_is_24h_style()) && (wf->display != DISPLAY_24_HOUR_TIME) && (wf->time_text[0] == '0')) { int pos = strlen(wf->time_text); for (int k = 0; k < pos; k++) { wf->time_text[k] = wf->time_text[k+1]; } } layer_mark_dirty((Layer *)wf->main_time_layer); layer_mark_dirty((Layer *)wf->text_time_layer); // Update date only if needed if ((wf->last_day != local_time->tm_mday) || (wf->last_month != local_time->tm_mon) || (wf->last_year != local_time->tm_year)) { strftime (wf->date_text, sizeof(wf->date_text), date_format, local_time); wf->last_day = local_time->tm_mday; wf->last_month = local_time->tm_mon; wf->last_year = local_time->tm_year; layer_mark_dirty((Layer *)wf->text_date_layer); } if (is_sunrise(local_time, wf) || is_sunset(local_time, wf)) { update_background(wf, local_gmt_offset); } }
void rxvt_term::bg_init () { #if BG_IMAGE_FROM_ROOT if (option (Opt_transparent)) { if (rs [Rs_blurradius]) root_effects.set_blur (rs [Rs_blurradius]); if (ISSET_PIXCOLOR (Color_tint)) root_effects.set_tint (pix_colors_focused [Color_tint]); if (rs [Rs_shade]) root_effects.set_shade (rs [Rs_shade]); rxvt_img::new_from_root (this)->replace (root_img); XSelectInput (dpy, display->root, PropertyChangeMask); rootwin_ev.start (display, display->root); } #endif #if BG_IMAGE_FROM_FILE if (rs[Rs_backgroundPixmap]) { fimage.set_file_geometry (this, rs[Rs_backgroundPixmap]); if (!bg_window_position_sensitive ()) update_background (); } #endif }
void game_prepare() { printf("generating nav_mesh\n"); walk_terrain(); #ifdef NAV_DEBUG draw_nav_mesh(full_terrain, false, true); update_background(); #endif }
void load_game(void) { update_background(); update_content(); collisions(); update_stats(); display_content(); draw(); }
static void update(struct game_state *gs) { update_particles(); update_background(); if (irand(18) == 0) gen_explosion(10.f*(frand() - .5f), 10.f*(frand() - .5f)); ++tics; }
void seqroll::change_vert () { m_scroll_offset_key = (int) m_vadjust->get_value(); m_scroll_offset_y = m_scroll_offset_key * c_key_y; if (m_ignore_redraw) return; update_background(); update_pixmap(); force_draw(); }
static void update(struct game_state *gs) { if (inner_state.state != IS_LEVEL_CLEARED && inner_state.state != IS_LEVEL_TRANSITION) update_eye(); update_crosshair(); update_background(); update_water(); update_particles(); update_explosions(); if (ship_is_visible()) { update_ship(); update_missiles(); update_bombs(); update_lasers(); update_foes(); } update_powerups(); update_in_game_texts(); if (inner_state.state == IS_IN_GAME) { update_multiplier(); update_combo(); } if (inner_state.state == IS_GAME_OVER) { if (inner_state.tics >= GAME_OVER_FADE_IN_TICS) { if (!update_stats_table()) { gc.score += game_over_stats.bonus; set_inner_state(IS_RANK); } } } if (inner_state.state == IS_LEVEL_CLEARED) { if (inner_state.tics >= LEVEL_CLEARED_FADE_IN_TICS) { if (!update_stats_table()) { gc.score += game_over_stats.bonus; set_inner_state(IS_LEVEL_TRANSITION); } } } update_level_tics(); update_inner_state(); if (serializing) serialize(); }
void seqroll::redraw () { if (m_ignore_redraw) return; m_scroll_offset_ticks = (int) m_hadjust->get_value(); m_scroll_offset_x = m_scroll_offset_ticks / m_zoom; update_background(); update_pixmap(); force_draw(); }
void seqroll::set_background_sequence (bool a_state, int a_seq) { m_drawing_background_seq = a_state; m_background_sequence = a_seq; if (m_ignore_redraw) return; update_background(); update_pixmap(); queue_draw(); }
static void handle_mousedown(SDL_MouseButtonEvent button_event, camera *camera, PLAYERS *players) { bool modifier = (SDL_GetModState() & KMOD_CTRL) > 0; gsl_vector *dest; int rel_map_size = MAP_SIZE / ZOOM_LEVEL; int start_x = (WIDTH - rel_map_size) / 2; int end_x = WIDTH - start_x; int start_y = (HEIGHT - rel_map_size) / 2; int end_y = HEIGHT - start_y; if(button_event.x > end_x || button_event.x < start_x || button_event.y > end_y || button_event.y < start_y) return; switch(button_event.button) { case 1: if(paused) toggle_pause(); select_units_at(modifier, button_event.x, button_event.y, camera, players); break; case 3: dest = calculate_map_position(button_event.x, button_event.y, camera); unit *un = check_for_unit_near(dest, players, NULL, false, true); if(un != NULL) { selected_units_attack(un); } else { move_selected_units_to(dest, players); } gsl_vector_free(dest); break; case 4: zoom_in(camera); update_background(); break; case 5: zoom_out(camera); update_background(); } }
/*************************************************************************** draw_background ??? **************************************************************************/ static void draw_background( struct osd_bitmap *bitmap ) { int scrollx = 0x17a + 16*8 - (rear_horiz_scroll_low + rear_horiz_scroll_high); if (rear_refresh) { update_background( ); rear_refresh=0; } copyscrollbitmap(bitmap,bg_bitmap,1,&scrollx,0,0,&bottomvisiblearea,TRANSPARENCY_NONE,0); }
void load_menu(void) { update_background(); rect_pos(&game.rect, 90, 100, 0, 0); SDL_BlitSurface(obj.ttitle, NULL, game.screen, &game.rect); rect_pos(&game.rect, 70, 280, 0, 0); SDL_BlitSurface((kmenu.j == 1?obj.tsplay:obj.tplay), NULL, game.screen, &game.rect); rect_pos(&game.rect, 70, 380, 0, 0); SDL_BlitSurface((kmenu.j == -1?obj.tscredit:obj.tcredit), NULL, game.screen, &game.rect); rect_pos(&game.rect, 100, 480, 0, 0); SDL_BlitSurface(obj.texit, NULL, game.screen, &game.rect); draw(); }
void color_swatch_t::paintEvent( QPaintEvent *event) { QPainter painter( this); if( event->rect().intersects(contentsRect())) painter.setClipRegion( event->region().intersect(contentsRect())); if( !valid_background_) { update_background(); valid_background_ = true; } painter.drawImage( contentsRect().topLeft(), background_); }
static void regenerate_terrain() { if(full_terrain != NULL) { if(background != full_terrain) SDL_FreeSurface(background); SDL_FreeSurface(full_terrain); full_terrain = NULL; background = NULL; } printf("generating terrain\n"); generate_fractal_terrain(); full_terrain = print_terrain(); update_background(); }
static void on_box_allocation_changed (ClutterActor *box, const ClutterActorBox *allocation, ClutterAllocationFlags flags, ClutterActor *background) { gfloat new_width, new_height; clutter_actor_box_get_size (allocation, &new_width, &new_height); clutter_cairo_texture_set_surface_size (CLUTTER_CAIRO_TEXTURE (background), new_width, new_height); update_background (background, &bg_color, new_width, new_height); }
void SpectralMeterView::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { Q_UNUSED(option); Q_UNUSED(widget); // re-draw the background pixmap if (bgPixmap.width() != int(m_boundingRect.width()) || bgPixmap.height() != int(m_boundingRect.height())) { update_background(); } painter->drawPixmap(0, 0, bgPixmap); // draw the bars if (m_spectrum.size()) { QRect rect; painter->setClipRegion(m_rect); painter->setBrush(m_brushFg); painter->setPen(Qt::NoPen); int spc = 0; if (num_bands < 64) spc = 1; // draw the freq bands for (uint i = 0; i < (uint)m_spectrum.size(); ++i) { if (m_bands.at(i+1) < lower_db) { continue; } rect.setTopLeft(QPoint((int)freq2xpos(m_bands.at(i)) + spc, (int)db2ypos(m_spectrum.at(i)))); rect.setBottomRight(QPoint((int)freq2xpos(m_bands.at(i+1)) - spc, (int)db2ypos(DB_FLOOR))); painter->drawRect(rect); } // draw the average line if requested if (show_average) { painter->setPen(m_penAvgCurve); QPoint pt; QPoint po((int)m_map_idx2xpos.at(0), (int)db2ypos(m_avg_db.at(0))); for (uint i = 0; i < (uint)m_avg_db.size(); ++i) { pt.setX((int)m_map_idx2xpos.at(i)); pt.setY((int)db2ypos(m_avg_db.at(i))); painter->drawLine(po, pt); po = pt; } } } }
// Updates all nescessary sprites, images, buttons etc. void update(void) { static _Bool called = false; GDATAPTR game = get_game_data(); update_background(); if(game->gamestarted && game->paused) { paused(score, survival_time, lives); } else if(lives == 0) { gameover(score, survival_time); } else if(game->gamestarted) { if(!called) { //cpSpaceResizeStaticHash(get_global_cpSpace(), 700.0, 4*10); cpSpaceAddCollisionHandler(get_global_cpSpace(), 1, 2, collision_begin, NULL, NULL, NULL, NULL); cpSpaceAddCollisionHandler(get_global_cpSpace(), 0, 2, collision_static_begin, NULL, NULL, NULL, NULL); cpSpaceAddCollisionHandler(get_global_cpSpace(), 0, 1, collision_static_begin, NULL, NULL, NULL, NULL); called = false; } logic(); update_clouds(); cpSpaceStep(get_global_cpSpace(), 1.0f/60.0f); cpSpaceEachBody(get_global_cpSpace(), &update_sprites, NULL); update_ground(); update_lives(); add_element_to_render_queue(NULL, 0, 0, 0, RCOLOR(0, 0, 0, 255), update_score); add_element_to_render_queue(NULL, 290, 0, 0, RCOLOR(0, 0, 0, 255), update_survivaltime); } else if(game->options) { options(); } else if(game->howtoplay) { howtoplay(); } else if(game->highscores) { highscores(); } }
static void main_menu_background_update(void) { update_background(); if (eye_z > 50.f) eye_z -= .2f; ++tics; if (menu_is_visible()) { if (highscore_spread > 0) highscore_spread--; if (menu_is_on_top_level(main_menu)) { if (++idle_tics > TICS_BEFORE_PLAYBACK) start_playback(); } if (main_menu->spread < 0) main_menu->spread += 10.f; } }
static void sync_tuple_changed_callback(const uint32_t key, const Tuple* new_tuple, const Tuple* old_tuple, void* context) { bool temps_changed = false; bool suns_changed = false; uint32_t watch_num = key / KEYS_PER_WATCH; uint32_t function = key % KEYS_PER_WATCH; watchfaces[watch_num].last_weather_update = time(NULL); switch (function) { case PBCOMM_GMT_SEC_OFFSET_KEY: if (new_tuple->value->int32 != watchfaces[watch_num].gmt_sec_offset) { watchfaces[watch_num].gmt_sec_offset = new_tuple->value->int32; update_time(&watchfaces[watch_num], watchfaces[0].gmt_sec_offset); update_background(&watchfaces[watch_num], watchfaces[0].gmt_sec_offset); } if (watch_num == 0) { update_time(&watchfaces[1], watchfaces[0].gmt_sec_offset); update_background(&watchfaces[1], watchfaces[0].gmt_sec_offset); update_time(&watchfaces[2], watchfaces[0].gmt_sec_offset); update_background(&watchfaces[2], watchfaces[0].gmt_sec_offset); } break; case PBCOMM_CITY_KEY: // if (strcmp(new_tuple->value->cstring, old_tuple->value->cstring) != 0) { text_layer_set_text(watchfaces[watch_num].text_city_layer, new_tuple->value->cstring); text_layer_set_text(watchfaces[watch_num].main_city_layer, new_tuple->value->cstring); layer_mark_dirty((Layer *)watchfaces[watch_num].text_city_layer); layer_mark_dirty((Layer *)watchfaces[watch_num].main_city_layer); // } break; case PBCOMM_BACKGROUND_KEY: if (new_tuple->value->int8 != watchfaces[watch_num].background) { watchfaces[watch_num].background = new_tuple->value->int8; update_background(&watchfaces[watch_num], watchfaces[0].gmt_sec_offset); } break; case PBCOMM_12_24_DISPLAY_KEY: if (new_tuple->value->int8 != watchfaces[watch_num].display) { watchfaces[watch_num].display = new_tuple->value->int8; switch (watchfaces[watch_num].display) { case DISPLAY_WATCH_CONFIG_TIME: if (clock_is_24h_style()) { strncpy (watchfaces[watch_num].time_format, time_24h_format, sizeof(time_24h_format)); } else { strncpy (watchfaces[watch_num].time_format, time_12h_format, sizeof(time_12h_format)); } break; case DISPLAY_12_HOUR_TIME: strncpy (watchfaces[watch_num].time_format, time_12h_format, sizeof(time_12h_format)); break; case DISPLAY_24_HOUR_TIME: default: strncpy (watchfaces[watch_num].time_format, time_24h_format, sizeof(time_24h_format)); break; } update_time(&watchfaces[watch_num], watchfaces[0].gmt_sec_offset); } break; case PBCOMM_WEATHER_KEY: // Includes all weather information in a byte array for ( int j = 0; j < MAX_WEATHER_DAYS; j++ ) { // if (new_tuple->value->data[j+WEATHER_ICONS] != old_tuple->value->data[j+WEATHER_ICONS] ) { if ((int8_t)new_tuple->value->data[j+WEATHER_ICONS] >= MAX_WEATHER_CONDITIONS) { bitmap_layer_set_bitmap(watchfaces[watch_num].bitmap_weather_layer[j+WEATHER_ICONS], conditions[0]); } else { bitmap_layer_set_bitmap(watchfaces[watch_num].bitmap_weather_layer[j], conditions[(int8_t)new_tuple->value->data[j+WEATHER_ICONS]]); } layer_mark_dirty((Layer *)watchfaces[watch_num].bitmap_weather_layer[j]); // temps_changed = true; not needed since the mark_dirty does what's needed // } } if ((int8_t)new_tuple->value->data[CURRENT_TEMP] != watchfaces[watch_num].temp) { watchfaces[watch_num].temp = (int8_t)new_tuple->value->data[CURRENT_TEMP]; temps_changed = true; } for ( int j = 0; j < MAX_WEATHER_DAYS; j++ ) { if ((int8_t)new_tuple->value->data[j+MAX_TEMPS] != watchfaces[watch_num].hi_temp[j]) { watchfaces[watch_num].hi_temp[j] = (int8_t)new_tuple->value->data[j+MAX_TEMPS]; temps_changed = true; } } for ( int j = 0; j < MAX_WEATHER_DAYS; j++ ) { if ((int8_t)new_tuple->value->data[j+MIN_TEMPS] != watchfaces[watch_num].lo_temp[j]) { watchfaces[watch_num].lo_temp[j] = (int8_t)new_tuple->value->data[j+MIN_TEMPS]; temps_changed = true; } } if (temps_changed) { update_temps(&watchfaces[watch_num]); } if ((int8_t)new_tuple->value->data[SUNRISE_HOUR] != watchfaces[watch_num].sunrise_hour) { watchfaces[watch_num].sunrise_hour = (int8_t)new_tuple->value->data[SUNRISE_HOUR]; suns_changed = true; } if ((int8_t)new_tuple->value->data[SUNRISE_MINUTE] != watchfaces[watch_num].sunrise_min) { watchfaces[watch_num].sunrise_min = (int8_t)new_tuple->value->data[SUNRISE_MINUTE]; suns_changed = true; } if ((int8_t)new_tuple->value->data[SUNSET_HOUR] != watchfaces[watch_num].sunset_hour) { watchfaces[watch_num].sunset_hour = (int8_t)new_tuple->value->data[SUNSET_HOUR]; suns_changed = true; } if ((int8_t)new_tuple->value->data[SUNSET_MINUTE] != watchfaces[watch_num].sunset_min) { watchfaces[watch_num].sunset_min = (int8_t)new_tuple->value->data[SUNSET_MINUTE]; suns_changed = true; } if (suns_changed) { update_background(&watchfaces[watch_num], watchfaces[0].gmt_sec_offset); } break; default: break; } }
void rxvt_term::trace_update_background (const char *file, int line) { fprintf (stderr, "%s:%d:update_background()\n", file, line); update_background (); }
int main_menu(WINDOW* screen) { int max_x, max_y; getmaxyx(screen, max_y, max_x); char* title_menu_l[4] = {"Play!", "Options", "Help", "Quit"}; struct Menu* title_menu = new_menu(max_x / 8, 8, 4, title_menu_l, BLUE_ON_BLACK, GREEN_ON_BLACK); //For the moving background... struct Ball* ball = make_ball(max_x / 2, max_y / 4, HARD_BALL_VX, HARD_BALL_VY); struct Paddle* paddle = make_paddle(0, max_y / 2, 5, 2); Timer* timer = sgl_timer_new(); //Default settings... int difficulty = EASY; int sound = SOUND_OFF; char* random_name = ai_names[randint(ai_names_c)]; struct Game* game = make_game(max_x, max_y, difficulty, sound, PADDLE_SENSITIVITY, random_name, getenv("USER"), 1, 0, DEFAULT_SCORE); int key; while (key != 'q'){ switch (key = getch()){ case KEY_DOWN: move_selected(title_menu, DOWN); break; case KEY_UP: move_selected(title_menu, UP); break; case KEY_RIGHT: case KEY_ENTER: switch (title_menu->selected){ case 0: //Play game play_game(game); break; case 1: //Options game = options_menu(screen, game, ball, paddle, max_x, max_y); clear(); break; case 2: //Help help_menu(screen, ball, paddle, max_x, max_y); break; case 3: //Quit return 0; break; } break; } //Render the background if (sgl_timer_elapsed_milliseconds(timer) > 20){ sgl_timer_reset(timer); update_background(ball, paddle, max_x, max_y); draw_background(screen, ball, paddle); refresh(); } draw_strings(screen, 1, max_x / 2 - strlen(game_title[0]), game_title, 6); draw_menu(title_menu); wrefresh(title_menu->win); } clear(); refresh(); return 0; }
struct Game* options_menu(WINDOW* screen, struct Game* game, struct Ball* ball, struct Paddle* paddle, int max_x, int max_y) { clear(); refresh(); move_ball_xy(ball, ball->x, max_y / 2); char* opts_menu_l[8] = {"Difficulty", "Sound", "Paddle Sensitivity",\ "Screen Size", "Left Control", "Right Control",\ "Play to", "Save & Return"}; struct Menu* opts_menu = new_menu(max_x / 8, 8, 8, opts_menu_l, BLUE_ON_BLACK, GREEN_ON_BLACK); WINDOW* info_win = newwin(3, max_x, max_y - 3, 0); Timer* timer = sgl_timer_new(); char* tmp_str = malloc(sizeof(char) * MAX_STRING_LENGTH); int key; while (key != 'q'){ switch (key = getch()){ case KEY_DOWN: move_selected(opts_menu, DOWN); wclear(info_win); break; case KEY_UP: wclear(info_win); move_selected(opts_menu, UP); break; case KEY_LEFT: switch (opts_menu->selected){ case 0: //Difficulty if (game->difficulty == 0) game->difficulty = 2; else game->difficulty--; break; case 1: //Sound if (game->sound) game->sound = 0; else game->sound = 1; break; case 2: //Paddle sensitivity if (game->sensitivity == 1) game->sensitivity = 4;//DEHARDCODE THE 4 else game->sensitivity--; break; case 4: //Left control selection... game->p1_aictrl = (game->p1_aictrl ? 0 : 1); break; case 5: //Right control selection game->p2_aictrl = (game->p2_aictrl ? 0 : 1); break; case 6: //Change maximum score... game->max_score--; if (game->max_score < 1) game->max_score = MAX_SCORE; break; } break; case KEY_RIGHT: case KEY_ENTER: switch (opts_menu->selected){ case 0: //Difficulty if (game->difficulty == 2) game->difficulty = 0; else game->difficulty++; break; case 1: //Sound if (game->sound) game->sound = 0; else game->sound = 1; break; case 2: //Paddle sensitivity if (game->sensitivity == 4) game->sensitivity = 1; else game->sensitivity++; break; case 3: //Change Resolution change_resolution(screen, game); break; case 4: //Left control selection... if (game->p1_aictrl) game->p1_aictrl = 0; else game->p1_aictrl = 1; break; case 5: //Right control selection if (game->p2_aictrl) game->p2_aictrl = 0; else game->p2_aictrl = 1; break; case 6: //Change maximum score... game->max_score++; if (game->max_score > MAX_SCORE) game->max_score = 1; break; case 7: //Quit return game; break; } break; } //Move and bound ball if (sgl_timer_elapsed_milliseconds(timer) > 20){ sgl_timer_reset(timer); update_background(ball, paddle, max_x, max_y - 4); draw_background(screen, ball, paddle); box(info_win, 0, 0); } draw_strings(screen, 1, max_x / 2 - strlen(options_title[0]), options_title, 6); draw_menu(opts_menu); /************************************************************ * NOTE: The spaces in strings below are there for a purpose! * They erase double digits. eg. "1 " erases "10" */ snprintf(tmp_str, MAX_STRING_LENGTH, "%d ", game->difficulty + 1);//+1 so we don't get a difficulty of '0' mvwaddstr(screen, opts_menu->y, opts_menu->x + opts_menu->width + 1, tmp_str);//print difficulty mvwaddstr(screen, opts_menu->y + 1, opts_menu->x + opts_menu->width + 1, game->sound ? "On " : "Off");//print sound snprintf(tmp_str, MAX_STRING_LENGTH, "%d ", game->sensitivity); mvwaddstr(screen, opts_menu->y + 2, opts_menu->x + opts_menu->width + 1, tmp_str);//print sensitivity snprintf(tmp_str, MAX_STRING_LENGTH, "%dx%d", game->width, game->height); //Print the resolution mvwaddstr(screen, opts_menu->y + 3, opts_menu->x + opts_menu->width + 1, tmp_str); mvwaddstr(screen, opts_menu->y + 4, opts_menu->x + opts_menu->width + 1, game->p1_aictrl ? "Computer" : "Human "); mvwaddstr(screen, opts_menu->y + 5, opts_menu->x + opts_menu->width + 1, game->p2_aictrl ? "Computer" : "Human "); snprintf(tmp_str, MAX_STRING_LENGTH, "%d ", game->max_score); mvwaddstr(screen, opts_menu->y + 6, opts_menu->x + opts_menu->width + 1, tmp_str); //Write a helpful hint in the info_win switch (opts_menu->selected){ case 0: mvwaddstr(info_win, 1, 1, "Change the difficulty, higher numbers are more difficult"); break; case 1: mvwaddstr(info_win, 1, 1, "Toggle sound on or off"); break; case 2: mvwaddstr(info_win, 1, 1, "Adjust paddle sensitivity, higher numbers are less sensitive"); break; case 3: mvwaddstr(info_win, 1, 1, "Change the playing screen size"); break; case 4: mvwaddstr(info_win, 1, 1, "Toggle control between Computer and Human for the left paddle"); break; case 5: mvwaddstr(info_win, 1, 1, "Toggle control between Computer and Human for the right paddle"); break; case 6: mvwaddstr(info_win, 1, 1, "Change the maximum score needed to win"); break; case 7: mvwaddstr(info_win, 1, 1, "Save changes and go back to main menu"); break; } wrefresh(opts_menu->win); wrefresh(info_win); } clear(); refresh(); return game; }