/** @brief Main in-game rendering routine. * * @param b Board configuration to render. */ void draw_scene(board_t *b, GLuint fb, int reflections) { char temp[80]; int clock_seconds = 0; int clock_minutes = 0; glBindFramebuffer(GL_FRAMEBUFFER, fb); transition_update(); gg_dialog_cleanup(); glDisable(GL_BLEND); glDepthFunc(GL_ALWAYS); draw_backdrop(); glEnable(GL_BLEND); glDepthFunc(GL_LEQUAL); go_3d(get_screen_width(), get_screen_height()); render_scene_3d(b, fb, reflections); mouse_square = find_square(get_true_mouse_x(), get_true_mouse_y()); glBindFramebuffer(GL_FRAMEBUFFER, fb); resize_window(get_screen_width(), get_screen_height()); glPushMatrix(); draw_ui_elements(); // draw_move_list(get_col(COL_WHITE), get_col(COL_YELLOW)); // draw_capture_list(get_col(COL_WHITE)); clock_minutes = (((SDL_GetTicks() - get_turn_counter()) / 1000) / 60); clock_seconds = ((SDL_GetTicks() - get_turn_counter()) / 1000) - (clock_minutes * 60); snprintf(temp, sizeof(temp), "%i:%02i", clock_minutes, clock_seconds); /*text_draw_string( 303, 440, temp, 1, &col_black);*/ glPopMatrix(); /*if ( get_white_in_check() == TRUE ) text_draw_string_bouncy( 180, 420, "White is in check!", 1, get_col(COL_WHITE)); else if ( get_black_in_check() == TRUE ) text_draw_string_bouncy( 180, 420, "Black is in check!", 1, get_col(COL_WHITE));*/ gg_dialog_render_all(); if (get_fading_out()) { if (!draw_fade(FADE_OUT)) set_switch_to_menu(TRUE); } else { if (get_show_egg()) draw_sonic_fade(FADE_IN); else draw_fade(FADE_IN); } /* Draw mouse cursor.. */ draw_texture(get_mouse_cursor(), get_mouse_x(), (479 - get_mouse_y() - 32), 32, 32, 1.0f, get_col(COL_WHITE)); }
void GameManager::draw() { int window_width, window_height; platform_get_size(&window_width, &window_height); if (window_width <= 0 || window_height <= 0) // for some reason, GLFW sets these properties to 0 when minimized. return; #ifdef CHOWDREN_FORCE_REMOTE platform_set_remote_value(CHOWDREN_REMOTE_TARGET); #endif PROFILE_FUNC(); PROFILE_BEGIN(platform_begin_draw); platform_begin_draw(); PROFILE_END(); #ifdef CHOWDREN_USE_SUBAPP Frame * render_frame; if (SubApplication::current != NULL && SubApplication::current->flags & VISIBLE) { render_frame = &SubApplication::current->subapp_frame; } else render_frame = frame; #else Frame * render_frame = frame; #endif PROFILE_BEGIN(frame_draw); #ifdef CHOWDREN_IS_WIIU int remote_setting = platform_get_remote_value(); if (remote_setting == CHOWDREN_HYBRID_TARGET) { platform_set_display_target(CHOWDREN_REMOTE_TARGET); render_frame->draw(CHOWDREN_REMOTE_TARGET); draw_fade(); platform_set_display_target(CHOWDREN_TV_TARGET); render_frame->draw(CHOWDREN_TV_TARGET); draw_fade(); } else { platform_set_display_target(CHOWDREN_TV_TARGET); render_frame->draw(CHOWDREN_HYBRID_TARGET); draw_fade(); if (remote_setting == CHOWDREN_REMOTE_TARGET) { platform_clone_buffers(); platform_set_display_target(CHOWDREN_REMOTE_TARGET); render_frame->draw(CHOWDREN_REMOTE_ONLY); } } #elif CHOWDREN_IS_3DS platform_set_display_target(CHOWDREN_TV_TARGET); render_frame->draw(CHOWDREN_TV_TARGET); draw_fade(); // only draw 30 fps on bottom screen static int draw_interval = 0; if (draw_interval == 0) { platform_set_display_target(CHOWDREN_REMOTE_TARGET); render_frame->draw(CHOWDREN_REMOTE_TARGET); draw_fade(); } draw_interval = (draw_interval + 1) % 3; #else render_frame->draw(CHOWDREN_HYBRID_TARGET); draw_fade(); #endif PROFILE_END(); Render::set_offset(0, 0); #ifdef CHOWDREN_IS_DEMO if (show_build_timer > 0.0) { std::string date(__DATE__); std::string tim(__TIME__); std::string val = date + " " + tim; glPushMatrix(); glTranslatef(50, 50, 0); glScalef(5, -5, 5); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); get_font(24)->Render(val.c_str(), val.size(), FTPoint(), FTPoint()); glPopMatrix(); } #endif PROFILE_BEGIN(platform_swap_buffers); platform_swap_buffers(); PROFILE_END(); }
void show (void) { ALLEGRO_BITMAP *screen = mr.cell[0][0].screen; switch (video_effect.type) { case VIDEO_NO_EFFECT: flip_display (NULL); return; case VIDEO_OFF: return; default: break; } if (! pause_anim) { if (++effect_counter >= video_effect.duration + 2) { effect_counter = 0; stop_video_effect (); return; } switch (video_effect.type) { case VIDEO_FLICKERING: if (effect_counter % 2 && effect_counter < video_effect.duration) { clear_bitmap (effect_buffer, video_effect.color); convert_mask_to_alpha (screen, BLACK); } else clear_bitmap (effect_buffer, BLACK); draw_bitmap (screen, effect_buffer, 0, 0, 0); break; case VIDEO_FADE_IN: switch (vm) { case CGA: case EGA: draw_shutter (screen, effect_buffer, video_effect.duration / 4, effect_counter); if (effect_counter >= video_effect.duration / 4) effect_counter += video_effect.duration; break; case VGA: draw_fade (screen, effect_buffer, 1 - (float) effect_counter / (float) video_effect.duration); break; } break; case VIDEO_FADE_OUT: switch (vm) { case CGA: case EGA: draw_shutter (black_screen, effect_buffer, video_effect.duration / 4, effect_counter); if (effect_counter >= video_effect.duration / 4) effect_counter += video_effect.duration; break; case VGA: draw_fade (screen, effect_buffer, (float) effect_counter / (float) video_effect.duration); break; } if (effect_counter + 1 >= video_effect.duration) clear_bitmap (effect_buffer, BLACK); break; case VIDEO_ROLL_RIGHT: draw_roll_right (screen, effect_buffer, video_effect.duration, effect_counter); break; default: assert (false); break; } } flip_display (effect_buffer); }