CCKit2
    Preparing search index...

    Class CCApplication

    The CCApplication class is the main class that controls the app run loop, handles events, and manages the lifecycle of the program.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    acceptsFirstResponder: boolean = true

    Whether the object can become the first responder.

    appearance?: CCAppearance

    The desired appearance of the app.

    appIcon?: CCImage

    The icon for the app.

    A delegate object to receive lifecycle notifications.

    isActive: boolean = false

    Whether the current app is the active app.

    isHidden: boolean = false

    Whether the app is currently hidden.

    isRunning: boolean = false

    Whether the main loop is currently running.

    keyWindow?: CCWindow

    The key window, which gets input events.

    mainWindow?: CCWindow

    The main window of the application.

    modalWindow?: CCWindow

    The modal window being displayed, if it exists.

    nextResponder?: CCResponder

    The next responder in the responder chain.

    windows: CCWindow[] = []

    A list of all windows in the application.

    The connection to the window manager for the app.

    The CCApplication instance for the current app.

    Accessors

    Methods

    • Activates the app.

      Parameters

      • ignoreOtherApps: boolean

        If false, will not activate if another app is already active

      Returns void

    • This is used to place a blinking cursor on screen while not drawing. It's only called on the first responder of a window.

      Returns [CCPoint, number] | undefined

      The position and color of the cursor in window coordinates, or undefined to not place a cursor

    • Discards any event matching the specified event name, optionally only before another event.

      Parameters

      • matching: string

        The event name to match

      • Optionalbefore: CCEvent

        If provided, only events before this event will be removed

      Returns void

    • Called to activate the application before starting the main loop.

      Returns void

    • Hides the app from the screen, activating the next app.

      Returns void

    • Sends a list of key input events to the input manager, which will send back text input events through insertText(text: string).

      Parameters

      • events: CCEvent[]

        The input events to send

      Returns void

    • Returns the first event in the queue which matches the specified name.

      Parameters

      • matching: string

        The event name to match

      • dequeue: boolean

        Whether to pop the event from the queue

      Returns CCEvent | undefined

      The matching event, or null if not found

    • Handles when a method action fails to find a responder.

      Parameters

      • method: string

        The method that was attempted

      Returns void

    • Adds an event to the event queue, to be processed by the run loop.

      Parameters

      • event: CCEvent

        The event to queue

      • atStart: boolean

        Whether to add it to the front of the queue

      Returns void

    • Displays an error message in a popup window.

      Parameters

      • error: CCError

        The error to show

      • Optionalwindow: CCWindow

        If specified, a window to show the error as a modal on

      • Optionalcallback: () => void

        If specified, a function to call when the popup appears on screen

      Returns void

    • Follows up to a previous response from the app delegate to delay termination.

      Parameters

      • terminate: boolean

        Whether to terminate the app now

      Returns void

    • Run the main event loop.

      Returns void

      If the event loop is already running.

    • Runs a modal event loop for a window, pausing event processing until the window is closed and the modal state is cleared.

      Parameters

      • window: CCWindow

        The modal window to show

      Returns ModalResponse

      A response code indicating how the modal exited

    • Shows an About window for the app.

      Parameters

      • Optionaloptions: {
            build?: number;
            credits?: string;
            icon?: CCImage;
            name?: string;
            version?: string;
        }

        Any options to pass to the window

      Returns void

    • Shows a character palette window.

      Returns void

    • Sends a notification to terminate the app.

      Returns void

    • Attempts to call the specified method on the object, passing the call on to the next responder if this object doesn't implement it.

      Parameters

      • method: string

        The name of the method to call

      • ...args: any[]

        Any parameters to pass to the method

      Returns boolean

      Whether a responder was able to respond to the method

    • Unhides and (optionally) activates the app.

      Parameters

      • Optionalactivate: boolean

        Whether to also activate the app

      Returns void

    • Updates all windows in the application.

      Returns void