Added a Matrix<T> typedef
Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
@@ -4,6 +4,8 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter/scheduler.dart';
|
import 'package:flutter/scheduler.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
|
typedef Matrix<T> = List<List<T>>;
|
||||||
|
|
||||||
void main() => runApp(const MaterialApp(home: WolfRenderer()));
|
void main() => runApp(const MaterialApp(home: WolfRenderer()));
|
||||||
|
|
||||||
typedef LinearCoordinates = ({double x, double y});
|
typedef LinearCoordinates = ({double x, double y});
|
||||||
@@ -20,7 +22,7 @@ class _WolfRendererState extends State<WolfRenderer>
|
|||||||
late Ticker _gameLoop;
|
late Ticker _gameLoop;
|
||||||
final FocusNode _focusNode = FocusNode();
|
final FocusNode _focusNode = FocusNode();
|
||||||
|
|
||||||
final List<List<int>> map = [
|
final Matrix<int> map = [
|
||||||
[1, 1, 1, 1, 1, 1, 1, 1],
|
[1, 1, 1, 1, 1, 1, 1, 1],
|
||||||
[1, 0, 0, 0, 0, 0, 0, 1],
|
[1, 0, 0, 0, 0, 0, 0, 1],
|
||||||
[1, 0, 1, 0, 0, 1, 0, 1],
|
[1, 0, 1, 0, 0, 1, 0, 1],
|
||||||
@@ -145,7 +147,7 @@ class _WolfRendererState extends State<WolfRenderer>
|
|||||||
}
|
}
|
||||||
|
|
||||||
class RaycasterPainter extends CustomPainter {
|
class RaycasterPainter extends CustomPainter {
|
||||||
final List<List<int>> map;
|
final Matrix<int> map;
|
||||||
final LinearCoordinates player;
|
final LinearCoordinates player;
|
||||||
final double playerAngle;
|
final double playerAngle;
|
||||||
final double fov;
|
final double fov;
|
||||||
|
|||||||
Reference in New Issue
Block a user