yoru

package module
v0.0.0-...-3a585db Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2025 License: MIT Imports: 24 Imported by: 0

README

Yoru - Adventure game framework for Ebitengine

GoDoc Donate

Framework for creating Ebitengine adventure games.

Note: Breaking changes will be made until v1.0 is released. Here be dragons.

Features

  • Manage project resources using the yoru development tool
  • Preview changes to image assets instantly without restarting

Documentation

Index

Constants

This section is empty.

Variables

View Source
var G = newGame()
View Source
var GV = G.V

Functions

func Debug

func Debug() bool

func SetDebug

func SetDebug(debug bool)

func SetPlayer

func SetPlayer(s *Sprite)

func SetProject

func SetProject(p *Project)

func SetRoom

func SetRoom(r *Room, loc *image.Point)

func SetViewport

func SetViewport(width int, height int)

Types

type Frame

type Frame struct {
	Image        *Image
	FlipH, FlipV bool             `json:",omitempty"`
	Rect         *image.Rectangle `json:",omitempty"`
	// contains filtered or unexported fields
}

func NewFrame

func NewFrame(img *Image) *Frame

func (*Frame) MarshalJSON

func (f *Frame) MarshalJSON() ([]byte, error)

func (*Frame) SetHFlip

func (f *Frame) SetHFlip(hFlip bool)

func (*Frame) SetSubImage

func (f *Frame) SetSubImage(r image.Rectangle)

func (*Frame) SetVFlip

func (f *Frame) SetVFlip(vFlip bool)

func (*Frame) UnmarshalJSON

func (f *Frame) UnmarshalJSON(buf []byte) error

type Image

type Image struct {
	Image *ebiten.Image
	// contains filtered or unexported fields
}

func LoadImage

func LoadImage(fs fs.FS, filePath string) (*Image, error)

func NewImage

func NewImage(img *ebiten.Image) (*Image, error)

func (*Image) MarshalJSON

func (i *Image) MarshalJSON() ([]byte, error)

type Project

type Project struct {
	Name    string
	About   string
	Author  string
	Website string
	Width   int
	Height  int
	TPS     int

	Images  map[string]*Image  `json:"-"`
	Frames  map[string]*Frame  `json:"-"`
	Sprites map[string]*Sprite `json:"-"`
	Rooms   map[string]*Room   `json:"-"`
	// contains filtered or unexported fields
}

Project represents all metadata and assets related to a game.

func LoadProject

func LoadProject(fileSystem fs.FS, fileName string, localDir string) (*Project, error)

func (*Project) Load

func (p *Project) Load(fileSystem fs.FS) error

func (*Project) LoadImage

func (p *Project) LoadImage(path string) (*Image, error)

func (*Project) NewFrame

func (p *Project) NewFrame(name string, img *Image) *Frame

func (*Project) NewRoom

func (p *Project) NewRoom(name string) *Room

func (*Project) NewSprite

func (p *Project) NewSprite(name string, f *Frame) *Sprite

func (*Project) Save

func (p *Project) Save(path string) error

func (*Project) SetLocalDir

func (p *Project) SetLocalDir(dir string)

type Room

type Room struct {
	BGColor  color.RGBA `json:",omitempty"` // Background color.
	BGSprite *Sprite    `json:",omitempty"` // Background sprite.
	Sprites  []*Sprite  `json:",omitempty"`
	Spawn    *image.Point
	// contains filtered or unexported fields
}

func NewRoom

func NewRoom() *Room

func (*Room) Draw

func (r *Room) Draw(screen *ebiten.Image) error

func (*Room) MarshalJSON

func (r *Room) MarshalJSON() ([]byte, error)

func (*Room) Name

func (r *Room) Name() string

func (*Room) UnmarshalJSON

func (r *Room) UnmarshalJSON(buf []byte) error

type Sprite

type Sprite struct {
	Name string `json:"-"`
	X, Y int

	Original *Frame

	Animations []SpriteAnimation
	// contains filtered or unexported fields
}

func NewSprite

func NewSprite(f *Frame) *Sprite

func (*Sprite) Draw

func (s *Sprite) Draw(target *ebiten.Image)

func (*Sprite) MarshalJSON

func (s *Sprite) MarshalJSON() ([]byte, error)

func (*Sprite) SetAnimation

func (s *Sprite) SetAnimation(a string)

func (*Sprite) SetAnimations

func (s *Sprite) SetAnimations(a []SpriteAnimation)

func (*Sprite) UnmarshalJSON

func (s *Sprite) UnmarshalJSON(buf []byte) error

func (*Sprite) Update

func (s *Sprite) Update()

type SpriteAnimation

type SpriteAnimation struct {
	Name   string
	Frames []*Frame
}

func NewSpriteAnimation

func NewSpriteAnimation(name string) SpriteAnimation

type Viewport

type Viewport struct {
	*etk.Box
	// contains filtered or unexported fields
}

func NewViewport

func NewViewport() *Viewport

func (*Viewport) Draw

func (v *Viewport) Draw(screen *ebiten.Image) error

func (*Viewport) Focus

func (v *Viewport) Focus() bool

Focus returns the focus state of the widget.

func (*Viewport) Room

func (v *Viewport) Room() *Room

func (*Viewport) SetFocus

func (v *Viewport) SetFocus(focus bool) bool

SetFocus sets the focus state of the widget.

func (*Viewport) SetRoom

func (v *Viewport) SetRoom(room *Room)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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