| 1 | 1 | ▶ | use Modern::Perl; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | package Intertangle::Yarn::Types; | ||
| 3 | # ABSTRACT: Types for Yarn | ||
| 4 | $Intertangle::Yarn::Types::VERSION = '0.001'; | ||
| 5 | 1 | use Type::Library 0.008 -base, | |
| 6 | -declare => [qw( | ||
| 7 | Point | ||
| 8 | Vec2 | ||
| 9 | Size | ||
| 10 | AngleDegrees | ||
| 11 | Rect | ||
| 12 | Matrix | ||
| 13 | 1 | ▶ | )]; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | 1 | ▶ | use Type::Utils -all; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | 1 | ▶ | use Types::Standard qw(Tuple Num); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | 1 | ▶ | use Types::Common::Numeric qw(PositiveOrZeroNum); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 17 | |||
| 18 | 1 | ▶ | use Intertangle::Yarn::Graphene; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 19 | |||
| 20 | class_type "Point", | ||
| 21 | { class => 'Intertangle::Yarn::Graphene::Point' }; | ||
| 22 | |||
| 23 | coerce "Point", | ||
| 24 | from Tuple[Num, Num], | ||
| 25 | via { | ||
| 26 | Intertangle::Yarn::Graphene::Point->new( | ||
| 27 | x => $_->[0], | ||
| 28 | y => $_->[1], | ||
| 29 | ) | ||
| 30 | }; | ||
| 31 | |||
| 32 | class_type "Vec2", | ||
| 33 | { class => 'Intertangle::Yarn::Graphene::Vec2' }; | ||
| 34 | |||
| 35 | coerce "Vec2", | ||
| 36 | from Tuple[Num, Num], | ||
| 37 | via { | ||
| 38 | Intertangle::Yarn::Graphene::Vec2->new( | ||
| 39 | x => $_->[0], | ||
| 40 | y => $_->[1], | ||
| 41 | ) | ||
| 42 | }; | ||
| 43 | |||
| 44 | class_type "Size", | ||
| 45 | { class => 'Intertangle::Yarn::Graphene::Size' }; | ||
| 46 | |||
| 47 | coerce "Size", | ||
| 48 | from Tuple[PositiveOrZeroNum, PositiveOrZeroNum], | ||
| 49 | via { | ||
| 50 | Intertangle::Yarn::Graphene::Size->new( | ||
| 51 | width => $_->[0], | ||
| 52 | height => $_->[1], | ||
| 53 | ) | ||
| 54 | }; | ||
| 55 | |||
| 56 | declare "AngleDegrees", parent => Num; | ||
| 57 | |||
| 58 | class_type "Rect", | ||
| 59 | { class => 'Intertangle::Yarn::Graphene::Rect' }; | ||
| 60 | |||
| 61 | class_type "Matrix", | ||
| 62 | { class => 'Intertangle::Yarn::Graphene::Matrix' }; | ||
| 63 | |||
| 64 | 1; | ||
| 65 | |||
| 66 | __END__ | ||