content: import 'package:flame/components.dart';
  import 'package:flame_audio/flame_audio.dart';
  import 'package:flutter/material.dart';
  import 'package:kojaem_novel_game_prototype/route.dart';
  import 'package:shared_preferences/shared_preferences.dart';
  
  class StartPage extends Component with HasGameReference<RouterGame> {
    StartPage() {
      addAll([
        // PauseButton(position: Vector2(20, 10)),
        BgmToggleButton(position: Vector2(20, 10)),
        AutoSaveToggleButton(position: Vector2(70, 10)),
        _logo = TextComponent(
          text: 'Lobby',
          textRenderer: TextPaint(
            style: const TextStyle(
              fontSize: 64,
              fontFamily: 'GmarketSans',
              color: Color(0xFFC8FFF5),
              fontWeight: FontWeight.w700,
            ),
          ),
          anchor: Anchor.center,
        ),
        _button1 = RoundedButton(
          text: '새로하기',
          action: () async {
            if (game.playBgm) {
              FlameAudio.bgm.play('HYP - Picnic.mp3');
            }
            final SharedPreferences pref = await SharedPreferences.getInstance();
            pref.setString('story', 'start');
            game.router.pushNamed('newGame');
          },
          color: const Color(0xffadde6c),
          borderColor: const Color(0xffedffab),
        ),
        _button2 = RoundedButton(
          text: '이어하기',
          action: () async {
            if (game.playBgm) {
              FlameAudio.bgm.play('HYP - Picnic.mp3');
            }
            game.router.pushNamed('continueGame');
          },
          color: const Color(0xffdebe6c),
          borderColor: const Color(0xfffff4c7),
        ),
      ]);
    }
  
    late final TextComponent _logo;
    late final RoundedButton _button1;
    late final RoundedButton _button2;
  
    @override
    void onGameResize(Vector2 size) {
      super.onGameResize(size);
      _logo.position = Vector2(size.x / 2, size.y / 3);
      _button1.position = Vector2(size.x / 2, _logo.y + 80);
      _button2.position = Vector2(size.x / 2, _logo.y + 140);
    }
  }
  