CCKit2
    Preparing search index...

    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: number | undefined,
            y: number | undefined,
            width: number,
            height: number,
            title: string,
            options: CCWindowManagerWindowOptions,
        ): CCWindowManagerFramebuffer | undefined;
        pullEvent(): CCEvent;
        setAppMetadata?(title: string, icon: CCImage): void;
        updateAppMenu?(menu: CCMenuItemDescription[]): void;
        wakeUp(): void;
    }
    Index

    Methods

    • Creates a new window in the window manager.

      Parameters

      • forWindow: CCWindow

        The CCWindow instance this window is for

      • x: number | undefined

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

      • y: number | undefined

        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 CCWindowManagerFramebuffer | undefined

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

    • Sets the application name and icon, for use in a task manager.

      Parameters

      • title: string

        The title of the app

      • icon: CCImage

        The icon for the app, which should be exactly 2x1

      Returns void

    • 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

    • If the app is waiting for an event in pullEvent, this function will cause it to wake up and return an empty CCEvent (which will be ignored). This is used to handle CCKit events immediately.

      If the app is not waiting for an event, this function should do nothing.

      Returns void