Documentation ¶
Index ¶
- Variables
- type Drawer
- type RGBA
- type RectOpts
- type Sdl2Draw
- func (s *Sdl2Draw) Background(rgba RGBA) error
- func (s *Sdl2Draw) ColorRect(x, y, w, h int32, rgba RGBA) error
- func (s *Sdl2Draw) LoadResources(fontsPath, texturesPath string) (func() error, error)
- func (s *Sdl2Draw) Present(f func() error) error
- func (s Sdl2Draw) ScreenHeight() int32
- func (s Sdl2Draw) ScreenWidth() int32
- func (s *Sdl2Draw) SetMainFont(fontFileName string) error
- func (s *Sdl2Draw) Text(txt string, opts TextOpts) (erro error)
- func (s *Sdl2Draw) TextureRect(x, y, w, h int32, texture string) error
- type TextAlign
- type TextOpts
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ColorGreen rgba green color ColorGreen = RGBA{R: 34, G: 139, B: 34, A: 10} // ColorWhite rgba white color ColorWhite = RGBA{R: 255, G: 255, B: 255, A: 255} // ColorBlack rgba black color ColorBlack = RGBA{R: 0, G: 0, B: 0, A: 0} )
Functions ¶
This section is empty.
Types ¶
type Drawer ¶
type Drawer interface { // Background draws the whole background to the given RGBA color Background(rgba RGBA) error // Text writes given text with given options to the window Text(txt string, opts TextOpts) error // ColorRect draw rectangle with the given color ColorRect(x, y, w, h int32, rgba RGBA) error // TextureRect draw rectangle with the given texture file name TextureRect(x, y, w, h int32, texture string) error // Present draws everything into the window Present(f func() error) error // LoadResources loads fonts and textures of the given path LoadResources(fontsPath, texturesPath string) (func() error, error) // SetMainFont Set default font, if someone will use Text function the Main font will be used SetMainFont(fontFileName string) error // ScreenHeight returns the height of screen in pixels ScreenHeight() int32 // ScreenWidth returns the width of screen in pixels ScreenWidth() int32 }
Drawer an engine who can draw on window
type Sdl2Draw ¶
type Sdl2Draw struct {
// contains filtered or unexported fields
}
Sdl2Draw adapter for sdl2 go bindings
func NewSdl2Draw ¶
NewSdl2Draw creates new sdl2draw drawer
func (*Sdl2Draw) Background ¶
Background draws whole background of sdl2 window to the given rgba color
func (*Sdl2Draw) ColorRect ¶
ColorRect draws into sdl2 window given color rectangle in the given coordinates
func (*Sdl2Draw) LoadResources ¶
LoadResources load resources of fonts and textures given path
func (Sdl2Draw) ScreenHeight ¶
ScreenHeight returns the height in pixels of the sdl2 created screen
func (Sdl2Draw) ScreenWidth ¶
ScreenWidth returns the width in pixels of the sdl2 created screen
func (*Sdl2Draw) SetMainFont ¶
SetMainFont sets the default font for all text
Click to show internal directories.
Click to hide internal directories.