miniscruff / igloo Goto Github PK
View Code? Open in Web Editor NEWGame Framework wrapper around Ebiten
Home Page: https://pkg.go.dev/github.com/miniscruff/igloo
License: MIT License
Game Framework wrapper around Ebiten
Home Page: https://pkg.go.dev/github.com/miniscruff/igloo
License: MIT License
Ebiten has a run game interface, implement our base game struct for scene loading, updating, and drawing.
Add Remove(tickerImp) to Ticker
add top-left to transform, to help with is in view checks to account for when anchor is not (0,0)
Totally skipped these when writing it all... whoops
Creating blank images of a specific color requires two methods, and as it can be nice for tests it could be helpful as a util method.
Currently transform is limited to position and rotation. This is only part of what a 2D object consists of and therefore lots of code is duplicated between the label and sprite types.
Instead our transforms should be everything related to our bounds including width, height, anchors and also building the geom for ebiten.
Build a content type called nine slices with sides instead of borders.
Then a graphics type called nine slices for rendering
Be able to bounce a tween back and forth with manual events.
Should be able to create a vec2 directly from 2 ints
Currently our scenes will have a list of assets we load at the start, then dispose of when we exit the scene. It also means we have to carry around any assets to structs as we need to dispose of them later.
Instead a content manager that wraps the loading and unloading will simplify this process.
State management that uses the event system to swap from one state to another, the system would then be able to change or do whatever it needed to do.
For example:
type DoorState string
const (
OpenDoor DoorState = "open"
ClosedDoor = "closed"
)
type Door struct {
sprite *Sprite
transform *Transform
playerTransform *Transform
fsm *FSM[DoorState]
}
func (d *DoorEntity) Update() {
sqrDist := d.transform.Position().SqrDist(d.playerTransform.Position())
inRange := sqrDist < config.DoorRange * config.DoorRange
if inRange {
d.fsm.Transition(OpenDoor)
} else {
d.fsm.Transition(ClosedDoor)
}
}
func (d *DoorEntity) Draw(dest *ebiten.Image, camera Camera) {
d.sprite.Draw(dest, camera)
}
func NewDoor(sprite *Sprite, playerTransform *PlayerTransform) *Door {
fsm := NewFSM[DoorState](
Closed, // start state
FSMTransition(OpenDoor, []DoorState{ClosedDoor}),
FSMTransition(ClosedDoor, []DoorState{OpenDoor}),
)
fsm.OnTransition(OpenDoor, func() {
d.tween.Bounce()
})
fsm.OnTransition(CloseDoor, func() {
d.tween.Bounce()
})
return &Door{
sprite: sprite,
transform: sprite.Transform,
playerTransform: playerTransform,
fsm: fsm,
}
}
Currently the ticker will start anything that is added to the ticker. This does not give us the option to pause anything on start for tweens or timers. Therefore, we should not auto start tickers for greater control.
Currently we use a position, width and height but that is the same as a bounds. And we can utilize any bounds functions as we need to.
Everything should be in a "per tick" amount not time. Also do some cleanup and tests of the tween system.
TickRunner: Runs all the tickers, part of scene context
Ticker: Single ticker with events
Tween: a type of ticker
Timer: another type of ticker
Game needs a "get active context" sort of function so we can get the active tick runner to add to
Tickers will no longer auto-start but we may want to have our tweens play immediately after creating them, so an option to do so will be good.
Using go generics create a little event system. See my own implementation of an event store: https://gotipplay.golang.org/p/oA6C8MFWPAx
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.