Skip to content

Commit

Permalink
oak: upgrade imports and module to v3
Browse files Browse the repository at this point in the history
  • Loading branch information
200sc committed May 19, 2021
1 parent 7eeeebd commit 3bf0f7e
Show file tree
Hide file tree
Showing 276 changed files with 769 additions and 773 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## A Pure Go game engine

[![Go Reference](https://pkg.go.dev/badge/github.com/oakmound/oak/v2.svg)](https://pkg.go.dev/github.com/oakmound/oak/v2)
[![Go Reference](https://pkg.go.dev/badge/github.com/oakmound/oak/v3.svg)](https://pkg.go.dev/github.com/oakmound/oak/v3)
[![Code Coverage](https://codecov.io/gh/oakmound/oak/branch/develop/graph/badge.svg)](https://codecov.io/gh/oakmound/oak)
[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge-flat.svg)](https://github.com/avelino/awesome-go)

Expand All @@ -26,7 +26,7 @@

## Installation <a name="installation"/>

`go get -u github.com/oakmound/oak/v2/`
`go get -u github.com/oakmound/oak/v3/`

## Motivation <a name="motivation"/>

Expand All @@ -48,7 +48,7 @@ We anticipate in the immediate future needing to introduce alternate drivers tha
- Logical frame rate distinct from Draw rate
- Fullscreen, Window Positioning support, etc
- Auto-scaling for screen size changes (or dynamic content sizing)
1. [Image Rendering](https://pkg.go.dev/github.com/oakmound/oak/v2/render)
1. [Image Rendering](https://pkg.go.dev/github.com/oakmound/oak/v3/render)
- `render.Renderable` interface
- Sprite Sheet Batch Loading at startup
- Manipulation
Expand All @@ -61,23 +61,23 @@ We anticipate in the immediate future needing to introduce alternate drivers tha
- Primitive builders, `ColorBox`, `Line`, `Bezier`
- History-tracking `Reverting`
- Primarily 2D
1. [Particle System](https://pkg.go.dev/github.com/oakmound/oak/v2/render/particle)
1. [Mouse Handling](https://pkg.go.dev/github.com/oakmound/oak/v2/mouse)
1. [Joystick Support](https://pkg.go.dev/github.com/oakmound/oak/v2/joystick)
1. [Audio Support](https://pkg.go.dev/github.com/oakmound/oak/v2/audio)
1. [Particle System](https://pkg.go.dev/github.com/oakmound/oak/v3/render/particle)
1. [Mouse Handling](https://pkg.go.dev/github.com/oakmound/oak/v3/mouse)
1. [Joystick Support](https://pkg.go.dev/github.com/oakmound/oak/v3/joystick)
1. [Audio Support](https://pkg.go.dev/github.com/oakmound/oak/v3/audio)
- Positional filters to pan and scale audio based on a listening position
1. [Collision](https://pkg.go.dev/github.com/oakmound/oak/v2/collision)
1. [Collision](https://pkg.go.dev/github.com/oakmound/oak/v3/collision)
- Collision R-Tree forked from [rtreego](https://github.com/dhconnelly/rtreego)
- [2D Raycasting](https://pkg.go.dev/github.com/oakmound/oak/v2/collision/ray)
- [2D Raycasting](https://pkg.go.dev/github.com/oakmound/oak/v3/collision/ray)
- Collision Spaces
- Attachable to Objects
- Auto React to collisions through events
- OnHit bindings `func(s1,s2 *collision.Space)`
- Start/Stop collision with targeted objects
1. [2D Physics System](https://pkg.go.dev/github.com/oakmound/oak/v2/physics)
1. [Event Handler](https://pkg.go.dev/github.com/oakmound/oak/v2/event)
1. [2D Physics System](https://pkg.go.dev/github.com/oakmound/oak/v3/physics)
1. [Event Handler](https://pkg.go.dev/github.com/oakmound/oak/v3/event)
- PubSub system: `event.CID` can `Bind(eventName,fn)` and `Trigger(eventName,payload)` events
1. [Shaping](https://pkg.go.dev/github.com/oakmound/oak/v2/shape)
1. [Shaping](https://pkg.go.dev/github.com/oakmound/oak/v3/shape)
- Convert shapes into:
- Containment checks
- Outlines
Expand All @@ -96,8 +96,8 @@ This is an example of the most basic oak program:
package main

import (
"github.com/oakmound/oak/v2"
"github.com/oakmound/oak/v2/scene"
"github.com/oakmound/oak/v3"
"github.com/oakmound/oak/v3/scene"
)

func main() {
Expand All @@ -110,7 +110,7 @@ func main() {
}
```

See below or the [examples](examples) folder for longer demos, [godoc](https://pkg.go.dev/github.com/oakmound/oak/v2) for reference documentation, and the [wiki](https://github.com/oakmound/oak/wiki) for more guided feature sets, tutorials and walkthroughs.
See below or the [examples](examples) folder for longer demos, [godoc](https://pkg.go.dev/github.com/oakmound/oak/v3) for reference documentation, and the [wiki](https://github.com/oakmound/oak/wiki) for more guided feature sets, tutorials and walkthroughs.

## Implementation and Examples <a name="examples"></a>

Expand Down
4 changes: 2 additions & 2 deletions alg/floatgeom/point.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package floatgeom
import (
"math"

"github.com/oakmound/oak/v2/alg"
"github.com/oakmound/oak/v3/alg"
)

// Point2 represents a 2D point on a plane.
Expand All @@ -17,7 +17,7 @@ type Point4 [4]float64

// AnglePoint creates a unit vector from the given angle in degrees as a Point2.
func AnglePoint(angle float64) Point2 {
return RadianPoint(angle * math.Pi / 180)
return RadianPoint(angle * alg.DegToRad)
}

// RadianPoint creates a unit vector from the given angle in radians as a Point2.
Expand Down
2 changes: 1 addition & 1 deletion alg/floatgeom/point_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"
"time"

"github.com/oakmound/oak/v2/alg"
"github.com/oakmound/oak/v3/alg"
)

func Seed() {
Expand Down
2 changes: 1 addition & 1 deletion alg/intgeom/point.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package intgeom
import (
"math"

"github.com/oakmound/oak/v2/alg"
"github.com/oakmound/oak/v3/alg"
)

// Point2 represents a 2D point in space.
Expand Down
2 changes: 1 addition & 1 deletion alg/intgeom/point_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"
"time"

"github.com/oakmound/oak/v2/alg"
"github.com/oakmound/oak/v3/alg"
)

func Seed() {
Expand Down
2 changes: 1 addition & 1 deletion alg/range/colorrange/linear.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package colorrange
import (
"image/color"

"github.com/oakmound/oak/v2/alg/range/intrange"
"github.com/oakmound/oak/v3/alg/range/intrange"
)

// linear color ranges return colors on a linear distribution
Expand Down
2 changes: 1 addition & 1 deletion alg/range/floatrange/linear.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package floatrange
import (
"math/rand"

"github.com/oakmound/oak/v2/alg/range/internal/random"
"github.com/oakmound/oak/v3/alg/range/internal/random"
)

// NewSpread returns a linear range from base-spread to base+spread
Expand Down
2 changes: 1 addition & 1 deletion alg/range/intrange/linear.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package intrange
import (
"math/rand"

"github.com/oakmound/oak/v2/alg/range/internal/random"
"github.com/oakmound/oak/v3/alg/range/internal/random"
)

// NewLinear returns a linear range between min and max
Expand Down
2 changes: 1 addition & 1 deletion audio/audio.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/200sc/klangsynthese/audio"
"github.com/200sc/klangsynthese/font"
"github.com/oakmound/oak/v2/oakerr"
"github.com/oakmound/oak/v3/oakerr"
)

// Audio is a struct of some audio data and the variables
Expand Down
2 changes: 1 addition & 1 deletion audio/channelManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package audio

import (
"github.com/200sc/klangsynthese/font"
"github.com/oakmound/oak/v2/alg/range/intrange"
"github.com/oakmound/oak/v3/alg/range/intrange"
)

// A ChannelManager can create audio channels that won't be stopped at scene end,
Expand Down
2 changes: 1 addition & 1 deletion audio/channel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"
"time"

"github.com/oakmound/oak/v2/alg/range/intrange"
"github.com/oakmound/oak/v3/alg/range/intrange"
)

func TestChannels(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions audio/channels.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"time"

"github.com/200sc/klangsynthese/font"
"github.com/oakmound/oak/v2/alg/range/intrange"
"github.com/oakmound/oak/v2/timing"
"github.com/oakmound/oak/v3/alg/range/intrange"
"github.com/oakmound/oak/v3/timing"
)

// DefaultActiveChannel acts like GetActiveChannel when fed DefaultFont
Expand Down
4 changes: 2 additions & 2 deletions audio/ears.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package audio

import (
"github.com/oakmound/oak/v2/dlog"
"github.com/oakmound/oak/v2/physics"
"github.com/oakmound/oak/v3/dlog"
"github.com/oakmound/oak/v3/physics"
)

// ScaleType should be moved to a different package that handles global
Expand Down
2 changes: 1 addition & 1 deletion audio/error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package audio
import (
"testing"

"github.com/oakmound/oak/v2/oakerr"
"github.com/oakmound/oak/v3/oakerr"
)

func TestErrorChannel(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion audio/fontManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package audio

import (
"github.com/200sc/klangsynthese/font"
"github.com/oakmound/oak/v2/oakerr"
"github.com/oakmound/oak/v3/oakerr"
)

const defaultFontKey = "def"
Expand Down
6 changes: 3 additions & 3 deletions audio/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"github.com/200sc/klangsynthese/wav"
"golang.org/x/sync/errgroup"

"github.com/oakmound/oak/v2/dlog"
"github.com/oakmound/oak/v2/fileutil"
"github.com/oakmound/oak/v2/oakerr"
"github.com/oakmound/oak/v3/dlog"
"github.com/oakmound/oak/v3/fileutil"
"github.com/oakmound/oak/v3/oakerr"
)

// Data is an alias for an interface supporting the built in filters in our
Expand Down
2 changes: 1 addition & 1 deletion audio/play.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package audio

import (
"github.com/200sc/klangsynthese/font"
"github.com/oakmound/oak/v2/dlog"
"github.com/oakmound/oak/v3/dlog"
)

// Play is shorthand for Get followed by Play.
Expand Down
2 changes: 1 addition & 1 deletion audio/posFilter.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"github.com/200sc/klangsynthese/audio"
"github.com/200sc/klangsynthese/audio/filter"
"github.com/200sc/klangsynthese/audio/filter/supports"
"github.com/oakmound/oak/v2/physics"
"github.com/oakmound/oak/v3/physics"
)

// SupportsPos is a type used by filters to check that the audio they are given
Expand Down
4 changes: 2 additions & 2 deletions collision/attachSpace.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package collision
import (
"errors"

"github.com/oakmound/oak/v2/event"
"github.com/oakmound/oak/v2/physics"
"github.com/oakmound/oak/v3/event"
"github.com/oakmound/oak/v3/physics"
)

// An AttachSpace is a composable struct that provides attachment
Expand Down
4 changes: 2 additions & 2 deletions collision/attachSpace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"testing"
"time"

"github.com/oakmound/oak/v2/event"
"github.com/oakmound/oak/v2/physics"
"github.com/oakmound/oak/v3/event"
"github.com/oakmound/oak/v3/physics"
)

type aspace struct {
Expand Down
2 changes: 1 addition & 1 deletion collision/filter.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package collision

import "github.com/oakmound/oak/v2/event"
import "github.com/oakmound/oak/v3/event"

// A Filter will take a set of collision spaces
// and return the subset that match some requirement
Expand Down
2 changes: 1 addition & 1 deletion collision/geom.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package collision
import (
"math"

"github.com/oakmound/oak/v2/alg/floatgeom"
"github.com/oakmound/oak/v3/alg/floatgeom"
)

// minDist computes the square of the distance from a point to a rectangle.
Expand Down
2 changes: 1 addition & 1 deletion collision/onCollision.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package collision
import (
"errors"

"github.com/oakmound/oak/v2/event"
"github.com/oakmound/oak/v3/event"
)

// A Phase is a struct that other structs who want to use PhaseCollision
Expand Down
2 changes: 1 addition & 1 deletion collision/onCollision_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"
"time"

"github.com/oakmound/oak/v2/event"
"github.com/oakmound/oak/v3/event"
)

type cphase struct {
Expand Down
2 changes: 1 addition & 1 deletion collision/point.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package collision

import "github.com/oakmound/oak/v2/alg/floatgeom"
import "github.com/oakmound/oak/v3/alg/floatgeom"

// A Point is a specific point where
// collision occurred and a zone to identify
Expand Down
4 changes: 2 additions & 2 deletions collision/ray/castFilter.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package ray

import (
"github.com/oakmound/oak/v2/collision"
"github.com/oakmound/oak/v2/event"
"github.com/oakmound/oak/v3/collision"
"github.com/oakmound/oak/v3/event"
)

// A CastFilter is a function that can be applied to a Caster
Expand Down
4 changes: 2 additions & 2 deletions collision/ray/castLimit.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package ray

import (
"github.com/oakmound/oak/v2/collision"
"github.com/oakmound/oak/v2/event"
"github.com/oakmound/oak/v3/collision"
"github.com/oakmound/oak/v3/event"
)

// A CastLimit is a function that can be applied to
Expand Down
4 changes: 2 additions & 2 deletions collision/ray/caster.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package ray
import (
"math"

"github.com/oakmound/oak/v2/alg/floatgeom"
"github.com/oakmound/oak/v2/collision"
"github.com/oakmound/oak/v3/alg/floatgeom"
"github.com/oakmound/oak/v3/collision"
)

var (
Expand Down
4 changes: 2 additions & 2 deletions collision/ray/caster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"reflect"
"testing"

"github.com/oakmound/oak/v2/alg/floatgeom"
"github.com/oakmound/oak/v2/collision"
"github.com/oakmound/oak/v3/alg/floatgeom"
"github.com/oakmound/oak/v3/collision"
)

func TestCasterScene(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions collision/ray/coneCaster.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package ray

import (
"github.com/oakmound/oak/v2/alg"
"github.com/oakmound/oak/v2/alg/floatgeom"
"github.com/oakmound/oak/v2/collision"
"github.com/oakmound/oak/v3/alg"
"github.com/oakmound/oak/v3/alg/floatgeom"
"github.com/oakmound/oak/v3/collision"
)

var (
Expand Down
6 changes: 3 additions & 3 deletions collision/ray/coneCaster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"testing"
"time"

"github.com/oakmound/oak/v2/alg"
"github.com/oakmound/oak/v2/alg/floatgeom"
"github.com/oakmound/oak/v2/collision"
"github.com/oakmound/oak/v3/alg"
"github.com/oakmound/oak/v3/alg/floatgeom"
"github.com/oakmound/oak/v3/collision"
)

func TestConeCasterSettings(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions collision/ray/raycast_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package ray
import (
"testing"

"github.com/oakmound/oak/v2/alg/floatgeom"
"github.com/oakmound/oak/v2/alg/range/floatrange"
"github.com/oakmound/oak/v2/collision"
"github.com/oakmound/oak/v3/alg/floatgeom"
"github.com/oakmound/oak/v3/alg/range/floatrange"
"github.com/oakmound/oak/v3/collision"
)

func TestEmptyRaycasts(t *testing.T) {
Expand Down
Loading

0 comments on commit 3bf0f7e

Please sign in to comment.