| 12345678910111213141516171819202122232425 |
- package main
- import (
- "battlecamp-go-server/board"
- "log"
- "net/http"
- "strconv"
- )
- func main() {
- http.HandleFunc("/", generateBoard)
- log.Fatal(http.ListenAndServe(":8081", nil))
- }
- func generateBoard(w http.ResponseWriter, r *http.Request) {
- x, _ := strconv.Atoi(r.FormValue("x"))
- y, _ := strconv.Atoi(r.FormValue("y"))
- width, _ := strconv.Atoi(r.FormValue("width"))
- height, _ := strconv.Atoi(r.FormValue("height"))
- totalWidth, _ := strconv.Atoi(r.FormValue("totalWidth"))
- totalHeight, _ := strconv.Atoi(r.FormValue("totalHeight"))
- log.Printf("Creating partial x=%v, y=%v, width=%v, height=%v, totalWidth=%v, totalHeight=%v", x, y, width, height, totalWidth, totalHeight)
- b := board.NewPartial(x, y, width, height, totalWidth, totalHeight)
- b.WriteData(w)
- }
|