-
Notifications
You must be signed in to change notification settings - Fork 84
Oak 3.0 Changelog
Patrick Stephen edited this page Oct 30, 2021
·
5 revisions
This document details all changes between oak v2.5.0 and oak v3.0.0.
- Throughout the project, tests have been expanded, and use of
github.com/stretchr/testify
has been removed. - Throughout the project, errors returned by packages are more regularly errors from the
oakerr
package. - Reduced verbosity of all packages. Unnecessary logs have been removed throughout the codebase
- Several functions which previously logged or ignored errors now return them.
- When a type, function, or variable was named
Def$
before, it is now namedDefault$
. - Utilities or types that were unused or trivial to implement have been removed.
- Global state variables have been adjusted so that they are used less often, and specifically less often without specifically invoking them or invoking package level functions instead of one's own created variables. They still exist, as in small examples or prototypes they are convenient, and some closer to the OS level are still always used and unexposed for user manipulation.
- The Gopkg.lock and Gopkg.toml files, used for dep, have been removed. Dep has been deprecated and archived.
Several of these new packages are former dependencies that were brought into oak. This was motivated by the number of additional steps it took to manage propagating bug fixes from within these dependencies back to oak. By moving them here, we remove needing to cut new releases of the dependencies and needing to update oak's go module files for the new version.
- New package, handling the interface between
scene
andoak.Window
.
- New package, contains common debug helper functions like rendering collision trees and printing mouse position.
- New package, a port of from
github.com/oakmound/shiny
. - Oak programs shouldn't need to directly interact with
shiny
other than to decide which driver to use, if not using the default. - Darwin, Linux, and Windows default drivers now at approximate feature parity.
- New package split from
oak/shake.go
, can generically shake screens and any entity that can be positioned.
- New package, a port of
github.com/200sc/go-dist
, representing ranges of colors, integers, and floats.
-
github.com/200sc/klangsynthese
has been ported here.
- Added
Config.IdleDrawFrameRate
, controlling how often the screen will redraw when it does not have focus. - Added the
Window
type, containing old package globals and enabling running multiple oak windows simultaneously. - Most public functions in the package are now methods on
Window
s, in addition to defaultoak.<Method>
helpers, which will redirect to a default window. - We now propagate the
event.FocusLoss
andevent.FocusGain
events on appropriate window changes. - Mouse events now trigger both an absolute and
Relative
event, the latter taking into account the viewport position. - Added
HideCursor
,ShowNotification
, andSetTrayIcon
window methods. - Added
UpdateViewSize
, to enable resizing the rectangle rendered within the client window. - Added
SkipRNGSeed
toConfig
, a setting which will skip callingmath/rand.Seed
if set. - Added
Window.DoBetweenDraws
, which will confine a function to be called in between screen draws.
-
Screen.Scale
is now afloat64
instead of anint
. -
SetBinaryPayload(func(...), func(...))
is nowSetFS(fs.FS)
. -
Config.EventRefreshRate
can now be properly unmarshaled from JSON. - Config creation and loading has been overhauled, using
NewConfig
and functional option loaders,FileConfig
andReaderConfig
- The draw loop has been substantially simplified.
- Backgrounds can now be any type that have
GetRGBA() *image.RGBA
, enabling complex or animating backgrounds. - Init now takes in a variadic set of
ConfigOption
s, so patterns that used tosetup config, then oak.Init(scene)
now will look likeoak.Init(scene, func() {setup config})
. - Key events now have a
key.Event
payload instead of astring
payload. -
Joystick
is nowInputTypeJoystick
. -
KeyboardMouse
is nowInputTypeKeyboardMouse
. -
trackInputChanges
now propagatesInputChange
events. - The engine will more reliably exit with a clean error if it cannot proceed during initialization.
-
Assets
no longer contains anAssetPath
or aFontPath
. - The
Font
config type has been removed. Non-default fonts must be manually loaded outside of a base oak config, with a full asset path. This change emphasizes the built in nature of the default font and the reality of font configuration that the color, dpi, and hinting of a font is not often customizable from an end user's perspective. -
Setup...
constants have been removed and folded into theConfig
struct. - Shiny gestures are no longer supported at the input loop layer, as they were fundamentally unused. This may be revisited.
- Keybindings have been removed as they did not cooperate well with other key refactoring. This will be revisited.
- Language constants have moved to
oakerr
. - SeedRNG is no longer public, and no longer logs excessively.
- Removed
Add
, preferringAddScene
. - Debug console functionality has been moved to
debugstream
. -
Shake
functionality has moved toentities/x/shake
.
- The
Cache
type has been introduced to handle file loading and caching. Several loading functions have changed to work with this new type and theDefaultCache
global variable. -
DefFont
has been renamed toDefaultFont
. -
DefPlay
has been renamed toDefaultPlay
. - Fixed a bug in blank audio loading where the provided "blank" audio was invalid PCM.
- The
FontManager
type has been removed. It was not frequently used and can be trivially introduced as a standalone package. - Channels, signals, and channel managers have been removed. They were tricky to use correctly and designed toward a specific game, not used by any games since.
-
GetSounds
has been removed.
- Added
PhaseCollisionWithBus
. - Added
Space.SetZLayer(float64)
.
-
DefTree
has been renamedDefaultTree
. -
Attach
now takes a*Tree
argument, and no longer binds to priority -1. -
PhaseCollision
now takes a single*Tree
which can benil
instead of a variadic set. -
NewTree
now takes no arguments and cannot error. The oldNewTree
with custom node sizes has been renamed toNewCustomTree
. - Fixed a bug where
With
would returnnil
spaces. - Moved
CallOnHits
to be a method on aTree
. -
ReactiveSpace
can now take in aTree
, and its methods are concurrent safe. -
CID
is nowIDTypeCID
. -
PID
is nowIDTypePID
.
-
NewEmptyReactiveSpace
has been removed. -
Space.String()
has been removed.
- Log strings used by oak are now exposed as constants in this package.
-
SetOutput
has been added, replacingFileWrite
andCreateLogFile
. - Exposed
DefaultLogger
, replacingSetLogger
.
-
SetDebugFilter
has been renamedSetFilter
. - Log filters are now generic functions:
func(string) bool
, instead of picking between regex matching andstrings.Contains
. - The
Logger
andFullLogger
interfaces are now combined. -
SetDebugLevel
has been renamedSetLogLevel
.
-
CreateLogFile
has been removed. -
Warn
has been removed. -
SetLogger
has been removed. -
Logger.GetLogLevel
has been removed. Its hard to imagine a scenario where you would want to query the current log level other than to update it to be more or less verbose-- just set the desired verbosity. -
FileWrite
has been removed.
- Added
TriggerCIDBack
. - Added the
Empty
helper, for when aBindable
does not care about its arguments or return value.
-
Enter
events now take anEnterPayload
, containing total frames, duration since last frame, and proportionally how that duration compares to the expected average tick duration. - event Buses now take a
CallerMap
reference. -
Bus.ResolvePending
has been renamed toBus.ResolveChanges
. - The global caller list is now represented by the
CallerMap
type. - Many methods that used to be optional in a
Handler
are now required. -
GlobalBind
andBind
now takestring, Bindable
as their argument order, formerlyBindable, string
. We feltBind(EventName, func(){})
read better, especially with larger functions. -
Bindable
s now acceptCID, interface{}
instead ofint, interface{}
.
- Event bindings in the built in bus no longer support priority levels, as they were virtually unused.
- The
Cache
type has been introduced to handle file loading and caching. Several loading functions have changed to work with this new type and theDefaultCache
global variable. -
Font
s can now be provided fallback fonts, which they will try to use to render characters that would be rendered as an undefined character - Added
ToSprite
toCompositeR
.
-
Font
s now more accurately determine which elements of a font are undefined runes, e.g. a kanji character in a roman alphabet font. -
Font
andFontGenerator
s have had their interface significantly adjusted to simplify creation and reduce accidental persistence of one font's qualities or pointer to secondary fonts. -
Font
s are now copied several times as they are passed around, to enforce that the same font is not used to draw two pieces of text at once, which can panic. -
Font.Generate
can now return an error. -
Text
s are now drawn from the top left, like all otherRenderable
s. - Batch loading has been rewritten. Alias json files are no longer supported. Individual file names can now hint to the batch loading system that they are a sheet with a particular sheet size, and this will supercede a hint coming from their containing directory. Directories and files now must end in explicitly %dx%d e.g.
window64x64.png
or/tiles32x32/
to be caught and automatically cached as sheets. - The
Polygon
type now usesfloatgeom.Polygon2
. -
OverlaySprites
takes a slice of pointers instead of structs. -
ShinyOverwrite
has been renamed toOverwriteImage
. -
ShinyDraw
has been renamed toDrawImage
. -
Stackable
s have been changed to an interface that can be externally used, by removing private methods. -
Stackable
s now have aClear
method. - FPS types are now
Renderable
s instead ofStackable
s. -
DefFont
is nowDefaultFont
. - DrawToScreen now accepts a *intgeom.Point2 for the viewport position.
-
NewStrText
is nowNewText
, the oldNewText
nowNewStringerText
.
-
Noisebox
has been removed. -
Scrollbox
has been removed. -
DrawOffset
onRenderable
s has been removed andDraw
has taken on its arguments (x and y offsets). -
Font.DrawString
has been privatized. -
ParseSubSprite
has been removed. -
LoadSprites
has been removed. -
SetFontDefaults
has been removed. -
LoadSpriteAndDraw
has been removed. -
ShinySet
has been removed. -
DrawForTime
has been removed (moved to a scene context method). - Draw polygons have been removed.
-
FontManager
has been removed. - Deprecated methods have been removed.
-
RemainingWeights
has been renamed toCumulativeWeights
, and the oldCumulativeWeights
function has been removed.
- Added the
Polygon2
type.
- Removed
String
methods from all entities.
- Added
Destroy
toBtn
. -
DisallowRevert
is now flipped toAllowRevert
. - Added the
Label(collision.Label)
option.
- Now accepts
*scene.Context
s.
- Adds the
Lighter
utility to return a lighter version of a color.
- Many new examples have been added and most existing examples have been adjusted.
- Removed the
cliffracers
example.
- This package has been stripped down to just be an exposed
FS fs.FS
, a couple configuration options, and theOpen
,ReadFile
, andReadDir
functions.
- Stick changes can be isolated to only propagate if they exceed a deadzone threshold.
- Added the
State
type, encompassing key down/up/held states.
- Added the
Binding
helper, converting a weakly typedinterface{}
payload into a*Event
type. -
DefTree
has been renamed toDefaultTree
. - Buttons are now strongly typed.
- Mouse bindings now accept a
*Event
instead of aEvent
. -
Event
now has aStopPropagation
boolean which, when set, will stop mouse collision spaces beneath the one triggered on from receiving the event. - Mouse gestures, unused, have been removed, for now.
- Errors now can be formatted to multiple languages.
- Several redundant error types have been removed.
- All
Vector
methods now modifyVector
s in place. (#115)
-
gift.Resampling
is now aliases as the localResampling
type.
- Added the
Allocator
type to contain particle allocation requests. - Allocators can now be stopped.
- Scene start functions now take in
(*scene.Context)
as their only argument, a new struct containing everything a scene should need to render, bind, modify the window, etc. - Added
DoAfter
,DoAfterContext
, andDrawForTime
toContext
.
-
FPSToDuration
has been renamed toFPSToFrameDelay
. - Added
FrameDelayToFPS
. - Removed
DynamicTicker
, the standard library*time.Ticker
type supports our use case for these since Go 1.15. - Removed
DoAfter
andDoAfterContext
, moved to scene package.