Starling Framework

repository·master·Indexed 25 days ago

https://github.com/gamua/starling-framework

A lightweight, hardware-accelerated 2D engine for ActionScript 3. It utilizes the Adobe AIR Stage3D API to render objects via the GPU, enabling high-performance graphical applications and games for desktop (Windows, macOS) and mobile (iOS, Android) platforms.

Tokens
3.2K
Snippets
8
Records
27
Agent score
85%

What's inside Starling Framework

  1. Overview of Starling Framework

    master

    Starling Framework is a cross-platform, hardware-accelerated game engine for creating 2D games and graphical applications using ActionScript 3. It utilizes the Adobe AIR Stage3D API to render all objects directly via the GPU, providing high performance while mimicking the classic display tree architecture of Adobe AIR/Flash.

    Key features include:

    • GPU Acceleration: Direct rendering via Stage3D.
    • Cross-Platform Deployment: Target mobile (iOS, Android) and desktop (Windows, macOS) using Adobe AIR.
    • Lightweight Architecture: Designed to be easy to read, understand, and extend.
  2. Automate resource copying before simulator launch in IntelliJ IDEA

    master

    To ensure resources are always available when running or debugging your application in a simulator, add the copy_resources.rb External Tool to your run/debug configuration:

    1. Open your project's Run/Debug Configuration.
    2. Locate the Before launch section.
    3. Click the + icon and select Run External Tool.
    4. Choose the platform-specific tool you created (e.g., Copy Resources - iOS).
  3. Export iOS Icons and Launch Assets using the Xcode project

    master

    To customize and export iOS app icons and launch screens for a Starling/AIR project, use the provided Xcode project in util/ios_asset_project/.

    1. Modify the project in Xcode as described in the distriqt documentation.
    2. Build the project using Xcode.
    3. In the Xcode project navigator, right-click on iOS Asset Project.app and select 'Show in Finder'.
    4. In Finder, right-click the app file and select 'Show Package Contents'.
    5. Copy the following files to your Starling Scaffold (system subfolder) or your AIR project:
      • Assets.car (required for icons)
      • LaunchScreen.storyboardc (optional, used for custom launch screens)
  4. Implement Notch support on iOS

    master

    On iOS, the viewport fills the entire screen, including the notch and home indicator. To handle the 'safe area' and avoid UI overlap, it is recommended to use the Application ANE from distriqt.

    To implement this in the scaffold:

    1. Enable the commented-out code in the scaffold that uses the ANE.
    2. Update Scaffold_Mobile-app.xml to include the ANE.
    3. Modify utils/ScreenSetup to utilize the ANE's safe area information.
  5. Convert graphics to distance field textures with Field Agent

    master

    Field Agent converts pure black and white bitmaps into distance field textures.

    Input Requirements:

    • The foreground (the object to render) must be pure black.
    • The background can be white or transparent.
    • Recommended input: A vector image exported to PNG.

    Basic Usage:

    ruby field_agent.rb input.png output.png
    ruby field_agent.rb input.png output.png
  6. Access Starling Framework documentation and resources

    master
  7. Configure IntelliJ IDEA External Tool to copy resources for simulators

    master

    When running Starling projects on simulators (iOS, Android, or AIR), IntelliJ IDEA may not automatically include resources defined in the module settings. To fix this, you can use the copy_resources.rb script as an External Tool in IntelliJ IDEA. This script parses your IDEA module file to identify and copy the correct resources into the output folder.

    Setup Instructions

    1. Open IntelliJ IDEA Preferences and navigate to Tools.
    2. Create a new External Tool entry for each platform you support using the following configurations:

    For iOS:

    • Name: Copy Resources - iOS
    • Description: Copies the project's resources into the output folder so that the simulator can find them.
    • Program: /path/to/starling/util/idea/copy_resources.rb
    • Parameters: $ModuleFilePath$ ios
    • Working Directory: (leave empty)

    For Android:

    • Parameters: $ModuleFilePath$ android

    For AIR Desktop:

    • Parameters: $ModuleFilePath$ air-desktop

    Note: If you omit the second parameter (e.g., just use $ModuleFilePath$), the script will attempt to copy resources for all configured platforms.

  8. Build the project in Visual Studio Code

    master

    To run the scaffold in Visual Studio Code, follow these steps:

    1. Install the ActionScript & MXML extension by Josh Tynjala.
    2. Point the extension to your latest AIR SDK.
    3. Open the project folder in VS Code.
    4. (Optional) To run on a physical device, update the signingOptions in asconfig.json with your local Apple and Google development keys.
    5. Open the Run and Debug menu in the sidebar and select one of the available configurations to start.