Compare commits

..

1 Commits

Author SHA1 Message Date
651a8e932f changes 2024-05-24 18:14:17 +03:00
36 changed files with 718 additions and 419 deletions

View File

@ -1,3 +1,9 @@
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}
def localProperties = new Properties() def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties') def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) { if (localPropertiesFile.exists()) {
@ -6,10 +12,10 @@ if (localPropertiesFile.exists()) {
} }
} }
def flutterRoot = localProperties.getProperty('flutter.sdk') // def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) { // if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") // throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
} // }
def flutterVersionCode = localProperties.getProperty('flutter.versionCode') def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) { if (flutterVersionCode == null) {
@ -21,17 +27,17 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0' flutterVersionName = '1.0'
} }
apply plugin: 'com.android.application' // apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" // apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android { android {
compileSdkVersion 30 compileSdkVersion 34
defaultConfig { defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.firogames.firo_runner" applicationId "com.firogames.firo_runner"
minSdkVersion 16 minSdkVersion flutter.minSdkVersion
targetSdkVersion 30 targetSdkVersion 34
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
} }
@ -48,3 +54,8 @@ android {
flutter { flutter {
source '../..' source '../..'
} }
// dependencies {
// implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.20"
// }

View File

@ -7,6 +7,7 @@
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop" android:launchMode="singleTop"
android:theme="@style/LaunchTheme" android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"

View File

@ -1,13 +1,13 @@
buildscript { // buildscript {
repositories { // repositories {
google() // google()
jcenter() // jcenter()
} // }
dependencies { // dependencies {
classpath 'com.android.tools.build:gradle:4.1.0' // classpath 'com.android.tools.build:gradle:4.1.0'
} // }
} // }
allprojects { allprojects {
repositories { repositories {
@ -22,6 +22,6 @@ subprojects {
project.evaluationDependsOn(':app') project.evaluationDependsOn(':app')
} }
task clean(type: Delete) { tasks.register("clean", Delete) {
delete rootProject.buildDir delete rootProject.buildDir
} }

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip

View File

@ -1,11 +1,38 @@
include ':app' // include ':app'
def localPropertiesFile = new File(rootProject.projectDir, "local.properties") // def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties() // def properties = new Properties()
assert localPropertiesFile.exists() // assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } // localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
def flutterSdkPath = properties.getProperty("flutter.sdk") // def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties" // assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" // apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}()
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
id "org.jetbrains.kotlin.android" version "1.7.20" apply false
}
include ":app"

View File

@ -5,7 +5,6 @@ import 'package:flame/components.dart';
import 'package:flame/extensions.dart'; import 'package:flame/extensions.dart';
import 'package:flame/flame.dart'; import 'package:flame/flame.dart';
import 'package:flame_audio/flame_audio.dart'; import 'package:flame_audio/flame_audio.dart';
import 'package:audioplayers/src/api/player_mode.dart';
enum FireworkState { normal } enum FireworkState { normal }
@ -48,11 +47,10 @@ class Firework extends Component {
current: FireworkState.normal, current: FireworkState.normal,
); );
sprite1.changePriorityWithoutResorting(FIREWORK_PRIORITY); sprite1.priority = FIREWORK_PRIORITY;
sprite1.update(100); sprite1.update(100);
sprite1.size = sprite1.size = Vector2(gameRef.canvasSize.y, gameRef.canvasSize.y);
Vector2(gameRef.viewport.canvasSize.y, gameRef.viewport.canvasSize.y);
sprite1.position = Vector2(0, 0); sprite1.position = Vector2(0, 0);
sprite2 = SpriteAnimationGroupComponent( sprite2 = SpriteAnimationGroupComponent(
@ -62,12 +60,10 @@ class Firework extends Component {
current: FireworkState.normal, current: FireworkState.normal,
); );
sprite2.changePriorityWithoutResorting(FIREWORK_PRIORITY); sprite2.priority = FIREWORK_PRIORITY;
sprite2.size = sprite2.size = Vector2(gameRef.canvasSize.y, gameRef.canvasSize.y);
Vector2(gameRef.viewport.canvasSize.y, gameRef.viewport.canvasSize.y); sprite2.position = Vector2(gameRef.canvasSize.x - sprite2.size.x, 0);
sprite2.position =
Vector2(gameRef.viewport.canvasSize.x - sprite2.size.x, 0);
sprite2.update(100); sprite2.update(100);
} }
@ -80,7 +76,7 @@ class Firework extends Component {
@override @override
void update(double dt) { void update(double dt) {
if (!(sprite1.animation?.done() ?? false)) { if (!(sprite1.animationTicker?.done() ?? false)) {
timeSinceFirework = 0; timeSinceFirework = 0;
} else { } else {
timeSinceFirework += dt; timeSinceFirework += dt;
@ -92,27 +88,27 @@ class Firework extends Component {
void renderText(Canvas canvas) { void renderText(Canvas canvas) {
sprite1.render(canvas); sprite1.render(canvas);
sprite1.render(canvas); sprite1.render(canvas);
if ((sprite1.animation?.done() ?? false) && final textPainter = gameRef.fireworksPaint.toTextPainter(message);
textPainter.layout();
final textWidth = textPainter.width;
final textHeight = textPainter.height;
if ((sprite1.animationTicker?.done() ?? false) &&
timeSinceFirework < 1 && timeSinceFirework < 1 &&
message != "") { message != "") {
gameRef.fireworksPaint.render( gameRef.fireworksPaint.render(
canvas, canvas,
message, message,
Vector2( Vector2(gameRef.size.x / 2 - textWidth / 2,
gameRef.size.x / 2 - gameRef.size.y / 9 - textHeight / 2),
gameRef.fireworksPaint.measureTextWidth(message) / 2,
gameRef.size.y / 9 -
gameRef.fireworksPaint.measureTextHeight(message) / 2),
); );
} }
} }
void reset() { void reset() {
message = messages.elementAt(random.nextInt(messages.length)); message = messages.elementAt(random.nextInt(messages.length));
sprite1.animation!.reset(); sprite1.animationTicker!.reset();
sprite2.animation!.reset(); sprite2.animationTicker!.reset();
FlameAudio.audioCache FlameAudio.play("sfx/fireworks.mp3", volume: 0.75);
.play("sfx/fireworks.mp3", volume: 0.75, mode: PlayerMode.LOW_LATENCY);
} }
void resize(Vector2 newSize, double xRatio, double yRatio) { void resize(Vector2 newSize, double xRatio, double yRatio) {

View File

@ -131,19 +131,19 @@ class GameState extends Component {
if (!isPaused) { if (!isPaused) {
switch (getLevel()) { switch (getLevel()) {
case 7: case 7:
return gameRef.viewport.canvasSize.x * 0.30; return gameRef.canvasSize.x * 0.30;
case 6: case 6:
return gameRef.viewport.canvasSize.x * 0.28; return gameRef.canvasSize.x * 0.28;
case 5: case 5:
return gameRef.viewport.canvasSize.x * 0.26; return gameRef.canvasSize.x * 0.26;
case 4: case 4:
return gameRef.viewport.canvasSize.x * 0.24; return gameRef.canvasSize.x * 0.24;
case 3: case 3:
return gameRef.viewport.canvasSize.x * 0.22; return gameRef.canvasSize.x * 0.22;
case 2: case 2:
return gameRef.viewport.canvasSize.x * 0.20; return gameRef.canvasSize.x * 0.20;
default: default:
return gameRef.viewport.canvasSize.x * 0.18; return gameRef.canvasSize.x * 0.18;
} }
} else { } else {
return 0; return 0;

View File

@ -63,7 +63,7 @@ class BugHolder extends Holder {
if (platform != null) { if (platform != null) {
platform.removeChildren.add(() { platform.removeChildren.add(() {
objects[level].remove(bug); objects[level].remove(bug);
bug.remove(); gameRef.remove(bug);
}); });
} }
return false; return false;

View File

@ -23,7 +23,7 @@ class CoinHolder extends Holder {
current: CoinState.normal, current: CoinState.normal,
); );
sprite.changePriorityWithoutResorting(COIN_PRIORITY); sprite.priority = COIN_PRIORITY;
sprite.size = Vector2(20, 20); sprite.size = Vector2(20, 20);
} }

View File

@ -58,7 +58,7 @@ class DebrisHolder extends Holder {
if (platform != null) { if (platform != null) {
platform.removeChildren.add(() { platform.removeChildren.add(() {
objects[level].remove(debris); objects[level].remove(debris);
debris.remove(); gameRef.remove(debris);
}); });
} }
return false; return false;

View File

@ -48,7 +48,7 @@ class Holder {
// Remove and object from this holder. // Remove and object from this holder.
void remove(List<MovingObject> levelHolder, int j) { void remove(List<MovingObject> levelHolder, int j) {
levelHolder[j].remove(); levelHolder[j].removeSprite();
levelHolder.removeAt(j); levelHolder.removeAt(j);
} }

View File

@ -56,7 +56,7 @@ class WallHolder extends Holder {
if (platform != null) { if (platform != null) {
platform.removeChildren.add(() { platform.removeChildren.add(() {
objects[level].remove(wall); objects[level].remove(wall);
wall.remove(); gameRef.remove(wall);
}); });
} }
return false; return false;

View File

@ -44,9 +44,9 @@ class WireHolder extends Holder {
} }
Wire wire = Wire(gameRef); Wire wire = Wire(gameRef);
wire.sprite.renderFlipX = true; wire.sprite.flipHorizontally();
if (level % 3 == 0) { if (level % 3 == 0) {
wire.sprite.renderFlipY = true; wire.sprite.flipVertically();
wire.setPosition( wire.setPosition(
xCoordinate, gameRef.blockSize * level - 2 * gameRef.blockSize / 7); xCoordinate, gameRef.blockSize * level - 2 * gameRef.blockSize / 7);
} else { } else {
@ -63,7 +63,7 @@ class WireHolder extends Holder {
if (platform != null) { if (platform != null) {
platform.removeChildren.add(() { platform.removeChildren.add(() {
objects[level].remove(wire); objects[level].remove(wire);
wire.remove(); gameRef.remove(wire);
}); });
} }
return false; return false;

View File

@ -16,12 +16,12 @@ import 'package:firo_runner/overlays/sign_in_overlay.dart';
import 'package:firo_runner/holders/wall_holder.dart'; import 'package:firo_runner/holders/wall_holder.dart';
import 'package:firo_runner/moving_objects/wire.dart'; import 'package:firo_runner/moving_objects/wire.dart';
import 'package:firo_runner/holders/wire_holder.dart'; import 'package:firo_runner/holders/wire_holder.dart';
import 'package:flame/camera.dart';
import 'package:flame/components.dart'; import 'package:flame/components.dart';
import 'package:flame/events.dart';
import 'package:flame/extensions.dart'; import 'package:flame/extensions.dart';
import 'package:flame/flame.dart'; import 'package:flame/flame.dart';
import 'package:flame/game.dart'; import 'package:flame/game.dart';
import 'package:flame/gestures.dart';
import 'package:flame/keyboard.dart';
import 'package:flame_audio/flame_audio.dart'; import 'package:flame_audio/flame_audio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@ -96,8 +96,8 @@ void main() async {
'loading': (_, myGame) { 'loading': (_, myGame) {
return Center( return Center(
child: Container( child: Container(
height: myGame.viewport.canvasSize.y, height: myGame.canvasSize.y,
width: myGame.viewport.canvasSize.x, width: myGame.canvasSize.x,
color: Colors.black, color: Colors.black,
), ),
); );
@ -132,14 +132,14 @@ int getNearestPlatform(int level) {
: 8; : 8;
} }
class MyGame extends BaseGame with PanDetector, TapDetector, KeyboardEvents { class MyGame extends FlameGame with PanDetector, TapDetector, KeyboardEvents {
TextPaint fireworksPaint = TextPaint( TextPaint fireworksPaint = TextPaint(
config: const TextPaintConfig( style: TextStyle(
fontSize: 48.0, fontFamily: 'Codystar', color: FIREWORK_COLOR), fontSize: 48.0, fontFamily: 'Codystar', color: FIREWORK_COLOR),
); );
TextPaint scoresPaint = TextPaint( TextPaint scoresPaint = TextPaint(
config: const TextPaintConfig(fontSize: 16.0, color: FIREWORK_COLOR), style: TextStyle(fontSize: 16.0, color: FIREWORK_COLOR),
); );
String leaderboard = ""; String leaderboard = "";
@ -163,7 +163,8 @@ class MyGame extends BaseGame with PanDetector, TapDetector, KeyboardEvents {
late GameState gameState; late GameState gameState;
late double blockSize; late double blockSize;
bool loaded = false; @override
bool isLoaded = false;
bool firstDeath = true; bool firstDeath = true;
late Wire wire; late Wire wire;
late TextComponent _distance; late TextComponent _distance;
@ -171,7 +172,7 @@ class MyGame extends BaseGame with PanDetector, TapDetector, KeyboardEvents {
int startLoading = 0; int startLoading = 0;
MyGame() : super() { MyGame() : super() {
viewport.resize(Vector2(1920, 1080)); FixedResolutionViewport(resolution: Vector2(1920, 1080));
} }
// Load the game and all of its assets, may take a couple of seconds. // Load the game and all of its assets, may take a couple of seconds.
@ -236,15 +237,19 @@ class MyGame extends BaseGame with PanDetector, TapDetector, KeyboardEvents {
await runner.load(); await runner.load();
// Set up game UI // Set up game UI
loaded = true; isLoaded = true;
_distance = TextComponent("Time: 0", _distance = TextComponent(
position: Vector2(size.x - 100, 10), textRenderer: scoresPaint) text: "Time: 0",
position: Vector2(size.x - 100, 10),
textRenderer: scoresPaint)
..anchor = Anchor.topRight; ..anchor = Anchor.topRight;
_distance.changePriorityWithoutResorting(OVERLAY_PRIORITY); _distance.priority = OVERLAY_PRIORITY;
_coins = TextComponent(": 0", _coins = TextComponent(
position: Vector2(size.x - 20, 10), textRenderer: scoresPaint) text: ": 0",
position: Vector2(size.x - 20, 10),
textRenderer: scoresPaint)
..anchor = Anchor.topRight; ..anchor = Anchor.topRight;
_coins.changePriorityWithoutResorting(OVERLAY_PRIORITY); _coins.priority = OVERLAY_PRIORITY;
// add all overlays first since the first time they are added there is a // add all overlays first since the first time they are added there is a
// delay, so calling it earlier makes a smoother experience. // delay, so calling it earlier makes a smoother experience.
@ -403,7 +408,7 @@ class MyGame extends BaseGame with PanDetector, TapDetector, KeyboardEvents {
// Put the loss screen up. // Put the loss screen up.
Future<void> displayLoss() async { Future<void> displayLoss() async {
if (!(runner.sprite.animation?.done() ?? false) && if (!(runner.sprite.animationTicker?.done() ?? false) &&
runner.sprite.animation!.loop == false && runner.sprite.animation!.loop == false &&
firstDeath) { firstDeath) {
return; return;
@ -422,11 +427,11 @@ class MyGame extends BaseGame with PanDetector, TapDetector, KeyboardEvents {
// reset the game. // reset the game.
void reset() { void reset() {
runner.sprite.animation!.reset(); runner.sprite.animationTicker!.reset();
overlays.remove('gameOver'); overlays.remove('gameOver');
overlays.remove('mainMenu'); overlays.remove('mainMenu');
shouldReset = false; shouldReset = false;
components.clear(); children.clear();
setUp(); setUp();
} }
@ -456,7 +461,7 @@ class MyGame extends BaseGame with PanDetector, TapDetector, KeyboardEvents {
void setUp() { void setUp() {
add(runner); add(runner);
fireworks.setUp(); fireworks.setUp();
runner.sprite.clearEffects(); runner.sprite.animations?.clear();
runner.sprite.current = RunnerState.run; runner.sprite.current = RunnerState.run;
circuitBackground.setUp(); circuitBackground.setUp();
platformHolder.setUp(); platformHolder.setUp();
@ -524,11 +529,11 @@ class MyGame extends BaseGame with PanDetector, TapDetector, KeyboardEvents {
} }
@override @override
void onResize(Vector2 canvasSize) { void onGameResize(Vector2 canvasSize) {
Vector2 oldSize = viewport.canvasSize; Vector2 oldSize = canvasSize;
super.onResize(canvasSize); super.onGameResize(canvasSize);
blockSize = canvasSize.y / 9; blockSize = canvasSize.y / 9;
if (loaded) { if (isLoaded) {
double xRatio = canvasSize.x / oldSize.x; double xRatio = canvasSize.x / oldSize.x;
double yRatio = canvasSize.y / oldSize.y; double yRatio = canvasSize.y / oldSize.y;
circuitBackground.resize(canvasSize, xRatio, yRatio); circuitBackground.resize(canvasSize, xRatio, yRatio);
@ -556,8 +561,8 @@ class MyGame extends BaseGame with PanDetector, TapDetector, KeyboardEvents {
@override @override
void onPanUpdate(DragUpdateInfo info) { void onPanUpdate(DragUpdateInfo info) {
xDeltas.add(info.delta.game.x); xDeltas.add(info.delta.global.x);
yDeltas.add(info.delta.game.y); yDeltas.add(info.delta.global.y);
if (xDeltas.length > 2 && !action) { if (xDeltas.length > 2 && !action) {
action = true; action = true;
if (!playingMusic && kIsWeb) { if (!playingMusic && kIsWeb) {
@ -605,36 +610,41 @@ class MyGame extends BaseGame with PanDetector, TapDetector, KeyboardEvents {
// Keyboard controls. // Keyboard controls.
var keyboardKey; var keyboardKey;
@override @override
void onKeyEvent(RawKeyEvent event) { KeyEventResult onKeyEvent(KeyEvent event, Set<LogicalKeyboardKey> keys) {
if (!playingMusic && kIsWeb) { if (!playingMusic && kIsWeb) {
playMusic(); playMusic();
} }
if (event is RawKeyDownEvent) { if (event is KeyDownEvent) {
action = true; action = true;
keyboardKey = null; keyboardKey = null;
switch (event.data.logicalKey.keyId) { switch (event.logicalKey.keyId) {
case 4294968068: case 4294968068:
case 119: case 119:
case 87: case 87:
// case "w": // case "w":
runner.control("up"); runner.control("up");
break; break;
case 4294968066: case 4294968066:
case 97: case 97:
case 65: case 65:
// case "a": // case "a":
runner.control("left"); runner.control("left");
break; break;
case 4294968065: case 4294968065:
case 115: case 115:
case 83: case 83:
// case "s": // case "s":
runner.control("down"); runner.control("down");
break; break;
case 4294968067: case 4294968067:
case 100: case 100:
case 68: case 68:
// case "d": // case "d":
runner.control("right"); runner.control("right");
break; break;
default: default:
@ -642,8 +652,11 @@ class MyGame extends BaseGame with PanDetector, TapDetector, KeyboardEvents {
} }
} }
if (event is RawKeyUpEvent) { if (event is KeyUpEvent) {
action = false; action = false;
return KeyEventResult.handled;
} }
return KeyEventResult.ignored;
} }
} }

View File

@ -21,7 +21,7 @@ class Bug extends MovingObject {
current: BugState.normal, current: BugState.normal,
); );
sprite.changePriorityWithoutResorting(BUG_PRIORITY); sprite.priority = BUG_PRIORITY;
setSize( setSize(
gameRef.blockSize, gameRef.blockSize,

View File

@ -152,9 +152,9 @@ class CircuitBackground extends MovingObject {
current: OverlayState.first, current: OverlayState.first,
); );
overlayA.changePriorityWithoutResorting(WINDOW_PRIORITY - 1); overlayA.priority = WINDOW_PRIORITY - 1;
overlayA.changePriorityWithoutResorting(WINDOW_PRIORITY - 1); overlayA.priority = WINDOW_PRIORITY - 1;
windows0 = await Flame.images.load("windows-0.png"); windows0 = await Flame.images.load("windows-0.png");
windows1 = await Flame.images.load("windows-1.png"); windows1 = await Flame.images.load("windows-1.png");
@ -246,9 +246,9 @@ class CircuitBackground extends MovingObject {
current: WindowState.first, current: WindowState.first,
); );
windowA.changePriorityWithoutResorting(WINDOW_PRIORITY); windowA.priority = WINDOW_PRIORITY;
windowA.changePriorityWithoutResorting(WINDOW_PRIORITY); windowA.priority = WINDOW_PRIORITY;
setUp(); setUp();
} }
@ -260,8 +260,8 @@ class CircuitBackground extends MovingObject {
overlayB.current = OverlayState.first; overlayB.current = OverlayState.first;
background1Position = Vector2(0, 0); background1Position = Vector2(0, 0);
background1Size = Vector2( background1Size = Vector2(
gameRef.viewport.canvasSize.y * (background.width / background.height), gameRef.canvasSize.y * (background.width / background.height),
gameRef.viewport.canvasSize.y); gameRef.canvasSize.y);
windowA.position = background1Position; windowA.position = background1Position;
windowA.size = background1Size; windowA.size = background1Size;
overlayA.position = background1Position; overlayA.position = background1Position;
@ -270,8 +270,8 @@ class CircuitBackground extends MovingObject {
background2Position = background2Position =
Vector2(background1Position.x + background1Size.x - 1, 0); Vector2(background1Position.x + background1Size.x - 1, 0);
background2Size = Vector2( background2Size = Vector2(
gameRef.viewport.canvasSize.y * (background.width / background.height), gameRef.canvasSize.y * (background.width / background.height),
gameRef.viewport.canvasSize.y); gameRef.canvasSize.y);
windowB.position = background2Position; windowB.position = background2Position;
windowB.size = background2Size; windowB.size = background2Size;
overlayB.position = background2Position; overlayB.position = background2Position;

View File

@ -16,7 +16,7 @@ class Coin extends MovingObject {
current: CoinState.normal, current: CoinState.normal,
); );
sprite.changePriorityWithoutResorting(COIN_PRIORITY); sprite.priority = COIN_PRIORITY;
var platform = gameRef.platformHolder.l1[0].image; var platform = gameRef.platformHolder.l1[0].image;

View File

@ -16,7 +16,7 @@ class Debris extends MovingObject {
current: DebrisState.normal, current: DebrisState.normal,
); );
sprite.changePriorityWithoutResorting(DEBRIS_PRIORITY); sprite.priority = DEBRIS_PRIORITY;
setSize( setSize(
gameRef.blockSize * gameRef.blockSize *

View File

@ -1,12 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:firo_runner/main.dart'; import 'package:firo_runner/main.dart';
import 'package:flame/components.dart'; import 'package:flame/components.dart';
// Class meant to be extended by any object that will move left on the screen. class MovingObject extends Component {
// Ensures a relatively constant moving velocity, and takes care of sprite
// animations and positioning.
class MovingObject {
late SpriteAnimationGroupComponent sprite; late SpriteAnimationGroupComponent sprite;
MyGame gameRef; MyGame gameRef;
@ -21,21 +17,26 @@ class MovingObject {
} }
Sprite getSprite() { Sprite getSprite() {
return sprite.animation!.getSprite(); return sprite.animationTicker!.getSprite();
} }
@override
void update(double dt) { void update(double dt) {
double velocity = gameRef.gameState.getVelocity(); double velocity = gameRef.gameState.getVelocity();
sprite.position = sprite.position - Vector2(velocity * dt, 0); sprite.position = sprite.position - Vector2(velocity * dt, 0);
} }
// Get the rightmost pixel position of this sprite. @override
void render(Canvas canvas) {
sprite.render(canvas);
}
double getRightEnd() { double getRightEnd() {
return sprite.position.x + sprite.width; return sprite.position.x + sprite.width;
} }
void remove() { void removeSprite() {
sprite.remove(); gameRef.remove(sprite);
} }
// See where this object intersects another object if at all. // See where this object intersects another object if at all.

View File

@ -47,8 +47,7 @@ class Platform extends MovingObject {
current: PlatformState.mid, current: PlatformState.mid,
); );
sprite.changePriorityWithoutResorting(PLATFORM_PRIORITY); sprite.priority = PLATFORM_PRIORITY;
setSize( setSize(
gameRef.blockSize * gameRef.blockSize *
(gameRef.platformHolder.l1[0].image.width / (gameRef.platformHolder.l1[0].image.width /
@ -58,9 +57,9 @@ class Platform extends MovingObject {
} }
@override @override
void remove() { void removeFromParent() {
removeChildrenObjects(); removeChildrenObjects();
super.remove(); super.removeFromParent();
} }
void removeChildrenObjects() { void removeChildrenObjects() {

View File

@ -18,7 +18,7 @@ class Wall extends MovingObject {
current: WallState.normal, current: WallState.normal,
); );
sprite.changePriorityWithoutResorting(WALL_PRIORITY); sprite.priority = WALL_PRIORITY;
setSize( setSize(
gameRef.blockSize * gameRef.blockSize *

View File

@ -17,7 +17,7 @@ class Wire extends MovingObject {
current: WireState.normal, current: WireState.normal,
); );
sprite.changePriorityWithoutResorting(WIRE_PRIORITY); sprite.priority = WIRE_PRIORITY;
setSize( setSize(
gameRef.blockSize, gameRef.blockSize,

View File

@ -14,7 +14,7 @@ class DepositOverlay extends StatelessWidget {
List<Widget> getDepositAddress(double width) { List<Widget> getDepositAddress(double width) {
List<Widget> list = []; List<Widget> list = [];
if (game.address.length != 34) {} if (game.address.length != 34) {}
list.add(QrImage( list.add(QrImageView(
data: game.address, data: game.address,
version: QrVersions.auto, version: QrVersions.auto,
size: width / 5, size: width / 5,
@ -50,8 +50,8 @@ class DepositOverlay extends StatelessWidget {
child: InkWell( child: InkWell(
child: Center( child: Center(
child: Container( child: Container(
height: game.viewport.canvasSize.y, height: game.canvasSize.y,
width: game.viewport.canvasSize.x, width: game.canvasSize.x,
decoration: const BoxDecoration( decoration: const BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: lossImage, image: lossImage,

View File

@ -140,8 +140,8 @@ class LeaderBoardOverlay extends StatelessWidget {
child: InkWell( child: InkWell(
child: Center( child: Center(
child: Container( child: Container(
height: game.viewport.canvasSize.y, height: game.canvasSize.y,
width: game.viewport.canvasSize.x, width: game.canvasSize.x,
decoration: const BoxDecoration( decoration: const BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: lossImage, image: lossImage,

View File

@ -3,8 +3,6 @@ import 'package:flutter/material.dart';
import '../main.dart'; import '../main.dart';
import 'package:audioplayers/src/api/player_mode.dart';
class LoseMenuOverlay extends StatelessWidget { class LoseMenuOverlay extends StatelessWidget {
const LoseMenuOverlay({ const LoseMenuOverlay({
Key? key, Key? key,
@ -18,8 +16,8 @@ class LoseMenuOverlay extends StatelessWidget {
double width = MediaQuery.of(context).size.width; double width = MediaQuery.of(context).size.width;
return Center( return Center(
child: Container( child: Container(
height: game.viewport.canvasSize.y, height: game.canvasSize.y,
width: game.viewport.canvasSize.x, width: game.canvasSize.x,
decoration: const BoxDecoration( decoration: const BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: lossImage, image: lossImage,
@ -65,8 +63,7 @@ class LoseMenuOverlay extends StatelessWidget {
// ), // ),
onPressed: () async { onPressed: () async {
// Go to the Main Menu // Go to the Main Menu
await FlameAudio.audioCache.play('sfx/button_click.mp3', await FlameAudio.play('sfx/button_click.mp3');
mode: PlayerMode.LOW_LATENCY);
game.mainMenu(); game.mainMenu();
}, },
), ),
@ -98,11 +95,9 @@ class LoseMenuOverlay extends StatelessWidget {
onPressed: game.competitive && game.tries <= 0 onPressed: game.competitive && game.tries <= 0
? null ? null
: () async { : () async {
await FlameAudio.audioCache.play( await FlameAudio.play('sfx/button_click.mp3');
'sfx/button_click.mp3', game.runner.friend = await FlameAudio.loop(
mode: PlayerMode.LOW_LATENCY); 'sfx/robot_friend_beep.mp3');
game.runner.friend = await FlameAudio.audioCache
.loop('sfx/robot_friend_beep.mp3');
game.reset(); game.reset();
}, },
), ),

View File

@ -1,7 +1,6 @@
import 'package:flame_audio/flame_audio.dart'; import 'package:flame_audio/flame_audio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:audioplayers/src/api/player_mode.dart';
import '../main.dart'; import '../main.dart';
class MainMenuOverlay extends StatelessWidget { class MainMenuOverlay extends StatelessWidget {
@ -17,8 +16,8 @@ class MainMenuOverlay extends StatelessWidget {
double width = MediaQuery.of(context).size.width; double width = MediaQuery.of(context).size.width;
return Center( return Center(
child: Container( child: Container(
height: game.viewport.canvasSize.y, height: game.canvasSize.y,
width: game.viewport.canvasSize.x, width: game.canvasSize.x,
decoration: const BoxDecoration( decoration: const BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: mainMenuImage, image: mainMenuImage,
@ -68,20 +67,16 @@ class MainMenuOverlay extends StatelessWidget {
), ),
onPressed: () async { onPressed: () async {
// Go to the Main Menu // Go to the Main Menu
FlameAudio.audioCache.play('sfx/menu_button.mp3', FlameAudio.play('sfx/menu_button.mp3');
mode: PlayerMode.LOW_LATENCY);
game.competitive = false; game.competitive = false;
game.reset(); game.reset();
game.runner.boost = FlameAudio.audioCache.play( game.runner.boost =
'sfx/laser.mp3', FlameAudio.play('sfx/laser.mp3', volume: 0.0);
volume: 0.0,
mode: PlayerMode.LOW_LATENCY);
FlameAudio.bgm.stop(); FlameAudio.bgm.stop();
FlameAudio.bgm.play('Infinite_Spankage_M.mp3'); FlameAudio.bgm.play('Infinite_Spankage_M.mp3');
game.runner.friend = await FlameAudio.audioCache.loop( game.runner.friend = await FlameAudio.loop(
'sfx/robot_friend_beep.mp3', 'sfx/robot_friend_beep.mp3',
volume: 0.25, volume: 0.25);
mode: PlayerMode.LOW_LATENCY);
}, },
), ),
], ],
@ -118,9 +113,7 @@ class MainMenuOverlay extends StatelessWidget {
: () async { : () async {
game.address = await game.connectServer( game.address = await game.connectServer(
"deposit", "user=${game.username}"); "deposit", "user=${game.username}");
FlameAudio.audioCache.play( FlameAudio.play('sfx/button_click.mp3');
'sfx/button_click.mp3',
mode: PlayerMode.LOW_LATENCY);
game.overlays.add("deposit"); game.overlays.add("deposit");
}, },
), ),
@ -150,23 +143,18 @@ class MainMenuOverlay extends StatelessWidget {
? null ? null
: () async { : () async {
// Go to the Main Menu // Go to the Main Menu
FlameAudio.audioCache.play( FlameAudio.play('sfx/menu_button.mp3');
'sfx/menu_button.mp3', game.runner.boost = FlameAudio.play(
mode: PlayerMode.LOW_LATENCY); 'sfx/laser.mp3',
game.runner.boost = FlameAudio.audioCache volume: 0.0);
.play('sfx/laser.mp3',
volume: 0.0,
mode: PlayerMode.LOW_LATENCY);
game.competitive = true; game.competitive = true;
game.reset(); game.reset();
FlameAudio.bgm.stop(); FlameAudio.bgm.stop();
FlameAudio.bgm FlameAudio.bgm
.play('Infinite_Spankage_M.mp3'); .play('Infinite_Spankage_M.mp3');
game.runner.friend = await FlameAudio game.runner.friend = await FlameAudio.loop(
.audioCache 'sfx/robot_friend_beep.mp3',
.loop('sfx/robot_friend_beep.mp3', volume: 0.25);
volume: 0.25,
mode: PlayerMode.LOW_LATENCY);
}, },
), ),
], ],
@ -197,8 +185,7 @@ class MainMenuOverlay extends StatelessWidget {
), ),
), ),
onPressed: () async { onPressed: () async {
FlameAudio.audioCache.play('sfx/button_click.mp3', FlameAudio.play('sfx/button_click.mp3');
mode: PlayerMode.LOW_LATENCY);
game.overlays.add("signin"); game.overlays.add("signin");
}, },
), ),
@ -224,8 +211,7 @@ class MainMenuOverlay extends StatelessWidget {
onPressed: () async { onPressed: () async {
game.leaderboard = await game.connectServer( game.leaderboard = await game.connectServer(
"leaderboard", "user=value"); "leaderboard", "user=value");
FlameAudio.audioCache.play('sfx/button_click.mp3', FlameAudio.play('sfx/button_click.mp3');
mode: PlayerMode.LOW_LATENCY);
game.overlays.add("leaderboard"); game.overlays.add("leaderboard");
}, },
), ),

View File

@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import '../main.dart'; import '../main.dart';
import 'package:audioplayers/src/api/player_mode.dart';
/// This is the stateful widget that the main application instantiates. /// This is the stateful widget that the main application instantiates.
class SignInOverlay extends StatefulWidget { class SignInOverlay extends StatefulWidget {
@ -32,8 +31,8 @@ class _MyStatefulWidgetState extends State<SignInOverlay> {
child: InkWell( child: InkWell(
child: Center( child: Center(
child: Container( child: Container(
height: widget.game.viewport.canvasSize.y, height: widget.game.canvasSize.y,
width: widget.game.viewport.canvasSize.x, width: widget.game.canvasSize.x,
decoration: const BoxDecoration( decoration: const BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: lossImage, image: lossImage,
@ -88,9 +87,7 @@ class _MyStatefulWidgetState extends State<SignInOverlay> {
onPressed: () async { onPressed: () async {
// // Validate will return true if the form is valid, or false if // // Validate will return true if the form is valid, or false if
// // the form is invalid. // // the form is invalid.
FlameAudio.audioCache.play( FlameAudio.play('sfx/button_click.mp3');
'sfx/button_click.mp3',
mode: PlayerMode.LOW_LATENCY);
if (!_formKey.currentState!.validate()) { if (!_formKey.currentState!.validate()) {
return; return;
} }

View File

@ -10,7 +10,6 @@ import 'package:flame/components.dart';
import 'package:flame/image_composition.dart'; import 'package:flame/image_composition.dart';
import 'package:flame_audio/flame_audio.dart'; import 'package:flame_audio/flame_audio.dart';
import 'package:flutter/animation.dart'; import 'package:flutter/animation.dart';
import 'package:audioplayers/src/api/player_mode.dart';
enum RunnerState { enum RunnerState {
run, run,
@ -66,7 +65,7 @@ class Runner extends Component with HasGameRef<MyGame> {
} }
Sprite getSprite() { Sprite getSprite() {
return sprite.animation!.getSprite(); return sprite.animationTicker!.getSprite();
} }
@override @override
@ -88,26 +87,31 @@ class Runner extends Component with HasGameRef<MyGame> {
if (gameRef.gameState.isPaused) { if (gameRef.gameState.isPaused) {
return; return;
} }
sprite.animation!.reset(); sprite.animationTicker!.reset();
switch (event) { switch (event) {
case "jump": case "jump":
previousState = runnerState; previousState = runnerState;
runnerState = event; runnerState = "jump";
sprite.current = RunnerState.jump; sprite.current = RunnerState.jump;
sprite.addEffect(MoveEffect( print('jump');
path: [ sprite.add(MoveToEffect(
// sprite.position, // sprite.position,
Vector2(sprite.x, (level - 1) * gameRef.blockSize), Vector2(sprite.x, (level - 1) * gameRef.blockSize),
], EffectController(
duration: 0.15, duration: 0.15,
curve: Curves.bounceIn, curve: Curves.bounceIn,
),
onComplete: () { onComplete: () {
print('complete jump');
updateLevel(); updateLevel();
this.event("float"); this.event("float");
}, },
)); ));
break; break;
case "double_jump": case "double_jump":
print('double_jump');
if (belowPlatform()) { if (belowPlatform()) {
break; break;
} }
@ -128,12 +132,12 @@ class Runner extends Component with HasGameRef<MyGame> {
sprite.current = RunnerState.float; sprite.current = RunnerState.float;
break; break;
} }
sprite.addEffect(MoveEffect( sprite.add(MoveToEffect(
path: [
Vector2(sprite.x, (level - 2) * gameRef.blockSize), Vector2(sprite.x, (level - 2) * gameRef.blockSize),
], EffectController(
duration: 0.20, duration: 0.20,
curve: Curves.ease, curve: Curves.ease,
),
onComplete: () { onComplete: () {
updateLevel(); updateLevel();
clearEffects(); clearEffects();
@ -146,17 +150,20 @@ class Runner extends Component with HasGameRef<MyGame> {
)); ));
break; break;
case "fall": case "fall":
print('fall');
previousState = runnerState; previousState = runnerState;
clearEffects(); clearEffects();
runnerState = event; runnerState = event;
sprite.current = RunnerState.fall; sprite.current = RunnerState.fall;
sprite.addEffect(getFallingEffect()); sprite.add(getFallingEffect());
break; break;
case "kick": case "kick":
print('kick');
previousState = runnerState; previousState = runnerState;
runnerState = event; runnerState = event;
boost = FlameAudio.audioCache boost = FlameAudio.play('sfx/laser.mp3', volume: 1.0);
.play('sfx/laser.mp3', volume: 1.0, mode: PlayerMode.LOW_LATENCY);
switch (gameRef.gameState.getRobotLevel()) { switch (gameRef.gameState.getRobotLevel()) {
case 3: case 3:
sprite.current = RunnerState.kick3; sprite.current = RunnerState.kick3;
@ -170,15 +177,16 @@ class Runner extends Component with HasGameRef<MyGame> {
} }
break; break;
case "run": case "run":
print('run');
previousState = runnerState; previousState = runnerState;
runnerState = event; runnerState = event;
sprite.current = RunnerState.run; sprite.current = RunnerState.run;
break; break;
case "float": case "float":
print('float');
previousState = runnerState; previousState = runnerState;
runnerState = event; runnerState = event;
boost = FlameAudio.audioCache.play('sfx/jet_boost.mp3', boost = FlameAudio.play('sfx/jet_boost.mp3', volume: 0.25);
volume: 0.25, mode: PlayerMode.LOW_LATENCY);
switch (gameRef.gameState.getRobotLevel()) { switch (gameRef.gameState.getRobotLevel()) {
case 3: case 3:
sprite.current = RunnerState.float3; sprite.current = RunnerState.float3;
@ -190,25 +198,34 @@ class Runner extends Component with HasGameRef<MyGame> {
sprite.current = RunnerState.float; sprite.current = RunnerState.float;
break; break;
} }
sprite.addEffect(MoveEffect(
path: [sprite.position],
duration: 1.5,
curve: Curves.ease,
onComplete: () {
updateLevel(); updateLevel();
if (onTopOfPlatform()) { if (onTopOfPlatform()) {
this.event("run"); this.event("run");
} else { } else {
this.event("fall"); this.event("fall");
} }
}, // sprite.add(MoveToEffect(
)); // sprite.position,
// EffectController(
// duration: 1.5,
// curve: Curves.ease,
// ),
// onComplete: () {
// updateLevel();
// if (onTopOfPlatform()) {
// this.event("run");
// } else {
// this.event("fall");
// }
// },
// ));
break; break;
case "duck": case "duck":
print('duck');
previousState = runnerState; previousState = runnerState;
runnerState = event; runnerState = event;
boost = FlameAudio.audioCache boost = FlameAudio.play('sfx/shield.mp3', volume: 0.25);
.play('sfx/shield.mp3', volume: 0.25, mode: PlayerMode.LOW_LATENCY);
switch (gameRef.gameState.getRobotLevel()) { switch (gameRef.gameState.getRobotLevel()) {
case 3: case 3:
sprite.current = RunnerState.duck3; sprite.current = RunnerState.duck3;
@ -220,24 +237,25 @@ class Runner extends Component with HasGameRef<MyGame> {
sprite.current = RunnerState.duck; sprite.current = RunnerState.duck;
break; break;
} }
sprite.addEffect(MoveEffect( sprite.add(MoveToEffect(
path: [sprite.position], sprite.position,
EffectController(
duration: 1.5, duration: 1.5,
curve: Curves.linear, curve: Curves.linear,
),
onComplete: () { onComplete: () {
if (boost != null) {
boost.then((value) => value.stop()); boost.then((value) => value.stop());
}
this.event("run"); this.event("run");
}, },
)); ));
break; break;
case "die": case "die":
print('die');
if (dead) { if (dead) {
return; return;
} }
FlameAudio.audioCache.play('sfx/fall_death_speed.mp3', FlameAudio.play('sfx/fall_death_speed.mp3', volume: 0.5);
volume: 0.5, mode: PlayerMode.LOW_LATENCY);
previousState = runnerState; previousState = runnerState;
clearEffects(); clearEffects();
runnerState = event; runnerState = event;
@ -245,14 +263,14 @@ class Runner extends Component with HasGameRef<MyGame> {
dead = true; dead = true;
friend.stop(); friend.stop();
gameRef.die(); gameRef.die();
sprite.addEffect(getFallingEffect()); sprite.add(getFallingEffect());
break; break;
case "electrocute": case "electrocute":
print('electrocute');
if (dead) { if (dead) {
return; return;
} }
FlameAudio.audioCache.play('sfx/fall_death_speed.mp3', FlameAudio.play('sfx/fall_death_speed.mp3', volume: 0.5);
volume: 0.5, mode: PlayerMode.LOW_LATENCY);
previousState = runnerState; previousState = runnerState;
clearEffects(); clearEffects();
runnerState = event; runnerState = event;
@ -260,16 +278,17 @@ class Runner extends Component with HasGameRef<MyGame> {
dead = true; dead = true;
friend.stop(); friend.stop();
gameRef.die(); gameRef.die();
sprite.addEffect(getFallingEffect()); sprite.add(getFallingEffect());
break; break;
case "glitch": case "glitch":
print('glitch');
if (dead) { if (dead) {
return; return;
} }
FlameAudio.audioCache.play('sfx/glitch_death.mp3', FlameAudio.play('sfx/glitch_death.mp3', volume: 0.5);
volume: 0.5, mode: PlayerMode.LOW_LATENCY);
previousState = runnerState; previousState = runnerState;
clearEffects(); // clearEffects();
runnerState = event; runnerState = event;
sprite.current = RunnerState.glitch; sprite.current = RunnerState.glitch;
dead = true; dead = true;
@ -297,36 +316,52 @@ class Runner extends Component with HasGameRef<MyGame> {
for (MovingObject p in gameRef.platformHolder.objects[i]) { for (MovingObject p in gameRef.platformHolder.objects[i]) {
if (estimatedXCoordinate >= p.sprite.x - p.sprite.width / 2 && if (estimatedXCoordinate >= p.sprite.x - p.sprite.width / 2 &&
estimatedXCoordinate <= p.sprite.x + p.sprite.width) { estimatedXCoordinate <= p.sprite.x + p.sprite.width) {
return MoveEffect( return MoveToEffect(
path: [
Vector2(sprite.x, (i - 1) * gameRef.blockSize), Vector2(sprite.x, (i - 1) * gameRef.blockSize),
], EffectController(
duration: time, duration: time,
curve: Curves.ease, curve: Curves.ease,
),
onComplete: () { onComplete: () {
updateLevel(); updateLevel();
if (onTopOfPlatform()) { if (onTopOfPlatform()) {
FlameAudio.audioCache FlameAudio.play('sfx/land.mp3');
.play('sfx/land.mp3', mode: PlayerMode.LOW_LATENCY);
event("run"); event("run");
} else { } else {
event("fall"); event("fall");
} }
}, },
); );
// return MoveEffect(
// path: [
// Vector2(sprite.x, (i - 1) * gameRef.blockSize),
// ],
// duration: time,
// curve: Curves.ease,
// onComplete: () {
// updateLevel();
// if (onTopOfPlatform()) {
// FlameAudio
// .play('sfx/land.mp3');
// event("run");
// } else {
// event("fall");
// }
// },
// );
} }
} }
} }
return MoveEffect(
path: [ return MoveToEffect(
Vector2(sprite.x, 8 * gameRef.blockSize), Vector2(sprite.x, 8 * gameRef.blockSize),
], EffectController(
duration: 0.2 * (8 - level), duration: 0.2 * (8 - level),
curve: Curves.ease, curve: Curves.ease,
),
onComplete: () { onComplete: () {
updateLevel(); updateLevel();
FlameAudio.audioCache FlameAudio.play('sfx/land.mp3');
.play('sfx/land.mp3', mode: PlayerMode.LOW_LATENCY);
if (onTopOfPlatform()) { if (onTopOfPlatform()) {
event("run"); event("run");
} else { } else {
@ -334,6 +369,23 @@ class Runner extends Component with HasGameRef<MyGame> {
} }
}, },
); );
// return MoveEffect(
// path: [
// Vector2(sprite.x, 8 * gameRef.blockSize),
// ],
// duration: 0.2 * (8 - level),
// curve: Curves.ease,
// onComplete: () {
// updateLevel();
// FlameAudio
// .play('sfx/land.mp3');
// if (onTopOfPlatform()) {
// event("run");
// } else {
// event("fall");
// }
// },
// );
} }
// Platform agnostic control input to determine the runners actions. // Platform agnostic control input to determine the runners actions.
@ -370,7 +422,7 @@ class Runner extends Component with HasGameRef<MyGame> {
break; break;
case "left": case "left":
if (runnerState == "kick") { if (runnerState == "kick") {
sprite.animation!.reset(); sprite.animationTicker!.reset();
clearEffects(); clearEffects();
event("run"); event("run");
} }
@ -385,9 +437,9 @@ class Runner extends Component with HasGameRef<MyGame> {
event("die"); event("die");
} }
// If the animation is finished // If the animation is finished
if (sprite.animation?.done() ?? false) { if (sprite.animationTicker?.done() ?? false) {
if (!dead) { if (!dead) {
sprite.animation!.reset(); sprite.animationTicker!.reset();
if (runnerState == "kick") { if (runnerState == "kick") {
event("run"); event("run");
} }
@ -399,8 +451,7 @@ class Runner extends Component with HasGameRef<MyGame> {
if (onTopOfPlatform()) { if (onTopOfPlatform()) {
updateLevel(); updateLevel();
clearEffects(); clearEffects();
FlameAudio.audioCache FlameAudio.play('sfx/land.mp3');
.play('sfx/land.mp3', mode: PlayerMode.LOW_LATENCY);
event("run"); event("run");
} }
} }
@ -464,8 +515,7 @@ class Runner extends Component with HasGameRef<MyGame> {
for (int i = 0; i < coinLevel.length;) { for (int i = 0; i < coinLevel.length;) {
if (coinLevel[i].intersect(runnerRect) != "none") { if (coinLevel[i].intersect(runnerRect) != "none") {
gameRef.gameState.numCoins++; gameRef.gameState.numCoins++;
FlameAudio.audioCache.play('sfx/coin_catch.mp3', FlameAudio.play('sfx/coin_catch.mp3', volume: 0.25);
volume: 0.25, mode: PlayerMode.LOW_LATENCY);
gameRef.coinHolder.remove(coinLevel, i); gameRef.coinHolder.remove(coinLevel, i);
continue; continue;
} }
@ -503,8 +553,7 @@ class Runner extends Component with HasGameRef<MyGame> {
return; return;
} }
} else if (intersectState == "left" && runnerState == "kick") { } else if (intersectState == "left" && runnerState == "kick") {
FlameAudio.audioCache FlameAudio.play('sfx/bug_death1.mp3');
.play('sfx/bug_death1.mp3', mode: PlayerMode.LOW_LATENCY);
bugLevel[i].sprite.current = BugState.breaking; bugLevel[i].sprite.current = BugState.breaking;
gameRef.coinHolder.generateCoin(gameRef, level, gameRef.coinHolder.generateCoin(gameRef, level,
force: true, xPosition: bugLevel[i].sprite.x + gameRef.blockSize); force: true, xPosition: bugLevel[i].sprite.x + gameRef.blockSize);
@ -528,8 +577,7 @@ class Runner extends Component with HasGameRef<MyGame> {
} else if (runnerState == "duck" && intersectState != "above") { } else if (runnerState == "duck" && intersectState != "above") {
continue; continue;
} else { } else {
FlameAudio.audioCache FlameAudio.play('sfx/obstacle_death.mp3');
.play('sfx/obstacle_death.mp3', mode: PlayerMode.LOW_LATENCY);
event("die"); event("die");
} }
} }
@ -546,8 +594,7 @@ class Runner extends Component with HasGameRef<MyGame> {
if (intersectState == "none") { if (intersectState == "none") {
continue; continue;
} else { } else {
FlameAudio.audioCache FlameAudio.play('sfx/obstacle_death.mp3');
.play('sfx/obstacle_death.mp3', mode: PlayerMode.LOW_LATENCY);
event("die"); event("die");
} }
} }
@ -633,7 +680,7 @@ class Runner extends Component with HasGameRef<MyGame> {
current: RunnerState.run, current: RunnerState.run,
); );
changePriorityWithoutResorting(RUNNER_PRIORITY); priority = RUNNER_PRIORITY;
} }
Future<SpriteAnimation> loadSpriteAnimation(String name, int howManyFrames, Future<SpriteAnimation> loadSpriteAnimation(String name, int howManyFrames,
@ -661,15 +708,24 @@ class Runner extends Component with HasGameRef<MyGame> {
sprite.y = gameRef.blockSize * level; sprite.y = gameRef.blockSize * level;
sprite.size.x = gameRef.blockSize; sprite.size.x = gameRef.blockSize;
sprite.size.y = gameRef.blockSize; sprite.size.y = gameRef.blockSize;
if (sprite.effects.isNotEmpty) { if (sprite.animations!.isNotEmpty) {
sprite.effects.first.onComplete!(); sprite.animations?.forEach((key, animation) {
sprite.animationTicker?.onComplete!();
});
} }
} }
void clearEffects({bool keepSounds = false}) { void clearEffects({bool keepSounds = false}) {
sprite.clearEffects(); sprite.animations?.clear();
if (!keepSounds && boost != null) { if (!keepSounds && boost != null) {
boost.then((value) => value.stop()); boost.then((value) => value.stop());
} }
} }
// void clearEffects({bool keepSounds = false}) {
// sprite.clearEffects();
// if (!keepSounds) {
// audioPlayer.stop();
// }
} }

View File

@ -6,6 +6,10 @@
#include "generated_plugin_registrant.h" #include "generated_plugin_registrant.h"
#include <audioplayers_linux/audioplayers_linux_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) { void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) audioplayers_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "AudioplayersLinuxPlugin");
audioplayers_linux_plugin_register_with_registrar(audioplayers_linux_registrar);
} }

View File

@ -3,6 +3,10 @@
# #
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
audioplayers_linux
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST
) )
set(PLUGIN_BUNDLED_LIBRARIES) set(PLUGIN_BUNDLED_LIBRARIES)
@ -13,3 +17,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST})
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>) list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
endforeach(plugin) endforeach(plugin)
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
endforeach(ffi_plugin)

View File

@ -5,133 +5,215 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: archive name: archive
url: "https://pub.dartlang.org" sha256: "6bd38d335f0954f5fad9c79e614604fbf03a0e5b975923dd001b6ea965ef5b4b"
url: "https://pub.dev"
source: hosted source: hosted
version: "3.1.5" version: "3.6.0"
args: args:
dependency: transitive dependency: transitive
description: description:
name: args name: args
url: "https://pub.dartlang.org" sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a"
url: "https://pub.dev"
source: hosted source: hosted
version: "2.3.0" version: "2.5.0"
async: async:
dependency: transitive dependency: transitive
description: description:
name: async name: async
url: "https://pub.dartlang.org" sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
url: "https://pub.dev"
source: hosted source: hosted
version: "2.8.1" version: "2.11.0"
audioplayers: audioplayers:
dependency: transitive dependency: "direct main"
description: description:
name: audioplayers name: audioplayers
url: "https://pub.dartlang.org" sha256: c05c6147124cd63e725e861335a8b4d57300b80e6e92cea7c145c739223bbaef
url: "https://pub.dev"
source: hosted source: hosted
version: "0.19.1" version: "5.2.1"
audioplayers_android:
dependency: transitive
description:
name: audioplayers_android
sha256: b00e1a0e11365d88576320ec2d8c192bc21f1afb6c0e5995d1c57ae63156acb5
url: "https://pub.dev"
source: hosted
version: "4.0.3"
audioplayers_darwin:
dependency: transitive
description:
name: audioplayers_darwin
sha256: "3034e99a6df8d101da0f5082dcca0a2a99db62ab1d4ddb3277bed3f6f81afe08"
url: "https://pub.dev"
source: hosted
version: "5.0.2"
audioplayers_linux:
dependency: transitive
description:
name: audioplayers_linux
sha256: "60787e73fefc4d2e0b9c02c69885402177e818e4e27ef087074cf27c02246c9e"
url: "https://pub.dev"
source: hosted
version: "3.1.0"
audioplayers_platform_interface:
dependency: transitive
description:
name: audioplayers_platform_interface
sha256: "365c547f1bb9e77d94dd1687903a668d8f7ac3409e48e6e6a3668a1ac2982adb"
url: "https://pub.dev"
source: hosted
version: "6.1.0"
audioplayers_web:
dependency: transitive
description:
name: audioplayers_web
sha256: "22cd0173e54d92bd9b2c80b1204eb1eb159ece87475ab58c9788a70ec43c2a62"
url: "https://pub.dev"
source: hosted
version: "4.1.0"
audioplayers_windows:
dependency: transitive
description:
name: audioplayers_windows
sha256: "9536812c9103563644ada2ef45ae523806b0745f7a78e89d1b5fb1951de90e1a"
url: "https://pub.dev"
source: hosted
version: "3.1.0"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
name: boolean_selector name: boolean_selector
url: "https://pub.dartlang.org" sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.0" version: "2.1.1"
characters: characters:
dependency: transitive dependency: transitive
description: description:
name: characters name: characters
url: "https://pub.dartlang.org" sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
url: "https://pub.dev"
source: hosted source: hosted
version: "1.1.0" version: "1.3.0"
charcode: checked_yaml:
dependency: transitive dependency: transitive
description: description:
name: charcode name: checked_yaml
url: "https://pub.dartlang.org" sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff
url: "https://pub.dev"
source: hosted source: hosted
version: "1.3.1" version: "2.0.3"
cli_util:
dependency: transitive
description:
name: cli_util
sha256: c05b7406fdabc7a49a3929d4af76bcaccbbffcbcdcf185b082e1ae07da323d19
url: "https://pub.dev"
source: hosted
version: "0.4.1"
clock: clock:
dependency: transitive dependency: transitive
description: description:
name: clock name: clock
url: "https://pub.dartlang.org" sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
url: "https://pub.dev"
source: hosted source: hosted
version: "1.1.0" version: "1.1.1"
collection: collection:
dependency: transitive dependency: transitive
description: description:
name: collection name: collection
url: "https://pub.dartlang.org" sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.dev"
source: hosted source: hosted
version: "1.15.0" version: "1.18.0"
crypto: crypto:
dependency: transitive dependency: transitive
description: description:
name: crypto name: crypto
url: "https://pub.dartlang.org" sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab
url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.1" version: "3.0.3"
cupertino_icons: cupertino_icons:
dependency: "direct main" dependency: "direct main"
description: description:
name: cupertino_icons name: cupertino_icons
url: "https://pub.dartlang.org" sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6
url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.3" version: "1.0.8"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
name: fake_async name: fake_async
url: "https://pub.dartlang.org" sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
url: "https://pub.dev"
source: hosted source: hosted
version: "1.2.0" version: "1.3.1"
ffi: ffi:
dependency: transitive dependency: transitive
description: description:
name: ffi name: ffi
url: "https://pub.dartlang.org" sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21"
url: "https://pub.dev"
source: hosted source: hosted
version: "1.1.2" version: "2.1.2"
file: file:
dependency: transitive dependency: transitive
description: description:
name: file name: file
url: "https://pub.dartlang.org" sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c"
url: "https://pub.dev"
source: hosted source: hosted
version: "6.1.2" version: "7.0.0"
fixnum:
dependency: transitive
description:
name: fixnum
sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1"
url: "https://pub.dev"
source: hosted
version: "1.1.0"
flame: flame:
dependency: "direct main" dependency: "direct main"
description: description:
name: flame name: flame
url: "https://pub.dartlang.org" sha256: da1812e2f17a8ffd5d43ea6a83137794e7f482bcf50419bc9847b8efdb39f791
url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.0-releasecandidate.13" version: "1.17.0"
flame_audio: flame_audio:
dependency: "direct main" dependency: "direct main"
description: description:
name: flame_audio name: flame_audio
url: "https://pub.dartlang.org" sha256: a3798e22f744726320f1368c078de01bbde9910d7e3a0537ce217b7f99615f80
url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.0-rc.1" version: "2.10.1"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_launcher_icons: flutter_launcher_icons:
dependency: "direct dev" dependency: "direct main"
description: description:
name: flutter_launcher_icons name: flutter_launcher_icons
url: "https://pub.dartlang.org" sha256: "526faf84284b86a4cb36d20a5e45147747b7563d921373d4ee0559c54fcdbcea"
url: "https://pub.dev"
source: hosted source: hosted
version: "0.9.2" version: "0.13.1"
flutter_lints: flutter_lints:
dependency: "direct dev" dependency: "direct dev"
description: description:
name: flutter_lints name: flutter_lints
url: "https://pub.dartlang.org" sha256: "9e8c3858111da373efc5aa341de011d9bd23e2c5c5e0c62bccf32438e192d7b1"
url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.4" version: "3.0.2"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
@ -146,191 +228,258 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: http name: http
url: "https://pub.dartlang.org" sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938"
url: "https://pub.dev"
source: hosted source: hosted
version: "0.13.3" version: "1.2.1"
http_parser: http_parser:
dependency: transitive dependency: transitive
description: description:
name: http_parser name: http_parser
url: "https://pub.dartlang.org" sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b"
url: "https://pub.dev"
source: hosted source: hosted
version: "4.0.0" version: "4.0.2"
image: image:
dependency: transitive dependency: transitive
description: description:
name: image name: image
url: "https://pub.dartlang.org" sha256: "2237616a36c0d69aef7549ab439b833fb7f9fb9fc861af2cc9ac3eedddd69ca8"
url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.7" version: "4.2.0"
js: js:
dependency: transitive dependency: transitive
description: description:
name: js name: js
url: "https://pub.dartlang.org" sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
url: "https://pub.dev"
source: hosted source: hosted
version: "0.6.3" version: "0.6.7"
json_annotation:
dependency: transitive
description:
name: json_annotation
sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1"
url: "https://pub.dev"
source: hosted
version: "4.9.0"
leak_tracker:
dependency: transitive
description:
name: leak_tracker
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
url: "https://pub.dev"
source: hosted
version: "10.0.4"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
url: "https://pub.dev"
source: hosted
version: "3.0.3"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
url: "https://pub.dev"
source: hosted
version: "3.0.1"
lints: lints:
dependency: transitive dependency: transitive
description: description:
name: lints name: lints
url: "https://pub.dartlang.org" sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290
url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.1" version: "3.0.0"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
name: matcher name: matcher
url: "https://pub.dartlang.org" sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
url: "https://pub.dev"
source: hosted source: hosted
version: "0.12.10" version: "0.12.16+1"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
url: "https://pub.dev"
source: hosted
version: "0.8.0"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
url: "https://pub.dartlang.org" sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
url: "https://pub.dev"
source: hosted source: hosted
version: "1.7.0" version: "1.12.0"
ordered_set: ordered_set:
dependency: transitive dependency: transitive
description: description:
name: ordered_set name: ordered_set
url: "https://pub.dartlang.org" sha256: "1bfaaaee0419e43ecc9eaebd410eb4bd5039657b72011de75ff3e2915c9aac60"
url: "https://pub.dev"
source: hosted source: hosted
version: "3.2.0" version: "5.0.3"
path: path:
dependency: transitive dependency: transitive
description: description:
name: path name: path
url: "https://pub.dartlang.org" sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
url: "https://pub.dev"
source: hosted source: hosted
version: "1.8.0" version: "1.9.0"
path_provider: path_provider:
dependency: transitive dependency: transitive
description: description:
name: path_provider name: path_provider
url: "https://pub.dartlang.org" sha256: c9e7d3a4cd1410877472158bee69963a4579f78b68c65a2b7d40d1a7a88bb161
url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.3" version: "2.1.3"
path_provider_android:
dependency: transitive
description:
name: path_provider_android
sha256: a248d8146ee5983446bf03ed5ea8f6533129a12b11f12057ad1b4a67a2b3b41d
url: "https://pub.dev"
source: hosted
version: "2.2.4"
path_provider_foundation:
dependency: transitive
description:
name: path_provider_foundation
sha256: f234384a3fdd67f989b4d54a5d73ca2a6c422fa55ae694381ae0f4375cd1ea16
url: "https://pub.dev"
source: hosted
version: "2.4.0"
path_provider_linux: path_provider_linux:
dependency: transitive dependency: transitive
description: description:
name: path_provider_linux name: path_provider_linux
url: "https://pub.dartlang.org" sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279
url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.2" version: "2.2.1"
path_provider_macos:
dependency: transitive
description:
name: path_provider_macos
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
path_provider_platform_interface: path_provider_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: path_provider_platform_interface name: path_provider_platform_interface
url: "https://pub.dartlang.org" sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334"
url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.1" version: "2.1.2"
path_provider_windows: path_provider_windows:
dependency: transitive dependency: transitive
description: description:
name: path_provider_windows name: path_provider_windows
url: "https://pub.dartlang.org" sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170"
url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.3" version: "2.2.1"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.1"
petitparser: petitparser:
dependency: transitive dependency: transitive
description: description:
name: petitparser name: petitparser
url: "https://pub.dartlang.org" sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27
url: "https://pub.dev"
source: hosted source: hosted
version: "4.3.0" version: "6.0.2"
platform: platform:
dependency: transitive dependency: transitive
description: description:
name: platform name: platform
url: "https://pub.dartlang.org" sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec"
url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.2" version: "3.1.4"
plugin_platform_interface: plugin_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: plugin_platform_interface name: plugin_platform_interface
url: "https://pub.dartlang.org" sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.1" version: "2.1.8"
process:
dependency: transitive
description:
name: process
url: "https://pub.dartlang.org"
source: hosted
version: "4.2.3"
qr: qr:
dependency: transitive dependency: transitive
description: description:
name: qr name: qr
url: "https://pub.dartlang.org" sha256: "64957a3930367bf97cc211a5af99551d630f2f4625e38af10edd6b19131b64b3"
url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.0" version: "3.0.1"
qr_flutter: qr_flutter:
dependency: "direct main" dependency: "direct main"
description: description:
name: qr_flutter name: qr_flutter
url: "https://pub.dartlang.org" sha256: "5095f0fc6e3f71d08adef8feccc8cea4f12eec18a2e31c2e8d82cb6019f4b097"
url: "https://pub.dev"
source: hosted source: hosted
version: "4.0.0" version: "4.1.0"
shared_preferences: shared_preferences:
dependency: "direct main" dependency: "direct main"
description: description:
name: shared_preferences name: shared_preferences
url: "https://pub.dartlang.org" sha256: d3bbe5553a986e83980916ded2f0b435ef2e1893dfaa29d5a7a790d0eca12180
url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.8" version: "2.2.3"
shared_preferences_android:
dependency: transitive
description:
name: shared_preferences_android
sha256: "1ee8bf911094a1b592de7ab29add6f826a7331fb854273d55918693d5364a1f2"
url: "https://pub.dev"
source: hosted
version: "2.2.2"
shared_preferences_foundation:
dependency: transitive
description:
name: shared_preferences_foundation
sha256: "0a8a893bf4fd1152f93fec03a415d11c27c74454d96e2318a7ac38dd18683ab7"
url: "https://pub.dev"
source: hosted
version: "2.4.0"
shared_preferences_linux: shared_preferences_linux:
dependency: transitive dependency: transitive
description: description:
name: shared_preferences_linux name: shared_preferences_linux
url: "https://pub.dartlang.org" sha256: "9f2cbcf46d4270ea8be39fa156d86379077c8a5228d9dfdb1164ae0bb93f1faa"
url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.2" version: "2.3.2"
shared_preferences_macos:
dependency: transitive
description:
name: shared_preferences_macos
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
shared_preferences_platform_interface: shared_preferences_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: shared_preferences_platform_interface name: shared_preferences_platform_interface
url: "https://pub.dartlang.org" sha256: "22e2ecac9419b4246d7c22bfbbda589e3acf5c0351137d87dd2939d984d37c3b"
url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.0" version: "2.3.2"
shared_preferences_web: shared_preferences_web:
dependency: transitive dependency: transitive
description: description:
name: shared_preferences_web name: shared_preferences_web
url: "https://pub.dartlang.org" sha256: "9aee1089b36bd2aafe06582b7d7817fd317ef05fc30e6ba14bff247d0933042a"
url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.2" version: "2.3.0"
shared_preferences_windows: shared_preferences_windows:
dependency: transitive dependency: transitive
description: description:
name: shared_preferences_windows name: shared_preferences_windows
url: "https://pub.dartlang.org" sha256: "841ad54f3c8381c480d0c9b508b89a34036f512482c407e6df7a9c4aa2ef8f59"
url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.2" version: "2.3.2"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
@ -340,100 +489,138 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: source_span name: source_span
url: "https://pub.dartlang.org" sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
url: "https://pub.dev"
source: hosted source: hosted
version: "1.8.1" version: "1.10.0"
sprintf:
dependency: transitive
description:
name: sprintf
sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23"
url: "https://pub.dev"
source: hosted
version: "7.0.0"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
name: stack_trace name: stack_trace
url: "https://pub.dartlang.org" sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
url: "https://pub.dev"
source: hosted source: hosted
version: "1.10.0" version: "1.11.1"
stream_channel: stream_channel:
dependency: transitive dependency: transitive
description: description:
name: stream_channel name: stream_channel
url: "https://pub.dartlang.org" sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.0" version: "2.1.2"
string_scanner: string_scanner:
dependency: transitive dependency: transitive
description: description:
name: string_scanner name: string_scanner
url: "https://pub.dartlang.org" sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
url: "https://pub.dev"
source: hosted source: hosted
version: "1.1.0" version: "1.2.0"
synchronized: synchronized:
dependency: transitive dependency: transitive
description: description:
name: synchronized name: synchronized
url: "https://pub.dartlang.org" sha256: "539ef412b170d65ecdafd780f924e5be3f60032a1128df156adad6c5b373d558"
url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.0" version: "3.1.0+1"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
name: term_glyph name: term_glyph
url: "https://pub.dartlang.org" sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
url: "https://pub.dev"
source: hosted source: hosted
version: "1.2.0" version: "1.2.1"
test_api: test_api:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
url: "https://pub.dartlang.org" sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
url: "https://pub.dev"
source: hosted source: hosted
version: "0.4.2" version: "0.7.0"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
name: typed_data name: typed_data
url: "https://pub.dartlang.org" sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
url: "https://pub.dev"
source: hosted source: hosted
version: "1.3.0" version: "1.3.2"
uuid: uuid:
dependency: transitive dependency: transitive
description: description:
name: uuid name: uuid
url: "https://pub.dartlang.org" sha256: "814e9e88f21a176ae1359149021870e87f7cddaf633ab678a5d2b0bff7fd1ba8"
url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.4" version: "4.4.0"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
name: vector_math name: vector_math
url: "https://pub.dartlang.org" sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.0" version: "2.1.4"
vm_service:
dependency: transitive
description:
name: vm_service
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
url: "https://pub.dev"
source: hosted
version: "14.2.1"
web:
dependency: transitive
description:
name: web
sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27"
url: "https://pub.dev"
source: hosted
version: "0.5.1"
win32: win32:
dependency: transitive dependency: transitive
description: description:
name: win32 name: win32
url: "https://pub.dartlang.org" sha256: a79dbe579cb51ecd6d30b17e0cae4e0ea15e2c0e66f69ad4198f22a6789e94f4
url: "https://pub.dev"
source: hosted source: hosted
version: "2.2.9" version: "5.5.1"
xdg_directories: xdg_directories:
dependency: transitive dependency: transitive
description: description:
name: xdg_directories name: xdg_directories
url: "https://pub.dartlang.org" sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d
url: "https://pub.dev"
source: hosted source: hosted
version: "0.2.0" version: "1.0.4"
xml: xml:
dependency: transitive dependency: transitive
description: description:
name: xml name: xml
url: "https://pub.dartlang.org" sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226
url: "https://pub.dev"
source: hosted source: hosted
version: "5.3.0" version: "6.5.0"
yaml: yaml:
dependency: transitive dependency: transitive
description: description:
name: yaml name: yaml
url: "https://pub.dartlang.org" sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5"
url: "https://pub.dev"
source: hosted source: hosted
version: "3.1.0" version: "3.1.2"
sdks: sdks:
dart: ">=2.14.0 <3.0.0" dart: ">=3.4.0 <4.0.0"
flutter: ">=2.5.0" flutter: ">=3.19.0"

View File

@ -18,21 +18,23 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1 version: 1.0.0+1
environment: environment:
sdk: ">=2.12.0 <3.0.0" sdk: '>=3.2.4 <4.0.0'
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
flame: "^1.0.0-releasecandidate.11" flame: ^1.15.0
flame_audio: "^1.0.0-rc.1" flame_audio: ^2.10.1
http: ^0.13.3 http: ^1.2.0
qr_flutter: ^4.0.0 qr_flutter: ^4.1.0
shared_preferences: ^2.0.8 shared_preferences: ^2.2.2
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2 cupertino_icons: ^1.0.6
flutter_launcher_icons: ^0.13.1
audioplayers: ^5.2.1
flutter_icons: flutter_icons:
android: "launcher_icon" android: "launcher_icon"
@ -40,10 +42,9 @@ flutter_icons:
image_path: "assets/icon/head-logo.png" image_path: "assets/icon/head-logo.png"
dev_dependencies: dev_dependencies:
flutter_lints: ^1.0.4 flutter_lints: ^3.0.2
flutter_test: flutter_test:
sdk: flutter sdk: flutter
flutter_launcher_icons: "^0.9.2"
# For information on the generic Dart part of this file, see the # For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec # following page: https://dart.dev/tools/pub/pubspec
@ -87,4 +88,3 @@ flutter:
- family: Codystar - family: Codystar
fonts: fonts:
- asset: assets/fonts/Codystar-Regular.ttf - asset: assets/fonts/Codystar-Regular.ttf

View File

@ -9,6 +9,11 @@ include(${EPHEMERAL_DIR}/generated_config.cmake)
# https://github.com/flutter/flutter/issues/57146. # https://github.com/flutter/flutter/issues/57146.
set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")
# Set fallback configurations for older versions of the flutter tool.
if (NOT DEFINED FLUTTER_TARGET_PLATFORM)
set(FLUTTER_TARGET_PLATFORM "windows-x64")
endif()
# === Flutter Library === # === Flutter Library ===
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")
@ -91,7 +96,7 @@ add_custom_command(
COMMAND ${CMAKE_COMMAND} -E env COMMAND ${CMAKE_COMMAND} -E env
${FLUTTER_TOOL_ENVIRONMENT} ${FLUTTER_TOOL_ENVIRONMENT}
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
windows-x64 $<CONFIG> ${FLUTTER_TARGET_PLATFORM} $<CONFIG>
VERBATIM VERBATIM
) )
add_custom_target(flutter_assemble DEPENDS add_custom_target(flutter_assemble DEPENDS

View File

@ -6,6 +6,9 @@
#include "generated_plugin_registrant.h" #include "generated_plugin_registrant.h"
#include <audioplayers_windows/audioplayers_windows_plugin.h>
void RegisterPlugins(flutter::PluginRegistry* registry) { void RegisterPlugins(flutter::PluginRegistry* registry) {
AudioplayersWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("AudioplayersWindowsPlugin"));
} }

View File

@ -3,6 +3,10 @@
# #
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
audioplayers_windows
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST
) )
set(PLUGIN_BUNDLED_LIBRARIES) set(PLUGIN_BUNDLED_LIBRARIES)
@ -13,3 +17,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST})
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>) list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
endforeach(plugin) endforeach(plugin)
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
endforeach(ffi_plugin)

View File

@ -60,14 +60,14 @@ IDI_APP_ICON ICON "resources\\app_icon.ico"
// Version // Version
// //
#ifdef FLUTTER_BUILD_NUMBER #if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD)
#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER #define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD
#else #else
#define VERSION_AS_NUMBER 1,0,0 #define VERSION_AS_NUMBER 1,0,0,0
#endif #endif
#ifdef FLUTTER_BUILD_NAME #if defined(FLUTTER_VERSION)
#define VERSION_AS_STRING #FLUTTER_BUILD_NAME #define VERSION_AS_STRING FLUTTER_VERSION
#else #else
#define VERSION_AS_STRING "1.0.0" #define VERSION_AS_STRING "1.0.0"
#endif #endif