graphic

package
v0.0.0-...-e981eed Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package graphic is using the sdl2 go interface from (c)https://github.com/veandco/go-sdl2/ under the BSD 3 License

Package graphic is using the sdl2 go interface from (c)https://github.com/veandco/go-sdl2/ under the BSD 3 License

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Element

type Element struct {
	Value *Instance
	// contains filtered or unexported fields
}

Element of list only instance*

func (*Element) Next

func (element *Element) Next() *Element

Next returns element previous to self

func (*Element) Prev

func (element *Element) Prev() *Element

Prev returns element previous to self

type Graphic

type Graphic struct {
	Sprites  []Sprite
	Renderer *sdl.Renderer
	// contains filtered or unexported fields
}

Graphic contains the information required to render a window with diffrent Sprites

func New

func New(title string, x, y, width, heigh int32, WindowFlags, RendererFlags uint32) (Graphic, error)

New returns a Graphic object with initialized renderer and window note that Sprites have to be added manual

func (*Graphic) AddSprite

func (graphic *Graphic) AddSprite(imgPath string, srcRect sdl.Rect) (uint32, error)

AddSprite adds another sprite which can be used be creating a instance of it see Sprite.NewInstance

func (*Graphic) Print

func (graphic *Graphic) Print()

Print info about every sprite and instance

func (*Graphic) RenderBoard

func (graphic *Graphic) RenderBoard()

RenderBoard renders the information from the graphic object to the screen

func (*Graphic) RenderStack

func (graphic *Graphic) RenderStack(instances []Instance)

RenderStack renders one stack of cards

func (*Graphic) SetCardSpaces

func (graphic *Graphic) SetCardSpaces(rects []sdl.Rect)

SetCardSpaces set the rectangle for card spaces

type Instance

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

Instance position angle and the center of an instance of a sprite

func (Instance) GetBaseHeight

func (instance Instance) GetBaseHeight() float32

GetBaseHeight returns the height of an unzommed instance

func (Instance) GetBaseWitdth

func (instance Instance) GetBaseWitdth() float32

GetBaseWitdth returns the width of an unzommed instance

func (*Instance) Hide

func (instance *Instance) Hide()

Hide makes the instance invisible until Show

func (*Instance) IsHidden

func (instance *Instance) IsHidden() bool

IsHidden returns if an instance is hidden

func (*Instance) IsZoomed

func (instance *Instance) IsZoomed() bool

IsZoomed returns if an instance is zommed in

func (*Instance) NewPosition

func (instance *Instance) NewPosition(center sdl.FPoint)

NewPosition sets the position of this instance center is the center of the instances new position

func (*Instance) NewPositionCorner

func (instance *Instance) NewPositionCorner(corner sdl.FPoint)

NewPositionCorner sets the top left corner of the instance to corner

func (*Instance) ResetZoom

func (instance *Instance) ResetZoom()

ResetZoom dRect.W, dRect.H is reset to default values

func (*Instance) SetAngle

func (instance *Instance) SetAngle(angle float64)

SetAngle setter for instance.angle

func (*Instance) Show

func (instance *Instance) Show()

Show makes the instance visible

func (*Instance) Zoom

func (instance *Instance) Zoom(multiplier float32)

Zoom changes the texture size by textureSize*multiplier does not work if the object is hidden could have weird artifacts at small texture sizes

type List

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

List double linked list which can only store instances

func (*List) First

func (list *List) First() *Element

First Element in list

func (*List) Push

func (list *List) Push(value *Instance) *Element

Push adds an element at the front of the list

type Sprite

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

Sprite contains the texture a list of instances and a srcRect

func NewSprite

func NewSprite(renderer *sdl.Renderer, imgPath string, srcRect sdl.Rect) (Sprite, error)

NewSprite creates a sprite based on a renderer, the image path and a src rectangle

func (*Sprite) NewInstance

func (sprite *Sprite) NewInstance(angle float64, center sdl.FPoint) *Instance

NewInstance adds a instance to the sprite and initializes the width and height of the dest rectangle with the src rectangle

func (*Sprite) ShowInstance

func (sprite *Sprite) ShowInstance(instance *Instance)

ShowInstance makes instance visible

Jump to

Keyboard shortcuts

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