GSDP:GAM100/CProcessing/fullscreenAdvanced()

From Inside
Jump to: navigation, search

fullscreenAdvanced()

Description

The function fullscreenAdvanced() sets the window to fullscreen like fullscreen() but lets you set the pixel aspect ratio of the screen as well. If you try to set the screen to an aspect ratio unsupported by the monitor, it will be set to the closest aspect ratio possible.

Parameters

fullscreenAdvanced(int new_width, int new_height)

  • new_width - (int) The pixel width of the window.
  • new_height - (int) The pixel height of the window.

Example

// Horizontal position of the square
float x_pos;

void init()
{
  // Start the square at the left of the screen
  x_pos = 0;

  // Set the square to draw yellow
  fill(color(255, 255, 0, 255));

  // Set the window to fullscreen 1280x720
  fullscreenAdvanced(1280, 720);
}

void update()
{
  // Set background to black
  background(color(0, 0, 0, 255));

  // Draw the square
  rect(x_pos, (float)canvasHeight / 2.0f, 100, 100);
  x_pos += 2;

  // If space pressed, reset the state 
  if (keyPressed(KEY_SPACE))
    SetNextGameStateForced(init, update, NULL);
  else if (keyPressed(KEY_Q))
    Terminate();
}

Related

Personal tools
Namespaces

Variants
Actions
Navigation
NameSpaces:>
Tools
Dynamic:>