shapes

package
v0.0.0-...-fe76f8b Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const ANIMATION_ATTACK = 2
View Source
const ANIMATION_MOVE = 0

some pre-defined animations

View Source
const ANIMATION_STAND = 1
View Source
const MAX_SHAPES_PER_IMG = 0x100

Variables

View Source
var AnimationNames map[string]int = map[string]int{
	"move":   ANIMATION_MOVE,
	"stand":  ANIMATION_STAND,
	"attack": ANIMATION_ATTACK,
}

but more can be added

View Source
var Cursors []CursorDef
View Source
var DIR_E = Direction(4)
View Source
var DIR_N = Direction(6)
View Source
var DIR_NE = Direction(5)
View Source
var DIR_NONE = Direction(8)
View Source
var DIR_NW = Direction(7)
View Source
var DIR_S = Direction(2)
View Source
var DIR_SE = Direction(3)
View Source
var DIR_SW = Direction(1)
View Source
var DIR_W = Direction(0)
View Source
var Directions = map[string]Direction{
	"w":  DIR_W,
	"sw": DIR_SW,
	"s":  DIR_S,
	"se": DIR_SE,
	"e":  DIR_E,
	"ne": DIR_NE,
	"n":  DIR_N,
	"nw": DIR_NW,
	"":   DIR_NONE,
}
View Source
var FilteredShapes []*Shape
View Source
var Images []*ImageInfo
View Source
var Names map[string]int = map[string]int{}
View Source
var Shapes []*Shape
View Source
var UiImages map[string]image.Image = map[string]image.Image{}

Functions

func Filter

func Filter(query string) bool

func InitCreatures

func InitCreatures(gameDir string, data []map[string]interface{}, screenResolution, pixelResolution [2]int, debug util.DebugLog) error

func InitShapes

func InitShapes(gameDir string, data []map[string]interface{}, screenResolution, pixelResolution [2]int, debug util.DebugLog) error

Types

type Animation

type Animation struct {
	Name  string
	Steps int
	Tex   map[Direction][]*TextureCoords
}

type CursorDef

type CursorDef struct {
	Name               string
	HotspotX, HotspotY int
}

type Direction

type Direction int

func GetDir

func GetDir(dx, dy int) Direction

func GetDirScreen

func GetDirScreen(dx, dy float64) Direction

func (Direction) GetDelta

func (dir Direction) GetDelta() (int, int)

type Edge

type Edge struct {
	Shapes []*Shape
}

type ImageInfo

type ImageInfo struct {
	Image     image.Image
	MagFilter int32
}

type Shape

type Shape struct {
	Index          int
	Name           string
	Description    string
	Group          int
	Thumb, Image   image.Image
	Size           [3]float32
	Tex            *TextureCoords
	Fudge          float32
	AlphaMin       float32
	ImageIndex     int
	ShapeMeta      *ShapeMeta
	Edges          map[string]map[string][]*Shape
	Offset         [3]float32
	EditorVisible  bool
	Animations     map[int]*Animation
	VertexShader   string
	FragmentShader string
	Support        bool
	SupportPos     [][]bool
	IsExtra        bool
	IsDraggable    bool
	IsInteractive  bool
	IsSaved        bool
	Scale          [3]float64
	Adjust         [2]float32
	Light          bool
	LightZ         float32
	IgnoreLight    bool
	Marker         bool

	OnHide int

	AnimatedShapes []*Shape
	Transparent    bool
	VariantOf      string
	VariantWeight  float32
	Variants       []*Shape
	ExtraZ         float32
	// contains filtered or unexported fields
}

func (*Shape) GetEdge

func (shape *Shape) GetEdge(shapeName, edgeName string) *Shape

func (*Shape) GetVariant

func (shape *Shape) GetVariant() int

get this shapes' variant using a weighted random distribution

func (*Shape) HasEdges

func (shape *Shape) HasEdges(shapeName string) bool

func (*Shape) Traverse

func (shape *Shape) Traverse(fx func(x, y, z int) bool)

type ShapeMeta

type ShapeMeta struct {
	DpiMultiplier float32
	UnitPixels    [2]int
}

type TextureCoords

type TextureCoords struct {
	PixelOffset [2]float32
	PixelDim    [2]float32
	TexOffset   [2]float32
	TexDim      [2]float32
}

func NewTextureCoords

func NewTextureCoords(imageBounds image.Rectangle, px, py, pw, ph float32) *TextureCoords

Jump to

Keyboard shortcuts

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