add tables
This commit is contained in:
parent
d1e130b5a9
commit
d57e502c74
10 changed files with 36 additions and 4 deletions
BIN
assets/misc/table1.kra
Normal file
BIN
assets/misc/table1.kra
Normal file
Binary file not shown.
BIN
assets/misc/table1.png
Normal file
BIN
assets/misc/table1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 671 B |
BIN
assets/misc/table2.kra
Normal file
BIN
assets/misc/table2.kra
Normal file
Binary file not shown.
BIN
assets/misc/table2.png
Normal file
BIN
assets/misc/table2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 553 B |
BIN
assets/misc/tableCorner.kra
Normal file
BIN
assets/misc/tableCorner.kra
Normal file
Binary file not shown.
BIN
assets/misc/tableCorner.png
Normal file
BIN
assets/misc/tableCorner.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 600 B |
|
@ -56,15 +56,19 @@ load = do
|
|||
mwalltnw <- createImage nvg (FileName "assets/walls/wall_t_nw.png") 0
|
||||
mwallcross <- createImage nvg (FileName "assets/walls/wall_cross.png") 0
|
||||
mmiscbox1 <- createImage nvg (FileName "assets/misc/box1.png") 0
|
||||
mmisctable1 <- createImage nvg (FileName "assets/misc/table1.png") 0
|
||||
mmisctable2 <- createImage nvg (FileName "assets/misc/table2.png") 0
|
||||
mmisctableC <- createImage nvg (FileName "assets/misc/tableCorner.png") 0
|
||||
_ <- createFont nvg "bedstead"
|
||||
(FileName "assets/font/Bedstead-Semicondensed.ttf")
|
||||
let mimgs = [ mwallasc, mwalldesc,
|
||||
mwallcornern, mwallcornere, mwallcorners, mwallcornerw,
|
||||
mwalltne, mwalltse, mwalltsw, mwalltnw, mwallcross,
|
||||
mmiscbox1
|
||||
mmiscbox1,
|
||||
mmisctable1, mmisctable2, mmisctableC
|
||||
]
|
||||
when (any isNothing mimgs) $ do
|
||||
logIO Error "Failed to load walls"
|
||||
logIO Error "Failed to load image assets"
|
||||
exitFailure
|
||||
let imgs = zipWith (\a b -> (a, fromJust b)) [ImgWallAsc ..] mimgs
|
||||
return UserData
|
||||
|
|
|
@ -51,7 +51,10 @@ loadMap = do
|
|||
{ worldState = nws
|
||||
, stateData = MenuData
|
||||
{ mapMat = mat
|
||||
, imgMat = inter
|
||||
, imgMat = M.fromList (nrows inter) (ncols inter) $
|
||||
Prelude.map
|
||||
(\a -> if a == Just ImgEmpty then Nothing else a)
|
||||
(M.toList inter)
|
||||
, initCoords = (0, 500)
|
||||
}
|
||||
, uuid = [uu]
|
||||
|
|
|
@ -9,6 +9,7 @@ import Types.UserData
|
|||
|
||||
data Cluster
|
||||
= ClusterBox1
|
||||
| ClusterCornerTable
|
||||
deriving (Enum, Bounded)
|
||||
|
||||
clusterMat :: Cluster -> Matrix (Maybe ImgId)
|
||||
|
@ -18,9 +19,16 @@ clusterMat ClusterBox1 =
|
|||
[ [Just ImgMiscBox1]
|
||||
-- , [Nothing, Nothing, Nothing]
|
||||
]
|
||||
clusterMat ClusterCornerTable =
|
||||
M.fromLists
|
||||
[ [Just ImgEmpty, Just ImgMiscTable2, Just ImgMiscTableCorner]
|
||||
, [Just ImgEmpty, Just ImgEmpty , Just ImgMiscTable1]
|
||||
, [Just ImgEmpty, Just ImgEmpty , Just ImgEmpty]
|
||||
]
|
||||
|
||||
clusterRoom :: Cluster -> TileState
|
||||
clusterRoom ClusterBox1 = Offi
|
||||
clusterRoom ClusterCornerTable = Offi
|
||||
|
||||
instance Size Cluster where
|
||||
size c =
|
||||
|
|
|
@ -40,7 +40,8 @@ data StateData
|
|||
}
|
||||
|
||||
data ImgId
|
||||
= ImgWallAsc
|
||||
= ImgEmpty -- TODO: Find better solution thatn empty image.
|
||||
| ImgWallAsc
|
||||
| ImgWallDesc
|
||||
| ImgWallCornerN
|
||||
| ImgWallCornerE
|
||||
|
@ -52,10 +53,16 @@ data ImgId
|
|||
| ImgWallTNW
|
||||
| ImgWallCross
|
||||
| ImgMiscBox1
|
||||
| ImgMiscTable1
|
||||
| ImgMiscTable2
|
||||
| ImgMiscTableCorner
|
||||
deriving (Show, Eq, Ord, Enum)
|
||||
|
||||
isWall :: ImgId -> Bool
|
||||
isWall ImgMiscBox1 = False
|
||||
isWall ImgMiscTable1 = False
|
||||
isWall ImgMiscTable2 = False
|
||||
isWall ImgMiscTableCorner = False
|
||||
isWall _ = True
|
||||
|
||||
imgObstacle :: Maybe ImgId -> [(Boundaries Double)]
|
||||
|
@ -98,6 +105,16 @@ imgObstacle (Just ImgWallCross) =
|
|||
[ Boundaries (0.34, 0) (0.66, 1)
|
||||
, Boundaries (0, 0.34) (1, 0.66)
|
||||
]
|
||||
imgObstacle (Just ImgMiscTable1) =
|
||||
[ Boundaries (0, 0.34) (1, 1)
|
||||
]
|
||||
imgObstacle (Just ImgMiscTable2) =
|
||||
[ Boundaries (0, 0) (0.63, 1)
|
||||
]
|
||||
imgObstacle (Just ImgMiscTableCorner) =
|
||||
[ Boundaries (0, 0) (0.63, 1)
|
||||
, Boundaries (0, 0.34) (1, 1)
|
||||
]
|
||||
imgObstacle _ = []
|
||||
|
||||
data FontId
|
||||
|
|
Loading…
Reference in a new issue