Added the initial map (just a black background for now)w
This commit is contained in:
parent
77fdf01d92
commit
5087ab54e1
4 changed files with 41 additions and 5 deletions
|
@ -2,12 +2,16 @@ module GLOBALS exposing (..)
|
||||||
|
|
||||||
|
|
||||||
player_move_speed =
|
player_move_speed =
|
||||||
120
|
150
|
||||||
|
|
||||||
|
|
||||||
character_radius =
|
character_radius =
|
||||||
25
|
20
|
||||||
|
|
||||||
|
|
||||||
playAreaSize =
|
playAreaSize =
|
||||||
( "500", "900" )
|
( 800, 880 )
|
||||||
|
|
||||||
|
|
||||||
|
backgroundColor =
|
||||||
|
"black"
|
||||||
|
|
|
@ -14,5 +14,5 @@ view model =
|
||||||
in
|
in
|
||||||
div []
|
div []
|
||||||
[ h1 [] [ text "ElmMan!" ]
|
[ h1 [] [ text "ElmMan!" ]
|
||||||
, Views.PlayArea.render width height model
|
, Views.PlayArea.render (toString width) (toString height) model
|
||||||
]
|
]
|
||||||
|
|
29
src/Views/Map.elm
Normal file
29
src/Views/Map.elm
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
module Views.Map exposing (..)
|
||||||
|
|
||||||
|
import GLOBALS exposing (backgroundColor, playAreaSize)
|
||||||
|
import Svg exposing (Svg, g, path)
|
||||||
|
import Svg.Attributes exposing (d, fill)
|
||||||
|
import Svg.Path exposing (pathToString, lineTo, subpath, startAt, closed)
|
||||||
|
|
||||||
|
|
||||||
|
render : Svg msg
|
||||||
|
render =
|
||||||
|
let
|
||||||
|
( width, height ) =
|
||||||
|
playAreaSize
|
||||||
|
in
|
||||||
|
g []
|
||||||
|
[ path
|
||||||
|
[ d <|
|
||||||
|
pathToString
|
||||||
|
[ subpath (startAt ( 0, 0 ))
|
||||||
|
closed
|
||||||
|
[ lineTo ( width, 0 )
|
||||||
|
, lineTo ( width, height )
|
||||||
|
, lineTo ( 0, height )
|
||||||
|
]
|
||||||
|
]
|
||||||
|
, fill backgroundColor
|
||||||
|
]
|
||||||
|
[]
|
||||||
|
]
|
|
@ -5,10 +5,13 @@ import Svg exposing (svg)
|
||||||
import Svg.Attributes exposing (width, height, viewBox)
|
import Svg.Attributes exposing (width, height, viewBox)
|
||||||
import Types exposing (Model)
|
import Types exposing (Model)
|
||||||
import Views.Player
|
import Views.Player
|
||||||
|
import Views.Map
|
||||||
|
|
||||||
|
|
||||||
render : String -> String -> Model -> Html msg
|
render : String -> String -> Model -> Html msg
|
||||||
render w h model =
|
render w h model =
|
||||||
svg
|
svg
|
||||||
[ width w, height h, viewBox ("0 0 " ++ w ++ " " ++ h) ]
|
[ width w, height h, viewBox ("0 0 " ++ w ++ " " ++ h) ]
|
||||||
[ Views.Player.render model ]
|
[ Views.Map.render
|
||||||
|
, Views.Player.render model
|
||||||
|
]
|
||||||
|
|
Loading…
Reference in a new issue