From 4ca4778bad6f586b38e41df9e571a9331e73b2f1 Mon Sep 17 00:00:00 2001 From: nsensfel Date: Thu, 19 Oct 2017 15:33:41 +0200 Subject: Adds colors to see the battlemap. Navigator seems borked, though. --- Makefile | 4 +- src/battlemap/src/View/Battlemap.elm | 1 + src/battlemap/src/View/Battlemap/Navigator.elm | 48 ++++++++++++++++-- src/battlemap/src/View/Battlemap/Tile.elm | 1 + src/battlemap/www/index.html | 67 ++++++++++++++++++++++++++ 5 files changed, 115 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index f290bd1..7768579 100644 --- a/Makefile +++ b/Makefile @@ -17,8 +17,8 @@ clean: $(MAKE) -C $$module clean ; \ done -$(MODULES_WWW): %: $(WWW_DIR) - ln -s $(SRC_DIR)/$(notdir $<)/www $@ +$(MODULES_WWW): %: + ln -s $(SRC_DIR)/$(patsubst $(WWW_DIR)/%,%,$@)/www $@ $(WWW_DIR): mkdir -p $@ diff --git a/src/battlemap/src/View/Battlemap.elm b/src/battlemap/src/View/Battlemap.elm index efe4d1e..94acf25 100644 --- a/src/battlemap/src/View/Battlemap.elm +++ b/src/battlemap/src/View/Battlemap.elm @@ -27,6 +27,7 @@ char_on_map tile_size char = (Html.div [ (Html.Attributes.class "battlemap-character-icon"), + (Html.Attributes.class "battlemap-tiled"), (Html.Attributes.class ("asset-character-icon-" ++ (Character.get_icon_id char)) ), diff --git a/src/battlemap/src/View/Battlemap/Navigator.elm b/src/battlemap/src/View/Battlemap/Navigator.elm index 4180e6d..a138a19 100644 --- a/src/battlemap/src/View/Battlemap/Navigator.elm +++ b/src/battlemap/src/View/Battlemap/Navigator.elm @@ -1,10 +1,12 @@ module View.Battlemap.Navigator exposing (get_html) +import List import Html ---import Html.Attributes ---import Html.Events +import Html.Attributes +import Html.Events ---import Battlemap.Location +import Battlemap.Location +import Battlemap.Marker import Battlemap.Navigator import Event @@ -14,4 +16,42 @@ get_html : ( Battlemap.Navigator.Summary -> (List (Html.Html Event.Type)) ) -get_html tile_size nav_summary = [] +get_html tile_size nav_summary = + (List.map + (\(loc_ref, marker) -> + (Html.div + [ + (Html.Attributes.class "battlemap-marker-icon"), + (Html.Attributes.class "battlemap-tiled"), + (Html.Attributes.class + ( + "asset-marker-icon-" + ++ + if (marker == Battlemap.Marker.CanGoTo) + then + "can-go-to" + else + "can-attack" + ) + ), + (Html.Events.onClick + (Event.TileSelected loc_ref) + ), + (Html.Attributes.style + ( + let + loc = (Battlemap.Location.from_ref loc_ref) + in + [ + ("top", ((toString (loc.y * tile_size)) ++ "px")), + ("left", ((toString (loc.x * tile_size)) ++ "px")) + ] + ) + ) + ] + [ + ] + ) + ) + nav_summary.markers + ) diff --git a/src/battlemap/src/View/Battlemap/Tile.elm b/src/battlemap/src/View/Battlemap/Tile.elm index d38d84e..d4b4cc8 100644 --- a/src/battlemap/src/View/Battlemap/Tile.elm +++ b/src/battlemap/src/View/Battlemap/Tile.elm @@ -21,6 +21,7 @@ get_html tile_size tile = (Html.div [ (Html.Attributes.class "battlemap-tile-icon"), + (Html.Attributes.class "battlemap-tiled"), (Html.Attributes.class ("asset-tile-" ++ (toString (Battlemap.Tile.get_icon_id tile))) ), diff --git a/src/battlemap/www/index.html b/src/battlemap/www/index.html index f630b80..e8bff19 100644 --- a/src/battlemap/www/index.html +++ b/src/battlemap/www/index.html @@ -1,6 +1,73 @@ + -- cgit v1.2.3-70-g09d2