Documentation ¶
Index ¶
- Constants
- Variables
- func NewScreen(w, h, rw, rh int32, n string, fs, vs, lf bool) (*Screen, *Layer, error)
- type Image
- type Layer
- func (l *Layer) Clear(c color.RGBA)
- func (l *Layer) DrawChar(s string, x, y, sc int32, c color.RGBA) error
- func (l *Layer) DrawCharFlip(s string, x, y, sc int32, c color.RGBA) error
- func (l *Layer) DrawCircleBorder(x, y int32, r float64, c color.RGBA)
- func (l *Layer) DrawCircleFill(x, y int32, r1, r2 float64, c color.RGBA)
- func (l *Layer) DrawLine(x, y, x2, y2 int32, c color.RGBA)
- func (l *Layer) DrawPoint(x, y int32, c color.RGBA)
- func (l *Layer) DrawRectBorder(x, y, w, h int32, c color.RGBA)
- func (l *Layer) DrawRectFill(x, y, w, h int32, c color.RGBA)
- func (l *Layer) DrawString(s string, x, y, sc int32, c color.RGBA) []error
- func (l *Layer) DrawStringFlip(s string, x, y, sc int32, c color.RGBA) []error
- func (l *Layer) FlipX()
- func (l *Layer) FlipY()
- func (l *Layer) Offset(x, y float64)
- func (l *Layer) ReadPoint(x, y int32) (color.RGBA, error)
- func (l *Layer) Rotate(r float64, p *sdl.Point)
- func (l *Layer) Scale(sx, sy float64)
- type Screen
Constants ¶
const ( //AlphaNone is no alpha blend for DrawPoint AlphaNone = iota //AlphaAdd is a basic add alpha for DrawPoint AlphaAdd )
Variables ¶
var ( //White color preset White color.RGBA //Silver color preset Silver color.RGBA //Gray color preset Gray color.RGBA //Black color preset Black color.RGBA //Red color preset Red color.RGBA //Maroon color preset Maroon color.RGBA //Orange color preset Orange color.RGBA //Yellow color preset Yellow color.RGBA //Olive color preset Olive color.RGBA //Lime color preset Lime color.RGBA //Green color preset Green color.RGBA //Aqua color preset Aqua color.RGBA //Teal color preset Teal color.RGBA //Blue color preset Blue color.RGBA Navy color.RGBA //Fuscia color preset Fuscia color.RGBA //Purple color preset Purple color.RGBA )
Functions ¶
func NewScreen ¶
NewScreen sets up package and returns a *Screen to manage the global state as well as a firs *Layer to draw to. Currently only supports a ARGB8888 colour space w, h are the dimensions of the layer you draw to rw, rh are the real dimensions of the window/screen (will scale screen) n is name of Window fs is fullscreen, vs is vSync and lf is linear filtering for screen scaling When quiting, call QuitScreen to close off all SDL assets.
Types ¶
type Layer ¶
type Layer struct { Memory []byte W, H int32 //Layer resolution A int //AlphaMode Scr *Screen Hide bool // contains filtered or unexported fields }
Layer contains a screen layer of info, a basic screen always has a 0 layer
func (*Layer) DrawCharFlip ¶ added in v0.0.3
DrawCharFlip renders character s to x, y scaled sc times with y 0 at bottom of screen
func (*Layer) DrawCircleBorder ¶
DrawCircleBorder makes circle of r radius at x, y using current working color
func (*Layer) DrawCircleFill ¶
DrawCircleFill fills a circle from r1 to r2 at x, y using current working color
func (*Layer) DrawLine ¶
DrawLine draws a line from x, y, to x2, y2 using current working color Code derived from examples given here: https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm
func (*Layer) DrawPoint ¶
DrawPoint sets a single point on the screen memory to current working color
func (*Layer) DrawRectBorder ¶
DrawRectBorder makes a w wide and h high rectangle, borders ony2 at x, y using current working color
func (*Layer) DrawRectFill ¶
DrawRectFill makees a w wide and h high rectangle at x, y using current working color
func (*Layer) DrawString ¶
DrawString renders string s to x, y scaled sc times
func (*Layer) DrawStringFlip ¶ added in v0.0.3
DrawStringFlip renders string s to x,y with y scaled sc times with y 0 at bottom of screen
func (*Layer) FlipX ¶ added in v0.0.3
func (l *Layer) FlipX()
FlipX flips layer x axis (0 is now right hand of screen)
func (*Layer) FlipY ¶ added in v0.0.3
func (l *Layer) FlipY()
FlipY flips layer y axis (0 is now bottom of screen)
type Screen ¶
type Screen struct { Layers []*Layer //Slice of screen layers W, H int32 //Screen resolution CharHeight, CharWidth int32 CharSpace, CharExclaim, CharDblQuote, CharHash, CharString, CharPercent, CharAmp, CharApostrophe, CharOpenBracketCurved, CharCloseBracketCurved, CharAsterisks, CharPlus, CharComma, CharMinus, CharPeriod, CharForwardSlash, Char0, Char1, Char2, Char3, Char4, Char5, Char6, Char7, Char8, Char9, CharColon, CharSemiColon, CharLessThan, CharEqual, CharGreaterThan, CharQuestion, CharAt, CharA, CharB, CharC, CharD, CharE, CharF, CharG, CharH, CharI, CharJ, CharK, CharL, CharM, CharN, CharO, CharP, CharQ, CharR, CharS, CharT, CharU, CharV, CharW, CharX, CharY, CharZ, CharOpenBracketSquare, CharBackSlash, CharCloseBracketSquare, CharCarrot, CharUnderScore, CharBackTick, Chara, Charb, Charc, Chard, Chare, Charf, Charg, Charh, Chari, Charj, Chark, Charl, Charm, Charn, Charo, Charp, Charq, Charr, Chars, Chart, Charu, Charv, Charw, Charx, Chary, Charz, CharOpenCurleyBrace, CharPipe, CharCloseCurleyBrace, CharTilde, CharNoChar string // contains filtered or unexported fields }
Screen manages the global state of go13h, and holds some useful info (ex character set) Screen also manages layer ordering and final rendering
func (*Screen) NewLayer ¶
NewLayer sets up and registers a new *Layer, note layers do not have to be the same width, height or texture filtering as other layers Layers can take up a lot of memory very easily, they take up their current working Memory, as well as the memory required for the backing texture ex: a 1920x1080 layer takes up 16Megabytes of RAM at minimum