sdlscreen

package
v0.0.0-...-c4bb79f Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2019 License: BSD-3-Clause Imports: 4 Imported by: 10

Documentation

Overview

Package sdlscreen implements a Displayer interface as required by tilegraphics and outputs using SDL2.

This package does not use SDL2 entirely correctly, nor is it really intended for serious use. It is mainly useful for testing the tilegraphics package without constantly reflashing a microcontroller.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Screen

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

Screen is a window implemented using SDL2 that can be drawn to.

func NewScreen

func NewScreen(name string, width, height int16) (*Screen, error)

NewScreen creates a new window with the given width and height.

func (*Screen) Close

func (s *Screen) Close() error

Close closes the window.

func (*Screen) Display

func (s *Screen) Display() error

Display updates the window surface. This is necessary to actually write to the screen what was drawn using FillRectangle, for example.

func (*Screen) FillRectangle

func (s *Screen) FillRectangle(x, y, width, height int16, c color.RGBA) error

FillRectangle fills the given rectangle with the given color, and returns an error if something went wrong.

func (*Screen) FillRectangleWithBuffer

func (s *Screen) FillRectangleWithBuffer(x, y, width, height int16, buffer []color.RGBA) error

FillRectangleWithBuffer fills the given rectangle with a slice of colors. The buffer must be in row major order.

func (*Screen) FillScreen

func (s *Screen) FillScreen(c color.RGBA) error

FillScreen sets the whole screen to the given color.

func (*Screen) SetPixel

func (s *Screen) SetPixel(x, y int16, c color.RGBA)

SetPixel sets the pixel at the given coordinates to the given color. Setting a pixel out of bounds is allowed: it won't do anything. An error may be returned if setting the pixel failed.

func (*Screen) Size

func (s *Screen) Size() (int16, int16)

Size returns the window content size.

Jump to

Keyboard shortcuts

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