1
Fork 0

Fix bord in het midden van het scherm

This commit is contained in:
Tibo De Peuter 2022-10-16 12:00:19 +02:00
parent e3fbb06443
commit 747ed6ea67

View file

@ -38,11 +38,11 @@ data Board = Board {
-- Aantal kaarten op de x-as.
width :: Int
width = 4
width = 3
-- Aantal kaarten op de y-as.
height :: Int
height = 4
height = 3
-- De grootte van een kaart.
scaling :: Int
@ -118,7 +118,6 @@ generateColors n = map (generateColor.fromIntegral.(div 360 n *)) [1..n]
-- Genereer een lijst van n kaarten (n/2 kleurenparen).
generateShuffledCards :: Int -> [Card]
-- TODO Dit moet nog verder uitgeklaard worden !!
generateShuffledCards n = map (\(x,y) -> (x,y,Hidden)) $ zip (genCoords n) colors
where colors = shuffleList $ colorsOnce ++ colorsOnce
colorsOnce = generateColors (n `div` 2)
@ -197,7 +196,7 @@ nextBoard b@Board{ turned = [c1, c2] }
-- Linksonderaan is (0,0) voor Card.Coordinate,
-- (-(x/2),-(y/2)) voor as van lengte x en y in Gloss.
convert :: Int -> Int -> Float
convert location axis = car + inset
convert location axis = car + inset + fromIntegral scaling / 2
where car = (-(fromIntegral axis / 2.0) + fromIntegral location) * fromIntegral scaling
inset = fromIntegral ((-(axis `div` 2) + location) * cardInset)