-
-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #565 from RafaelBarbosatec/develop
Version 3.12.0
- Loading branch information
Showing
27 changed files
with
886 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ "columns":56, | ||
"image":"solaria_tiles.png", | ||
"imageheight":240, | ||
"imagewidth":448, | ||
"margin":0, | ||
"name":"solaria_tiles", | ||
"spacing":0, | ||
"tilecount":1680, | ||
"tiledversion":"1.10.2", | ||
"tileheight":8, | ||
"tilewidth":8, | ||
"type":"tileset", | ||
"version":"1.10" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// ignore_for_file: public_member_api_docs, sort_constructors_first | ||
import 'package:bonfire/bonfire.dart'; | ||
import 'package:flutter/widgets.dart'; | ||
|
||
class ShaderConfig { | ||
final double distortionStrength; | ||
final Color toneColor; | ||
final Color lightColor; | ||
final double speed; | ||
final double opacity; | ||
final Vector2 lightRange; | ||
|
||
ShaderConfig({ | ||
this.distortionStrength = 0.05, | ||
this.toneColor = const Color(0xFF5ca4ec), | ||
this.lightColor = const Color(0xFFffffff), | ||
this.speed = 0.04, | ||
this.opacity = 0.7, | ||
Vector2? lightRange, | ||
}) : lightRange = lightRange ?? Vector2(0.4, 0.5); | ||
|
||
ShaderConfig copyWith({ | ||
double? distortionStrength, | ||
Color? toneColor, | ||
Color? lightColor, | ||
double? speed, | ||
double? opacity, | ||
Vector2? lightRange, | ||
}) { | ||
return ShaderConfig( | ||
distortionStrength: distortionStrength ?? this.distortionStrength, | ||
toneColor: toneColor ?? this.toneColor, | ||
lightColor: lightColor ?? this.lightColor, | ||
speed: speed ?? this.speed, | ||
opacity: opacity ?? this.opacity, | ||
lightRange: lightRange ?? this.lightRange, | ||
); | ||
} | ||
} | ||
|
||
class ShaderConfigController extends ChangeNotifier { | ||
ShaderConfig _config = ShaderConfig(); | ||
ShaderConfig get config => _config; | ||
|
||
void update(ShaderConfig config) { | ||
_config = config; | ||
notifyListeners(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,218 @@ | ||
import 'package:bonfire/bonfire.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_colorpicker/flutter_colorpicker.dart'; | ||
|
||
import 'shader_config_controller.dart'; | ||
|
||
class ShaderConfigPanel extends StatefulWidget { | ||
final ShaderConfigController controller; | ||
const ShaderConfigPanel({super.key, required this.controller}); | ||
|
||
@override | ||
State<ShaderConfigPanel> createState() => _ShaderConfigPanelState(); | ||
} | ||
|
||
class _ShaderConfigPanelState extends State<ShaderConfigPanel> { | ||
late double speed; | ||
late double distortionStrength; | ||
late double opacity; | ||
late Color toneColor; | ||
late Color lightColor; | ||
late Vector2 lightRange; | ||
|
||
@override | ||
void initState() { | ||
speed = widget.controller.config.speed; | ||
distortionStrength = widget.controller.config.distortionStrength; | ||
toneColor = widget.controller.config.toneColor; | ||
lightColor = widget.controller.config.lightColor; | ||
opacity = widget.controller.config.opacity; | ||
lightRange = widget.controller.config.lightRange; | ||
super.initState(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
body: Center( | ||
child: SingleChildScrollView( | ||
padding: const EdgeInsets.symmetric(vertical: 16), | ||
child: Column( | ||
mainAxisSize: MainAxisSize.min, | ||
children: [ | ||
Text('Speed: ${speed.toStringAsFixed(3)}'), | ||
Slider( | ||
value: speed, | ||
min: 0, | ||
max: 0.5, | ||
onChanged: (value) { | ||
setState(() { | ||
speed = value; | ||
}); | ||
widget.controller.update( | ||
widget.controller.config.copyWith( | ||
speed: speed, | ||
), | ||
); | ||
}, | ||
), | ||
Text( | ||
'Distortion Strength: ${distortionStrength.toStringAsFixed(3)}'), | ||
Slider( | ||
value: distortionStrength, | ||
min: 0, | ||
max: 0.5, | ||
onChanged: (value) { | ||
setState(() { | ||
distortionStrength = value; | ||
}); | ||
widget.controller.update( | ||
widget.controller.config.copyWith( | ||
distortionStrength: distortionStrength, | ||
), | ||
); | ||
}, | ||
), | ||
Text('Opacity: ${opacity.toStringAsFixed(3)}'), | ||
Slider( | ||
value: opacity, | ||
min: 0, | ||
max: 1, | ||
onChanged: (value) { | ||
setState(() { | ||
opacity = value; | ||
}); | ||
widget.controller.update( | ||
widget.controller.config.copyWith( | ||
opacity: opacity, | ||
), | ||
); | ||
}, | ||
), | ||
Text( | ||
'Light range: min${lightRange.x.toStringAsFixed(3)} | max${lightRange.y.toStringAsFixed(3)}'), | ||
RangeSlider( | ||
values: RangeValues(lightRange.x, lightRange.y), | ||
min: 0, | ||
max: 1, | ||
onChanged: (value) { | ||
setState(() { | ||
lightRange = Vector2(value.start, value.end); | ||
}); | ||
widget.controller.update( | ||
widget.controller.config.copyWith( | ||
lightRange: lightRange, | ||
), | ||
); | ||
}, | ||
), | ||
const SizedBox( | ||
height: 16, | ||
), | ||
Padding( | ||
padding: const EdgeInsets.symmetric(horizontal: 16), | ||
child: Row( | ||
children: [ | ||
const Text('Tone color'), | ||
const SizedBox( | ||
width: 16, | ||
), | ||
InkWell( | ||
onTap: () { | ||
showColorPicker( | ||
toneColor, | ||
(value) { | ||
setState(() { | ||
toneColor = value; | ||
}); | ||
widget.controller.update( | ||
widget.controller.config.copyWith( | ||
toneColor: toneColor, | ||
), | ||
); | ||
}, | ||
); | ||
}, | ||
child: Container( | ||
decoration: BoxDecoration( | ||
color: toneColor, | ||
shape: BoxShape.circle, | ||
), | ||
width: 30, | ||
height: 30, | ||
), | ||
), | ||
], | ||
), | ||
), | ||
const SizedBox( | ||
height: 16, | ||
), | ||
Padding( | ||
padding: const EdgeInsets.symmetric(horizontal: 16), | ||
child: Row( | ||
children: [ | ||
const Text('Light color'), | ||
const SizedBox( | ||
width: 16, | ||
), | ||
InkWell( | ||
onTap: () { | ||
showColorPicker( | ||
lightColor, | ||
(value) { | ||
setState(() { | ||
lightColor = value; | ||
}); | ||
widget.controller.update( | ||
widget.controller.config.copyWith( | ||
lightColor: lightColor, | ||
), | ||
); | ||
}, | ||
); | ||
}, | ||
child: Container( | ||
decoration: BoxDecoration( | ||
color: lightColor, | ||
shape: BoxShape.circle, | ||
), | ||
width: 30, | ||
height: 30, | ||
), | ||
), | ||
], | ||
), | ||
) | ||
], | ||
), | ||
), | ||
), | ||
); | ||
} | ||
|
||
void showColorPicker(Color color, ValueChanged<Color> onChange) { | ||
showDialog( | ||
context: context, | ||
builder: (context) { | ||
return AlertDialog( | ||
title: const Text('Pick a color!'), | ||
content: SingleChildScrollView( | ||
child: ColorPicker( | ||
pickerColor: color, | ||
onColorChanged: onChange, | ||
), | ||
), | ||
actions: <Widget>[ | ||
ElevatedButton( | ||
child: const Text('Got it'), | ||
onPressed: () { | ||
Navigator.of(context).pop(); | ||
}, | ||
), | ||
], | ||
); | ||
}, | ||
); | ||
} | ||
} |
Oops, something went wrong.