diff --git a/assets/misc/table1.kra b/assets/misc/table1.kra new file mode 100644 index 0000000..a90caf8 Binary files /dev/null and b/assets/misc/table1.kra differ diff --git a/assets/misc/table1.png b/assets/misc/table1.png new file mode 100644 index 0000000..7ca420f Binary files /dev/null and b/assets/misc/table1.png differ diff --git a/assets/misc/table2.kra b/assets/misc/table2.kra new file mode 100644 index 0000000..f3ae7d9 Binary files /dev/null and b/assets/misc/table2.kra differ diff --git a/assets/misc/table2.png b/assets/misc/table2.png new file mode 100644 index 0000000..6082d5c Binary files /dev/null and b/assets/misc/table2.png differ diff --git a/assets/misc/tableCorner.kra b/assets/misc/tableCorner.kra new file mode 100644 index 0000000..97caec0 Binary files /dev/null and b/assets/misc/tableCorner.kra differ diff --git a/assets/misc/tableCorner.png b/assets/misc/tableCorner.png new file mode 100644 index 0000000..170ffba Binary files /dev/null and b/assets/misc/tableCorner.png differ diff --git a/src/Init.hs b/src/Init.hs index a0e2028..373e983 100644 --- a/src/Init.hs +++ b/src/Init.hs @@ -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 diff --git a/src/Test.hs b/src/Test.hs index ad5bb43..e6dc656 100644 --- a/src/Test.hs +++ b/src/Test.hs @@ -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] diff --git a/src/Types/Interior.hs b/src/Types/Interior.hs index 5253f5c..4a6e4cf 100644 --- a/src/Types/Interior.hs +++ b/src/Types/Interior.hs @@ -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 = diff --git a/src/Types/UserData.hs b/src/Types/UserData.hs index a57ef4e..d82aa34 100644 --- a/src/Types/UserData.hs +++ b/src/Types/UserData.hs @@ -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