components

package
v1.37.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Components

type Components struct {
	Game interface{}
}

Components contains engine and game components

func InitComponents

func InitComponents(manager *ecs.Manager, gameComponents interface{}) *Components

InitComponents initializes components

type DepthNum added in v1.37.0

type DepthNum int

オブジェクトの描画順。小さい値を先に描画する

const (
	DepthNumFloor  DepthNum = iota // 床
	DepthNumRug                    // 床に置くもの。例: ワープホール、アイテム
	DepthNumTaller                 // 高さのあるもの。例: 操作対象エンティティ、敵シンボル、壁
)

type Sprite

type Sprite struct {
	// Horizontal position of the sprite in the sprite sheet
	X int
	// Vertical position of the sprite in the sprite sheet
	Y int
	// Width of the sprite
	Width int
	// Height of the sprite
	Height int
}

スプライトは1つ1つの意味をなす画像の位置を示す情報 1ファイルに対して複数のスプライトが定義されている

type SpriteRender

type SpriteRender struct {
	// スプライトシートファイル
	SpriteSheet *SpriteSheet
	// スプライトシートでのインデックス
	SpriteNumber int
	// 描画順。小さい順に先に(下に)描画する
	Depth DepthNum
	// Draw options
	Options ebiten.DrawImageOptions
}

SpriteRender component

type SpriteSheet

type SpriteSheet struct {
	// Texture image
	Texture Texture `toml:"texture_image"`
	// List of sprites
	Sprites []Sprite
}

画像ファイルであるテクスチャと、その位置ごとの解釈であるスプライトのマッピング

type Texture

type Texture struct {
	// Texture image
	Image *ebiten.Image
}

複数のスプライトが格納された画像ファイル

func (*Texture) UnmarshalText

func (t *Texture) UnmarshalText(text []byte) error

UnmarshalText fills structure fields from text data

Jump to

Keyboard shortcuts

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