summaryrefslogtreecommitdiffstats
path: root/Lasers_und_stuff/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lasers_und_stuff/main.py')
-rw-r--r--Lasers_und_stuff/main.py26
1 files changed, 7 insertions, 19 deletions
diff --git a/Lasers_und_stuff/main.py b/Lasers_und_stuff/main.py
index df7cd7e..55962e4 100644
--- a/Lasers_und_stuff/main.py
+++ b/Lasers_und_stuff/main.py
@@ -12,7 +12,7 @@ import os
import signal
import json
from pygame.locals import *
-from Cannon import CannonController
+from Cannon import HackWAWCannonController
from Cannon import Gunpoint
app = flask.Flask(__name__)
@@ -21,22 +21,22 @@ pygame.init()
cannon = None
-@app.route("/left/<int:amount>")
+@app.route("/left/<int:amount>", methods=["POST"])
def move_left(amount):
cannon.move_left(amount)
return "OK"
-@app.route("/right/<int:amount>")
+@app.route("/right/<int:amount>", methods=["POST"])
def move_right(amount):
cannon.move_right(amount)
return "OK"
-@app.route("/up/<int:amount>")
+@app.route("/up/<int:amount>", methods=["POST"])
def move_up(amount):
cannon.move_up(amount)
return "OK"
-@app.route("/down/<int:amount>")
+@app.route("/down/<int:amount>", methods=["POST"])
def move_down(amount):
cannon.move_down(amount)
return "OK"
@@ -47,20 +47,8 @@ def status():
@app.route("/")
def root():
- return """<html>
- <head>
- <title>Turret!</title>
- </head>
- <body>
- <div style="width: 400px; height: 400px; margin-top: -200px; margin-left: -200px; position: absolute; top: 50%; left: 50%;">
- <a href="/up/20">Up</a>
- <a href="/down/20">Down</a>
- <a href="/left/20">Left</a>
- <a href="/right/20">Right</a>
- </div>
- </body>
-</html>"""
-
+
+ return flask.render_template("status.html", data=cannon.get_data())
def main():
#create the screen
window = pygame.display.set_mode((800, 600))