entity

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2021 License: BSD-3-Clause, MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Color

type Color struct {
	Red   uint8
	Green uint8
	Blue  uint8

	sync.Mutex
}

Color data

type DrawableInformation

type DrawableInformation struct {
	// Width of image
	Width uint32
	// Height of image
	Height uint32

	// IsFlipped image flipped horizontally ?
	IsFlipped bool

	// TextureData about image
	TextureData *data.TextureData

	// FontData about text
	FontData *data.FontData

	// Color modifier
	Color *Color

	// Text name of object, or simple UI text in the screen
	Text *Text
}

DrawableInformation asset data

type Position

type Position struct {
	// X coordinate on the screen
	X int32
	// Y coordinate on the screen
	Y int32

	sync.Mutex
}

Position in screen

type SceneObject

type SceneObject interface {
	// OnUpdate event called on each tick to update state
	// Make actual data updates for object here
	OnUpdate()

	// GetDrawableInformation about object
	GetDrawableInformation() *DrawableInformation
	// GetPosition in the scene
	GetPosition() *Position
}

SceneObject interface represents as actor in the scene, can be anything

type StaticObject

type StaticObject struct {
	Position            *Position
	DrawableInformation *DrawableInformation
}

StaticObject not movable, not intractable just image on screen

func NewStaticObject

func NewStaticObject(position *Position, drawableInformation *DrawableInformation) *StaticObject

NewStaticObject simple static object, can image, can be building

func (*StaticObject) GetDrawableInformation

func (s *StaticObject) GetDrawableInformation() *DrawableInformation

GetDrawableInformation about object

func (*StaticObject) GetPosition

func (s *StaticObject) GetPosition() *Position

GetPosition in the scene

func (*StaticObject) OnUpdate

func (s *StaticObject) OnUpdate()

OnUpdate will do nothing, it's static object

type Text

type Text struct {
	TextToPrint string

	sync.Mutex
}

Text in scene screen

type TextObject

type TextObject struct {
	Position            *Position
	DrawableInformation *DrawableInformation
	// contains filtered or unexported fields
}

TextObject simple letter object

func NewTextObject

func NewTextObject(position *Position, font *data.FontData, color *Color) *TextObject

NewTextObject to show in scene

func (*TextObject) GetDrawableInformation

func (t *TextObject) GetDrawableInformation() *DrawableInformation

GetDrawableInformation about object

func (*TextObject) GetPosition

func (t *TextObject) GetPosition() *Position

GetPosition in the scene

func (*TextObject) OnUpdate

func (t *TextObject) OnUpdate()

OnUpdate update text

func (*TextObject) SetTextField

func (t *TextObject) SetTextField(textField string)

SetTextField of object

Jump to

Keyboard shortcuts

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