follow NanoVG changes
This commit is contained in:
parent
f8ea2785bf
commit
eecfe82abd
3 changed files with 44 additions and 42 deletions
|
@ -77,7 +77,7 @@ loadPlayerSprite fp w h nvg rids = do
|
||||||
mapM (\(num, i) -> do
|
mapM (\(num, i) -> do
|
||||||
let cr = crop (num * w) (row * h) w h img
|
let cr = crop (num * w) (row * h) w h img
|
||||||
mresimg <-
|
mresimg <-
|
||||||
createImageMem nvg ImagePremultiplied (toStrict $ encodePng cr)
|
createImageMem nvg (S.singleton ImagePremultiplied) (toStrict $ encodePng cr)
|
||||||
case mresimg of
|
case mresimg of
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
logIO
|
logIO
|
||||||
|
|
82
src/Load.hs
82
src/Load.hs
|
@ -13,11 +13,13 @@ import qualified Data.Map as M
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import Data.Ecstasy
|
import Data.Ecstasy
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
|
import qualified Data.Set as S
|
||||||
import Data.String
|
import Data.String
|
||||||
|
|
||||||
import System.Exit (exitFailure)
|
import System.Exit (exitFailure)
|
||||||
|
|
||||||
import NanoVG hiding (V2(..))
|
import NanoVG hiding (V2(..))
|
||||||
|
import NanoVG.Internal.Image
|
||||||
|
|
||||||
-- internal imports
|
-- internal imports
|
||||||
|
|
||||||
|
@ -69,202 +71,202 @@ loadFork ws win glc nvg future progress = do
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading icon \"conntroller_blue\""
|
, "Loading icon \"conntroller_blue\""
|
||||||
)))
|
)))
|
||||||
mcontrblue <- createImage nvg (FileName "assets/icons/controller_blue.png") 0
|
mcontrblue <- createImage nvg (FileName "assets/icons/controller_blue.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading icon \"controller_blue\""
|
, "Loading icon \"controller_blue\""
|
||||||
)))
|
)))
|
||||||
mcontrgreen <- createImage nvg (FileName "assets/icons/controller_green.png") 0
|
mcontrgreen <- createImage nvg (FileName "assets/icons/controller_green.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading icon \"controller_green\""
|
, "Loading icon \"controller_green\""
|
||||||
)))
|
)))
|
||||||
mkbdblue <- createImage nvg (FileName "assets/icons/keyboard_blue.png") 0
|
mkbdblue <- createImage nvg (FileName "assets/icons/keyboard_blue.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading icon \"keyboard_blue\""
|
, "Loading icon \"keyboard_blue\""
|
||||||
)))
|
)))
|
||||||
mkbdgreen <- createImage nvg (FileName "assets/icons/keyboard_green.png") 0
|
mkbdgreen <- createImage nvg (FileName "assets/icons/keyboard_green.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading icon \"keyboard_green\""
|
, "Loading icon \"keyboard_green\""
|
||||||
)))
|
)))
|
||||||
marrow <- createImage nvg (FileName "assets/icons/arrow.png") 0
|
marrow <- createImage nvg (FileName "assets/icons/arrow.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"wall_asc\""
|
, "Loading asset \"wall_asc\""
|
||||||
)))
|
)))
|
||||||
mwallasc <- createImage nvg (FileName "assets/walls/wall_asc.png") 0
|
mwallasc <- createImage nvg (FileName "assets/walls/wall_asc.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"wall_desc\""
|
, "Loading asset \"wall_desc\""
|
||||||
)))
|
)))
|
||||||
mwalldesc <- createImage nvg (FileName "assets/walls/wall_desc.png") 0
|
mwalldesc <- createImage nvg (FileName "assets/walls/wall_desc.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"wall_corner_n\""
|
, "Loading asset \"wall_corner_n\""
|
||||||
)))
|
)))
|
||||||
mwallcornern <- createImage nvg (FileName "assets/walls/wall_corner_n.png") 0
|
mwallcornern <- createImage nvg (FileName "assets/walls/wall_corner_n.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"wall_corner_e\""
|
, "Loading asset \"wall_corner_e\""
|
||||||
)))
|
)))
|
||||||
mwallcornere <- createImage nvg (FileName "assets/walls/wall_corner_e.png") 0
|
mwallcornere <- createImage nvg (FileName "assets/walls/wall_corner_e.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"wall_corner_s\""
|
, "Loading asset \"wall_corner_s\""
|
||||||
)))
|
)))
|
||||||
mwallcorners <- createImage nvg (FileName "assets/walls/wall_corner_s.png") 0
|
mwallcorners <- createImage nvg (FileName "assets/walls/wall_corner_s.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"wall_corner_w\""
|
, "Loading asset \"wall_corner_w\""
|
||||||
)))
|
)))
|
||||||
mwallcornerw <- createImage nvg (FileName "assets/walls/wall_corner_w.png") 0
|
mwallcornerw <- createImage nvg (FileName "assets/walls/wall_corner_w.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"wall_t_ne\""
|
, "Loading asset \"wall_t_ne\""
|
||||||
)))
|
)))
|
||||||
mwalltne <- createImage nvg (FileName "assets/walls/wall_t_ne.png") 0
|
mwalltne <- createImage nvg (FileName "assets/walls/wall_t_ne.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"wall_t_se\""
|
, "Loading asset \"wall_t_se\""
|
||||||
)))
|
)))
|
||||||
mwalltse <- createImage nvg (FileName "assets/walls/wall_t_se.png") 0
|
mwalltse <- createImage nvg (FileName "assets/walls/wall_t_se.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"wall_t_sw\""
|
, "Loading asset \"wall_t_sw\""
|
||||||
)))
|
)))
|
||||||
mwalltsw <- createImage nvg (FileName "assets/walls/wall_t_sw.png") 0
|
mwalltsw <- createImage nvg (FileName "assets/walls/wall_t_sw.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"wall_t_nw\""
|
, "Loading asset \"wall_t_nw\""
|
||||||
)))
|
)))
|
||||||
mwalltnw <- createImage nvg (FileName "assets/walls/wall_t_nw.png") 0
|
mwalltnw <- createImage nvg (FileName "assets/walls/wall_t_nw.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"wall_cross\""
|
, "Loading asset \"wall_cross\""
|
||||||
)))
|
)))
|
||||||
mwallcross <- createImage nvg (FileName "assets/walls/wall_cross.png") 0
|
mwallcross <- createImage nvg (FileName "assets/walls/wall_cross.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"box1\""
|
, "Loading asset \"box1\""
|
||||||
)))
|
)))
|
||||||
mmiscbox1 <- createImage nvg (FileName "assets/misc/box1.png") 0
|
mmiscbox1 <- createImage nvg (FileName "assets/misc/box1.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"tableSW\""
|
, "Loading asset \"tableSW\""
|
||||||
)))
|
)))
|
||||||
mtableSW <- createImage nvg (FileName "assets/table/tableSW.png") 0
|
mtableSW <- createImage nvg (FileName "assets/table/tableSW.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"tableSE\""
|
, "Loading asset \"tableSE\""
|
||||||
)))
|
)))
|
||||||
mtableSE <- createImage nvg (FileName "assets/table/tableSE.png") 0
|
mtableSE <- createImage nvg (FileName "assets/table/tableSE.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"tableNE\""
|
, "Loading asset \"tableNE\""
|
||||||
)))
|
)))
|
||||||
mtableNE <- createImage nvg (FileName "assets/table/tableNE.png") 0
|
mtableNE <- createImage nvg (FileName "assets/table/tableNE.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"tableNW\""
|
, "Loading asset \"tableNW\""
|
||||||
)))
|
)))
|
||||||
mtableNW <- createImage nvg (FileName "assets/table/tableNW.png") 0
|
mtableNW <- createImage nvg (FileName "assets/table/tableNW.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"tableC1\""
|
, "Loading asset \"tableC1\""
|
||||||
)))
|
)))
|
||||||
mtablec1 <- createImage nvg (FileName "assets/table/tablec1.png") 0
|
mtablec1 <- createImage nvg (FileName "assets/table/tablec1.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"tableC2\""
|
, "Loading asset \"tableC2\""
|
||||||
)))
|
)))
|
||||||
mtablec2 <- createImage nvg (FileName "assets/table/tablec2.png") 0
|
mtablec2 <- createImage nvg (FileName "assets/table/tablec2.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"tableC3\""
|
, "Loading asset \"tableC3\""
|
||||||
)))
|
)))
|
||||||
mtablec3 <- createImage nvg (FileName "assets/table/tablec3.png") 0
|
mtablec3 <- createImage nvg (FileName "assets/table/tablec3.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"tableC4\""
|
, "Loading asset \"tableC4\""
|
||||||
)))
|
)))
|
||||||
mtablec4 <- createImage nvg (FileName "assets/table/tablec4.png") 0
|
mtablec4 <- createImage nvg (FileName "assets/table/tablec4.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"tableCorner\""
|
, "Loading asset \"tableCorner\""
|
||||||
)))
|
)))
|
||||||
mtableC <- createImage nvg (FileName "assets/table/tableCorner.png") 0
|
mtableC <- createImage nvg (FileName "assets/table/tableCorner.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"flipchart\""
|
, "Loading asset \"flipchart\""
|
||||||
)))
|
)))
|
||||||
mmiscFlipchart <- createImage nvg (FileName "assets/misc/flipchart.png") 0
|
mmiscFlipchart <- createImage nvg (FileName "assets/misc/flipchart.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"plant1\""
|
, "Loading asset \"plant1\""
|
||||||
)))
|
)))
|
||||||
mmiscPlant1 <- createImage nvg (FileName "assets/misc/plant1.png") 0
|
mmiscPlant1 <- createImage nvg (FileName "assets/misc/plant1.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"plant2\""
|
, "Loading asset \"plant2\""
|
||||||
)))
|
)))
|
||||||
mmiscPlant2 <- createImage nvg (FileName "assets/misc/plant2.png") 0
|
mmiscPlant2 <- createImage nvg (FileName "assets/misc/plant2.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"watercooler\""
|
, "Loading asset \"watercooler\""
|
||||||
)))
|
)))
|
||||||
mmiscWatercooler <- createImage nvg (FileName "assets/misc/watercooler.png") 0
|
mmiscWatercooler <- createImage nvg (FileName "assets/misc/watercooler.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"vending machine\""
|
, "Loading asset \"vending machine\""
|
||||||
)))
|
)))
|
||||||
mmiscVending <- createImage nvg (FileName "assets/misc/vending.png") 0
|
mmiscVending <- createImage nvg (FileName "assets/misc/vending.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"Cabinet with Coffee machine SW\""
|
, "Loading asset \"Cabinet with Coffee machine SW\""
|
||||||
)))
|
)))
|
||||||
mcabCoffeeSW <- createImage nvg (FileName "assets/cabinet/cabCoffeeSW.png") 0
|
mcabCoffeeSW <- createImage nvg (FileName "assets/cabinet/cabCoffeeSW.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"Cabinet with Coffee machine SE\""
|
, "Loading asset \"Cabinet with Coffee machine SE\""
|
||||||
)))
|
)))
|
||||||
mcabCoffeeSE <- createImage nvg (FileName "assets/cabinet/cabCoffeeSE.png") 0
|
mcabCoffeeSE <- createImage nvg (FileName "assets/cabinet/cabCoffeeSE.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"Cabinet with sink SW\""
|
, "Loading asset \"Cabinet with sink SW\""
|
||||||
)))
|
)))
|
||||||
mcabSinkSW <- createImage nvg (FileName "assets/cabinet/cabSinkSW.png") 0
|
mcabSinkSW <- createImage nvg (FileName "assets/cabinet/cabSinkSW.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"Cabinet with sink SE\""
|
, "Loading asset \"Cabinet with sink SE\""
|
||||||
)))
|
)))
|
||||||
mcabSinkSE <- createImage nvg (FileName "assets/cabinet/cabSinkSE.png") 0
|
mcabSinkSE <- createImage nvg (FileName "assets/cabinet/cabSinkSE.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"Cabinet with stove SW\""
|
, "Loading asset \"Cabinet with stove SW\""
|
||||||
)))
|
)))
|
||||||
mcabStoveSW <- createImage nvg (FileName "assets/cabinet/cabStoveSW.png") 0
|
mcabStoveSW <- createImage nvg (FileName "assets/cabinet/cabStoveSW.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"Cabinet with stove SE\""
|
, "Loading asset \"Cabinet with stove SE\""
|
||||||
)))
|
)))
|
||||||
mcabStoveSE <- createImage nvg (FileName "assets/cabinet/cabStoveSE.png") 0
|
mcabStoveSE <- createImage nvg (FileName "assets/cabinet/cabStoveSE.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"cabinet SW\""
|
, "Loading asset \"cabinet SW\""
|
||||||
)))
|
)))
|
||||||
mcabinetSW <- createImage nvg (FileName "assets/cabinet/cabinetSW.png") 0
|
mcabinetSW <- createImage nvg (FileName "assets/cabinet/cabinetSW.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"cabinet SE\""
|
, "Loading asset \"cabinet SE\""
|
||||||
)))
|
)))
|
||||||
mcabinetSE <- createImage nvg (FileName "assets/cabinet/cabinetSE.png") 0
|
mcabinetSE <- createImage nvg (FileName "assets/cabinet/cabinetSE.png") (S.singleton ImagePremultiplied)
|
||||||
modifyMVar_ progress (return . (\(p, _) ->
|
modifyMVar_ progress (return . (\(p, _) ->
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Loading asset \"cabinet corner\""
|
, "Loading asset \"cabinet corner\""
|
||||||
)))
|
)))
|
||||||
mcabinetCorner <- createImage nvg (FileName "assets/cabinet/cabinetCorner.png") 0
|
mcabinetCorner <- createImage nvg (FileName "assets/cabinet/cabinetCorner.png") (S.singleton ImagePremultiplied)
|
||||||
let micons =
|
let micons =
|
||||||
[ mcontrblue, mcontrgreen, mkbdblue, mkbdgreen, marrow
|
[ mcontrblue, mcontrgreen, mkbdblue, mkbdgreen, marrow
|
||||||
]
|
]
|
||||||
|
|
|
@ -257,7 +257,7 @@ loadAnimationSprites fp nvg idconfs = do
|
||||||
mresimgs <- mapM
|
mresimgs <- mapM
|
||||||
(\cr ->
|
(\cr ->
|
||||||
createImageMem nvg
|
createImageMem nvg
|
||||||
ImagePremultiplied (toStrict $ encodePng cr))
|
(S.singleton ImagePremultiplied) (toStrict $ encodePng cr))
|
||||||
crs
|
crs
|
||||||
imgs <- if any isNothing mresimgs
|
imgs <- if any isNothing mresimgs
|
||||||
then do
|
then do
|
||||||
|
|
Loading…
Reference in a new issue