Game constructor

Game({
  1. required String title,
  2. required Sdl sdl,
  3. required SoundBackend soundBackend,
  4. String orgName = 'com.example',
  5. String appName = 'untitled_game',
  6. String preferencesFileName = 'preferences.json',
  7. String preferencesKey = defaultPreferencesKey,
  8. TriggerMap triggerMap = const TriggerMap([]),
  9. Random? random,
})

Create an instance.

Implementation

Game({
  required this.title,
  required this.sdl,
  required this.soundBackend,
  this.orgName = 'com.example',
  this.appName = 'untitled_game',
  this.preferencesFileName = 'preferences.json',
  this.preferencesKey = defaultPreferencesKey,
  this.triggerMap = const TriggerMap([]),
  final Random? random,
})  : _levels = [],
      _isRunning = false,
      tasks = [],
      gameControllers = {},
      joysticks = {},
      random = random ?? Random(),
      interfaceSounds = soundBackend.createSoundChannel(),
      ambianceSounds = soundBackend.createSoundChannel(),
      musicSounds = soundBackend.createSoundChannel();