graphic

package
v0.0.0-...-84a1979 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2020 License: GPL-3.0 Imports: 4 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 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) Render

func (graphic Graphic) Render()

Render renders the information from the graphic object to the screen

func (Graphic) RunOutput

func (graphic Graphic) RunOutput(FPS uint32, running *bool)

RunOutput will render FPS frames every second until running is false

type Instance

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

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

func (*Instance) NewPosition

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

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

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.Point) *list.Element

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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