From 4baeace2ee254d6bfdd894775c9a843ad8b82825 Mon Sep 17 00:00:00 2001 From: Simon Pirkelmann Date: Thu, 24 Sep 2020 23:58:17 +0200 Subject: [PATCH] enabled displaying robot position in the web app and setting the position at the start of the game --- templates/drag_example.html | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/templates/drag_example.html b/templates/drag_example.html index 9ea0b93..b3e8184 100644 --- a/templates/drag_example.html +++ b/templates/drag_example.html @@ -26,6 +26,24 @@ + {% if robot_pos is none %} +
+ + + + + +
+ {% else %} +
+ + + + + +
+ {% endif %} + @@ -43,7 +61,12 @@ var box = $(".box"); var mainCanvas = $(".main-canvas"); + + $("#btnSubmit").click(function () { + var robot_x = $("#inputRobotX"); + var robot_y = $("#inputRobotY"); + //alert("button"); for (i = 0; i < 9; i++) { var c = document.getElementsByClassName("box card" + String(i)); @@ -51,10 +74,9 @@ $(c).hide(); } } - $(please_wait).show(); - $.post("/send_cmds", "", function (data) { + $.post("/send_cmds", { "x" : robot_x.val(), "y": robot_y.val()}, function (data) { console.log(data); if (data === 'OK') { location.reload(); // reload page to get new cards for next round