Result = OpenWindowedScreen(WindowID, x, y, Width, Height [, AutoStretch, RightOffset, BottomOffset [, FlipMode]])
Open a new screen area according to given parameters on the given Window, which must be opened before using OpenWindow(). InitSprite() has to be called successfully before using this command. The "windowed screen" is able to use the hardware acceleration the same way than full-size OpenScreen() function.


WindowID The window to use to create the screen. WindowID() can be used to get a valid window identifier.
x, y The screen position in the specified window, in pixels.
Width, Height The screen resolution, in pixels.
AutoStretch (optional) Ignored.
RightOffset, BottomOffset (optional) Ignored.
FlipMode (optional) Ignored.

Return value

Nonzero if the screen has been successfully opened, zero otherwise.


Only one windowed screen can be opened at one time. The screen dimension can't be greater than the window size or artefacts can occurs.

Example: Fixed screen size with gadgets

  OpenWindow(0, 20, 20, 840, 640, "A screen in a window...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)

  OpenWindowedScreen(WindowID(0), 20, 20, 800, 600)
  Procedure RenderFrame()
    Static x, y
    ClearScreen(RGB(0, 0, 0))
    DisplaySprite(0, x, 30)
    FlipBuffers() ; continue the rendering
  ; Register the render event so FlipBuffers() will trigger the associated procedure
  BindEvent(#PB_Event_RenderFrame, @RenderFrame())
  CreateSprite(0, 64, 64)
  If StartDrawing(SpriteOutput(0))
    Circle(32, 32, 25, RGB(255, 0, 0)) ; Red circle
  FlipBuffers() ; trigger the rendering

For a more detailed example look at


See Also

OpenScreen(), FlipBuffers(), ResizeScreen()

Supported OS


<- OpenScreen() - Screen Index - RemoveScreenShader() ->