interfaces

package
v0.0.0-...-f73b11a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CollFunc

type CollFunc func(coll CollisionEvent) error

type CollisionEvent

type CollisionEvent struct {
	GameBase IGameBase
	OtherRB  IRigidbody
	Tags     *ctags.CTags
}

type FontOptions

type FontOptions struct {
	FontColor color.Color
	FontSize  float64
	DPI       float64
}

type IBgColor

type IBgColor interface {
	SetBgColor(clr color.Color)
	GetBgColor() color.Color
}

type ICamera

type ICamera interface {
	GetTransform() ITransform
	GetViewRange() float64
	SetViewRange(viewRange float64)
	GetResolutionWidth() int
	GetResolutionHeight() int
	GetResolutionVector() *vector2.Vector2
	SetResolution(width int, height int)
	SetResolutionWidth(width int)
	SetResolutionHeight(height int)
	GetOffset() *vector2.Vector2
	SetOffset(offset *vector2.Vector2)
	GetID() string
}

type ICollider

type ICollider interface {
	SetSizeScalar(ss *vector2.Vector2)
	GetSizeScalar() *vector2.Vector2
	GetSprite() ISprite
	GetPolygon() *collision2d.Polygon
	GetCTags() *ctags.CTags
	GetID() string
}

type IGOMap

type IGOMap interface {
	// Must be called before all the operations.
	SetupGame(gameBase IGameBase)
	// Tries to get the game object by given name.
	Get(name string) (i interface{}, ok bool)
	// Registers a new game object. If Awake() function implemented,
	// it will be called. This will be applied to all the components
	// of the game object.
	Register(name string, gameObject interface{}) error
	// Unregisters the game object. If Destroy() function implemented,
	// it will be called. This will be applied to all the components
	// of the game object.
	Unregister(name string) error
	// Calls Update(), PhysUpdate() functions.
	Update() error
	// Calls Draw(), DrawUI() functions, previously sorts it by
	// priority.
	Draw(screen *ebiten.Image) error
	// One-time function, that must be called from Scene.Enter()
	// only once. Starts all the queued startables, that implements
	// StartableQueued interface.
	StartQueuedStartables() error
	// Unregisters all the game objects.
	UnregisterAll() error
}

Not full implementation of the GOMap interface.

type IGameBase

type IGameBase interface {
	SetScene(s IScene) error
	GetCurrentScene() IScene
	Update() error
	Draw(screen *ebiten.Image)
	Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int)
	Run(windowSizeX int, windowSizeY int, title string) error
	RunAsMobile()
}

type IRigidbody

type IRigidbody interface {
	GetTransform() ITransform
	GetColliders() []ICollider
	SetColliders(colliders []ICollider)
	GetMass() float64
	SetMass(mass float64)
	GetCurrentVelocity() *vector2.Vector2
	SetCurrentVelocity(velocity *vector2.Vector2)
	OnCollision(ocf CollFunc)
	ExitCollision(ecf CollFunc)
	Activate(gb IGameBase)
	Deactivate(gb IGameBase)
	GetID() string // Implement goi.Component
}

type IScene

type IScene interface {
	Enter() error
	Exit() error
	SetEnterF(enterF SceneF)
	SetExitF(exitF SceneF)
	SetMainCamera(cam ICamera) error
	GetMainCamera() ICamera
	GetGOMap() IGOMap

	SetCurrentRigidbodies([]IRigidbody)
	GetCurrentRigidbodies() []IRigidbody
}

type ISprite

type ISprite interface {
	GetTransform() ITransform
	GetImage() *ebiten.Image
	SetImage(image *ebiten.Image)
	GetOptions() ISpriteOptions
	SetOptions(opts ISpriteOptions)
	GetPivot() *vector2.Vector2
	GetPivotOpposite() *vector2.Vector2
	GetPivotScaled() *vector2.Vector2
	GetPivotOppositeScaled() *vector2.Vector2
	SetPivot(pivot *vector2.Vector2)
	GetImageSize() *vector2.Vector2
	GetBoudingBox() (bbA, bbB *vector2.Vector2)
	GetID() string
}

type ISpriteOptions

type ISpriteOptions interface {
	IsVisible() bool
	SetVisible(v bool)
	SetColor(c color.Color)
	GetColor() color.Color
}

type ITileMap

type ITileMap[T any] interface {
	GetTransform() ITransform
	PlaceTile(localX, localY int, localRot, localLayer float64, tile T) ITransform
	RemoveTile(localX, localY int, localLayer float64) bool
}

type ITransform

type ITransform interface {
	SetPosition(pos *vector2.Vector2)
	SetScale(scale *vector2.Vector2)
	SetRotation(rot float64)
	SetLayer(layer float64)
	SetParent(parent ITransform)

	GetPosition() *vector2.Vector2
	GetScale() *vector2.Vector2
	GetRotation() float64
	GetLayer() float64
	GetParent() ITransform
}

type IUIButton

type IUIButton interface {
	OnClick(onClickF UIButtonClickF)
	ExitClick(exitClickF UIButtonClickF)
	OnHover(onHover UIButtonHoverF)
	ExitHover(exitHover UIButtonHoverF)
	GetID() string
}

type IUIText

type IUIText interface {
	GetFontFace() font.Face
	SetColor(fontColor color.Color)
	SetDPI(dpi float64) error
	SetSize(fontSize float64) error
	GetOptions() *FontOptions
	SetOptions(fontOptions *FontOptions) error
}

type SceneF

type SceneF func(scene IScene) error

type UIButtonClickEvent

type UIButtonClickEvent struct {
	GameBase    IGameBase
	Button      IUIButton
	MouseButton ebiten.MouseButton
}

type UIButtonClickF

type UIButtonClickF func(e UIButtonClickEvent) error

type UIButtonHoverEvent

type UIButtonHoverEvent struct {
	GameBase IGameBase
	Button   IUIButton
}

type UIButtonHoverF

type UIButtonHoverF func(e UIButtonHoverEvent) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL