diff --git a/server/assets/css/cover.css b/server/assets/css/cover.css index 9578e60..e7cc1e4 100644 --- a/server/assets/css/cover.css +++ b/server/assets/css/cover.css @@ -32,7 +32,12 @@ body { .cover-container { max-width: 50%; - /*max-width: 42em;*/ + @media (max-width: 1500px){ + max-width: 60%; + } + @media (max-width: 1020px){ + max-width: 80%; + } } diff --git a/server/assets/wasm/maze-wars.wasm b/server/assets/wasm/maze-wars.wasm index 5a3fe90..fb935fc 100755 Binary files a/server/assets/wasm/maze-wars.wasm and b/server/assets/wasm/maze-wars.wasm differ diff --git a/server/new.go b/server/new.go index 850cbe9..2f3781a 100644 --- a/server/new.go +++ b/server/new.go @@ -55,11 +55,11 @@ func New(ad *ActionDispatcher, s *Store, opt Options) error { r.HandleFunc("/ws", wsHandler(s)).Methods(http.MethodGet) // Webpage - r.HandleFunc("/play", playHandler).Methods(http.MethodGet) - r.HandleFunc("/download", downloadHandler).Methods(http.MethodGet) + r.HandleFunc("/play", playHandler(opt.Version)).Methods(http.MethodGet) + r.HandleFunc("/download", downloadHandler(opt.Version)).Methods(http.MethodGet) r.HandleFunc("/game", gameHandler(opt.Version)).Methods(http.MethodGet) - r.HandleFunc("/docs", docsHandler).Methods(http.MethodGet) - r.HandleFunc("/", homeHandler).Methods(http.MethodGet) + r.HandleFunc("/docs", docsHandler(opt.Version)).Methods(http.MethodGet) + r.HandleFunc("/", homeHandler(opt.Version)).Methods(http.MethodGet) // Game Endpoints r.HandleFunc("/users", usersCreateHandler(s)).Methods(http.MethodPost).Headers("Content-Type", "application/json") @@ -90,22 +90,29 @@ func New(ad *ActionDispatcher, s *Store, opt Options) error { } type templateData struct { - Tab string + Tab string + Version string } -func homeHandler(w http.ResponseWriter, r *http.Request) { - t, _ := templates.Templates["views/home/index.tmpl"] - t.Execute(w, templateData{"home"}) +func homeHandler(v string) func(w http.ResponseWriter, r *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + t, _ := templates.Templates["views/home/index.tmpl"] + t.Execute(w, templateData{Tab: "home", Version: v}) + } } -func playHandler(w http.ResponseWriter, r *http.Request) { - t, _ := templates.Templates["views/game/play.tmpl"] - t.Execute(w, templateData{"game"}) +func playHandler(v string) func(w http.ResponseWriter, r *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + t, _ := templates.Templates["views/game/play.tmpl"] + t.Execute(w, templateData{Tab: "game", Version: v}) + } } -func downloadHandler(w http.ResponseWriter, r *http.Request) { - t, _ := templates.Templates["views/game/download.tmpl"] - t.Execute(w, templateData{"download"}) +func downloadHandler(v string) func(w http.ResponseWriter, r *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + t, _ := templates.Templates["views/game/download.tmpl"] + t.Execute(w, templateData{Tab: "download", Version: v}) + } } func gameHandler(v string) func(w http.ResponseWriter, r *http.Request) { @@ -115,9 +122,11 @@ func gameHandler(v string) func(w http.ResponseWriter, r *http.Request) { } } -func docsHandler(w http.ResponseWriter, r *http.Request) { - t, _ := templates.Templates["views/docs/index.tmpl"] - t.Execute(w, templateData{"docs"}) +func docsHandler(v string) func(w http.ResponseWriter, r *http.Request) { + return func(w http.ResponseWriter, r *http.Request) { + t, _ := templates.Templates["views/docs/index.tmpl"] + t.Execute(w, templateData{Tab: "docs", Version: v}) + } } type usersCreateRequest struct { diff --git a/server/templates/views/game/download.tmpl b/server/templates/views/game/download.tmpl index 2ee865d..fcee260 100644 --- a/server/templates/views/game/download.tmpl +++ b/server/templates/views/game/download.tmpl @@ -5,7 +5,7 @@ {{define "content"}}

- Maze Wars is playable in 3 platforms: Windows, OSX and Linux on amd64 architecture + Maze Wars is playable in 3 platforms: Windows, OSX and Linux on amd64 architecture. And also from the Web Browser


@@ -20,20 +20,11 @@ Linux - - -
-
-
-

- Optionally you can also play it from the web, but it's really slow so play it at your own risk hehe -

-
-
-
Web
+
+
{{ end}} diff --git a/server/templates/views/game/play.tmpl b/server/templates/views/game/play.tmpl index 82f09cd..6c6c118 100644 --- a/server/templates/views/game/play.tmpl +++ b/server/templates/views/game/play.tmpl @@ -8,9 +8,8 @@ crossorigin="anonymous" >
-

- The current web version of this game is really slow. If you want a smooth experience download it. -

+
+
@@ -43,12 +41,17 @@ {{template "content" .}} + +
+ Version v{{.Version}} +
+ {{end}}