# GameSnacks Developer SDK

The GameSnacks Developer SDK provides various features to games hosted on
GameSnacks.

You don't need to load any scripts; the SDK is automatically loaded for all
games hosted on GameSnacks.

## GameSnacks interface

The main interface. An instance of this is available as the `GameSnacks`
property on `window`.

Features marked as **required** must be integrated into your game following all
requirements listed within these features.

### Properties

[`ad: Ad`](https://developers.google.com/gamesnacks/developer/ad)   

Methods for displaying in-game advertising. **Required**

[`audio: Audio`](https://developers.google.com/gamesnacks/developer/audio)   

Methods for controlling audio. **Required**

[`game: Game`](https://developers.google.com/gamesnacks/developer/game)   

Game lifecycle events and pause controls. **Required**

[`score: Score`](https://developers.google.com/gamesnacks/developer/score)   

Methods for updating the user's score. **Required**

[`storage: Storage`](https://developers.google.com/gamesnacks/developer/storage)   

Methods for persisting game and save data. **Required**

### Examples

    // Register lifecycle event handlers.
    GameSnacks.game.onPause(() => {
      // Display pause screen.
      engine.scene("pauseScreen").setVisible();
      // Pause game loop.
      engine.loop.sleep();
    });
    GameSnacks.game.onResume(...);

    // Set up audio controls.
    engine.sound.setMute(!GameSnacks.audio.isEnabled);
    GameSnacks.audio.subscribe((isEnabled) => engine.sound.setMute(!isEnabled));

    // Announce that the game is ready to be shown.
    GameSnacks.game.firstFrameReady();