Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
167 commits
Select commit Hold shift + click to select a range
9410fc5
event: overhaul api
200sc Mar 12, 2022
71c28e1
oak: use new event paradigms in key, mouse, joystick, and oak
200sc Mar 19, 2022
1279c49
oak: go mod tidy
200sc Mar 19, 2022
872db9b
Merge remote-tracking branch 'origin' into feature/v4-events
200sc Mar 19, 2022
94f50c9
oak: rename CID to CallerID globally, fix render, collision for new e…
200sc Mar 19, 2022
2708f5c
audio/pcm: drop writer js
200sc Mar 19, 2022
7eefe21
event: move two three event type system:
200sc Mar 22, 2022
64f2052
scene: remove loop
200sc Mar 22, 2022
f5d5052
entities: convert to event v4
200sc Mar 22, 2022
e5facb6
event: add unbind all helper, fix ticker and bindable list logic
200sc Mar 22, 2022
38bef9d
examples: Update a few examples without dependencies to have the new …
Implausiblyfun Mar 26, 2022
480e791
event: Update Bindable signature for better error messages
Implausiblyfun Mar 26, 2022
02e311e
oak: fix main package tests for event package changes
200sc Mar 26, 2022
be4ed76
Merge branch 'feature/v4-events' of github.com:oakmound/oak into feat…
200sc Mar 26, 2022
751ef09
shiny/driver: move driver level window manipulation to concrete types
200sc Mar 26, 2022
7d75b18
collision: update tests for new event api
200sc Mar 26, 2022
82ac457
scene: update tests for new event api
200sc Mar 26, 2022
c973759
render: correct tests for new event api
200sc Mar 26, 2022
daa0ded
mouse: correct tests for new event api
200sc Mar 26, 2022
f983f31
scene: Embed Eventhandler to allow for some embedded calls
Implausiblyfun Mar 26, 2022
6602149
event: rename CallerMap.Reset to Clear, enabling embedding via scene.…
200sc Mar 26, 2022
7f35da3
Merge pull request #197 from oakmound/poc/v4-eventhandler-rename
200sc Mar 28, 2022
747702d
entities/x: adjust to compile with event api v4
200sc Mar 28, 2022
d8f60a0
event: adjust docs
200sc Mar 29, 2022
382dded
event: add tests for trigger
200sc Mar 30, 2022
91ef924
event: add most tests, further trim down API, ensure concurrent-safe use
200sc Mar 31, 2022
ea990b1
event: restore 100% test coverage
200sc Mar 31, 2022
9d98d49
render/particle: Source CallerID ordering fix + Start adding non-defa…
Implausiblyfun Apr 2, 2022
d0fba73
key: Pull in more mobile key info into oak for cleaner calling signat…
Implausiblyfun Apr 2, 2022
494c9e1
debugtools\inputviz: Updates for the new key and cid changes
Implausiblyfun Apr 2, 2022
780a1fb
entities: Moving works as expected post event refactor
Implausiblyfun Apr 2, 2022
133cfba
examples: Fixes for CID changes and key changes
Implausiblyfun Apr 2, 2022
710c770
oak: drop background smear todo, correct key usage docs
200sc Apr 2, 2022
3ea313c
entities: Fixes new solids that dont have a cid passed in sharing col…
Implausiblyfun Apr 2, 2022
ac0771a
examples: Update more examples to the new event paradigm
Implausiblyfun Apr 2, 2022
9e93421
key: use Code types everywhere
200sc Apr 2, 2022
dbeccbe
Merge branch 'feature/v4-eventskeys+examples' of github.com:oakmound/…
200sc Apr 2, 2022
9ed6791
examples/titlescreen-demo: use new key / events
200sc Apr 2, 2022
24d9dd1
examples\platformer: Change for strs
Implausiblyfun Apr 2, 2022
435da4e
examples\sprite: str changes
Implausiblyfun Apr 2, 2022
d9b3e4b
examples/top-down-shooter-tutorial: finish fixing for new events and …
200sc Apr 2, 2022
112a5a7
Merge branch 'feature/v4-events-tests' into feature/v4-eventskeys+exa…
200sc Apr 2, 2022
862f50f
Merge branch 'feature/v4-eventskeys+examples' of github.com:oakmound/…
200sc Apr 2, 2022
4dfa4ce
examples/slides: Update for new event format
Implausiblyfun Apr 2, 2022
8ed5338
.github: Update workflows for go 1.18
Implausiblyfun Apr 2, 2022
e27b187
Merge pull request #199 from oakmound/feature/v4-eventskeys+examples
Implausiblyfun Apr 2, 2022
8c9ca67
examples: remove event.NoPayload usages
200sc Apr 2, 2022
8dd2b59
event: add SetCID to Caller, stop returning CIDs from Register
200sc Apr 2, 2022
419b016
Revert "event: add SetCID to Caller, stop returning CIDs from Register"
200sc Apr 2, 2022
fc32cea
Merge pull request #196 from oakmound/feature/v4-events
200sc Apr 2, 2022
cd17a15
Merge branch 'release/v4.0.0' into feature/v4-drivers
200sc Apr 3, 2022
8ed39ef
event: return directional channels from handler methods
200sc Apr 3, 2022
4a7b2d4
shiny/driver/mtldriver: add rgba->bgra conversion for m1s
200sc Apr 3, 2022
fe108d0
shiny/driver/mtldriver: switch bgra behavior by intel vs arm
200sc Apr 3, 2022
38f3cc4
shiny/driver/mtldriver: fix compilation of intel color variant
200sc Apr 3, 2022
a4a90d7
Merge branch 'release/v4.0.0' into feature/v4-drivers
200sc Apr 3, 2022
2f6b4c2
shiny/driver/mtldriver: match new window interface
200sc Apr 3, 2022
f4d1e79
shiny/driver/internal/win32: add build tags to cursor file
200sc Apr 3, 2022
e08046a
examples/screenopts: add title and notification buttons
200sc Apr 3, 2022
14d444c
event: correct dlog version
200sc Apr 3, 2022
43ea47c
shiny/driver: replace Tray methods with SetIcon
200sc Apr 4, 2022
9929aeb
shiny/driver/x11driver: add SetTitle
200sc Apr 4, 2022
a345bdd
shiny/driver/x11driver: add SetIcon
200sc Apr 4, 2022
2fd1ed1
shiny/driver/x11driver: add SetTopMost
200sc Apr 4, 2022
b16533d
shiny/driver/x11driver: add HideCursor
200sc Apr 4, 2022
e0e1717
shiny/driver/x11driver: fix for new window interface
200sc Apr 4, 2022
cffab97
shiny/driver/internal/win32: fix integer casting on window create
200sc Apr 4, 2022
547f1b3
shiny/driver/mtldriver: fill in implementation for SetIcon
200sc Apr 4, 2022
2422ab3
oak: bump dependencies
200sc Apr 4, 2022
e4255e3
examples/piano: fix synth switching
200sc Apr 4, 2022
f5dcd0b
examples: go mod tidy
200sc Apr 4, 2022
b471cdb
window: split window into App and Window to explicitly delineate sing…
200sc Apr 4, 2022
a2fc858
oak: add nooswindow build tags for app / window separation
200sc Apr 4, 2022
5259a84
shiny/screen: drop most draw methods from window
200sc Apr 4, 2022
a4bafb1
shiny/screen: drop PublishResult
200sc Apr 4, 2022
ad19967
audio: combine audio and pcm libraries
200sc Apr 5, 2022
32bee02
audio: add work in progress alsa driver option
200sc Apr 5, 2022
fdf9eef
audio: add detuning and fading
200sc Apr 5, 2022
73beaca
audio/synth: add noise generator
200sc Apr 5, 2022
5682f7c
audio: refine interface to reduce clipping on windows
200sc Apr 6, 2022
7ffde6f
audio/sequence: strip package of functionality until we re-evaulate i…
200sc Apr 6, 2022
77ae8ee
oak: go mod tidy
200sc Apr 6, 2022
d520dc5
Merge branch 'feature/v4-drivers' into feature/v4-entities
200sc Apr 6, 2022
3040b1f
entities: overhaul api
200sc Apr 6, 2022
af8c0de
examples/pong: rewrite for entities v4
200sc Apr 6, 2022
a919230
examples/collision-demo: rewrite for entities v4
200sc Apr 6, 2022
cf7de23
scene: embed DrawStack into Context
200sc Apr 6, 2022
3e72c2e
examples: rewrite for entities v4
200sc Apr 6, 2022
c98331b
shake: move shake to a non-x package
200sc Apr 6, 2022
d1a17eb
render/mod: integrate x/mods
200sc Apr 6, 2022
6fc8903
audio/sequnce: drop package (for now)
200sc Apr 6, 2022
7afb62f
entities/x/stat: drop package
200sc Apr 6, 2022
d1e9e29
entities: default entities to be drawn
200sc Apr 6, 2022
70e5c71
audio/synth: add wave combination
200sc Apr 8, 2022
d4aa34e
audio/synth: add pitch detection support
200sc Apr 8, 2022
0c97c2d
shake: Move shake out of X state. It is not tightly coupled to any ot…
Implausiblyfun Apr 9, 2022
2776f05
examples\collision-demo: Add temp sub demo for shaking.
Implausiblyfun Apr 9, 2022
54192ee
shake: Move shake out of X state. It is not tightly coupled to any ot…
Implausiblyfun Apr 9, 2022
7059925
examples/text-demos: Folderize the 2 text demos
Implausiblyfun Apr 9, 2022
b646f08
examples: Add READMEs where there were already images
Implausiblyfun Apr 9, 2022
7bf0edb
oak: provide package documentation comments to subpackages
200sc Apr 9, 2022
392dfd9
audio/synth: improve accuracy of pitch rounding
200sc Apr 9, 2022
2a74236
shiny: remove gesture, SendFirst
200sc Apr 9, 2022
1261fd3
go mod tidy
200sc Apr 9, 2022
6a524d3
examples/clipboard: remove mobile key import
200sc Apr 9, 2022
2844e45
oak: support nested examples in test_examples.sh
200sc Apr 9, 2022
e45e1f0
entities/x/btn: rewrite to use entities.Entity internally
200sc Apr 9, 2022
fc0af5c
examples/clipboard: go mod tidy
200sc Apr 9, 2022
df732e5
Merge pull request #202 from oakmound/feature/v4-shaker+examples
200sc Apr 9, 2022
eeb19dc
window: move viewport manipulation methods to App
200sc Apr 9, 2022
db98274
audio: fix comments
200sc Apr 9, 2022
625f93f
Merge pull request #198 from oakmound/feature/v4-drivers
200sc Apr 9, 2022
889cf83
Merge branch 'release/v4.0.0' into feature/v4-audio
200sc Apr 9, 2022
6228748
examples/clipboard: go mod tidy
200sc Apr 9, 2022
225ad13
Merge pull request #201 from oakmound/feature/v4-audio
200sc Apr 9, 2022
ad5fe60
Merge branch 'feature/v4-audio' into feature/v4-entities
200sc Apr 9, 2022
1521a42
entities/x/btn/grid: follow new entities API
200sc Apr 10, 2022
21c4487
examples/collision-demo: integrate screen shake into single example
200sc Apr 10, 2022
50a9b61
,github/workflows: add linux and windows example runners
200sc Apr 10, 2022
65c0b6c
.github/workflows: specify bash shell use on windows
200sc Apr 10, 2022
7feb7f1
shiny/driver: remove unused monitor size calculations
200sc Apr 11, 2022
5b15bea
oak: remove target width and target height
200sc Apr 11, 2022
8e1add8
oak: move and expand package doc
200sc Apr 11, 2022
cd80bcb
oak: update event docs
200sc Apr 11, 2022
06f3511
oak: update package documentation
200sc Apr 11, 2022
8168fee
Merge pull request #203 from oakmound/feature/v4-entities
200sc Apr 12, 2022
e6fb3e2
oak: rename window 'screen' methods to 'viewport'
200sc Apr 16, 2022
3788531
examples: adjust for new viewport / window bounds signatures
200sc Apr 16, 2022
6ec8ab7
window: document methods
200sc Apr 16, 2022
e12e9ed
timing: combine doc file into fps.go
200sc Apr 16, 2022
40c7eac
audio/format: make importing file format parsers optional
200sc Apr 16, 2022
870815e
examples/text-demos: reduce speed of color changing
200sc Apr 16, 2022
300b87a
audio: doc pass
200sc Apr 16, 2022
68c6324
render: enable not importing image loaders and gift via build flags
200sc Apr 16, 2022
3007222
scene: add DoEachFrame helper method
200sc Apr 16, 2022
4f0c09c
alg/range: overhaul to alg/span with generics
200sc Apr 17, 2022
2ab2563
scene: embed key state into context
200sc Apr 17, 2022
b512f3f
entities: remove keystate from TopDown checks
200sc Apr 17, 2022
a3bf684
oak: add span to test coverage script
200sc Apr 17, 2022
863a876
examples/slide: use floating point spans
200sc Apr 17, 2022
5b31b05
examples: rename EnforceRange to Clamp
200sc Apr 17, 2022
f1ebdf3
fileutil: expand test coverage
200sc Apr 17, 2022
f625c00
mouse: add coverage for new event converters
200sc Apr 17, 2022
32f3d91
alg/intgeom: test span methods for rects
200sc Apr 17, 2022
bea9363
oak: update core package tests
200sc Apr 17, 2022
a205f35
examples/slide/show: replace usage of GetBackgroundImage
200sc Apr 17, 2022
a58e0ee
render: add font test coverage
200sc Apr 17, 2022
fe8c1c6
render: expand test coverage
200sc Apr 17, 2022
8e93c59
oak: add driver config setting coverage
200sc Apr 17, 2022
c32fae7
oak: add mouse propagastion stoppage test
200sc Apr 17, 2022
53c2f79
oak: expand general test coverage
200sc Apr 18, 2022
e69d5df
examples/bezier: remove point.X() and point.Y()
200sc Apr 18, 2022
3c73dd9
event: add persistent binding methods to Handler
200sc Apr 23, 2022
21f1006
oak: bump v3 -> v4
200sc Apr 23, 2022
121dabc
examples: bump to oak v4
200sc Apr 23, 2022
8607bae
Merge pull request #204 from oakmound/feature/v4-docs-and-tests
200sc Apr 23, 2022
0e8102f
examples: remove, combine, and update examples in general
200sc May 1, 2022
9f592f1
README: Update some of the iconography
Implausiblyfun May 10, 2022
8c8e5f0
retidy and update tidy script
200sc May 21, 2022
ce6d9b4
Update readme example links for piano and flappy bird
200sc May 21, 2022
ba70b4a
audio: code review updates
200sc May 21, 2022
ef797e8
README: Update the readme to have a few more points added
Implausiblyfun May 21, 2022
ba8c6a0
Merge pull request #206 from oakmound/feature/v4-examples-readme-bump
Implausiblyfun May 21, 2022
d02801f
Merge pull request #205 from oakmound/feature/v4-examples
200sc May 21, 2022
c746211
Merge branch 'master' into release/v4.0.0
200sc May 21, 2022
d24e386
examples/top-down-shooter: fix set viewport logic
200sc May 21, 2022
e4df7da
shiny/driver: remove unused imports
200sc May 21, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
55 changes: 49 additions & 6 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,58 @@
name: Go
on: [push]
jobs:
test-arm:
name: Test (arm)
test-windows-x64:
name: Test (windows amd64)
runs-on: [self-hosted, windows, x64]
steps:

