Exemplo n.º 1
0
void
Display::resize(const Size& size_)
{
  Size size(size_);

  // Limit Window size so some reasonable minimum
  if (size.width  < 640) size.width  = 640;
  if (size.height < 480) size.height = 480;

  Display::set_video_mode(size, is_fullscreen(), true);

  if (ScreenManager::instance())
    ScreenManager::instance()->resize(size);
}
Exemplo n.º 2
0
void gui_display (int32_t shortcut)
{
    pause_sound ();

    if (shortcut >=0 && shortcut < 4) {
	/* If we're running full-screen, we must toggle
	 * to windowed mode before opening the dialog */
	int32_t was_fullscreen;

	if (was_fullscreen = is_fullscreen ()) {
	    toggle_fullscreen (0);
	    if (is_fullscreen ()) {
		resume_sound ();
		return;
	    }
	}

	(new floppyFilePanel (shortcut))->run ();

	if (was_fullscreen)
	    toggle_fullscreen (0);
    }
    resume_sound ();
}
Exemplo n.º 3
0
/**
 * @brief Returns whether a video mode is supported.
 * @param mode a video mode
 * @return true if this mode is supported
 */
bool VideoManager::is_mode_supported(VideoMode mode) {

  if (forced_mode != NO_MODE && mode != forced_mode) {
    return false;
  }

  const Rectangle* size = &mode_sizes[mode];

  if (size->get_width() == 0) {
    return false;
  }

  int flags = surface_flags;
  if (is_fullscreen(mode)) {
    flags |= SDL_FULLSCREEN;
  }

  return SDL_VideoModeOK(size->get_width(), size->get_height(), 32, flags) != 0;
}
Exemplo n.º 4
0
/**
 * @brief Sets the video mode.
 *
 * The specified video mode is supposed to be supported.
 *
 * @param mode the video mode
 */
void VideoManager::set_video_mode(VideoMode mode) {

  int flags = surface_flags;
  int show_cursor;
  if (is_fullscreen(mode)) {
    flags |= SDL_FULLSCREEN;
    show_cursor = SDL_DISABLE;
  }
  else {
    show_cursor = SDL_ENABLE;
  }

  const Rectangle& size = mode_sizes[mode];
  if (size.get_width() > SOLARUS_SCREEN_WIDTH * 2) {
    // Wide screen resolution with two black side bars.
    offset = dst_position_wide.get_x();
  }
  else {
    // No side bars.
    offset = 0;
  }
  width = size.get_width();
  end_row_increment = 2 * offset + width;

  if (!disable_window) {
    SDL_Surface* screen_internal_surface = SDL_SetVideoMode(
        size.get_width(), size.get_height(), SOLARUS_COLOR_DEPTH, flags);

    Debug::check_assertion(screen_internal_surface != NULL, StringConcat() << "Cannot create the video surface for mode " << mode);

    SDL_ShowCursor(show_cursor);
    delete this->screen_surface;
    this->screen_surface = new Surface(screen_internal_surface);
  }
  this->video_mode = mode;

  // Write the configuration file.
  Configuration::set_value("video_mode", mode);
}
Exemplo n.º 5
0
void
acknowledge_resize (void)
{
  if (! al_acknowledge_resize (display) && ! is_fullscreen ())
    error (0, 0, "%s: cannot acknowledge display resize (%p)", __func__, display);
}