 ;; left/right GUI functions
 ;;
 
+(defn- displaycharacterrostersprite [roster character x y]
+  )
+
+(defn rebuildrosterdisplaylist [gamestate rosterteam]
+  (let [roster (get (:rostermap @displayed-renderstate) rosterteam)
+        allcharacters (vals (:characters gamestate))
+        teamcharacters (filter #(= (:team %1) rosterteam) allcharacters)
+        orderedteamcharacters (sort-by :uniqueid teamcharacters)
+        rostersize (count teamcharacters)]
+    (.removeAllChildren roster)
+    (syncsprites! :team1rostersprites allcharacters)
+    (let [renderstate @displayed-renderstate
+          rostersprites (:team1rostersprites renderstate)]
+      (doseq [characterindex (range rostersize)
+              character (get orderedteamcharacters characterindex)
+              drawx 0
+              drawy (* tilespacing characterindex)]
+        (displaycharacterrostersprite roster character drawx drawy)))))
+
 
 ;;
 ;; initialization functions

  (let [stage (:stage @displayed-renderstate)
        tilemap (createeaseljscontainer "tilemap" 100 100)
        characters (createeaseljscontainer "characters" 100 100)
        leftRoster (createcharacterroster "leftRoster" 0 100)
        rightRoster (createcharacterroster "rightRoster" 500 100)]
    (.removeAllChildren stage)
    (.addChild stage tilemap)
    (.addChild stage characters)

    ;; embed direct references to the map and character containers for
    ;; easy manipulation later
    (swap! displayed-renderstate assoc :stage-map tilemap :stage-characters characters)
    (swap! displayed-renderstate assoc :leftRoster leftRoster :rightRoster rightRoster :rostermap rostermap)))

(defn initializerenderer [canvasname]
  (let [canvas (dom/get-element canvasname)
