Skip to content

Commit

Permalink
Move some packages into the common directory
Browse files Browse the repository at this point in the history
  • Loading branch information
z-riley committed Nov 15, 2024
1 parent 5f8c208 commit d77b825
Show file tree
Hide file tree
Showing 19 changed files with 29 additions and 19 deletions.
5 changes: 3 additions & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ func main() {
}
defer win.Destroy()

// Register window-level keybinds (for development only)
win.RegisterKeybind(turdgl.KeyLCtrl, turdgl.KeyPress, func() { win.Quit() })
if config.Debug {
win.RegisterKeybind(turdgl.KeyLCtrl, turdgl.KeyPress, func() { win.Quit() })
}

// Parse starting screen arg
screenStr := flag.String("screen", string(screen.Title), "starting screen")
Expand Down
4 changes: 2 additions & 2 deletions common/arena.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"time"

"github.com/google/uuid"
"github.com/z-riley/go-2048-battle/backend"
"github.com/z-riley/go-2048-battle/backend/grid"
"github.com/z-riley/go-2048-battle/common/backend"
"github.com/z-riley/go-2048-battle/common/backend/grid"
"github.com/z-riley/go-2048-battle/log"
"github.com/z-riley/turdgl"
"golang.org/x/exp/constraints"
Expand Down
2 changes: 1 addition & 1 deletion common/arena_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"

"github.com/google/uuid"
"github.com/z-riley/go-2048-battle/backend/grid"
"github.com/z-riley/go-2048-battle/common/backend/grid"
)

func TestGenerateRowAnimations(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions backend/backend.go → common/backend/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package backend
import (
"encoding/json"

"github.com/z-riley/go-2048-battle/backend/grid"
"github.com/z-riley/go-2048-battle/backend/store"
"github.com/z-riley/go-2048-battle/common/backend/grid"
"github.com/z-riley/go-2048-battle/common/backend/store"
"github.com/z-riley/go-2048-battle/log"
)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion comms/messages.go → common/comms/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package comms
import (
"encoding/json"

"github.com/z-riley/go-2048-battle/backend"
"github.com/z-riley/go-2048-battle/common/backend"
)

// Message contains data for multiplayer mode communication. The Type field
Expand Down
15 changes: 12 additions & 3 deletions config/config.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
// Package config contains global configuration.
package config

const (
Version = "0.0.1"
WinWidth = 1200
// Version is used to check compatibility with other go-2048-battle clients when
// in versus mode.
Version = "0.0.1"

// Debug enables debugging and diagnostics features which are useful for development.
Debug = false

// WinWidth specifies the pixel width of the window.
WinWidth = 1200

// WinHeight specifies the pixel height of the window.
WinHeight = 768
Debug = true
)
6 changes: 3 additions & 3 deletions screen/multiplayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"strconv"

"github.com/brunoga/deep"
"github.com/z-riley/go-2048-battle/backend"
"github.com/z-riley/go-2048-battle/backend/grid"
"github.com/z-riley/go-2048-battle/common"
"github.com/z-riley/go-2048-battle/comms"
"github.com/z-riley/go-2048-battle/common/backend"
"github.com/z-riley/go-2048-battle/common/backend/grid"
"github.com/z-riley/go-2048-battle/common/comms"
"github.com/z-riley/go-2048-battle/config"
"github.com/z-riley/go-2048-battle/log"
"github.com/z-riley/turdgl"
Expand Down
2 changes: 1 addition & 1 deletion screen/multiplayer_host.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/moby/moby/pkg/namesgenerator"
"github.com/z-riley/go-2048-battle/common"
"github.com/z-riley/go-2048-battle/comms"
"github.com/z-riley/go-2048-battle/common/comms"
"github.com/z-riley/go-2048-battle/config"
"github.com/z-riley/go-2048-battle/log"
"github.com/z-riley/turdgl"
Expand Down
4 changes: 2 additions & 2 deletions screen/multiplayer_join.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"time"

"github.com/moby/moby/pkg/namesgenerator"
"github.com/z-riley/go-2048-battle/backend/store"
"github.com/z-riley/go-2048-battle/common"
"github.com/z-riley/go-2048-battle/comms"
"github.com/z-riley/go-2048-battle/common/backend/store"
"github.com/z-riley/go-2048-battle/common/comms"
"github.com/z-riley/go-2048-battle/config"
"github.com/z-riley/go-2048-battle/log"
"github.com/z-riley/turdgl"
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions screen/singleplayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"strconv"

"github.com/brunoga/deep"
"github.com/z-riley/go-2048-battle/backend"
"github.com/z-riley/go-2048-battle/backend/grid"
"github.com/z-riley/go-2048-battle/common"
"github.com/z-riley/go-2048-battle/common/backend"
"github.com/z-riley/go-2048-battle/common/backend/grid"
"github.com/z-riley/go-2048-battle/config"
"github.com/z-riley/turdgl"
)
Expand Down

0 comments on commit d77b825

Please sign in to comment.