- name: Set up Go 1.18
uses: actions/setup-go@v1
with:
go-version: 1.18
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v1

- name: Get dependencies
run: |
go get -v -t -d ./...

- name: Test
run: ./test_examples.sh
shell: bash

test-linux-arm:
name: Test (linux arm)
runs-on: [self-hosted, linux, ARM64]
steps:

- name: Set up Go 1.17
- name: Set up Go 1.18
uses: actions/setup-go@v1
with:
go-version: 1.18
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v1

- name: Get dependencies
run: |
go get -v -t -d ./...

- name: Test
run: ./test_examples.sh

test-linux-x64:
name: Test (linux x64)
runs-on: [self-hosted, linux, x64]
steps:

- name: Set up Go 1.18
uses: actions/setup-go@v1
with:
go-version: 1.17
go-version: 1.18
id: go

- name: Check out code into the Go module directory
Expand All @@ -27,10 +70,10 @@ jobs:
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.17
- name: Set up Go 1.18
uses: actions/setup-go@v1
with:
go-version: 1.17
go-version: 1.18
id: go

- name: Check out code into the Go module directory
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@
# Output of the go coverage tool, specifically when used with LiteIDE
*.out

coverage.txt
coverage.txt

# Workspace configuration
.vscode
47 changes: 24 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

