Commit before putting walls into vector zones
This commit is contained in:
@@ -4,6 +4,7 @@ module Dodge.Base.Zone
|
||||
where
|
||||
import Dodge.Data
|
||||
import Dodge.Base.Window
|
||||
import Dodge.Bounds
|
||||
import Geometry
|
||||
import Geometry.Zone
|
||||
|
||||
@@ -12,10 +13,30 @@ import Data.List
|
||||
import Data.Bifunctor
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
import qualified Data.IntSet as IS
|
||||
import qualified Data.Vector as V
|
||||
zoneSize :: Float
|
||||
zoneSize = 50
|
||||
--zoneSize = 100
|
||||
|
||||
data Zoning a = Zoning
|
||||
{ _znObjects :: V.Vector (V.Vector a)
|
||||
, _znSize :: Int
|
||||
, _znBounds :: Bounds
|
||||
}
|
||||
|
||||
setupZoning :: Int -> Bounds -> a -> Zoning a
|
||||
setupZoning size bounds x = Zoning
|
||||
{ _znObjects = V.replicate xsize (V.replicate ysize x)
|
||||
, _znSize = size
|
||||
, _znBounds = bounds
|
||||
}
|
||||
where
|
||||
toInt y = (ceiling y `div` size) + 1
|
||||
xFloatSize = _bdMaxX bounds - _bdMinX bounds
|
||||
yFloatSize = _bdMaxX bounds - _bdMinX bounds
|
||||
xsize = toInt xFloatSize
|
||||
ysize = toInt yFloatSize
|
||||
|
||||
floorHun :: Float -> Int
|
||||
floorHun x = floor $ x / zoneSize
|
||||
|
||||
|
||||
Reference in New Issue
Block a user