aboutsummaryrefslogtreecommitdiff
blob: f2e900c2cc59b9505312669af5941a2e068c90df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
module View.SideBar.ManualControls exposing (get_html)

-- Elm -------------------------------------------------------------------------
import Html
import Html.Attributes
import Html.Events

-- Battlemap -------------------------------------------------------------------
import Struct.Direction
import Struct.Event

--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
direction_button : (
      Struct.Direction.Type ->
      String ->
      (Html.Html Struct.Event.Type)
   )
direction_button dir label =
   (Html.button
      [
         (Html.Events.onClick
            (Struct.Event.DirectionRequested dir)
         )
      ]
      [ (Html.text label) ]
   )

--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
get_html : (Html.Html Struct.Event.Type)
get_html =
   (Html.div
      [
         (Html.Attributes.class "battlemap-manual-controls")
      ]
      [
         (direction_button Struct.Direction.Left "Left"),
         (direction_button Struct.Direction.Down "Down"),
         (direction_button Struct.Direction.Up "Up"),
         (direction_button Struct.Direction.Right "Right")
      ]
   )