view

package
v0.0.0-...-53be003 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const WINDOW_TITLE string = "Learning Go/SDL"
View Source
const WINDOW_WIDTH, WINDOW_HEIGHT int32 = 800, 600

Variables

This section is empty.

Functions

This section is empty.

Types

type Button

type Button struct {
	Coord
	Rect
	Text        string
	BgColor     RGBA
	BorderColor RGBA
	TextColor   RGBA
	OnClick     func(event events.Event, args ...interface{}) error
}

type Coord

type Coord struct {
	X int32
	Y int32
}

type Display

type Display interface {
	Init() error
	DrawText(text string, pos Coord, color RGBA, hJust Just, vJust Just) error
	DrawRect(pos Coord, size Rect, bgColor RGBA, fgColor RGBA) error
	DrawButton(button Button) error
	DisplayImage(image Image, pos Coord) error
	Refresh()
	Clear() error
	Terminate() error
}

type Image

type Image interface {
	GetSize() Rect
	Close() error
}

type ImageLoader

type ImageLoader interface {
	Load(imagePath string, size Rect) (Image, error)
}

type Just

type Just int
const (
	LEFT Just = iota
	CENTER
	RIGHT
	TOP
	MIDDLE
	BOTTOM
)

type RGBA

type RGBA struct {
	R uint8
	G uint8
	B uint8
	A uint8
}

type Rect

type Rect struct {
	W int32
	H int32
}

type SdlDisplay

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

func NewSdlDisplay

func NewSdlDisplay(fontPath string) *SdlDisplay

func (*SdlDisplay) Clear

func (display *SdlDisplay) Clear() error

func (*SdlDisplay) DisplayImage

func (display *SdlDisplay) DisplayImage(image Image, pos Coord) error

func (*SdlDisplay) DrawButton

func (display *SdlDisplay) DrawButton(button Button) error

func (*SdlDisplay) DrawRect

func (display *SdlDisplay) DrawRect(pos Coord, size Rect, bgColor RGBA, fgColor RGBA) error

func (*SdlDisplay) DrawText

func (display *SdlDisplay) DrawText(text string, pos Coord, color RGBA, hJust Just, vJust Just) error

func (*SdlDisplay) Init

func (display *SdlDisplay) Init() error

func (*SdlDisplay) Refresh

func (display *SdlDisplay) Refresh()

func (*SdlDisplay) Terminate

func (display *SdlDisplay) Terminate() error

type SdlImage

type SdlImage struct {
	Image   *sdl.Surface
	Texture *sdl.Texture
	// contains filtered or unexported fields
}

func (*SdlImage) Close

func (image *SdlImage) Close() error

func (*SdlImage) GetSize

func (image *SdlImage) GetSize() Rect

type SdlImageLoader

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

func CreateSdlImageLoader

func CreateSdlImageLoader(resourcesBasePath string) (SdlImageLoader, error)

func (SdlImageLoader) Load

func (imageLoader SdlImageLoader) Load(imagePath string, size Rect) (Image, error)

Jump to

Keyboard shortcuts

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