Refactor, try to limit dependencies

This commit is contained in:
2022-07-28 00:59:56 +01:00
parent 8aa5c17ab9
commit 160560af5f
418 changed files with 15104 additions and 13342 deletions
+17 -13
View File
@@ -1,9 +1,10 @@
module Dodge.Button.Draw where
import Color
import Dodge.Data.Button
import Geometry
import Color
import ShapePicture
import Shape
import ShapePicture
drawButton :: ButtonDraw -> Button -> SPic
drawButton bd = case bd of
@@ -13,16 +14,19 @@ drawButton bd = case bd of
drawSwitch :: Color -> Color -> Button -> SPic
drawSwitch col1 col2 bt
| _btState bt == BtOff
= flick $ pi/4
| otherwise = flick (negate (pi/4))
| _btState bt == BtOff =
flick $ pi / 4
| otherwise = flick (negate (pi / 4))
where
flick a = ( mconcat
[ colorSH col1 . upperPrismPoly 20 $ reverse $ rectNSWE (-2) (-5) (-10) 10
, colorSH col2 . translateSH (V3 0 (-2) 20) . rotateSH a . upperPrismPoly 2 $ reverse
$ rectNSWE 10 0 (-2) 2
]
, mempty)
flick a =
( mconcat
[ colorSH col1 . upperPrismPoly 20 $ reverse $ rectNSWE (-2) (-5) (-10) 10
, colorSH col2 . translateSH (V3 0 (-2) 20) . rotateSH a . upperPrismPoly 2 $
reverse $
rectNSWE 10 0 (-2) 2
]
, mempty
)
defaultDrawButton :: Color -> Button -> SPic
defaultDrawButton col bt =
@@ -31,6 +35,6 @@ defaultDrawButton col bt =
)
where
buttonGeometry
| _btState bt == BtOff = reverse $ rectNSWE 10 (-1) (-width) width
| otherwise = reverse $ rectNSWE 2 (-1) (-width) width
| _btState bt == BtOff = reverse $ rectNSWE 10 (-1) (- width) width
| otherwise = reverse $ rectNSWE 2 (-1) (- width) width
width = 8