## A Pure Go game engine

[![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)
[![Go Reference](https://pkg.go.dev/badge/github.com/oakmound/oak/v4.svg)](https://pkg.go.dev/github.com/oakmound/oak/v4)
[![Code Coverage](https://codecov.io/gh/oakmound/oak/branch/master/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)

## Table of Contents
Expand All @@ -24,14 +24,14 @@

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

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

## Features and Systems <a name="features"></a>

1. Window Management
- Windows and key events forked from [shiny](https://pkg.go.dev/golang.org/x/exp/shiny)
- Support for multiple windows running at the same time
1. [Image Rendering](https://pkg.go.dev/github.com/oakmound/oak/v3/render)
1. [Image Rendering](https://pkg.go.dev/github.com/oakmound/oak/v4/render)
- Manipulation
- `render.Modifiable` interface
- Integrated with optimized image manipulation via [gift](https://github.com/disintegration/gift)
Expand All @@ -40,22 +40,22 @@
- Primitive builders, `ColorBox`, `Line`, `Bezier`
- History-tracking `Reverting`
- Primarily 2D
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)
1. [Collision](https://pkg.go.dev/github.com/oakmound/oak/v3/collision)
1. [Particle System](https://pkg.go.dev/github.com/oakmound/oak/v4/render/particle)
1. [Mouse Handling](https://pkg.go.dev/github.com/oakmound/oak/v4/mouse)
1. [Joystick Support](https://pkg.go.dev/github.com/oakmound/oak/v4/joystick)
1. [Audio Support](https://pkg.go.dev/github.com/oakmound/oak/v4/audio)
1. [Collision](https://pkg.go.dev/github.com/oakmound/oak/v4/collision)
- Collision R-Tree forked from [rtreego](https://github.com/dhconnelly/rtreego)
- [2D Raycasting](https://pkg.go.dev/github.com/oakmound/oak/v3/collision/ray)
- [2D Raycasting](https://pkg.go.dev/github.com/oakmound/oak/v4/collision/ray)
- Collision Spaces
- Attachable to Objects
- Auto React to collisions through events
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)
1. [2D Physics System](https://pkg.go.dev/github.com/oakmound/oak/v4/physics)
1. [Event Handler](https://pkg.go.dev/github.com/oakmound/oak/v4/event)

## Support <a name="support"></a>

For discussions not significant enough to be an Issue or PR, feel free to ping us in the #oak channel on the [gophers slack](https://invite.slack.golangbridge.org/).
For discussions not significant enough to be an Issue or PR, feel free to ping us in the #oak channel on the [gophers slack](https://invite.slack.golangbridge.org/). For insight into what is happening in oak see the [blog](https://200sc.dev/).

## Quick Start <a name="quick-start"></a>

Expand All @@ -65,8 +65,8 @@ This is an example of the most basic oak program:
package main

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

func main() {
Expand All @@ -79,27 +79,28 @@ func main() {
}
```

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 tutorials and walkthroughs.
See below or navigate to the [examples](examples) folder for demos. For more examples and documentation checkout [godoc](https://pkg.go.dev/github.com/oakmound/oak/v4) for reference documentation, the [wiki](https://github.com/oakmound/oak/wiki), or our extended features in [grove](https://github.com/oakmound/grove).

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

| | | |
|:-------------------------:|:-------------------------:|:-------------------------:|
|<img width="1400" src="examples/platformer-tutorial/6-complete/example.gif" a=examples/platformer-tutorial> [Platformer](examples/platformer-tutorial) | <img width="1400" src="examples/top-down-shooter-tutorial/6-performance/example.gif"> [Top down shooter](examples/top-down-shooter-tutorial)|<img width="1400" src="examples/radar-demo/example.gif"> [Radar](examples/radar-demo) |
|<img width="1400" src="examples/slide/example.gif"> [Slideshow](examples/slide) | <img width="1400" src="examples/bezier/example.PNG"> [Bezier Curves](examples/bezier) |<img width="1400" src="examples/joystick-viz/example.gif"> [Joysticks](examples/joystick-viz)|
|<img width="1400" src="examples/collision-demo/example.PNG"> [Collision Demo](examples/collision-demo) | <img width="1400" src="examples/custom-cursor/example.PNG"> [Custom Mouse Cursor](examples/custom-cursor) |<img width="1400" src="examples/fallback-font/example.PNG"> [Fallback Fonts](examples/fallback-font)|
|<img width="1400" src="examples/screenopts/example.PNG"> [Screen Options](examples/screenopts) | <img width="1400" src="examples/multi-window/example.PNG"> [Multi Window](examples/multi-window) |<img width="1400" src="examples/particle-demo/overviewExample.gif"> [Particle Demo](examples/particle-demo)|
|<img width="1400" src="examples/platformer/example.gif" a=examples/platformer> [Platformer](examples/platformer) | <img width="1400" src="examples/top-down-shooter//example.gif"> [Top down shooter](examples/top-down-shooter)|<img width="1400" src="examples/flappy-bird//example.gif"> [Flappy Bird](examples/flappy-bird/)
| <img width="1400" src="examples/bezier/example.PNG"> [Bezier Curves](examples/bezier) |<img width="1400" src="examples/joystick-viz/example.gif"> [Joysticks](examples/joystick-viz)|<img width="1400" src="examples/piano/example.gif"> [Piano](examples/piano)|
|<img width="1400" src="examples/screenopts/example.PNG"> [Screen Options](examples/screenopts) | <img width="1400" src="examples/multi-window/example.PNG"> [Multi Window](examples/multi-window) |<img width="1400" src="examples/particle-demo/overviewExample.gif"> [Particles](examples/particle-demo)|

## Games using Oak <a name="finished-games"/>
## Games using Oak <a name="finished-games"></a>

To kick off a larger game project you can get started with [game-template](https://github.com/oakmound/game-template).

| | |
|:-------------------------:|:-------------------------:|
|<img width="1400" src="https://img.itch.zone/aW1hZ2UvMTk4MjIxLzkyNzUyOC5wbmc=/original/aRusLc.png" a=examples/platformer-tutorial> [Agent Blue](https://oakmound.itch.io/agent-blue) | <img width="1400" src="https://img.itch.zone/aW1hZ2UvMTY4NDk1Lzc4MDk1Mi5wbmc=/original/hIjzFm.png"> [Fantastic Doctor](https://github.com/oakmound/lowrez17)
|<img width="1400" src="https://img.itch.zone/aW1hZ2UvMzkwNjM5LzI2NzU0ODMucG5n/original/eaoFrd.png"> [Hiring Now: Looters](https://oakmound.itch.io/cheststacker) | <img width="1400" src="https://img.itch.zone/aW1hZ2UvMTYzNjgyLzc1NDkxOS5wbmc=/original/%2BwvZ7j.png"> [Jeremy The Clam](https://github.com/200sc/jeremy)
|<img width="1400" src="https://img.itch.zone/aW1hZ2UvOTE0MjYzLzUxNjg3NDEucG5n/original/5btfEr.png"> [Diamond Deck Championship](https://oakmound.itch.io/diamond-deck-championship) |
|<img width="1400" src="https://img.itch.zone/aW1hZ2UvOTE0MjYzLzUxNjg3NDEucG5n/original/5btfEr.png"> [Diamond Deck Championship](https://oakmound.itch.io/diamond-deck-championship) | <img width="1400" src="https://img.itch.zone/aW1nLzgzMDM5MjcucG5n/105x83%23/oA19CL.png"> [SokoPic](https://oakmound.itch.io/sokopic)

## On Pure Go <a name="pure-go"/>

Oak has recently brought in dependencies that include C code, but we still describe the engine as a Pure Go engine, which at face value seems contradictory. Oak's goal is that, by default, a user can pull down the engine and create a fully functional game or GUI application on a machine with no C compiler installed, so when we say Pure Go we mean that, by default, the library is configured so no C compilation is required, and that no major features are locked behind C compliation.

We anticipate in the immediate future needing to introduce alternate drivers that include C dependencies for performance improvements in some scenarios, and currently we have no OSX solution that lacks objective C code.
We anticipate in the immediate future needing to introduce alternate drivers that include C dependencies for performance improvements in some scasenarios, and currently we have no OSX solution that lacks objective C code.
2 changes: 1 addition & 1 deletion 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/v3/alg"
"github.com/oakmound/oak/v4/alg"
)

// Point2 represents a 2D point on a plane.
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/v3/alg"
"github.com/oakmound/oak/v4/alg"
)

func Seed() {
Expand Down
2 changes: 1 addition & 1 deletion alg/floatgeom/polygon.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package floatgeom

import (
"github.com/oakmound/oak/v3/alg"
"github.com/oakmound/oak/v4/alg"
)

// A Polygon2 is a series of points in 2D space.
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/v3/alg"
"github.com/oakmound/oak/v4/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/v3/alg"
"github.com/oakmound/oak/v4/alg"
)

func Seed() {
Expand Down
96 changes: 96 additions & 0 deletions alg/intgeom/rect.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
package intgeom

import (
"math/rand"

"github.com/oakmound/oak/v4/alg/span"
)

// A Rect2 represents a span from one point in 2D space to another.
// If Min is less than max on any axis, it will return undefined results
// for methods.
Expand Down Expand Up @@ -326,3 +332,93 @@ func (r Rect2) Intersects(r2 Rect2) bool {
return !((r2.Max.X() <= r.Min.X() || r.Max.X() <= r2.Min.X()) ||
(r2.Max.Y() <= r.Min.Y() || r.Max.Y() <= r2.Min.Y()))
}

// MulConst multiplies the boundary points of this rectangle by i.
func (r Rect2) MulConst(i int) Rect2 {
return Rect2{
r.Min.MulConst(i),
r.Max.MulConst(i),
}
}

// Poll returns a pseudorandom point from within this rectangle
func (r Rect2) Poll() Point2 {
return Point2{
r.Min.X() + int(rand.Float64()*float64(r.W())),
r.Min.Y() + int(rand.Float64()*float64(r.H())),
}
}

// Clamp returns a version of the provided point such that it is contained within r. If it was already contained in
// r, it will not be changed.
func (r Rect2) Clamp(pt Point2) Point2 {
for i := 0; i < r.MaxDimensions(); i++ {
if pt[i] < r.Min[i] {
pt[i] = r.Min[i]
} else if pt[i] > r.Max[i] {
pt[i] = r.Max[i]
}
}
return pt
}

// Percentile returns a point within this rectangle along the vector from the top left to the bottom right of the
// rectangle, where for example, 0.0 will be r.Min, 1.0 will be r.Max, and 2.0 will be project the vector beyond r
// and return r.Min + {r.W()*2, r.H()*2}
func (r Rect2) Percentile(f float64) Point2 {
return Point2{
r.Min.X() + int(f*float64(r.W())),
r.Min.Y() + int(f*float64(r.H())),
}
}

// MulSpan returns this rectangle as a Point2 Span after multiplying the boundary points of the rectangle by f.
func (r Rect2) MulSpan(f float64) span.Span[Point2] {
return r.MulConst(int(f))
}

// MulConst multiplies the boundary points of this rectangle by i.
func (r Rect3) MulConst(i int) Rect3 {
return Rect3{
r.Min.MulConst(i),
r.Max.MulConst(i),
}
}

// Poll returns a pseudorandom point from within this rectangle
func (r Rect3) Poll() Point3 {
return Point3{
r.Min.X() + int(rand.Float64()*float64(r.W())),
r.Min.Y() + int(rand.Float64()*float64(r.H())),
r.Min.Z() + int(rand.Float64()*float64(r.D())),
}
}

// Clamp returns a version of the provided point such that it is contained within r. If it was already contained in
// r, it will not be changed.
func (r Rect3) Clamp(pt Point3) Point3 {
for i := 0; i < r.MaxDimensions(); i++ {
if pt[i] < r.Min[i] {
pt[i] = r.Min[i]
} else if pt[i] > r.Max[i] {
pt[i] = r.Max[i]
}
}
return pt
}

// Percentile returns a point within this rectangle along the vector from the top left to the bottom right of the
// rectangle, where for example, 0.0 will be r.Min, 1.0 will be r.Max, and 2.0 will be project the vector beyond r
// and return r.Min + {r.W()*2, r.H()*2, r.D()*2}
func (r Rect3) Percentile(f float64) Point3 {
return Point3{
r.Min.X() + int(f*float64(r.W())),
r.Min.Y() + int(f*float64(r.H())),
r.Min.Z() + int(f*float64(r.D())),
}
}

// MulConst multiplies the boundary points of this rectangle by i.
func (r Rect3) MulSpan(f float64) span.Span[Point3] {
return r.MulConst(int(f))
}
Loading