Interface CCWindowManagerConnection

The CCWindowManagerConnection interface is used by classes that implement a connection to a window server, which hosts all of the windows and handles things like drawing, decorations, positioning, and occlusion.

This allows apps to run on multiple platforms both with and without external window servers. For example, CraftOS systems can use the CCCraftOSWindowManager class to run a single-application window server, while Phoenix systems can use the CCPhoenixWMConnection class to connect to a multi-app PhoenixWM window server.

Use the CCDefaultWindowManagerConnection function to acquire an instance of CCWindowManagerConnection that's most appropriate for the current platform.

interface CCWindowManagerConnection {
    createWindow(
        forWindow: CCWindow,
        x: undefined | number,
        y: undefined | number,
        width: number,
        height: number,
        title: string,
        options: CCWindowManagerWindowOptions,
    ): undefined | CCWindowManagerFramebuffer;
    pullEvent(): CCEvent;
    updateAppMenu(menu: CCMenuItemDescription[]): void;
}

Methods

  • Creates a new window in the window manager.

    Parameters

    • forWindow: CCWindow

      The CCWindow instance this window is for

    • x: undefined | number

      The X position of the window, or undefined to let the WM choose

    • y: undefined | number

      The Y position of the window, or undefined to let the WM choose

    • width: number

      The width of the window

    • height: number

      The height of the window

    • title: string

      The title for the window

    • options: CCWindowManagerWindowOptions

      Options to specify for the window

    Returns undefined | CCWindowManagerFramebuffer

    A new window framebuffer target, or undefined if it couldn't be created

  • Updates the window manager with the app's current menu state. Each item corresponds to a main menu button in the titlebar, though note that the first item will always be given the title of the app, regardless of its title field.

    Parameters

    Returns void