raylibengine

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: Apache-2.0 Imports: 7 Imported by: 1

README

raylib-engine

Raylib Go back end to communicate with via events.

Events are metadata about what images to load and render, wehre to render them, what audio to play ane so on. No actual image or audio data is passed from the front end to the raylib engine so that the engine may use its own image and audio types for rendering and playing.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEngine

func NewEngine() lib.Engine

func NewRenderTransaction

func NewRenderTransaction(drawEvent bus.DrawEvent, textEvent bus.TextEvent, mediaCache MediaCache, previousTexture *rl.Texture2D) renderData

Types

type MediaCache

type MediaCache interface {
	CacheImages(event bus.DrawLayersEvent)
	CacheFonts(event lib.Font)
	GetImage(img string) *rl.Image
	GetFont(fontName string) *rl.Font
	GetAudio(fileName string) *rl.Sound
}

func NewMediaCache

func NewMediaCache() MediaCache

type MediaCacheData

type MediaCacheData struct {
	// contains filtered or unexported fields
}

func (*MediaCacheData) CacheFonts

func (c *MediaCacheData) CacheFonts(evt lib.Font)

func (*MediaCacheData) CacheImages

func (c *MediaCacheData) CacheImages(evt bus.DrawLayersEvent)

func (*MediaCacheData) GetAudio

func (c *MediaCacheData) GetAudio(fileName string) *rl.Sound

func (*MediaCacheData) GetFont

func (c *MediaCacheData) GetFont(fontName string) *rl.Font

func (*MediaCacheData) GetImage

func (c *MediaCacheData) GetImage(img string) *rl.Image

type RaylibPeerController

type RaylibPeerController interface {
	bus.DrawEventListener
	bus.AudioEventListener
	bus.TextEventListener
	bus.KeysRegistrationEventListener
	bus.ControlEventListener
	MediaCache
	GetControlEvents() []bus.ControlEvent
	GetDrawEvent() bus.DrawEvent
	GetAudioEvent() bus.AudioEvent //One event at at time...
	GetTextEvent() bus.TextEvent
	GetKeysRegistrationEvent() bus.KeysRegistrationEvent
}

func NewRaylibPeerController

func NewRaylibPeerController() RaylibPeerController

The peer raylibPeerController is to mediate any impedance mismatch between the tight single threaded loop of the Raylib engine and the concurrent mechanisms of Golang. Note: Raylib is very fast but very intolerant of mutations on any data it is using. So the peer and MediaCache can keep off thread data for rendering, listening and sending. Raylib loop will query this raylibPeerController for data it needs.

type RenderPipelineData

type RenderPipelineData struct {
	// contains filtered or unexported fields
}

func (*RenderPipelineData) Add

func (r *RenderPipelineData) Add(function renderingPipelineFunction) RendererPipeline

func (*RenderPipelineData) Execute

func (r *RenderPipelineData) Execute(transaction *renderData)

type RenderTransaction

type RenderTransaction interface {
	GetDrawEvent() bus.DrawEvent
	SetDrawEvent(event bus.DrawEvent)
	GetTextEvent() bus.TextEvent
	SetTextEvent(evt bus.TextEvent)
	GetMediaCache() MediaCache
	SetMediaCache(MediaCache)
	GetRenderImage() *rl.Image
	SetRenderImage(*rl.Image) //Mot used currently but will be in future instead of cache.
	SetRenderTexture(*rl.Texture2D)
	GetRenderTexture() *rl.Texture2D
	SetPreviousTexture(*rl.Texture2D)
	GetPreviousTexture() *rl.Texture2D
}

TODO Revamp this

type RendererPipeline

type RendererPipeline interface {
	Add(function renderingPipelineFunction) RendererPipeline
	Execute(transaction *renderData)
}

func NewRendererPipeline

func NewRendererPipeline() RendererPipeline

Jump to

Keyboard shortcuts

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