id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
30,700 | fogleman/gg | context.go | SetFillStyle | func (dc *Context) SetFillStyle(pattern Pattern) {
// if pattern is SolidPattern, also change dc.color(for dc.Clear, dc.drawString)
if fillStyle, ok := pattern.(*solidPattern); ok {
dc.color = fillStyle.color
}
dc.fillPattern = pattern
} | go | func (dc *Context) SetFillStyle(pattern Pattern) {
// if pattern is SolidPattern, also change dc.color(for dc.Clear, dc.drawString)
if fillStyle, ok := pattern.(*solidPattern); ok {
dc.color = fillStyle.color
}
dc.fillPattern = pattern
} | [
"func",
"(",
"dc",
"*",
"Context",
")",
"SetFillStyle",
"(",
"pattern",
"Pattern",
")",
"{",
"// if pattern is SolidPattern, also change dc.color(for dc.Clear, dc.drawString)",
"if",
"fillStyle",
",",
"ok",
":=",
"pattern",
".",
"(",
"*",
"solidPattern",
")",
";",
"... | // SetFillStyle sets current fill style | [
"SetFillStyle",
"sets",
"current",
"fill",
"style"
] | 72436a171bf31757dc87fb8fa9f7485307350307 | https://github.com/fogleman/gg/blob/72436a171bf31757dc87fb8fa9f7485307350307/context.go#L219-L225 |
30,701 | fogleman/gg | context.go | SetRGBA255 | func (dc *Context) SetRGBA255(r, g, b, a int) {
dc.color = color.NRGBA{uint8(r), uint8(g), uint8(b), uint8(a)}
dc.setFillAndStrokeColor(dc.color)
} | go | func (dc *Context) SetRGBA255(r, g, b, a int) {
dc.color = color.NRGBA{uint8(r), uint8(g), uint8(b), uint8(a)}
dc.setFillAndStrokeColor(dc.color)
} | [
"func",
"(",
"dc",
"*",
"Context",
")",
"SetRGBA255",
"(",
"r",
",",
"g",
",",
"b",
",",
"a",
"int",
")",
"{",
"dc",
".",
"color",
"=",
"color",
".",
"NRGBA",
"{",
"uint8",
"(",
"r",
")",
",",
"uint8",
"(",
"g",
")",
",",
"uint8",
"(",
"b",... | // SetRGBA255 sets the current color. r, g, b, a values should be between 0 and
// 255, inclusive. | [
"SetRGBA255",
"sets",
"the",
"current",
"color",
".",
"r",
"g",
"b",
"a",
"values",
"should",
"be",
"between",
"0",
"and",
"255",
"inclusive",
"."
] | 72436a171bf31757dc87fb8fa9f7485307350307 | https://github.com/fogleman/gg/blob/72436a171bf31757dc87fb8fa9f7485307350307/context.go#L247-L250 |
30,702 | fogleman/gg | context.go | SetRGBA | func (dc *Context) SetRGBA(r, g, b, a float64) {
dc.color = color.NRGBA{
uint8(r * 255),
uint8(g * 255),
uint8(b * 255),
uint8(a * 255),
}
dc.setFillAndStrokeColor(dc.color)
} | go | func (dc *Context) SetRGBA(r, g, b, a float64) {
dc.color = color.NRGBA{
uint8(r * 255),
uint8(g * 255),
uint8(b * 255),
uint8(a * 255),
}
dc.setFillAndStrokeColor(dc.color)
} | [
"func",
"(",
"dc",
"*",
"Context",
")",
"SetRGBA",
"(",
"r",
",",
"g",
",",
"b",
",",
"a",
"float64",
")",
"{",
"dc",
".",
"color",
"=",
"color",
".",
"NRGBA",
"{",
"uint8",
"(",
"r",
"*",
"255",
")",
",",
"uint8",
"(",
"g",
"*",
"255",
")"... | // SetRGBA sets the current color. r, g, b, a values should be between 0 and 1,
// inclusive. | [
"SetRGBA",
"sets",
"the",
"current",
"color",
".",
"r",
"g",
"b",
"a",
"values",
"should",
"be",
"between",
"0",
"and",
"1",
"inclusive",
"."
] | 72436a171bf31757dc87fb8fa9f7485307350307 | https://github.com/fogleman/gg/blob/72436a171bf31757dc87fb8fa9f7485307350307/context.go#L260-L268 |
30,703 | fogleman/gg | context.go | MoveTo | func (dc *Context) MoveTo(x, y float64) {
if dc.hasCurrent {
dc.fillPath.Add1(dc.start.Fixed())
}
x, y = dc.TransformPoint(x, y)
p := Point{x, y}
dc.strokePath.Start(p.Fixed())
dc.fillPath.Start(p.Fixed())
dc.start = p
dc.current = p
dc.hasCurrent = true
} | go | func (dc *Context) MoveTo(x, y float64) {
if dc.hasCurrent {
dc.fillPath.Add1(dc.start.Fixed())
}
x, y = dc.TransformPoint(x, y)
p := Point{x, y}
dc.strokePath.Start(p.Fixed())
dc.fillPath.Start(p.Fixed())
dc.start = p
dc.current = p
dc.hasCurrent = true
} | [
"func",
"(",
"dc",
"*",
"Context",
")",
"MoveTo",
"(",
"x",
",",
"y",
"float64",
")",
"{",
"if",
"dc",
".",
"hasCurrent",
"{",
"dc",
".",
"fillPath",
".",
"Add1",
"(",
"dc",
".",
"start",
".",
"Fixed",
"(",
")",
")",
"\n",
"}",
"\n",
"x",
","... | // Path Manipulation
// MoveTo starts a new subpath within the current path starting at the
// specified point. | [
"Path",
"Manipulation",
"MoveTo",
"starts",
"a",
"new",
"subpath",
"within",
"the",
"current",
"path",
"starting",
"at",
"the",
"specified",
"point",
"."
] | 72436a171bf31757dc87fb8fa9f7485307350307 | https://github.com/fogleman/gg/blob/72436a171bf31757dc87fb8fa9f7485307350307/context.go#L280-L291 |
30,704 | fogleman/gg | context.go | ClosePath | func (dc *Context) ClosePath() {
if dc.hasCurrent {
dc.strokePath.Add1(dc.start.Fixed())
dc.fillPath.Add1(dc.start.Fixed())
dc.current = dc.start
}
} | go | func (dc *Context) ClosePath() {
if dc.hasCurrent {
dc.strokePath.Add1(dc.start.Fixed())
dc.fillPath.Add1(dc.start.Fixed())
dc.current = dc.start
}
} | [
"func",
"(",
"dc",
"*",
"Context",
")",
"ClosePath",
"(",
")",
"{",
"if",
"dc",
".",
"hasCurrent",
"{",
"dc",
".",
"strokePath",
".",
"Add1",
"(",
"dc",
".",
"start",
".",
"Fixed",
"(",
")",
")",
"\n",
"dc",
".",
"fillPath",
".",
"Add1",
"(",
"... | // ClosePath adds a line segment from the current point to the beginning
// of the current subpath. If there is no current point, this is a no-op. | [
"ClosePath",
"adds",
"a",
"line",
"segment",
"from",
"the",
"current",
"point",
"to",
"the",
"beginning",
"of",
"the",
"current",
"subpath",
".",
"If",
"there",
"is",
"no",
"current",
"point",
"this",
"is",
"a",
"no",
"-",
"op",
"."
] | 72436a171bf31757dc87fb8fa9f7485307350307 | https://github.com/fogleman/gg/blob/72436a171bf31757dc87fb8fa9f7485307350307/context.go#L352-L358 |
30,705 | fogleman/gg | context.go | ClearPath | func (dc *Context) ClearPath() {
dc.strokePath.Clear()
dc.fillPath.Clear()
dc.hasCurrent = false
} | go | func (dc *Context) ClearPath() {
dc.strokePath.Clear()
dc.fillPath.Clear()
dc.hasCurrent = false
} | [
"func",
"(",
"dc",
"*",
"Context",
")",
"ClearPath",
"(",
")",
"{",
"dc",
".",
"strokePath",
".",
"Clear",
"(",
")",
"\n",
"dc",
".",
"fillPath",
".",
"Clear",
"(",
")",
"\n",
"dc",
".",
"hasCurrent",
"=",
"false",
"\n",
"}"
] | // ClearPath clears the current path. There is no current point after this
// operation. | [
"ClearPath",
"clears",
"the",
"current",
"path",
".",
"There",
"is",
"no",
"current",
"point",
"after",
"this",
"operation",
"."
] | 72436a171bf31757dc87fb8fa9f7485307350307 | https://github.com/fogleman/gg/blob/72436a171bf31757dc87fb8fa9f7485307350307/context.go#L362-L366 |
30,706 | fogleman/gg | context.go | NewSubPath | func (dc *Context) NewSubPath() {
if dc.hasCurrent {
dc.fillPath.Add1(dc.start.Fixed())
}
dc.hasCurrent = false
} | go | func (dc *Context) NewSubPath() {
if dc.hasCurrent {
dc.fillPath.Add1(dc.start.Fixed())
}
dc.hasCurrent = false
} | [
"func",
"(",
"dc",
"*",
"Context",
")",
"NewSubPath",
"(",
")",
"{",
"if",
"dc",
".",
"hasCurrent",
"{",
"dc",
".",
"fillPath",
".",
"Add1",
"(",
"dc",
".",
"start",
".",
"Fixed",
"(",
")",
")",
"\n",
"}",
"\n",
"dc",
".",
"hasCurrent",
"=",
"f... | // NewSubPath starts a new subpath within the current path. There is no current
// point after this operation. | [
"NewSubPath",
"starts",
"a",
"new",
"subpath",
"within",
"the",
"current",
"path",
".",
"There",
"is",
"no",
"current",
"point",
"after",
"this",
"operation",
"."
] | 72436a171bf31757dc87fb8fa9f7485307350307 | https://github.com/fogleman/gg/blob/72436a171bf31757dc87fb8fa9f7485307350307/context.go#L370-L375 |
30,707 | fogleman/gg | context.go | StrokePreserve | func (dc *Context) StrokePreserve() {
var painter raster.Painter
if dc.mask == nil {
if pattern, ok := dc.strokePattern.(*solidPattern); ok {
// with a nil mask and a solid color pattern, we can be more efficient
// TODO: refactor so we don't have to do this type assertion stuff?
p := raster.NewRGBAPainter... | go | func (dc *Context) StrokePreserve() {
var painter raster.Painter
if dc.mask == nil {
if pattern, ok := dc.strokePattern.(*solidPattern); ok {
// with a nil mask and a solid color pattern, we can be more efficient
// TODO: refactor so we don't have to do this type assertion stuff?
p := raster.NewRGBAPainter... | [
"func",
"(",
"dc",
"*",
"Context",
")",
"StrokePreserve",
"(",
")",
"{",
"var",
"painter",
"raster",
".",
"Painter",
"\n",
"if",
"dc",
".",
"mask",
"==",
"nil",
"{",
"if",
"pattern",
",",
"ok",
":=",
"dc",
".",
"strokePattern",
".",
"(",
"*",
"soli... | // StrokePreserve strokes the current path with the current color, line width,
// line cap, line join and dash settings. The path is preserved after this
// operation. | [
"StrokePreserve",
"strokes",
"the",
"current",
"path",
"with",
"the",
"current",
"color",
"line",
"width",
"line",
"cap",
"line",
"join",
"and",
"dash",
"settings",
".",
"The",
"path",
"is",
"preserved",
"after",
"this",
"operation",
"."
] | 72436a171bf31757dc87fb8fa9f7485307350307 | https://github.com/fogleman/gg/blob/72436a171bf31757dc87fb8fa9f7485307350307/context.go#L434-L449 |
30,708 | fogleman/gg | context.go | FillPreserve | func (dc *Context) FillPreserve() {
var painter raster.Painter
if dc.mask == nil {
if pattern, ok := dc.fillPattern.(*solidPattern); ok {
// with a nil mask and a solid color pattern, we can be more efficient
// TODO: refactor so we don't have to do this type assertion stuff?
p := raster.NewRGBAPainter(dc.... | go | func (dc *Context) FillPreserve() {
var painter raster.Painter
if dc.mask == nil {
if pattern, ok := dc.fillPattern.(*solidPattern); ok {
// with a nil mask and a solid color pattern, we can be more efficient
// TODO: refactor so we don't have to do this type assertion stuff?
p := raster.NewRGBAPainter(dc.... | [
"func",
"(",
"dc",
"*",
"Context",
")",
"FillPreserve",
"(",
")",
"{",
"var",
"painter",
"raster",
".",
"Painter",
"\n",
"if",
"dc",
".",
"mask",
"==",
"nil",
"{",
"if",
"pattern",
",",
"ok",
":=",
"dc",
".",
"fillPattern",
".",
"(",
"*",
"solidPat... | // FillPreserve fills the current path with the current color. Open subpaths
// are implicity closed. The path is preserved after this operation. | [
"FillPreserve",
"fills",
"the",
"current",
"path",
"with",
"the",
"current",
"color",
".",
"Open",
"subpaths",
"are",
"implicity",
"closed",
".",
"The",
"path",
"is",
"preserved",
"after",
"this",
"operation",
"."
] | 72436a171bf31757dc87fb8fa9f7485307350307 | https://github.com/fogleman/gg/blob/72436a171bf31757dc87fb8fa9f7485307350307/context.go#L461-L476 |
30,709 | fogleman/gg | context.go | InvertMask | func (dc *Context) InvertMask() {
if dc.mask == nil {
dc.mask = image.NewAlpha(dc.im.Bounds())
} else {
for i, a := range dc.mask.Pix {
dc.mask.Pix[i] = 255 - a
}
}
} | go | func (dc *Context) InvertMask() {
if dc.mask == nil {
dc.mask = image.NewAlpha(dc.im.Bounds())
} else {
for i, a := range dc.mask.Pix {
dc.mask.Pix[i] = 255 - a
}
}
} | [
"func",
"(",
"dc",
"*",
"Context",
")",
"InvertMask",
"(",
")",
"{",
"if",
"dc",
".",
"mask",
"==",
"nil",
"{",
"dc",
".",
"mask",
"=",
"image",
".",
"NewAlpha",
"(",
"dc",
".",
"im",
".",
"Bounds",
"(",
")",
")",
"\n",
"}",
"else",
"{",
"for... | // InvertMask inverts the alpha values in the current clipping mask such that
// a fully transparent region becomes fully opaque and vice versa. | [
"InvertMask",
"inverts",
"the",
"alpha",
"values",
"in",
"the",
"current",
"clipping",
"mask",
"such",
"that",
"a",
"fully",
"transparent",
"region",
"becomes",
"fully",
"opaque",
"and",
"vice",
"versa",
"."
] | 72436a171bf31757dc87fb8fa9f7485307350307 | https://github.com/fogleman/gg/blob/72436a171bf31757dc87fb8fa9f7485307350307/context.go#L523-L531 |
30,710 | fogleman/gg | context.go | Clear | func (dc *Context) Clear() {
src := image.NewUniform(dc.color)
draw.Draw(dc.im, dc.im.Bounds(), src, image.ZP, draw.Src)
} | go | func (dc *Context) Clear() {
src := image.NewUniform(dc.color)
draw.Draw(dc.im, dc.im.Bounds(), src, image.ZP, draw.Src)
} | [
"func",
"(",
"dc",
"*",
"Context",
")",
"Clear",
"(",
")",
"{",
"src",
":=",
"image",
".",
"NewUniform",
"(",
"dc",
".",
"color",
")",
"\n",
"draw",
".",
"Draw",
"(",
"dc",
".",
"im",
",",
"dc",
".",
"im",
".",
"Bounds",
"(",
")",
",",
"src",... | // Convenient Drawing Functions
// Clear fills the entire image with the current color. | [
"Convenient",
"Drawing",
"Functions",
"Clear",
"fills",
"the",
"entire",
"image",
"with",
"the",
"current",
"color",
"."
] | 72436a171bf31757dc87fb8fa9f7485307350307 | https://github.com/fogleman/gg/blob/72436a171bf31757dc87fb8fa9f7485307350307/context.go#L549-L552 |
30,711 | fogleman/gg | context.go | SetPixel | func (dc *Context) SetPixel(x, y int) {
dc.im.Set(x, y, dc.color)
} | go | func (dc *Context) SetPixel(x, y int) {
dc.im.Set(x, y, dc.color)
} | [
"func",
"(",
"dc",
"*",
"Context",
")",
"SetPixel",
"(",
"x",
",",
"y",
"int",
")",
"{",
"dc",
".",
"im",
".",
"Set",
"(",
"x",
",",
"y",
",",
"dc",
".",
"color",
")",
"\n",
"}"
] | // SetPixel sets the color of the specified pixel using the current color. | [
"SetPixel",
"sets",
"the",
"color",
"of",
"the",
"specified",
"pixel",
"using",
"the",
"current",
"color",
"."
] | 72436a171bf31757dc87fb8fa9f7485307350307 | https://github.com/fogleman/gg/blob/72436a171bf31757dc87fb8fa9f7485307350307/context.go#L555-L557 |
30,712 | fogleman/gg | context.go | DrawPoint | func (dc *Context) DrawPoint(x, y, r float64) {
dc.Push()
tx, ty := dc.TransformPoint(x, y)
dc.Identity()
dc.DrawCircle(tx, ty, r)
dc.Pop()
} | go | func (dc *Context) DrawPoint(x, y, r float64) {
dc.Push()
tx, ty := dc.TransformPoint(x, y)
dc.Identity()
dc.DrawCircle(tx, ty, r)
dc.Pop()
} | [
"func",
"(",
"dc",
"*",
"Context",
")",
"DrawPoint",
"(",
"x",
",",
"y",
",",
"r",
"float64",
")",
"{",
"dc",
".",
"Push",
"(",
")",
"\n",
"tx",
",",
"ty",
":=",
"dc",
".",
"TransformPoint",
"(",
"x",
",",
"y",
")",
"\n",
"dc",
".",
"Identity... | // DrawPoint is like DrawCircle but ensures that a circle of the specified
// size is drawn regardless of the current transformation matrix. The position
// is still transformed, but not the shape of the point. | [
"DrawPoint",
"is",
"like",
"DrawCircle",
"but",
"ensures",
"that",
"a",
"circle",
"of",
"the",
"specified",
"size",
"is",
"drawn",
"regardless",
"of",
"the",
"current",
"transformation",
"matrix",
".",
"The",
"position",
"is",
"still",
"transformed",
"but",
"n... | 72436a171bf31757dc87fb8fa9f7485307350307 | https://github.com/fogleman/gg/blob/72436a171bf31757dc87fb8fa9f7485307350307/context.go#L562-L568 |
30,713 | fogleman/gg | context.go | DrawImage | func (dc *Context) DrawImage(im image.Image, x, y int) {
dc.DrawImageAnchored(im, x, y, 0, 0)
} | go | func (dc *Context) DrawImage(im image.Image, x, y int) {
dc.DrawImageAnchored(im, x, y, 0, 0)
} | [
"func",
"(",
"dc",
"*",
"Context",
")",
"DrawImage",
"(",
"im",
"image",
".",
"Image",
",",
"x",
",",
"y",
"int",
")",
"{",
"dc",
".",
"DrawImageAnchored",
"(",
"im",
",",
"x",
",",
"y",
",",
"0",
",",
"0",
")",
"\n",
"}"
] | // DrawImage draws the specified image at the specified point. | [
"DrawImage",
"draws",
"the",
"specified",
"image",
"at",
"the",
"specified",
"point",
"."
] | 72436a171bf31757dc87fb8fa9f7485307350307 | https://github.com/fogleman/gg/blob/72436a171bf31757dc87fb8fa9f7485307350307/context.go#L657-L659 |
30,714 | fogleman/gg | context.go | DrawString | func (dc *Context) DrawString(s string, x, y float64) {
dc.DrawStringAnchored(s, x, y, 0, 0)
} | go | func (dc *Context) DrawString(s string, x, y float64) {
dc.DrawStringAnchored(s, x, y, 0, 0)
} | [
"func",
"(",
"dc",
"*",
"Context",
")",
"DrawString",
"(",
"s",
"string",
",",
"x",
",",
"y",
"float64",
")",
"{",
"dc",
".",
"DrawStringAnchored",
"(",
"s",
",",
"x",
",",
"y",
",",
"0",
",",
"0",
")",
"\n",
"}"
] | // DrawString draws the specified text at the specified point. | [
"DrawString",
"draws",
"the",
"specified",
"text",
"at",
"the",
"specified",
"point",
"."
] | 72436a171bf31757dc87fb8fa9f7485307350307 | https://github.com/fogleman/gg/blob/72436a171bf31757dc87fb8fa9f7485307350307/context.go#L737-L739 |
30,715 | fogleman/gg | context.go | DrawStringWrapped | func (dc *Context) DrawStringWrapped(s string, x, y, ax, ay, width, lineSpacing float64, align Align) {
lines := dc.WordWrap(s, width)
// sync h formula with MeasureMultilineString
h := float64(len(lines)) * dc.fontHeight * lineSpacing
h -= (lineSpacing - 1) * dc.fontHeight
x -= ax * width
y -= ay * h
switch a... | go | func (dc *Context) DrawStringWrapped(s string, x, y, ax, ay, width, lineSpacing float64, align Align) {
lines := dc.WordWrap(s, width)
// sync h formula with MeasureMultilineString
h := float64(len(lines)) * dc.fontHeight * lineSpacing
h -= (lineSpacing - 1) * dc.fontHeight
x -= ax * width
y -= ay * h
switch a... | [
"func",
"(",
"dc",
"*",
"Context",
")",
"DrawStringWrapped",
"(",
"s",
"string",
",",
"x",
",",
"y",
",",
"ax",
",",
"ay",
",",
"width",
",",
"lineSpacing",
"float64",
",",
"align",
"Align",
")",
"{",
"lines",
":=",
"dc",
".",
"WordWrap",
"(",
"s",... | // DrawStringWrapped word-wraps the specified string to the given max width
// and then draws it at the specified anchor point using the given line
// spacing and text alignment. | [
"DrawStringWrapped",
"word",
"-",
"wraps",
"the",
"specified",
"string",
"to",
"the",
"given",
"max",
"width",
"and",
"then",
"draws",
"it",
"at",
"the",
"specified",
"anchor",
"point",
"using",
"the",
"given",
"line",
"spacing",
"and",
"text",
"alignment",
... | 72436a171bf31757dc87fb8fa9f7485307350307 | https://github.com/fogleman/gg/blob/72436a171bf31757dc87fb8fa9f7485307350307/context.go#L760-L784 |
30,716 | fogleman/gg | context.go | MeasureString | func (dc *Context) MeasureString(s string) (w, h float64) {
d := &font.Drawer{
Face: dc.fontFace,
}
a := d.MeasureString(s)
return float64(a >> 6), dc.fontHeight
} | go | func (dc *Context) MeasureString(s string) (w, h float64) {
d := &font.Drawer{
Face: dc.fontFace,
}
a := d.MeasureString(s)
return float64(a >> 6), dc.fontHeight
} | [
"func",
"(",
"dc",
"*",
"Context",
")",
"MeasureString",
"(",
"s",
"string",
")",
"(",
"w",
",",
"h",
"float64",
")",
"{",
"d",
":=",
"&",
"font",
".",
"Drawer",
"{",
"Face",
":",
"dc",
".",
"fontFace",
",",
"}",
"\n",
"a",
":=",
"d",
".",
"M... | // MeasureString returns the rendered width and height of the specified text
// given the current font face. | [
"MeasureString",
"returns",
"the",
"rendered",
"width",
"and",
"height",
"of",
"the",
"specified",
"text",
"given",
"the",
"current",
"font",
"face",
"."
] | 72436a171bf31757dc87fb8fa9f7485307350307 | https://github.com/fogleman/gg/blob/72436a171bf31757dc87fb8fa9f7485307350307/context.go#L811-L817 |
30,717 | fogleman/gg | context.go | WordWrap | func (dc *Context) WordWrap(s string, w float64) []string {
return wordWrap(dc, s, w)
} | go | func (dc *Context) WordWrap(s string, w float64) []string {
return wordWrap(dc, s, w)
} | [
"func",
"(",
"dc",
"*",
"Context",
")",
"WordWrap",
"(",
"s",
"string",
",",
"w",
"float64",
")",
"[",
"]",
"string",
"{",
"return",
"wordWrap",
"(",
"dc",
",",
"s",
",",
"w",
")",
"\n",
"}"
] | // WordWrap wraps the specified string to the given max width and current
// font face. | [
"WordWrap",
"wraps",
"the",
"specified",
"string",
"to",
"the",
"given",
"max",
"width",
"and",
"current",
"font",
"face",
"."
] | 72436a171bf31757dc87fb8fa9f7485307350307 | https://github.com/fogleman/gg/blob/72436a171bf31757dc87fb8fa9f7485307350307/context.go#L821-L823 |
30,718 | fogleman/gg | context.go | Translate | func (dc *Context) Translate(x, y float64) {
dc.matrix = dc.matrix.Translate(x, y)
} | go | func (dc *Context) Translate(x, y float64) {
dc.matrix = dc.matrix.Translate(x, y)
} | [
"func",
"(",
"dc",
"*",
"Context",
")",
"Translate",
"(",
"x",
",",
"y",
"float64",
")",
"{",
"dc",
".",
"matrix",
"=",
"dc",
".",
"matrix",
".",
"Translate",
"(",
"x",
",",
"y",
")",
"\n",
"}"
] | // Translate updates the current matrix with a translation. | [
"Translate",
"updates",
"the",
"current",
"matrix",
"with",
"a",
"translation",
"."
] | 72436a171bf31757dc87fb8fa9f7485307350307 | https://github.com/fogleman/gg/blob/72436a171bf31757dc87fb8fa9f7485307350307/context.go#L834-L836 |
30,719 | fogleman/gg | context.go | Scale | func (dc *Context) Scale(x, y float64) {
dc.matrix = dc.matrix.Scale(x, y)
} | go | func (dc *Context) Scale(x, y float64) {
dc.matrix = dc.matrix.Scale(x, y)
} | [
"func",
"(",
"dc",
"*",
"Context",
")",
"Scale",
"(",
"x",
",",
"y",
"float64",
")",
"{",
"dc",
".",
"matrix",
"=",
"dc",
".",
"matrix",
".",
"Scale",
"(",
"x",
",",
"y",
")",
"\n",
"}"
] | // Scale updates the current matrix with a scaling factor.
// Scaling occurs about the origin. | [
"Scale",
"updates",
"the",
"current",
"matrix",
"with",
"a",
"scaling",
"factor",
".",
"Scaling",
"occurs",
"about",
"the",
"origin",
"."
] | 72436a171bf31757dc87fb8fa9f7485307350307 | https://github.com/fogleman/gg/blob/72436a171bf31757dc87fb8fa9f7485307350307/context.go#L840-L842 |
30,720 | fogleman/gg | context.go | ScaleAbout | func (dc *Context) ScaleAbout(sx, sy, x, y float64) {
dc.Translate(x, y)
dc.Scale(sx, sy)
dc.Translate(-x, -y)
} | go | func (dc *Context) ScaleAbout(sx, sy, x, y float64) {
dc.Translate(x, y)
dc.Scale(sx, sy)
dc.Translate(-x, -y)
} | [
"func",
"(",
"dc",
"*",
"Context",
")",
"ScaleAbout",
"(",
"sx",
",",
"sy",
",",
"x",
",",
"y",
"float64",
")",
"{",
"dc",
".",
"Translate",
"(",
"x",
",",
"y",
")",
"\n",
"dc",
".",
"Scale",
"(",
"sx",
",",
"sy",
")",
"\n",
"dc",
".",
"Tra... | // ScaleAbout updates the current matrix with a scaling factor.
// Scaling occurs about the specified point. | [
"ScaleAbout",
"updates",
"the",
"current",
"matrix",
"with",
"a",
"scaling",
"factor",
".",
"Scaling",
"occurs",
"about",
"the",
"specified",
"point",
"."
] | 72436a171bf31757dc87fb8fa9f7485307350307 | https://github.com/fogleman/gg/blob/72436a171bf31757dc87fb8fa9f7485307350307/context.go#L846-L850 |
30,721 | fogleman/gg | context.go | Rotate | func (dc *Context) Rotate(angle float64) {
dc.matrix = dc.matrix.Rotate(angle)
} | go | func (dc *Context) Rotate(angle float64) {
dc.matrix = dc.matrix.Rotate(angle)
} | [
"func",
"(",
"dc",
"*",
"Context",
")",
"Rotate",
"(",
"angle",
"float64",
")",
"{",
"dc",
".",
"matrix",
"=",
"dc",
".",
"matrix",
".",
"Rotate",
"(",
"angle",
")",
"\n",
"}"
] | // Rotate updates the current matrix with a clockwise rotation.
// Rotation occurs about the origin. Angle is specified in radians. | [
"Rotate",
"updates",
"the",
"current",
"matrix",
"with",
"a",
"clockwise",
"rotation",
".",
"Rotation",
"occurs",
"about",
"the",
"origin",
".",
"Angle",
"is",
"specified",
"in",
"radians",
"."
] | 72436a171bf31757dc87fb8fa9f7485307350307 | https://github.com/fogleman/gg/blob/72436a171bf31757dc87fb8fa9f7485307350307/context.go#L854-L856 |
30,722 | fogleman/gg | context.go | RotateAbout | func (dc *Context) RotateAbout(angle, x, y float64) {
dc.Translate(x, y)
dc.Rotate(angle)
dc.Translate(-x, -y)
} | go | func (dc *Context) RotateAbout(angle, x, y float64) {
dc.Translate(x, y)
dc.Rotate(angle)
dc.Translate(-x, -y)
} | [
"func",
"(",
"dc",
"*",
"Context",
")",
"RotateAbout",
"(",
"angle",
",",
"x",
",",
"y",
"float64",
")",
"{",
"dc",
".",
"Translate",
"(",
"x",
",",
"y",
")",
"\n",
"dc",
".",
"Rotate",
"(",
"angle",
")",
"\n",
"dc",
".",
"Translate",
"(",
"-",... | // RotateAbout updates the current matrix with a clockwise rotation.
// Rotation occurs about the specified point. Angle is specified in radians. | [
"RotateAbout",
"updates",
"the",
"current",
"matrix",
"with",
"a",
"clockwise",
"rotation",
".",
"Rotation",
"occurs",
"about",
"the",
"specified",
"point",
".",
"Angle",
"is",
"specified",
"in",
"radians",
"."
] | 72436a171bf31757dc87fb8fa9f7485307350307 | https://github.com/fogleman/gg/blob/72436a171bf31757dc87fb8fa9f7485307350307/context.go#L860-L864 |
30,723 | fogleman/gg | context.go | Shear | func (dc *Context) Shear(x, y float64) {
dc.matrix = dc.matrix.Shear(x, y)
} | go | func (dc *Context) Shear(x, y float64) {
dc.matrix = dc.matrix.Shear(x, y)
} | [
"func",
"(",
"dc",
"*",
"Context",
")",
"Shear",
"(",
"x",
",",
"y",
"float64",
")",
"{",
"dc",
".",
"matrix",
"=",
"dc",
".",
"matrix",
".",
"Shear",
"(",
"x",
",",
"y",
")",
"\n",
"}"
] | // Shear updates the current matrix with a shearing angle.
// Shearing occurs about the origin. | [
"Shear",
"updates",
"the",
"current",
"matrix",
"with",
"a",
"shearing",
"angle",
".",
"Shearing",
"occurs",
"about",
"the",
"origin",
"."
] | 72436a171bf31757dc87fb8fa9f7485307350307 | https://github.com/fogleman/gg/blob/72436a171bf31757dc87fb8fa9f7485307350307/context.go#L868-L870 |
30,724 | fogleman/gg | context.go | ShearAbout | func (dc *Context) ShearAbout(sx, sy, x, y float64) {
dc.Translate(x, y)
dc.Shear(sx, sy)
dc.Translate(-x, -y)
} | go | func (dc *Context) ShearAbout(sx, sy, x, y float64) {
dc.Translate(x, y)
dc.Shear(sx, sy)
dc.Translate(-x, -y)
} | [
"func",
"(",
"dc",
"*",
"Context",
")",
"ShearAbout",
"(",
"sx",
",",
"sy",
",",
"x",
",",
"y",
"float64",
")",
"{",
"dc",
".",
"Translate",
"(",
"x",
",",
"y",
")",
"\n",
"dc",
".",
"Shear",
"(",
"sx",
",",
"sy",
")",
"\n",
"dc",
".",
"Tra... | // ShearAbout updates the current matrix with a shearing angle.
// Shearing occurs about the specified point. | [
"ShearAbout",
"updates",
"the",
"current",
"matrix",
"with",
"a",
"shearing",
"angle",
".",
"Shearing",
"occurs",
"about",
"the",
"specified",
"point",
"."
] | 72436a171bf31757dc87fb8fa9f7485307350307 | https://github.com/fogleman/gg/blob/72436a171bf31757dc87fb8fa9f7485307350307/context.go#L874-L878 |
30,725 | fogleman/gg | context.go | TransformPoint | func (dc *Context) TransformPoint(x, y float64) (tx, ty float64) {
return dc.matrix.TransformPoint(x, y)
} | go | func (dc *Context) TransformPoint(x, y float64) (tx, ty float64) {
return dc.matrix.TransformPoint(x, y)
} | [
"func",
"(",
"dc",
"*",
"Context",
")",
"TransformPoint",
"(",
"x",
",",
"y",
"float64",
")",
"(",
"tx",
",",
"ty",
"float64",
")",
"{",
"return",
"dc",
".",
"matrix",
".",
"TransformPoint",
"(",
"x",
",",
"y",
")",
"\n",
"}"
] | // TransformPoint multiplies the specified point by the current matrix,
// returning a transformed position. | [
"TransformPoint",
"multiplies",
"the",
"specified",
"point",
"by",
"the",
"current",
"matrix",
"returning",
"a",
"transformed",
"position",
"."
] | 72436a171bf31757dc87fb8fa9f7485307350307 | https://github.com/fogleman/gg/blob/72436a171bf31757dc87fb8fa9f7485307350307/context.go#L882-L884 |
30,726 | fogleman/gg | context.go | InvertY | func (dc *Context) InvertY() {
dc.Translate(0, float64(dc.height))
dc.Scale(1, -1)
} | go | func (dc *Context) InvertY() {
dc.Translate(0, float64(dc.height))
dc.Scale(1, -1)
} | [
"func",
"(",
"dc",
"*",
"Context",
")",
"InvertY",
"(",
")",
"{",
"dc",
".",
"Translate",
"(",
"0",
",",
"float64",
"(",
"dc",
".",
"height",
")",
")",
"\n",
"dc",
".",
"Scale",
"(",
"1",
",",
"-",
"1",
")",
"\n",
"}"
] | // InvertY flips the Y axis so that Y grows from bottom to top and Y=0 is at
// the bottom of the image. | [
"InvertY",
"flips",
"the",
"Y",
"axis",
"so",
"that",
"Y",
"grows",
"from",
"bottom",
"to",
"top",
"and",
"Y",
"=",
"0",
"is",
"at",
"the",
"bottom",
"of",
"the",
"image",
"."
] | 72436a171bf31757dc87fb8fa9f7485307350307 | https://github.com/fogleman/gg/blob/72436a171bf31757dc87fb8fa9f7485307350307/context.go#L888-L891 |
30,727 | fogleman/gg | context.go | Push | func (dc *Context) Push() {
x := *dc
dc.stack = append(dc.stack, &x)
} | go | func (dc *Context) Push() {
x := *dc
dc.stack = append(dc.stack, &x)
} | [
"func",
"(",
"dc",
"*",
"Context",
")",
"Push",
"(",
")",
"{",
"x",
":=",
"*",
"dc",
"\n",
"dc",
".",
"stack",
"=",
"append",
"(",
"dc",
".",
"stack",
",",
"&",
"x",
")",
"\n",
"}"
] | // Stack
// Push saves the current state of the context for later retrieval. These
// can be nested. | [
"Stack",
"Push",
"saves",
"the",
"current",
"state",
"of",
"the",
"context",
"for",
"later",
"retrieval",
".",
"These",
"can",
"be",
"nested",
"."
] | 72436a171bf31757dc87fb8fa9f7485307350307 | https://github.com/fogleman/gg/blob/72436a171bf31757dc87fb8fa9f7485307350307/context.go#L897-L900 |
30,728 | fogleman/gg | context.go | Pop | func (dc *Context) Pop() {
before := *dc
s := dc.stack
x, s := s[len(s)-1], s[:len(s)-1]
*dc = *x
dc.mask = before.mask
dc.strokePath = before.strokePath
dc.fillPath = before.fillPath
dc.start = before.start
dc.current = before.current
dc.hasCurrent = before.hasCurrent
} | go | func (dc *Context) Pop() {
before := *dc
s := dc.stack
x, s := s[len(s)-1], s[:len(s)-1]
*dc = *x
dc.mask = before.mask
dc.strokePath = before.strokePath
dc.fillPath = before.fillPath
dc.start = before.start
dc.current = before.current
dc.hasCurrent = before.hasCurrent
} | [
"func",
"(",
"dc",
"*",
"Context",
")",
"Pop",
"(",
")",
"{",
"before",
":=",
"*",
"dc",
"\n",
"s",
":=",
"dc",
".",
"stack",
"\n",
"x",
",",
"s",
":=",
"s",
"[",
"len",
"(",
"s",
")",
"-",
"1",
"]",
",",
"s",
"[",
":",
"len",
"(",
"s",... | // Pop restores the last saved context state from the stack. | [
"Pop",
"restores",
"the",
"last",
"saved",
"context",
"state",
"from",
"the",
"stack",
"."
] | 72436a171bf31757dc87fb8fa9f7485307350307 | https://github.com/fogleman/gg/blob/72436a171bf31757dc87fb8fa9f7485307350307/context.go#L903-L914 |
30,729 | faiface/pixel | imdraw/imdraw.go | New | func New(pic pixel.Picture) *IMDraw {
tri := &pixel.TrianglesData{}
im := &IMDraw{
tri: tri,
batch: pixel.NewBatch(tri, pic),
}
im.SetMatrix(pixel.IM)
im.SetColorMask(pixel.Alpha(1))
im.Reset()
return im
} | go | func New(pic pixel.Picture) *IMDraw {
tri := &pixel.TrianglesData{}
im := &IMDraw{
tri: tri,
batch: pixel.NewBatch(tri, pic),
}
im.SetMatrix(pixel.IM)
im.SetColorMask(pixel.Alpha(1))
im.Reset()
return im
} | [
"func",
"New",
"(",
"pic",
"pixel",
".",
"Picture",
")",
"*",
"IMDraw",
"{",
"tri",
":=",
"&",
"pixel",
".",
"TrianglesData",
"{",
"}",
"\n",
"im",
":=",
"&",
"IMDraw",
"{",
"tri",
":",
"tri",
",",
"batch",
":",
"pixel",
".",
"NewBatch",
"(",
"tr... | // New creates a new empty IMDraw. An optional Picture can be used to draw with a Picture.
//
// If you just want to draw primitive shapes, pass nil as the Picture. | [
"New",
"creates",
"a",
"new",
"empty",
"IMDraw",
".",
"An",
"optional",
"Picture",
"can",
"be",
"used",
"to",
"draw",
"with",
"a",
"Picture",
".",
"If",
"you",
"just",
"want",
"to",
"draw",
"primitive",
"shapes",
"pass",
"nil",
"as",
"the",
"Picture",
... | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/imdraw/imdraw.go#L91-L101 |
30,730 | faiface/pixel | imdraw/imdraw.go | Reset | func (imd *IMDraw) Reset() {
imd.points = imd.points[:0]
imd.Color = pixel.Alpha(1)
imd.Picture = pixel.ZV
imd.Intensity = 0
imd.Precision = 64
imd.EndShape = NoEndShape
} | go | func (imd *IMDraw) Reset() {
imd.points = imd.points[:0]
imd.Color = pixel.Alpha(1)
imd.Picture = pixel.ZV
imd.Intensity = 0
imd.Precision = 64
imd.EndShape = NoEndShape
} | [
"func",
"(",
"imd",
"*",
"IMDraw",
")",
"Reset",
"(",
")",
"{",
"imd",
".",
"points",
"=",
"imd",
".",
"points",
"[",
":",
"0",
"]",
"\n",
"imd",
".",
"Color",
"=",
"pixel",
".",
"Alpha",
"(",
"1",
")",
"\n",
"imd",
".",
"Picture",
"=",
"pixe... | // Reset restores all point properties to defaults and removes all Pushed points.
//
// This does not affect matrix and color mask set by SetMatrix and SetColorMask. | [
"Reset",
"restores",
"all",
"point",
"properties",
"to",
"defaults",
"and",
"removes",
"all",
"Pushed",
"points",
".",
"This",
"does",
"not",
"affect",
"matrix",
"and",
"color",
"mask",
"set",
"by",
"SetMatrix",
"and",
"SetColorMask",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/imdraw/imdraw.go#L112-L119 |
30,731 | faiface/pixel | imdraw/imdraw.go | Draw | func (imd *IMDraw) Draw(t pixel.Target) {
imd.batch.Draw(t)
} | go | func (imd *IMDraw) Draw(t pixel.Target) {
imd.batch.Draw(t)
} | [
"func",
"(",
"imd",
"*",
"IMDraw",
")",
"Draw",
"(",
"t",
"pixel",
".",
"Target",
")",
"{",
"imd",
".",
"batch",
".",
"Draw",
"(",
"t",
")",
"\n",
"}"
] | // Draw draws all currently drawn shapes inside the IM onto another Target.
//
// Note, that IMDraw's matrix and color mask have no effect here. | [
"Draw",
"draws",
"all",
"currently",
"drawn",
"shapes",
"inside",
"the",
"IM",
"onto",
"another",
"Target",
".",
"Note",
"that",
"IMDraw",
"s",
"matrix",
"and",
"color",
"mask",
"have",
"no",
"effect",
"here",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/imdraw/imdraw.go#L124-L126 |
30,732 | faiface/pixel | imdraw/imdraw.go | Push | func (imd *IMDraw) Push(pts ...pixel.Vec) {
if _, ok := imd.Color.(pixel.RGBA); !ok {
imd.Color = pixel.ToRGBA(imd.Color)
}
opts := point{
col: imd.Color.(pixel.RGBA),
pic: imd.Picture,
in: imd.Intensity,
precision: imd.Precision,
endshape: imd.EndShape,
}
for _, pt := range pts {
... | go | func (imd *IMDraw) Push(pts ...pixel.Vec) {
if _, ok := imd.Color.(pixel.RGBA); !ok {
imd.Color = pixel.ToRGBA(imd.Color)
}
opts := point{
col: imd.Color.(pixel.RGBA),
pic: imd.Picture,
in: imd.Intensity,
precision: imd.Precision,
endshape: imd.EndShape,
}
for _, pt := range pts {
... | [
"func",
"(",
"imd",
"*",
"IMDraw",
")",
"Push",
"(",
"pts",
"...",
"pixel",
".",
"Vec",
")",
"{",
"if",
"_",
",",
"ok",
":=",
"imd",
".",
"Color",
".",
"(",
"pixel",
".",
"RGBA",
")",
";",
"!",
"ok",
"{",
"imd",
".",
"Color",
"=",
"pixel",
... | // Push adds some points to the IM queue. All Pushed points will have the same properties except for
// the position. | [
"Push",
"adds",
"some",
"points",
"to",
"the",
"IM",
"queue",
".",
"All",
"Pushed",
"points",
"will",
"have",
"the",
"same",
"properties",
"except",
"for",
"the",
"position",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/imdraw/imdraw.go#L130-L144 |
30,733 | faiface/pixel | imdraw/imdraw.go | SetMatrix | func (imd *IMDraw) SetMatrix(m pixel.Matrix) {
imd.matrix = m
imd.batch.SetMatrix(imd.matrix)
} | go | func (imd *IMDraw) SetMatrix(m pixel.Matrix) {
imd.matrix = m
imd.batch.SetMatrix(imd.matrix)
} | [
"func",
"(",
"imd",
"*",
"IMDraw",
")",
"SetMatrix",
"(",
"m",
"pixel",
".",
"Matrix",
")",
"{",
"imd",
".",
"matrix",
"=",
"m",
"\n",
"imd",
".",
"batch",
".",
"SetMatrix",
"(",
"imd",
".",
"matrix",
")",
"\n",
"}"
] | // SetMatrix sets a Matrix that all further points will be transformed by. | [
"SetMatrix",
"sets",
"a",
"Matrix",
"that",
"all",
"further",
"points",
"will",
"be",
"transformed",
"by",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/imdraw/imdraw.go#L152-L155 |
30,734 | faiface/pixel | imdraw/imdraw.go | SetColorMask | func (imd *IMDraw) SetColorMask(color color.Color) {
imd.mask = pixel.ToRGBA(color)
imd.batch.SetColorMask(imd.mask)
} | go | func (imd *IMDraw) SetColorMask(color color.Color) {
imd.mask = pixel.ToRGBA(color)
imd.batch.SetColorMask(imd.mask)
} | [
"func",
"(",
"imd",
"*",
"IMDraw",
")",
"SetColorMask",
"(",
"color",
"color",
".",
"Color",
")",
"{",
"imd",
".",
"mask",
"=",
"pixel",
".",
"ToRGBA",
"(",
"color",
")",
"\n",
"imd",
".",
"batch",
".",
"SetColorMask",
"(",
"imd",
".",
"mask",
")",... | // SetColorMask sets a color that all further point's color will be multiplied by. | [
"SetColorMask",
"sets",
"a",
"color",
"that",
"all",
"further",
"point",
"s",
"color",
"will",
"be",
"multiplied",
"by",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/imdraw/imdraw.go#L158-L161 |
30,735 | faiface/pixel | imdraw/imdraw.go | MakeTriangles | func (imd *IMDraw) MakeTriangles(t pixel.Triangles) pixel.TargetTriangles {
return imd.batch.MakeTriangles(t)
} | go | func (imd *IMDraw) MakeTriangles(t pixel.Triangles) pixel.TargetTriangles {
return imd.batch.MakeTriangles(t)
} | [
"func",
"(",
"imd",
"*",
"IMDraw",
")",
"MakeTriangles",
"(",
"t",
"pixel",
".",
"Triangles",
")",
"pixel",
".",
"TargetTriangles",
"{",
"return",
"imd",
".",
"batch",
".",
"MakeTriangles",
"(",
"t",
")",
"\n",
"}"
] | // MakeTriangles returns a specialized copy of the provided Triangles that draws onto this IMDraw. | [
"MakeTriangles",
"returns",
"a",
"specialized",
"copy",
"of",
"the",
"provided",
"Triangles",
"that",
"draws",
"onto",
"this",
"IMDraw",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/imdraw/imdraw.go#L164-L166 |
30,736 | faiface/pixel | imdraw/imdraw.go | MakePicture | func (imd *IMDraw) MakePicture(p pixel.Picture) pixel.TargetPicture {
return imd.batch.MakePicture(p)
} | go | func (imd *IMDraw) MakePicture(p pixel.Picture) pixel.TargetPicture {
return imd.batch.MakePicture(p)
} | [
"func",
"(",
"imd",
"*",
"IMDraw",
")",
"MakePicture",
"(",
"p",
"pixel",
".",
"Picture",
")",
"pixel",
".",
"TargetPicture",
"{",
"return",
"imd",
".",
"batch",
".",
"MakePicture",
"(",
"p",
")",
"\n",
"}"
] | // MakePicture returns a specialized copy of the provided Picture that draws onto this IMDraw. | [
"MakePicture",
"returns",
"a",
"specialized",
"copy",
"of",
"the",
"provided",
"Picture",
"that",
"draws",
"onto",
"this",
"IMDraw",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/imdraw/imdraw.go#L169-L171 |
30,737 | faiface/pixel | imdraw/imdraw.go | Rectangle | func (imd *IMDraw) Rectangle(thickness float64) {
if thickness == 0 {
imd.fillRectangle()
} else {
imd.outlineRectangle(thickness)
}
} | go | func (imd *IMDraw) Rectangle(thickness float64) {
if thickness == 0 {
imd.fillRectangle()
} else {
imd.outlineRectangle(thickness)
}
} | [
"func",
"(",
"imd",
"*",
"IMDraw",
")",
"Rectangle",
"(",
"thickness",
"float64",
")",
"{",
"if",
"thickness",
"==",
"0",
"{",
"imd",
".",
"fillRectangle",
"(",
")",
"\n",
"}",
"else",
"{",
"imd",
".",
"outlineRectangle",
"(",
"thickness",
")",
"\n",
... | // Rectangle draws a rectangle between each two subsequent Pushed points. Drawing a rectangle
// between two points means drawing a rectangle with sides parallel to the axes of the coordinate
// system, where the two points specify it's two opposite corners.
//
// If the thickness is 0, rectangles will be filled, other... | [
"Rectangle",
"draws",
"a",
"rectangle",
"between",
"each",
"two",
"subsequent",
"Pushed",
"points",
".",
"Drawing",
"a",
"rectangle",
"between",
"two",
"points",
"means",
"drawing",
"a",
"rectangle",
"with",
"sides",
"parallel",
"to",
"the",
"axes",
"of",
"the... | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/imdraw/imdraw.go#L184-L190 |
30,738 | faiface/pixel | imdraw/imdraw.go | Polygon | func (imd *IMDraw) Polygon(thickness float64) {
if thickness == 0 {
imd.fillPolygon()
} else {
imd.polyline(thickness, true)
}
} | go | func (imd *IMDraw) Polygon(thickness float64) {
if thickness == 0 {
imd.fillPolygon()
} else {
imd.polyline(thickness, true)
}
} | [
"func",
"(",
"imd",
"*",
"IMDraw",
")",
"Polygon",
"(",
"thickness",
"float64",
")",
"{",
"if",
"thickness",
"==",
"0",
"{",
"imd",
".",
"fillPolygon",
"(",
")",
"\n",
"}",
"else",
"{",
"imd",
".",
"polyline",
"(",
"thickness",
",",
"true",
")",
"\... | // Polygon draws a polygon from the Pushed points. If the thickness is 0, the convex polygon will be
// filled. Otherwise, an outline of the specified thickness will be drawn. The outline does not have
// to be convex.
//
// Note, that the filled polygon does not have to be strictly convex. The way it's drawn is that a... | [
"Polygon",
"draws",
"a",
"polygon",
"from",
"the",
"Pushed",
"points",
".",
"If",
"the",
"thickness",
"is",
"0",
"the",
"convex",
"polygon",
"will",
"be",
"filled",
".",
"Otherwise",
"an",
"outline",
"of",
"the",
"specified",
"thickness",
"will",
"be",
"dr... | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/imdraw/imdraw.go#L199-L205 |
30,739 | faiface/pixel | imdraw/imdraw.go | Circle | func (imd *IMDraw) Circle(radius, thickness float64) {
if thickness == 0 {
imd.fillEllipseArc(pixel.V(radius, radius), 0, 2*math.Pi)
} else {
imd.outlineEllipseArc(pixel.V(radius, radius), 0, 2*math.Pi, thickness, false)
}
} | go | func (imd *IMDraw) Circle(radius, thickness float64) {
if thickness == 0 {
imd.fillEllipseArc(pixel.V(radius, radius), 0, 2*math.Pi)
} else {
imd.outlineEllipseArc(pixel.V(radius, radius), 0, 2*math.Pi, thickness, false)
}
} | [
"func",
"(",
"imd",
"*",
"IMDraw",
")",
"Circle",
"(",
"radius",
",",
"thickness",
"float64",
")",
"{",
"if",
"thickness",
"==",
"0",
"{",
"imd",
".",
"fillEllipseArc",
"(",
"pixel",
".",
"V",
"(",
"radius",
",",
"radius",
")",
",",
"0",
",",
"2",
... | // Circle draws a circle of the specified radius around each Pushed point. If the thickness is 0,
// the circle will be filled, otherwise a circle outline of the specified thickness will be drawn. | [
"Circle",
"draws",
"a",
"circle",
"of",
"the",
"specified",
"radius",
"around",
"each",
"Pushed",
"point",
".",
"If",
"the",
"thickness",
"is",
"0",
"the",
"circle",
"will",
"be",
"filled",
"otherwise",
"a",
"circle",
"outline",
"of",
"the",
"specified",
"... | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/imdraw/imdraw.go#L209-L215 |
30,740 | faiface/pixel | imdraw/imdraw.go | Ellipse | func (imd *IMDraw) Ellipse(radius pixel.Vec, thickness float64) {
if thickness == 0 {
imd.fillEllipseArc(radius, 0, 2*math.Pi)
} else {
imd.outlineEllipseArc(radius, 0, 2*math.Pi, thickness, false)
}
} | go | func (imd *IMDraw) Ellipse(radius pixel.Vec, thickness float64) {
if thickness == 0 {
imd.fillEllipseArc(radius, 0, 2*math.Pi)
} else {
imd.outlineEllipseArc(radius, 0, 2*math.Pi, thickness, false)
}
} | [
"func",
"(",
"imd",
"*",
"IMDraw",
")",
"Ellipse",
"(",
"radius",
"pixel",
".",
"Vec",
",",
"thickness",
"float64",
")",
"{",
"if",
"thickness",
"==",
"0",
"{",
"imd",
".",
"fillEllipseArc",
"(",
"radius",
",",
"0",
",",
"2",
"*",
"math",
".",
"Pi"... | // Ellipse draws an ellipse of the specified radius in each axis around each Pushed points. If the
// thickness is 0, the ellipse will be filled, otherwise an ellipse outline of the specified
// thickness will be drawn. | [
"Ellipse",
"draws",
"an",
"ellipse",
"of",
"the",
"specified",
"radius",
"in",
"each",
"axis",
"around",
"each",
"Pushed",
"points",
".",
"If",
"the",
"thickness",
"is",
"0",
"the",
"ellipse",
"will",
"be",
"filled",
"otherwise",
"an",
"ellipse",
"outline",
... | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/imdraw/imdraw.go#L236-L242 |
30,741 | faiface/pixel | pixelgl/input.go | Pressed | func (w *Window) Pressed(button Button) bool {
return w.currInp.buttons[button]
} | go | func (w *Window) Pressed(button Button) bool {
return w.currInp.buttons[button]
} | [
"func",
"(",
"w",
"*",
"Window",
")",
"Pressed",
"(",
"button",
"Button",
")",
"bool",
"{",
"return",
"w",
".",
"currInp",
".",
"buttons",
"[",
"button",
"]",
"\n",
"}"
] | // Pressed returns whether the Button is currently pressed down. | [
"Pressed",
"returns",
"whether",
"the",
"Button",
"is",
"currently",
"pressed",
"down",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/input.go#L10-L12 |
30,742 | faiface/pixel | pixelgl/input.go | JustPressed | func (w *Window) JustPressed(button Button) bool {
return w.currInp.buttons[button] && !w.prevInp.buttons[button]
} | go | func (w *Window) JustPressed(button Button) bool {
return w.currInp.buttons[button] && !w.prevInp.buttons[button]
} | [
"func",
"(",
"w",
"*",
"Window",
")",
"JustPressed",
"(",
"button",
"Button",
")",
"bool",
"{",
"return",
"w",
".",
"currInp",
".",
"buttons",
"[",
"button",
"]",
"&&",
"!",
"w",
".",
"prevInp",
".",
"buttons",
"[",
"button",
"]",
"\n",
"}"
] | // JustPressed returns whether the Button has just been pressed down. | [
"JustPressed",
"returns",
"whether",
"the",
"Button",
"has",
"just",
"been",
"pressed",
"down",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/input.go#L15-L17 |
30,743 | faiface/pixel | pixelgl/input.go | Repeated | func (w *Window) Repeated(button Button) bool {
return w.currInp.repeat[button]
} | go | func (w *Window) Repeated(button Button) bool {
return w.currInp.repeat[button]
} | [
"func",
"(",
"w",
"*",
"Window",
")",
"Repeated",
"(",
"button",
"Button",
")",
"bool",
"{",
"return",
"w",
".",
"currInp",
".",
"repeat",
"[",
"button",
"]",
"\n",
"}"
] | // Repeated returns whether a repeat event has been triggered on button.
//
// Repeat event occurs repeatedly when a button is held down for some time. | [
"Repeated",
"returns",
"whether",
"a",
"repeat",
"event",
"has",
"been",
"triggered",
"on",
"button",
".",
"Repeat",
"event",
"occurs",
"repeatedly",
"when",
"a",
"button",
"is",
"held",
"down",
"for",
"some",
"time",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/input.go#L27-L29 |
30,744 | faiface/pixel | pixelgl/input.go | SetMousePosition | func (w *Window) SetMousePosition(v pixel.Vec) {
mainthread.Call(func() {
if (v.X >= 0 && v.X <= w.bounds.W()) &&
(v.Y >= 0 && v.Y <= w.bounds.H()) {
w.window.SetCursorPos(
v.X+w.bounds.Min.X,
(w.bounds.H()-v.Y)+w.bounds.Min.Y,
)
w.prevInp.mouse = v
w.currInp.mouse = v
w.tempInp.mouse = v
... | go | func (w *Window) SetMousePosition(v pixel.Vec) {
mainthread.Call(func() {
if (v.X >= 0 && v.X <= w.bounds.W()) &&
(v.Y >= 0 && v.Y <= w.bounds.H()) {
w.window.SetCursorPos(
v.X+w.bounds.Min.X,
(w.bounds.H()-v.Y)+w.bounds.Min.Y,
)
w.prevInp.mouse = v
w.currInp.mouse = v
w.tempInp.mouse = v
... | [
"func",
"(",
"w",
"*",
"Window",
")",
"SetMousePosition",
"(",
"v",
"pixel",
".",
"Vec",
")",
"{",
"mainthread",
".",
"Call",
"(",
"func",
"(",
")",
"{",
"if",
"(",
"v",
".",
"X",
">=",
"0",
"&&",
"v",
".",
"X",
"<=",
"w",
".",
"bounds",
".",... | // SetMousePosition positions the mouse cursor anywhere within the Window's Bounds. | [
"SetMousePosition",
"positions",
"the",
"mouse",
"cursor",
"anywhere",
"within",
"the",
"Window",
"s",
"Bounds",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/input.go#L42-L55 |
30,745 | faiface/pixel | pixelgl/input.go | String | func (b Button) String() string {
name, ok := buttonNames[b]
if !ok {
return "Invalid"
}
return name
} | go | func (b Button) String() string {
name, ok := buttonNames[b]
if !ok {
return "Invalid"
}
return name
} | [
"func",
"(",
"b",
"Button",
")",
"String",
"(",
")",
"string",
"{",
"name",
",",
"ok",
":=",
"buttonNames",
"[",
"b",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"name",
"\n",
"}"
] | // String returns a human-readable string describing the Button. | [
"String",
"returns",
"a",
"human",
"-",
"readable",
"string",
"describing",
"the",
"Button",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/input.go#L218-L224 |
30,746 | faiface/pixel | pixelgl/input.go | UpdateInput | func (w *Window) UpdateInput() {
mainthread.Call(func() {
glfw.PollEvents()
})
w.prevInp = w.currInp
w.currInp = w.tempInp
w.tempInp.repeat = [KeyLast + 1]bool{}
w.tempInp.scroll = pixel.ZV
w.tempInp.typed = ""
w.updateJoystickInput()
} | go | func (w *Window) UpdateInput() {
mainthread.Call(func() {
glfw.PollEvents()
})
w.prevInp = w.currInp
w.currInp = w.tempInp
w.tempInp.repeat = [KeyLast + 1]bool{}
w.tempInp.scroll = pixel.ZV
w.tempInp.typed = ""
w.updateJoystickInput()
} | [
"func",
"(",
"w",
"*",
"Window",
")",
"UpdateInput",
"(",
")",
"{",
"mainthread",
".",
"Call",
"(",
"func",
"(",
")",
"{",
"glfw",
".",
"PollEvents",
"(",
")",
"\n",
"}",
")",
"\n\n",
"w",
".",
"prevInp",
"=",
"w",
".",
"currInp",
"\n",
"w",
".... | // UpdateInput polls window events. Call this function to poll window events
// without swapping buffers. Note that the Update method invokes UpdateInput. | [
"UpdateInput",
"polls",
"window",
"events",
".",
"Call",
"this",
"function",
"to",
"poll",
"window",
"events",
"without",
"swapping",
"buffers",
".",
"Note",
"that",
"the",
"Update",
"method",
"invokes",
"UpdateInput",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/input.go#L407-L420 |
30,747 | faiface/pixel | pixelgl/glshader.go | update | func (gs *glShader) update() {
gs.uf = nil
for _, u := range gs.uniforms {
gs.uf = append(gs.uf, glhf.Attr{
Name: u.Name,
Type: u.Type,
})
}
var shader *glhf.Shader
mainthread.Call(func() {
var err error
shader, err = glhf.NewShader(
gs.vf,
gs.uf,
gs.vs,
gs.fs,
)
if err != nil {
pa... | go | func (gs *glShader) update() {
gs.uf = nil
for _, u := range gs.uniforms {
gs.uf = append(gs.uf, glhf.Attr{
Name: u.Name,
Type: u.Type,
})
}
var shader *glhf.Shader
mainthread.Call(func() {
var err error
shader, err = glhf.NewShader(
gs.vf,
gs.uf,
gs.vs,
gs.fs,
)
if err != nil {
pa... | [
"func",
"(",
"gs",
"*",
"glShader",
")",
"update",
"(",
")",
"{",
"gs",
".",
"uf",
"=",
"nil",
"\n",
"for",
"_",
",",
"u",
":=",
"range",
"gs",
".",
"uniforms",
"{",
"gs",
".",
"uf",
"=",
"append",
"(",
"gs",
".",
"uf",
",",
"glhf",
".",
"A... | // reinitialize GLShader data and recompile the underlying gl shader object | [
"reinitialize",
"GLShader",
"data",
"and",
"recompile",
"the",
"underlying",
"gl",
"shader",
"object"
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/glshader.go#L36-L59 |
30,748 | faiface/pixel | pixelgl/glshader.go | getUniform | func (gs *glShader) getUniform(Name string) int {
for i, u := range gs.uniforms {
if u.Name == Name {
return i
}
}
return -1
} | go | func (gs *glShader) getUniform(Name string) int {
for i, u := range gs.uniforms {
if u.Name == Name {
return i
}
}
return -1
} | [
"func",
"(",
"gs",
"*",
"glShader",
")",
"getUniform",
"(",
"Name",
"string",
")",
"int",
"{",
"for",
"i",
",",
"u",
":=",
"range",
"gs",
".",
"uniforms",
"{",
"if",
"u",
".",
"Name",
"==",
"Name",
"{",
"return",
"i",
"\n",
"}",
"\n",
"}",
"\n"... | // gets the uniform index from GLShader | [
"gets",
"the",
"uniform",
"index",
"from",
"GLShader"
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/glshader.go#L62-L69 |
30,749 | faiface/pixel | pixelgl/glshader.go | baseShader | func baseShader(c *Canvas) {
gs := &glShader{
vf: defaultCanvasVertexFormat,
vs: baseCanvasVertexShader,
fs: baseCanvasFragmentShader,
}
gs.setUniform("uTransform", &gs.uniformDefaults.transform)
gs.setUniform("uColorMask", &gs.uniformDefaults.colormask)
gs.setUniform("uBounds", &gs.uniformDefaults.bounds)
... | go | func baseShader(c *Canvas) {
gs := &glShader{
vf: defaultCanvasVertexFormat,
vs: baseCanvasVertexShader,
fs: baseCanvasFragmentShader,
}
gs.setUniform("uTransform", &gs.uniformDefaults.transform)
gs.setUniform("uColorMask", &gs.uniformDefaults.colormask)
gs.setUniform("uBounds", &gs.uniformDefaults.bounds)
... | [
"func",
"baseShader",
"(",
"c",
"*",
"Canvas",
")",
"{",
"gs",
":=",
"&",
"glShader",
"{",
"vf",
":",
"defaultCanvasVertexFormat",
",",
"vs",
":",
"baseCanvasVertexShader",
",",
"fs",
":",
"baseCanvasFragmentShader",
",",
"}",
"\n\n",
"gs",
".",
"setUniform"... | // Sets up a base shader with everything needed for a Pixel
// canvas to render correctly. The defaults can be overridden
// by simply using the SetUniform function. | [
"Sets",
"up",
"a",
"base",
"shader",
"with",
"everything",
"needed",
"for",
"a",
"Pixel",
"canvas",
"to",
"render",
"correctly",
".",
"The",
"defaults",
"can",
"be",
"overridden",
"by",
"simply",
"using",
"the",
"SetUniform",
"function",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/glshader.go#L98-L111 |
30,750 | faiface/pixel | pixelgl/glshader.go | Value | func (gu *gsUniformAttr) Value() interface{} {
if !gu.ispointer {
return gu.value
}
switch gu.Type {
case glhf.Vec2:
return *gu.value.(*mgl32.Vec2)
case glhf.Vec3:
return *gu.value.(*mgl32.Vec3)
case glhf.Vec4:
return *gu.value.(*mgl32.Vec4)
case glhf.Mat2:
return *gu.value.(*mgl32.Mat2)
case glhf.Mat... | go | func (gu *gsUniformAttr) Value() interface{} {
if !gu.ispointer {
return gu.value
}
switch gu.Type {
case glhf.Vec2:
return *gu.value.(*mgl32.Vec2)
case glhf.Vec3:
return *gu.value.(*mgl32.Vec3)
case glhf.Vec4:
return *gu.value.(*mgl32.Vec4)
case glhf.Mat2:
return *gu.value.(*mgl32.Mat2)
case glhf.Mat... | [
"func",
"(",
"gu",
"*",
"gsUniformAttr",
")",
"Value",
"(",
")",
"interface",
"{",
"}",
"{",
"if",
"!",
"gu",
".",
"ispointer",
"{",
"return",
"gu",
".",
"value",
"\n",
"}",
"\n",
"switch",
"gu",
".",
"Type",
"{",
"case",
"glhf",
".",
"Vec2",
":"... | // Value returns the attribute's concrete value. If the stored value
// is a pointer, we return the dereferenced value. | [
"Value",
"returns",
"the",
"attribute",
"s",
"concrete",
"value",
".",
"If",
"the",
"stored",
"value",
"is",
"a",
"pointer",
"we",
"return",
"the",
"dereferenced",
"value",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/glshader.go#L115-L151 |
30,751 | faiface/pixel | pixelgl/window.go | Update | func (w *Window) Update() {
mainthread.Call(func() {
_, _, oldW, oldH := intBounds(w.bounds)
newW, newH := w.window.GetSize()
w.bounds = w.bounds.ResizedMin(w.bounds.Size().Add(pixel.V(
float64(newW-oldW),
float64(newH-oldH),
)))
})
w.canvas.SetBounds(w.bounds)
mainthread.Call(func() {
w.begin()
... | go | func (w *Window) Update() {
mainthread.Call(func() {
_, _, oldW, oldH := intBounds(w.bounds)
newW, newH := w.window.GetSize()
w.bounds = w.bounds.ResizedMin(w.bounds.Size().Add(pixel.V(
float64(newW-oldW),
float64(newH-oldH),
)))
})
w.canvas.SetBounds(w.bounds)
mainthread.Call(func() {
w.begin()
... | [
"func",
"(",
"w",
"*",
"Window",
")",
"Update",
"(",
")",
"{",
"mainthread",
".",
"Call",
"(",
"func",
"(",
")",
"{",
"_",
",",
"_",
",",
"oldW",
",",
"oldH",
":=",
"intBounds",
"(",
"w",
".",
"bounds",
")",
"\n",
"newW",
",",
"newH",
":=",
"... | // Update swaps buffers and polls events. Call this method at the end of each frame. | [
"Update",
"swaps",
"buffers",
"and",
"polls",
"events",
".",
"Call",
"this",
"method",
"at",
"the",
"end",
"of",
"each",
"frame",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/window.go#L163-L200 |
30,752 | faiface/pixel | pixelgl/window.go | SetClosed | func (w *Window) SetClosed(closed bool) {
mainthread.Call(func() {
w.window.SetShouldClose(closed)
})
} | go | func (w *Window) SetClosed(closed bool) {
mainthread.Call(func() {
w.window.SetShouldClose(closed)
})
} | [
"func",
"(",
"w",
"*",
"Window",
")",
"SetClosed",
"(",
"closed",
"bool",
")",
"{",
"mainthread",
".",
"Call",
"(",
"func",
"(",
")",
"{",
"w",
".",
"window",
".",
"SetShouldClose",
"(",
"closed",
")",
"\n",
"}",
")",
"\n",
"}"
] | // SetClosed sets the closed flag of the Window.
//
// This is useful when overriding the user's attempt to close the Window, or just to close the
// Window from within the program. | [
"SetClosed",
"sets",
"the",
"closed",
"flag",
"of",
"the",
"Window",
".",
"This",
"is",
"useful",
"when",
"overriding",
"the",
"user",
"s",
"attempt",
"to",
"close",
"the",
"Window",
"or",
"just",
"to",
"close",
"the",
"Window",
"from",
"within",
"the",
... | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/window.go#L206-L210 |
30,753 | faiface/pixel | pixelgl/window.go | Closed | func (w *Window) Closed() bool {
var closed bool
mainthread.Call(func() {
closed = w.window.ShouldClose()
})
return closed
} | go | func (w *Window) Closed() bool {
var closed bool
mainthread.Call(func() {
closed = w.window.ShouldClose()
})
return closed
} | [
"func",
"(",
"w",
"*",
"Window",
")",
"Closed",
"(",
")",
"bool",
"{",
"var",
"closed",
"bool",
"\n",
"mainthread",
".",
"Call",
"(",
"func",
"(",
")",
"{",
"closed",
"=",
"w",
".",
"window",
".",
"ShouldClose",
"(",
")",
"\n",
"}",
")",
"\n",
... | // Closed returns the closed flag of the Window, which reports whether the Window should be closed.
//
// The closed flag is automatically set when a user attempts to close the Window. | [
"Closed",
"returns",
"the",
"closed",
"flag",
"of",
"the",
"Window",
"which",
"reports",
"whether",
"the",
"Window",
"should",
"be",
"closed",
".",
"The",
"closed",
"flag",
"is",
"automatically",
"set",
"when",
"a",
"user",
"attempts",
"to",
"close",
"the",
... | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/window.go#L215-L221 |
30,754 | faiface/pixel | pixelgl/window.go | SetTitle | func (w *Window) SetTitle(title string) {
mainthread.Call(func() {
w.window.SetTitle(title)
})
} | go | func (w *Window) SetTitle(title string) {
mainthread.Call(func() {
w.window.SetTitle(title)
})
} | [
"func",
"(",
"w",
"*",
"Window",
")",
"SetTitle",
"(",
"title",
"string",
")",
"{",
"mainthread",
".",
"Call",
"(",
"func",
"(",
")",
"{",
"w",
".",
"window",
".",
"SetTitle",
"(",
"title",
")",
"\n",
"}",
")",
"\n",
"}"
] | // SetTitle changes the title of the Window. | [
"SetTitle",
"changes",
"the",
"title",
"of",
"the",
"Window",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/window.go#L224-L228 |
30,755 | faiface/pixel | pixelgl/window.go | SetBounds | func (w *Window) SetBounds(bounds pixel.Rect) {
w.bounds = bounds
mainthread.Call(func() {
_, _, width, height := intBounds(bounds)
w.window.SetSize(width, height)
})
} | go | func (w *Window) SetBounds(bounds pixel.Rect) {
w.bounds = bounds
mainthread.Call(func() {
_, _, width, height := intBounds(bounds)
w.window.SetSize(width, height)
})
} | [
"func",
"(",
"w",
"*",
"Window",
")",
"SetBounds",
"(",
"bounds",
"pixel",
".",
"Rect",
")",
"{",
"w",
".",
"bounds",
"=",
"bounds",
"\n",
"mainthread",
".",
"Call",
"(",
"func",
"(",
")",
"{",
"_",
",",
"_",
",",
"width",
",",
"height",
":=",
... | // SetBounds sets the bounds of the Window in pixels. Bounds can be fractional, but the actual size
// of the window will be rounded to integers. | [
"SetBounds",
"sets",
"the",
"bounds",
"of",
"the",
"Window",
"in",
"pixels",
".",
"Bounds",
"can",
"be",
"fractional",
"but",
"the",
"actual",
"size",
"of",
"the",
"window",
"will",
"be",
"rounded",
"to",
"integers",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/window.go#L232-L238 |
30,756 | faiface/pixel | pixelgl/window.go | SetPos | func (w *Window) SetPos(pos pixel.Vec) {
mainthread.Call(func() {
left, top := int(pos.X), int(pos.Y)
w.window.SetPos(left, top)
})
} | go | func (w *Window) SetPos(pos pixel.Vec) {
mainthread.Call(func() {
left, top := int(pos.X), int(pos.Y)
w.window.SetPos(left, top)
})
} | [
"func",
"(",
"w",
"*",
"Window",
")",
"SetPos",
"(",
"pos",
"pixel",
".",
"Vec",
")",
"{",
"mainthread",
".",
"Call",
"(",
"func",
"(",
")",
"{",
"left",
",",
"top",
":=",
"int",
"(",
"pos",
".",
"X",
")",
",",
"int",
"(",
"pos",
".",
"Y",
... | // SetPos sets the position, in screen coordinates, of the upper-left corner
// of the client area of the window. Position can be fractional, but the actual position
// of the window will be rounded to integers.
//
// If it is a full screen window, this function does nothing. | [
"SetPos",
"sets",
"the",
"position",
"in",
"screen",
"coordinates",
"of",
"the",
"upper",
"-",
"left",
"corner",
"of",
"the",
"client",
"area",
"of",
"the",
"window",
".",
"Position",
"can",
"be",
"fractional",
"but",
"the",
"actual",
"position",
"of",
"th... | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/window.go#L245-L250 |
30,757 | faiface/pixel | pixelgl/window.go | GetPos | func (w *Window) GetPos() pixel.Vec {
var v pixel.Vec
mainthread.Call(func() {
x, y := w.window.GetPos()
v = pixel.V(float64(x), float64(y))
})
return v
} | go | func (w *Window) GetPos() pixel.Vec {
var v pixel.Vec
mainthread.Call(func() {
x, y := w.window.GetPos()
v = pixel.V(float64(x), float64(y))
})
return v
} | [
"func",
"(",
"w",
"*",
"Window",
")",
"GetPos",
"(",
")",
"pixel",
".",
"Vec",
"{",
"var",
"v",
"pixel",
".",
"Vec",
"\n",
"mainthread",
".",
"Call",
"(",
"func",
"(",
")",
"{",
"x",
",",
"y",
":=",
"w",
".",
"window",
".",
"GetPos",
"(",
")"... | // GetPos gets the position, in screen coordinates, of the upper-left corner
// of the client area of the window. The position is rounded to integers. | [
"GetPos",
"gets",
"the",
"position",
"in",
"screen",
"coordinates",
"of",
"the",
"upper",
"-",
"left",
"corner",
"of",
"the",
"client",
"area",
"of",
"the",
"window",
".",
"The",
"position",
"is",
"rounded",
"to",
"integers",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/window.go#L254-L261 |
30,758 | faiface/pixel | pixelgl/window.go | SetMonitor | func (w *Window) SetMonitor(monitor *Monitor) {
if w.Monitor() != monitor {
if monitor != nil {
w.setFullscreen(monitor)
} else {
w.setWindowed()
}
}
} | go | func (w *Window) SetMonitor(monitor *Monitor) {
if w.Monitor() != monitor {
if monitor != nil {
w.setFullscreen(monitor)
} else {
w.setWindowed()
}
}
} | [
"func",
"(",
"w",
"*",
"Window",
")",
"SetMonitor",
"(",
"monitor",
"*",
"Monitor",
")",
"{",
"if",
"w",
".",
"Monitor",
"(",
")",
"!=",
"monitor",
"{",
"if",
"monitor",
"!=",
"nil",
"{",
"w",
".",
"setFullscreen",
"(",
"monitor",
")",
"\n",
"}",
... | // SetMonitor sets the Window fullscreen on the given Monitor. If the Monitor is nil, the Window
// will be restored to windowed state instead.
//
// The Window will be automatically set to the Monitor's resolution. If you want a different
// resolution, you will need to set it manually with SetBounds method. | [
"SetMonitor",
"sets",
"the",
"Window",
"fullscreen",
"on",
"the",
"given",
"Monitor",
".",
"If",
"the",
"Monitor",
"is",
"nil",
"the",
"Window",
"will",
"be",
"restored",
"to",
"windowed",
"state",
"instead",
".",
"The",
"Window",
"will",
"be",
"automaticall... | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/window.go#L304-L312 |
30,759 | faiface/pixel | pixelgl/window.go | Monitor | func (w *Window) Monitor() *Monitor {
var monitor *glfw.Monitor
mainthread.Call(func() {
monitor = w.window.GetMonitor()
})
if monitor == nil {
return nil
}
return &Monitor{
monitor: monitor,
}
} | go | func (w *Window) Monitor() *Monitor {
var monitor *glfw.Monitor
mainthread.Call(func() {
monitor = w.window.GetMonitor()
})
if monitor == nil {
return nil
}
return &Monitor{
monitor: monitor,
}
} | [
"func",
"(",
"w",
"*",
"Window",
")",
"Monitor",
"(",
")",
"*",
"Monitor",
"{",
"var",
"monitor",
"*",
"glfw",
".",
"Monitor",
"\n",
"mainthread",
".",
"Call",
"(",
"func",
"(",
")",
"{",
"monitor",
"=",
"w",
".",
"window",
".",
"GetMonitor",
"(",
... | // Monitor returns a monitor the Window is fullscreen on. If the Window is not fullscreen, this
// function returns nil. | [
"Monitor",
"returns",
"a",
"monitor",
"the",
"Window",
"is",
"fullscreen",
"on",
".",
"If",
"the",
"Window",
"is",
"not",
"fullscreen",
"this",
"function",
"returns",
"nil",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/window.go#L316-L327 |
30,760 | faiface/pixel | pixelgl/window.go | Focused | func (w *Window) Focused() bool {
var focused bool
mainthread.Call(func() {
focused = w.window.GetAttrib(glfw.Focused) == glfw.True
})
return focused
} | go | func (w *Window) Focused() bool {
var focused bool
mainthread.Call(func() {
focused = w.window.GetAttrib(glfw.Focused) == glfw.True
})
return focused
} | [
"func",
"(",
"w",
"*",
"Window",
")",
"Focused",
"(",
")",
"bool",
"{",
"var",
"focused",
"bool",
"\n",
"mainthread",
".",
"Call",
"(",
"func",
"(",
")",
"{",
"focused",
"=",
"w",
".",
"window",
".",
"GetAttrib",
"(",
"glfw",
".",
"Focused",
")",
... | // Focused returns true if the Window has input focus. | [
"Focused",
"returns",
"true",
"if",
"the",
"Window",
"has",
"input",
"focus",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/window.go#L330-L336 |
30,761 | faiface/pixel | pixelgl/window.go | SetCursorVisible | func (w *Window) SetCursorVisible(visible bool) {
w.cursorVisible = visible
mainthread.Call(func() {
if visible {
w.window.SetInputMode(glfw.CursorMode, glfw.CursorNormal)
} else {
w.window.SetInputMode(glfw.CursorMode, glfw.CursorHidden)
}
})
} | go | func (w *Window) SetCursorVisible(visible bool) {
w.cursorVisible = visible
mainthread.Call(func() {
if visible {
w.window.SetInputMode(glfw.CursorMode, glfw.CursorNormal)
} else {
w.window.SetInputMode(glfw.CursorMode, glfw.CursorHidden)
}
})
} | [
"func",
"(",
"w",
"*",
"Window",
")",
"SetCursorVisible",
"(",
"visible",
"bool",
")",
"{",
"w",
".",
"cursorVisible",
"=",
"visible",
"\n",
"mainthread",
".",
"Call",
"(",
"func",
"(",
")",
"{",
"if",
"visible",
"{",
"w",
".",
"window",
".",
"SetInp... | // SetCursorVisible sets the visibility of the mouse cursor inside the Window client area. | [
"SetCursorVisible",
"sets",
"the",
"visibility",
"of",
"the",
"mouse",
"cursor",
"inside",
"the",
"Window",
"client",
"area",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/window.go#L349-L358 |
30,762 | faiface/pixel | pixelgl/window.go | MakeTriangles | func (w *Window) MakeTriangles(t pixel.Triangles) pixel.TargetTriangles {
return w.canvas.MakeTriangles(t)
} | go | func (w *Window) MakeTriangles(t pixel.Triangles) pixel.TargetTriangles {
return w.canvas.MakeTriangles(t)
} | [
"func",
"(",
"w",
"*",
"Window",
")",
"MakeTriangles",
"(",
"t",
"pixel",
".",
"Triangles",
")",
"pixel",
".",
"TargetTriangles",
"{",
"return",
"w",
".",
"canvas",
".",
"MakeTriangles",
"(",
"t",
")",
"\n",
"}"
] | // MakeTriangles generates a specialized copy of the supplied Triangles that will draw onto this
// Window.
//
// Window supports TrianglesPosition, TrianglesColor and TrianglesPicture. | [
"MakeTriangles",
"generates",
"a",
"specialized",
"copy",
"of",
"the",
"supplied",
"Triangles",
"that",
"will",
"draw",
"onto",
"this",
"Window",
".",
"Window",
"supports",
"TrianglesPosition",
"TrianglesColor",
"and",
"TrianglesPicture",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/window.go#L382-L384 |
30,763 | faiface/pixel | pixelgl/window.go | MakePicture | func (w *Window) MakePicture(p pixel.Picture) pixel.TargetPicture {
return w.canvas.MakePicture(p)
} | go | func (w *Window) MakePicture(p pixel.Picture) pixel.TargetPicture {
return w.canvas.MakePicture(p)
} | [
"func",
"(",
"w",
"*",
"Window",
")",
"MakePicture",
"(",
"p",
"pixel",
".",
"Picture",
")",
"pixel",
".",
"TargetPicture",
"{",
"return",
"w",
".",
"canvas",
".",
"MakePicture",
"(",
"p",
")",
"\n",
"}"
] | // MakePicture generates a specialized copy of the supplied Picture that will draw onto this Window.
//
// Window supports PictureColor. | [
"MakePicture",
"generates",
"a",
"specialized",
"copy",
"of",
"the",
"supplied",
"Picture",
"that",
"will",
"draw",
"onto",
"this",
"Window",
".",
"Window",
"supports",
"PictureColor",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/window.go#L389-L391 |
30,764 | faiface/pixel | pixelgl/window.go | SetColorMask | func (w *Window) SetColorMask(c color.Color) {
w.canvas.SetColorMask(c)
} | go | func (w *Window) SetColorMask(c color.Color) {
w.canvas.SetColorMask(c)
} | [
"func",
"(",
"w",
"*",
"Window",
")",
"SetColorMask",
"(",
"c",
"color",
".",
"Color",
")",
"{",
"w",
".",
"canvas",
".",
"SetColorMask",
"(",
"c",
")",
"\n",
"}"
] | // SetColorMask sets a global color mask for the Window. | [
"SetColorMask",
"sets",
"a",
"global",
"color",
"mask",
"for",
"the",
"Window",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/window.go#L399-L401 |
30,765 | faiface/pixel | pixelgl/window.go | SetComposeMethod | func (w *Window) SetComposeMethod(cmp pixel.ComposeMethod) {
w.canvas.SetComposeMethod(cmp)
} | go | func (w *Window) SetComposeMethod(cmp pixel.ComposeMethod) {
w.canvas.SetComposeMethod(cmp)
} | [
"func",
"(",
"w",
"*",
"Window",
")",
"SetComposeMethod",
"(",
"cmp",
"pixel",
".",
"ComposeMethod",
")",
"{",
"w",
".",
"canvas",
".",
"SetComposeMethod",
"(",
"cmp",
")",
"\n",
"}"
] | // SetComposeMethod sets a Porter-Duff composition method to be used in the following draws onto
// this Window. | [
"SetComposeMethod",
"sets",
"a",
"Porter",
"-",
"Duff",
"composition",
"method",
"to",
"be",
"used",
"in",
"the",
"following",
"draws",
"onto",
"this",
"Window",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/window.go#L405-L407 |
30,766 | faiface/pixel | pixelgl/window.go | Clear | func (w *Window) Clear(c color.Color) {
w.canvas.Clear(c)
} | go | func (w *Window) Clear(c color.Color) {
w.canvas.Clear(c)
} | [
"func",
"(",
"w",
"*",
"Window",
")",
"Clear",
"(",
"c",
"color",
".",
"Color",
")",
"{",
"w",
".",
"canvas",
".",
"Clear",
"(",
"c",
")",
"\n",
"}"
] | // Clear clears the Window with a single color. | [
"Clear",
"clears",
"the",
"Window",
"with",
"a",
"single",
"color",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/window.go#L422-L424 |
30,767 | faiface/pixel | pixelgl/window.go | Color | func (w *Window) Color(at pixel.Vec) pixel.RGBA {
return w.canvas.Color(at)
} | go | func (w *Window) Color(at pixel.Vec) pixel.RGBA {
return w.canvas.Color(at)
} | [
"func",
"(",
"w",
"*",
"Window",
")",
"Color",
"(",
"at",
"pixel",
".",
"Vec",
")",
"pixel",
".",
"RGBA",
"{",
"return",
"w",
".",
"canvas",
".",
"Color",
"(",
"at",
")",
"\n",
"}"
] | // Color returns the color of the pixel over the given position inside the Window. | [
"Color",
"returns",
"the",
"color",
"of",
"the",
"pixel",
"over",
"the",
"given",
"position",
"inside",
"the",
"Window",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/window.go#L427-L429 |
30,768 | faiface/pixel | text/atlas.go | Contains | func (a *Atlas) Contains(r rune) bool {
_, ok := a.mapping[r]
return ok
} | go | func (a *Atlas) Contains(r rune) bool {
_, ok := a.mapping[r]
return ok
} | [
"func",
"(",
"a",
"*",
"Atlas",
")",
"Contains",
"(",
"r",
"rune",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"a",
".",
"mapping",
"[",
"r",
"]",
"\n",
"return",
"ok",
"\n",
"}"
] | // Contains reports wheter r in contained within the Atlas. | [
"Contains",
"reports",
"wheter",
"r",
"in",
"contained",
"within",
"the",
"Atlas",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/text/atlas.go#L108-L111 |
30,769 | faiface/pixel | text/atlas.go | Kern | func (a *Atlas) Kern(r0, r1 rune) float64 {
return i2f(a.face.Kern(r0, r1))
} | go | func (a *Atlas) Kern(r0, r1 rune) float64 {
return i2f(a.face.Kern(r0, r1))
} | [
"func",
"(",
"a",
"*",
"Atlas",
")",
"Kern",
"(",
"r0",
",",
"r1",
"rune",
")",
"float64",
"{",
"return",
"i2f",
"(",
"a",
".",
"face",
".",
"Kern",
"(",
"r0",
",",
"r1",
")",
")",
"\n",
"}"
] | // Kern returns the kerning distance between runes r0 and r1. Positive distance means that the
// glyphs should be further apart. | [
"Kern",
"returns",
"the",
"kerning",
"distance",
"between",
"runes",
"r0",
"and",
"r1",
".",
"Positive",
"distance",
"means",
"that",
"the",
"glyphs",
"should",
"be",
"further",
"apart",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/text/atlas.go#L120-L122 |
30,770 | faiface/pixel | text/atlas.go | DrawRune | func (a *Atlas) DrawRune(prevR, r rune, dot pixel.Vec) (rect, frame, bounds pixel.Rect, newDot pixel.Vec) {
if !a.Contains(r) {
r = unicode.ReplacementChar
}
if !a.Contains(unicode.ReplacementChar) {
return pixel.Rect{}, pixel.Rect{}, pixel.Rect{}, dot
}
if !a.Contains(prevR) {
prevR = unicode.ReplacementCha... | go | func (a *Atlas) DrawRune(prevR, r rune, dot pixel.Vec) (rect, frame, bounds pixel.Rect, newDot pixel.Vec) {
if !a.Contains(r) {
r = unicode.ReplacementChar
}
if !a.Contains(unicode.ReplacementChar) {
return pixel.Rect{}, pixel.Rect{}, pixel.Rect{}, dot
}
if !a.Contains(prevR) {
prevR = unicode.ReplacementCha... | [
"func",
"(",
"a",
"*",
"Atlas",
")",
"DrawRune",
"(",
"prevR",
",",
"r",
"rune",
",",
"dot",
"pixel",
".",
"Vec",
")",
"(",
"rect",
",",
"frame",
",",
"bounds",
"pixel",
".",
"Rect",
",",
"newDot",
"pixel",
".",
"Vec",
")",
"{",
"if",
"!",
"a",... | // DrawRune returns parameters necessary for drawing a rune glyph.
//
// Rect is a rectangle where the glyph should be positioned. Frame is the glyph frame inside the
// Atlas's Picture. NewDot is the new position of the dot. | [
"DrawRune",
"returns",
"parameters",
"necessary",
"for",
"drawing",
"a",
"rune",
"glyph",
".",
"Rect",
"is",
"a",
"rectangle",
"where",
"the",
"glyph",
"should",
"be",
"positioned",
".",
"Frame",
"is",
"the",
"glyph",
"frame",
"inside",
"the",
"Atlas",
"s",
... | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/text/atlas.go#L143-L175 |
30,771 | faiface/pixel | text/atlas.go | makeSquareMapping | func makeSquareMapping(face font.Face, runes []rune, padding fixed.Int26_6) (map[rune]fixedGlyph, fixed.Rectangle26_6) {
width := sort.Search(int(fixed.I(1024*1024)), func(i int) bool {
width := fixed.Int26_6(i)
_, bounds := makeMapping(face, runes, padding, width)
return bounds.Max.X-bounds.Min.X >= bounds.Max.... | go | func makeSquareMapping(face font.Face, runes []rune, padding fixed.Int26_6) (map[rune]fixedGlyph, fixed.Rectangle26_6) {
width := sort.Search(int(fixed.I(1024*1024)), func(i int) bool {
width := fixed.Int26_6(i)
_, bounds := makeMapping(face, runes, padding, width)
return bounds.Max.X-bounds.Min.X >= bounds.Max.... | [
"func",
"makeSquareMapping",
"(",
"face",
"font",
".",
"Face",
",",
"runes",
"[",
"]",
"rune",
",",
"padding",
"fixed",
".",
"Int26_6",
")",
"(",
"map",
"[",
"rune",
"]",
"fixedGlyph",
",",
"fixed",
".",
"Rectangle26_6",
")",
"{",
"width",
":=",
"sort"... | // makeSquareMapping finds an optimal glyph arrangement of the given runes, so that their common
// bounding box is as square as possible. | [
"makeSquareMapping",
"finds",
"an",
"optimal",
"glyph",
"arrangement",
"of",
"the",
"given",
"runes",
"so",
"that",
"their",
"common",
"bounding",
"box",
"is",
"as",
"square",
"as",
"possible",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/text/atlas.go#L185-L192 |
30,772 | faiface/pixel | text/atlas.go | makeMapping | func makeMapping(face font.Face, runes []rune, padding, width fixed.Int26_6) (map[rune]fixedGlyph, fixed.Rectangle26_6) {
mapping := make(map[rune]fixedGlyph)
bounds := fixed.Rectangle26_6{}
dot := fixed.P(0, 0)
for _, r := range runes {
b, advance, ok := face.GlyphBounds(r)
if !ok {
fmt.Println(r)
cont... | go | func makeMapping(face font.Face, runes []rune, padding, width fixed.Int26_6) (map[rune]fixedGlyph, fixed.Rectangle26_6) {
mapping := make(map[rune]fixedGlyph)
bounds := fixed.Rectangle26_6{}
dot := fixed.P(0, 0)
for _, r := range runes {
b, advance, ok := face.GlyphBounds(r)
if !ok {
fmt.Println(r)
cont... | [
"func",
"makeMapping",
"(",
"face",
"font",
".",
"Face",
",",
"runes",
"[",
"]",
"rune",
",",
"padding",
",",
"width",
"fixed",
".",
"Int26_6",
")",
"(",
"map",
"[",
"rune",
"]",
"fixedGlyph",
",",
"fixed",
".",
"Rectangle26_6",
")",
"{",
"mapping",
... | // makeMapping arranges glyphs of the given runes into rows in such a way, that no glyph is located
// fully to the right of the specified width. Specifically, it places glyphs in a row one by one and
// once it reaches the specified width, it starts a new row. | [
"makeMapping",
"arranges",
"glyphs",
"of",
"the",
"given",
"runes",
"into",
"rows",
"in",
"such",
"a",
"way",
"that",
"no",
"glyph",
"is",
"located",
"fully",
"to",
"the",
"right",
"of",
"the",
"specified",
"width",
".",
"Specifically",
"it",
"places",
"gl... | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/text/atlas.go#L197-L244 |
30,773 | faiface/pixel | pixelgl/canvas.go | NewCanvas | func NewCanvas(bounds pixel.Rect) *Canvas {
c := &Canvas{
gf: NewGLFrame(bounds),
mat: mgl32.Ident3(),
col: mgl32.Vec4{1, 1, 1, 1},
}
baseShader(c)
c.SetBounds(bounds)
c.shader.update()
return c
} | go | func NewCanvas(bounds pixel.Rect) *Canvas {
c := &Canvas{
gf: NewGLFrame(bounds),
mat: mgl32.Ident3(),
col: mgl32.Vec4{1, 1, 1, 1},
}
baseShader(c)
c.SetBounds(bounds)
c.shader.update()
return c
} | [
"func",
"NewCanvas",
"(",
"bounds",
"pixel",
".",
"Rect",
")",
"*",
"Canvas",
"{",
"c",
":=",
"&",
"Canvas",
"{",
"gf",
":",
"NewGLFrame",
"(",
"bounds",
")",
",",
"mat",
":",
"mgl32",
".",
"Ident3",
"(",
")",
",",
"col",
":",
"mgl32",
".",
"Vec4... | // NewCanvas creates a new empty, fully transparent Canvas with given bounds. | [
"NewCanvas",
"creates",
"a",
"new",
"empty",
"fully",
"transparent",
"Canvas",
"with",
"given",
"bounds",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/canvas.go#L33-L44 |
30,774 | faiface/pixel | pixelgl/canvas.go | SetUniform | func (c *Canvas) SetUniform(name string, value interface{}) {
c.shader.setUniform(name, value)
} | go | func (c *Canvas) SetUniform(name string, value interface{}) {
c.shader.setUniform(name, value)
} | [
"func",
"(",
"c",
"*",
"Canvas",
")",
"SetUniform",
"(",
"name",
"string",
",",
"value",
"interface",
"{",
"}",
")",
"{",
"c",
".",
"shader",
".",
"setUniform",
"(",
"name",
",",
"value",
")",
"\n",
"}"
] | // SetUniform will update the named uniform with the value of any supported underlying
// attribute variable. If the uniform already exists, including defaults, they will be reassigned
// to the new value. The value can be a pointer. | [
"SetUniform",
"will",
"update",
"the",
"named",
"uniform",
"with",
"the",
"value",
"of",
"any",
"supported",
"underlying",
"attribute",
"variable",
".",
"If",
"the",
"uniform",
"already",
"exists",
"including",
"defaults",
"they",
"will",
"be",
"reassigned",
"to... | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/canvas.go#L49-L51 |
30,775 | faiface/pixel | pixelgl/canvas.go | SetFragmentShader | func (c *Canvas) SetFragmentShader(src string) {
c.shader.fs = src
c.shader.update()
} | go | func (c *Canvas) SetFragmentShader(src string) {
c.shader.fs = src
c.shader.update()
} | [
"func",
"(",
"c",
"*",
"Canvas",
")",
"SetFragmentShader",
"(",
"src",
"string",
")",
"{",
"c",
".",
"shader",
".",
"fs",
"=",
"src",
"\n",
"c",
".",
"shader",
".",
"update",
"(",
")",
"\n",
"}"
] | // SetFragmentShader allows you to set a new fragment shader on the underlying
// framebuffer. Argument "src" is the GLSL source, not a filename. | [
"SetFragmentShader",
"allows",
"you",
"to",
"set",
"a",
"new",
"fragment",
"shader",
"on",
"the",
"underlying",
"framebuffer",
".",
"Argument",
"src",
"is",
"the",
"GLSL",
"source",
"not",
"a",
"filename",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/canvas.go#L55-L58 |
30,776 | faiface/pixel | pixelgl/canvas.go | MakeTriangles | func (c *Canvas) MakeTriangles(t pixel.Triangles) pixel.TargetTriangles {
return &canvasTriangles{
GLTriangles: NewGLTriangles(c.shader.s, t),
dst: c,
}
} | go | func (c *Canvas) MakeTriangles(t pixel.Triangles) pixel.TargetTriangles {
return &canvasTriangles{
GLTriangles: NewGLTriangles(c.shader.s, t),
dst: c,
}
} | [
"func",
"(",
"c",
"*",
"Canvas",
")",
"MakeTriangles",
"(",
"t",
"pixel",
".",
"Triangles",
")",
"pixel",
".",
"TargetTriangles",
"{",
"return",
"&",
"canvasTriangles",
"{",
"GLTriangles",
":",
"NewGLTriangles",
"(",
"c",
".",
"shader",
".",
"s",
",",
"t... | // MakeTriangles creates a specialized copy of the supplied Triangles that draws onto this Canvas.
//
// TrianglesPosition, TrianglesColor and TrianglesPicture are supported. | [
"MakeTriangles",
"creates",
"a",
"specialized",
"copy",
"of",
"the",
"supplied",
"Triangles",
"that",
"draws",
"onto",
"this",
"Canvas",
".",
"TrianglesPosition",
"TrianglesColor",
"and",
"TrianglesPicture",
"are",
"supported",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/canvas.go#L63-L68 |
30,777 | faiface/pixel | pixelgl/canvas.go | MakePicture | func (c *Canvas) MakePicture(p pixel.Picture) pixel.TargetPicture {
if cp, ok := p.(*canvasPicture); ok {
return &canvasPicture{
GLPicture: cp.GLPicture,
dst: c,
}
}
if gp, ok := p.(GLPicture); ok {
return &canvasPicture{
GLPicture: gp,
dst: c,
}
}
return &canvasPicture{
GLPicture... | go | func (c *Canvas) MakePicture(p pixel.Picture) pixel.TargetPicture {
if cp, ok := p.(*canvasPicture); ok {
return &canvasPicture{
GLPicture: cp.GLPicture,
dst: c,
}
}
if gp, ok := p.(GLPicture); ok {
return &canvasPicture{
GLPicture: gp,
dst: c,
}
}
return &canvasPicture{
GLPicture... | [
"func",
"(",
"c",
"*",
"Canvas",
")",
"MakePicture",
"(",
"p",
"pixel",
".",
"Picture",
")",
"pixel",
".",
"TargetPicture",
"{",
"if",
"cp",
",",
"ok",
":=",
"p",
".",
"(",
"*",
"canvasPicture",
")",
";",
"ok",
"{",
"return",
"&",
"canvasPicture",
... | // MakePicture create a specialized copy of the supplied Picture that draws onto this Canvas.
//
// PictureColor is supported. | [
"MakePicture",
"create",
"a",
"specialized",
"copy",
"of",
"the",
"supplied",
"Picture",
"that",
"draws",
"onto",
"this",
"Canvas",
".",
"PictureColor",
"is",
"supported",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/canvas.go#L73-L90 |
30,778 | faiface/pixel | pixelgl/canvas.go | SetColorMask | func (c *Canvas) SetColorMask(col color.Color) {
rgba := pixel.Alpha(1)
if col != nil {
rgba = pixel.ToRGBA(col)
}
c.col = mgl32.Vec4{
float32(rgba.R),
float32(rgba.G),
float32(rgba.B),
float32(rgba.A),
}
} | go | func (c *Canvas) SetColorMask(col color.Color) {
rgba := pixel.Alpha(1)
if col != nil {
rgba = pixel.ToRGBA(col)
}
c.col = mgl32.Vec4{
float32(rgba.R),
float32(rgba.G),
float32(rgba.B),
float32(rgba.A),
}
} | [
"func",
"(",
"c",
"*",
"Canvas",
")",
"SetColorMask",
"(",
"col",
"color",
".",
"Color",
")",
"{",
"rgba",
":=",
"pixel",
".",
"Alpha",
"(",
"1",
")",
"\n",
"if",
"col",
"!=",
"nil",
"{",
"rgba",
"=",
"pixel",
".",
"ToRGBA",
"(",
"col",
")",
"\... | // SetColorMask sets a color that every color in triangles or a picture will be multiplied by. | [
"SetColorMask",
"sets",
"a",
"color",
"that",
"every",
"color",
"in",
"triangles",
"or",
"a",
"picture",
"will",
"be",
"multiplied",
"by",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/canvas.go#L105-L116 |
30,779 | faiface/pixel | pixelgl/canvas.go | SetBounds | func (c *Canvas) SetBounds(bounds pixel.Rect) {
c.gf.SetBounds(bounds)
if c.sprite == nil {
c.sprite = pixel.NewSprite(nil, pixel.Rect{})
}
c.sprite.Set(c, c.Bounds())
//c.sprite.SetMatrix(pixel.IM.Moved(c.Bounds().Center()))
} | go | func (c *Canvas) SetBounds(bounds pixel.Rect) {
c.gf.SetBounds(bounds)
if c.sprite == nil {
c.sprite = pixel.NewSprite(nil, pixel.Rect{})
}
c.sprite.Set(c, c.Bounds())
//c.sprite.SetMatrix(pixel.IM.Moved(c.Bounds().Center()))
} | [
"func",
"(",
"c",
"*",
"Canvas",
")",
"SetBounds",
"(",
"bounds",
"pixel",
".",
"Rect",
")",
"{",
"c",
".",
"gf",
".",
"SetBounds",
"(",
"bounds",
")",
"\n",
"if",
"c",
".",
"sprite",
"==",
"nil",
"{",
"c",
".",
"sprite",
"=",
"pixel",
".",
"Ne... | // SetBounds resizes the Canvas to the new bounds. Old content will be preserved. | [
"SetBounds",
"resizes",
"the",
"Canvas",
"to",
"the",
"new",
"bounds",
".",
"Old",
"content",
"will",
"be",
"preserved",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/canvas.go#L125-L132 |
30,780 | faiface/pixel | pixelgl/canvas.go | Clear | func (c *Canvas) Clear(color color.Color) {
c.gf.Dirty()
rgba := pixel.ToRGBA(color)
// color masking
rgba = rgba.Mul(pixel.RGBA{
R: float64(c.col[0]),
G: float64(c.col[1]),
B: float64(c.col[2]),
A: float64(c.col[3]),
})
mainthread.CallNonBlock(func() {
c.setGlhfBounds()
c.gf.Frame().Begin()
glhf... | go | func (c *Canvas) Clear(color color.Color) {
c.gf.Dirty()
rgba := pixel.ToRGBA(color)
// color masking
rgba = rgba.Mul(pixel.RGBA{
R: float64(c.col[0]),
G: float64(c.col[1]),
B: float64(c.col[2]),
A: float64(c.col[3]),
})
mainthread.CallNonBlock(func() {
c.setGlhfBounds()
c.gf.Frame().Begin()
glhf... | [
"func",
"(",
"c",
"*",
"Canvas",
")",
"Clear",
"(",
"color",
"color",
".",
"Color",
")",
"{",
"c",
".",
"gf",
".",
"Dirty",
"(",
")",
"\n\n",
"rgba",
":=",
"pixel",
".",
"ToRGBA",
"(",
"color",
")",
"\n\n",
"// color masking",
"rgba",
"=",
"rgba",
... | // Clear fills the whole Canvas with a single color. | [
"Clear",
"fills",
"the",
"whole",
"Canvas",
"with",
"a",
"single",
"color",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/canvas.go#L188-L212 |
30,781 | faiface/pixel | pixelgl/canvas.go | Color | func (c *Canvas) Color(at pixel.Vec) pixel.RGBA {
return c.gf.Color(at)
} | go | func (c *Canvas) Color(at pixel.Vec) pixel.RGBA {
return c.gf.Color(at)
} | [
"func",
"(",
"c",
"*",
"Canvas",
")",
"Color",
"(",
"at",
"pixel",
".",
"Vec",
")",
"pixel",
".",
"RGBA",
"{",
"return",
"c",
".",
"gf",
".",
"Color",
"(",
"at",
")",
"\n",
"}"
] | // Color returns the color of the pixel over the given position inside the Canvas. | [
"Color",
"returns",
"the",
"color",
"of",
"the",
"pixel",
"over",
"the",
"given",
"position",
"inside",
"the",
"Canvas",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/canvas.go#L215-L217 |
30,782 | faiface/pixel | pixelgl/canvas.go | Pixels | func (c *Canvas) Pixels() []uint8 {
var pixels []uint8
mainthread.Call(func() {
tex := c.Texture()
tex.Begin()
pixels = tex.Pixels(0, 0, tex.Width(), tex.Height())
tex.End()
})
return pixels
} | go | func (c *Canvas) Pixels() []uint8 {
var pixels []uint8
mainthread.Call(func() {
tex := c.Texture()
tex.Begin()
pixels = tex.Pixels(0, 0, tex.Width(), tex.Height())
tex.End()
})
return pixels
} | [
"func",
"(",
"c",
"*",
"Canvas",
")",
"Pixels",
"(",
")",
"[",
"]",
"uint8",
"{",
"var",
"pixels",
"[",
"]",
"uint8",
"\n\n",
"mainthread",
".",
"Call",
"(",
"func",
"(",
")",
"{",
"tex",
":=",
"c",
".",
"Texture",
"(",
")",
"\n",
"tex",
".",
... | // Pixels returns an alpha-premultiplied RGBA sequence of the content of the Canvas. | [
"Pixels",
"returns",
"an",
"alpha",
"-",
"premultiplied",
"RGBA",
"sequence",
"of",
"the",
"content",
"of",
"the",
"Canvas",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/canvas.go#L245-L256 |
30,783 | faiface/pixel | pixelgl/canvas.go | Draw | func (c *Canvas) Draw(t pixel.Target, matrix pixel.Matrix) {
c.sprite.Draw(t, matrix)
} | go | func (c *Canvas) Draw(t pixel.Target, matrix pixel.Matrix) {
c.sprite.Draw(t, matrix)
} | [
"func",
"(",
"c",
"*",
"Canvas",
")",
"Draw",
"(",
"t",
"pixel",
".",
"Target",
",",
"matrix",
"pixel",
".",
"Matrix",
")",
"{",
"c",
".",
"sprite",
".",
"Draw",
"(",
"t",
",",
"matrix",
")",
"\n",
"}"
] | // Draw draws the content of the Canvas onto another Target, transformed by the given Matrix, just
// like if it was a Sprite containing the whole Canvas. | [
"Draw",
"draws",
"the",
"content",
"of",
"the",
"Canvas",
"onto",
"another",
"Target",
"transformed",
"by",
"the",
"given",
"Matrix",
"just",
"like",
"if",
"it",
"was",
"a",
"Sprite",
"containing",
"the",
"whole",
"Canvas",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/canvas.go#L260-L262 |
30,784 | faiface/pixel | pixelgl/canvas.go | DrawColorMask | func (c *Canvas) DrawColorMask(t pixel.Target, matrix pixel.Matrix, mask color.Color) {
c.sprite.DrawColorMask(t, matrix, mask)
} | go | func (c *Canvas) DrawColorMask(t pixel.Target, matrix pixel.Matrix, mask color.Color) {
c.sprite.DrawColorMask(t, matrix, mask)
} | [
"func",
"(",
"c",
"*",
"Canvas",
")",
"DrawColorMask",
"(",
"t",
"pixel",
".",
"Target",
",",
"matrix",
"pixel",
".",
"Matrix",
",",
"mask",
"color",
".",
"Color",
")",
"{",
"c",
".",
"sprite",
".",
"DrawColorMask",
"(",
"t",
",",
"matrix",
",",
"m... | // DrawColorMask draws the content of the Canvas onto another Target, transformed by the given
// Matrix and multiplied by the given mask, just like if it was a Sprite containing the whole Canvas.
//
// If the color mask is nil, a fully opaque white mask will be used causing no effect. | [
"DrawColorMask",
"draws",
"the",
"content",
"of",
"the",
"Canvas",
"onto",
"another",
"Target",
"transformed",
"by",
"the",
"given",
"Matrix",
"and",
"multiplied",
"by",
"the",
"given",
"mask",
"just",
"like",
"if",
"it",
"was",
"a",
"Sprite",
"containing",
... | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/canvas.go#L268-L270 |
30,785 | faiface/pixel | pixelgl/joystick.go | JoystickPresent | func (w *Window) JoystickPresent(js Joystick) bool {
return w.currJoy.connected[js]
} | go | func (w *Window) JoystickPresent(js Joystick) bool {
return w.currJoy.connected[js]
} | [
"func",
"(",
"w",
"*",
"Window",
")",
"JoystickPresent",
"(",
"js",
"Joystick",
")",
"bool",
"{",
"return",
"w",
".",
"currJoy",
".",
"connected",
"[",
"js",
"]",
"\n",
"}"
] | // JoystickPresent returns if the joystick is currently connected.
//
// This API is experimental. | [
"JoystickPresent",
"returns",
"if",
"the",
"joystick",
"is",
"currently",
"connected",
".",
"This",
"API",
"is",
"experimental",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/joystick.go#L35-L37 |
30,786 | faiface/pixel | pixelgl/joystick.go | JoystickName | func (w *Window) JoystickName(js Joystick) string {
return w.currJoy.name[js]
} | go | func (w *Window) JoystickName(js Joystick) string {
return w.currJoy.name[js]
} | [
"func",
"(",
"w",
"*",
"Window",
")",
"JoystickName",
"(",
"js",
"Joystick",
")",
"string",
"{",
"return",
"w",
".",
"currJoy",
".",
"name",
"[",
"js",
"]",
"\n",
"}"
] | // JoystickName returns the name of the joystick. A disconnected joystick will return an
// empty string.
//
// This API is experimental. | [
"JoystickName",
"returns",
"the",
"name",
"of",
"the",
"joystick",
".",
"A",
"disconnected",
"joystick",
"will",
"return",
"an",
"empty",
"string",
".",
"This",
"API",
"is",
"experimental",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/joystick.go#L43-L45 |
30,787 | faiface/pixel | pixelgl/joystick.go | JoystickButtonCount | func (w *Window) JoystickButtonCount(js Joystick) int {
return len(w.currJoy.buttons[js])
} | go | func (w *Window) JoystickButtonCount(js Joystick) int {
return len(w.currJoy.buttons[js])
} | [
"func",
"(",
"w",
"*",
"Window",
")",
"JoystickButtonCount",
"(",
"js",
"Joystick",
")",
"int",
"{",
"return",
"len",
"(",
"w",
".",
"currJoy",
".",
"buttons",
"[",
"js",
"]",
")",
"\n",
"}"
] | // JoystickButtonCount returns the number of buttons a connected joystick has.
//
// This API is experimental. | [
"JoystickButtonCount",
"returns",
"the",
"number",
"of",
"buttons",
"a",
"connected",
"joystick",
"has",
".",
"This",
"API",
"is",
"experimental",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/joystick.go#L50-L52 |
30,788 | faiface/pixel | pixelgl/joystick.go | JoystickAxisCount | func (w *Window) JoystickAxisCount(js Joystick) int {
return len(w.currJoy.axis[js])
} | go | func (w *Window) JoystickAxisCount(js Joystick) int {
return len(w.currJoy.axis[js])
} | [
"func",
"(",
"w",
"*",
"Window",
")",
"JoystickAxisCount",
"(",
"js",
"Joystick",
")",
"int",
"{",
"return",
"len",
"(",
"w",
".",
"currJoy",
".",
"axis",
"[",
"js",
"]",
")",
"\n",
"}"
] | // JoystickAxisCount returns the number of axes a connected joystick has.
//
// This API is experimental. | [
"JoystickAxisCount",
"returns",
"the",
"number",
"of",
"axes",
"a",
"connected",
"joystick",
"has",
".",
"This",
"API",
"is",
"experimental",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/joystick.go#L57-L59 |
30,789 | faiface/pixel | pixelgl/joystick.go | JoystickPressed | func (w *Window) JoystickPressed(js Joystick, button int) bool {
return w.currJoy.getButton(js, button)
} | go | func (w *Window) JoystickPressed(js Joystick, button int) bool {
return w.currJoy.getButton(js, button)
} | [
"func",
"(",
"w",
"*",
"Window",
")",
"JoystickPressed",
"(",
"js",
"Joystick",
",",
"button",
"int",
")",
"bool",
"{",
"return",
"w",
".",
"currJoy",
".",
"getButton",
"(",
"js",
",",
"button",
")",
"\n",
"}"
] | // JoystickPressed returns whether the joystick Button is currently pressed down.
// If the button index is out of range, this will return false.
//
// This API is experimental. | [
"JoystickPressed",
"returns",
"whether",
"the",
"joystick",
"Button",
"is",
"currently",
"pressed",
"down",
".",
"If",
"the",
"button",
"index",
"is",
"out",
"of",
"range",
"this",
"will",
"return",
"false",
".",
"This",
"API",
"is",
"experimental",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/joystick.go#L65-L67 |
30,790 | faiface/pixel | pixelgl/joystick.go | JoystickJustPressed | func (w *Window) JoystickJustPressed(js Joystick, button int) bool {
return w.currJoy.getButton(js, button) && !w.prevJoy.getButton(js, button)
} | go | func (w *Window) JoystickJustPressed(js Joystick, button int) bool {
return w.currJoy.getButton(js, button) && !w.prevJoy.getButton(js, button)
} | [
"func",
"(",
"w",
"*",
"Window",
")",
"JoystickJustPressed",
"(",
"js",
"Joystick",
",",
"button",
"int",
")",
"bool",
"{",
"return",
"w",
".",
"currJoy",
".",
"getButton",
"(",
"js",
",",
"button",
")",
"&&",
"!",
"w",
".",
"prevJoy",
".",
"getButto... | // JoystickJustPressed returns whether the joystick Button has just been pressed down.
// If the button index is out of range, this will return false.
//
// This API is experimental. | [
"JoystickJustPressed",
"returns",
"whether",
"the",
"joystick",
"Button",
"has",
"just",
"been",
"pressed",
"down",
".",
"If",
"the",
"button",
"index",
"is",
"out",
"of",
"range",
"this",
"will",
"return",
"false",
".",
"This",
"API",
"is",
"experimental",
... | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/joystick.go#L73-L75 |
30,791 | faiface/pixel | pixelgl/joystick.go | JoystickAxis | func (w *Window) JoystickAxis(js Joystick, axis int) float64 {
return w.currJoy.getAxis(js, axis)
} | go | func (w *Window) JoystickAxis(js Joystick, axis int) float64 {
return w.currJoy.getAxis(js, axis)
} | [
"func",
"(",
"w",
"*",
"Window",
")",
"JoystickAxis",
"(",
"js",
"Joystick",
",",
"axis",
"int",
")",
"float64",
"{",
"return",
"w",
".",
"currJoy",
".",
"getAxis",
"(",
"js",
",",
"axis",
")",
"\n",
"}"
] | // JoystickAxis returns the value of a joystick axis at the last call to Window.Update.
// If the axis index is out of range, this will return 0.
//
// This API is experimental. | [
"JoystickAxis",
"returns",
"the",
"value",
"of",
"a",
"joystick",
"axis",
"at",
"the",
"last",
"call",
"to",
"Window",
".",
"Update",
".",
"If",
"the",
"axis",
"index",
"is",
"out",
"of",
"range",
"this",
"will",
"return",
"0",
".",
"This",
"API",
"is"... | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/joystick.go#L89-L91 |
30,792 | faiface/pixel | pixelgl/joystick.go | updateJoystickInput | func (w *Window) updateJoystickInput() {
for js := Joystick1; js <= JoystickLast; js++ {
// Determine and store if the joystick was connected
joystickPresent := glfw.JoystickPresent(glfw.Joystick(js))
w.tempJoy.connected[js] = joystickPresent
if joystickPresent {
w.tempJoy.buttons[js] = glfw.GetJoystickBut... | go | func (w *Window) updateJoystickInput() {
for js := Joystick1; js <= JoystickLast; js++ {
// Determine and store if the joystick was connected
joystickPresent := glfw.JoystickPresent(glfw.Joystick(js))
w.tempJoy.connected[js] = joystickPresent
if joystickPresent {
w.tempJoy.buttons[js] = glfw.GetJoystickBut... | [
"func",
"(",
"w",
"*",
"Window",
")",
"updateJoystickInput",
"(",
")",
"{",
"for",
"js",
":=",
"Joystick1",
";",
"js",
"<=",
"JoystickLast",
";",
"js",
"++",
"{",
"// Determine and store if the joystick was connected",
"joystickPresent",
":=",
"glfw",
".",
"Joys... | // Used internally during Window.UpdateInput to update the state of the joysticks. | [
"Used",
"internally",
"during",
"Window",
".",
"UpdateInput",
"to",
"update",
"the",
"state",
"of",
"the",
"joysticks",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/joystick.go#L94-L120 |
30,793 | faiface/pixel | pixelgl/joystick.go | getButton | func (js *joystickState) getButton(joystick Joystick, button int) bool {
// Check that the joystick and button is valid, return false by default
if js.buttons[joystick] == nil || button >= len(js.buttons[joystick]) || button < 0 {
return false
}
return js.buttons[joystick][byte(button)] == 1
} | go | func (js *joystickState) getButton(joystick Joystick, button int) bool {
// Check that the joystick and button is valid, return false by default
if js.buttons[joystick] == nil || button >= len(js.buttons[joystick]) || button < 0 {
return false
}
return js.buttons[joystick][byte(button)] == 1
} | [
"func",
"(",
"js",
"*",
"joystickState",
")",
"getButton",
"(",
"joystick",
"Joystick",
",",
"button",
"int",
")",
"bool",
"{",
"// Check that the joystick and button is valid, return false by default",
"if",
"js",
".",
"buttons",
"[",
"joystick",
"]",
"==",
"nil",
... | // Returns if a button on a joystick is down, returning false if the button or joystick is invalid. | [
"Returns",
"if",
"a",
"button",
"on",
"a",
"joystick",
"is",
"down",
"returning",
"false",
"if",
"the",
"button",
"or",
"joystick",
"is",
"invalid",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/joystick.go#L130-L136 |
30,794 | faiface/pixel | pixelgl/joystick.go | getAxis | func (js *joystickState) getAxis(joystick Joystick, axis int) float64 {
// Check that the joystick and axis is valid, return 0 by default.
if js.axis[joystick] == nil || axis >= len(js.axis[joystick]) || axis < 0 {
return 0
}
return float64(js.axis[joystick][axis])
} | go | func (js *joystickState) getAxis(joystick Joystick, axis int) float64 {
// Check that the joystick and axis is valid, return 0 by default.
if js.axis[joystick] == nil || axis >= len(js.axis[joystick]) || axis < 0 {
return 0
}
return float64(js.axis[joystick][axis])
} | [
"func",
"(",
"js",
"*",
"joystickState",
")",
"getAxis",
"(",
"joystick",
"Joystick",
",",
"axis",
"int",
")",
"float64",
"{",
"// Check that the joystick and axis is valid, return 0 by default.",
"if",
"js",
".",
"axis",
"[",
"joystick",
"]",
"==",
"nil",
"||",
... | // Returns the value of a joystick axis, returning 0 if the button or joystick is invalid. | [
"Returns",
"the",
"value",
"of",
"a",
"joystick",
"axis",
"returning",
"0",
"if",
"the",
"button",
"or",
"joystick",
"is",
"invalid",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/pixelgl/joystick.go#L139-L145 |
30,795 | faiface/pixel | sprite.go | NewSprite | func NewSprite(pic Picture, frame Rect) *Sprite {
tri := MakeTrianglesData(6)
s := &Sprite{
tri: tri,
d: Drawer{Triangles: tri},
}
s.matrix = IM
s.mask = Alpha(1)
s.Set(pic, frame)
return s
} | go | func NewSprite(pic Picture, frame Rect) *Sprite {
tri := MakeTrianglesData(6)
s := &Sprite{
tri: tri,
d: Drawer{Triangles: tri},
}
s.matrix = IM
s.mask = Alpha(1)
s.Set(pic, frame)
return s
} | [
"func",
"NewSprite",
"(",
"pic",
"Picture",
",",
"frame",
"Rect",
")",
"*",
"Sprite",
"{",
"tri",
":=",
"MakeTrianglesData",
"(",
"6",
")",
"\n",
"s",
":=",
"&",
"Sprite",
"{",
"tri",
":",
"tri",
",",
"d",
":",
"Drawer",
"{",
"Triangles",
":",
"tri... | // NewSprite creates a Sprite from the supplied frame of a Picture. | [
"NewSprite",
"creates",
"a",
"Sprite",
"from",
"the",
"supplied",
"frame",
"of",
"a",
"Picture",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/sprite.go#L26-L36 |
30,796 | faiface/pixel | sprite.go | Set | func (s *Sprite) Set(pic Picture, frame Rect) {
s.d.Picture = pic
if frame != s.frame {
s.frame = frame
s.calcData()
}
} | go | func (s *Sprite) Set(pic Picture, frame Rect) {
s.d.Picture = pic
if frame != s.frame {
s.frame = frame
s.calcData()
}
} | [
"func",
"(",
"s",
"*",
"Sprite",
")",
"Set",
"(",
"pic",
"Picture",
",",
"frame",
"Rect",
")",
"{",
"s",
".",
"d",
".",
"Picture",
"=",
"pic",
"\n",
"if",
"frame",
"!=",
"s",
".",
"frame",
"{",
"s",
".",
"frame",
"=",
"frame",
"\n",
"s",
".",... | // Set sets a new frame of a Picture for this Sprite. | [
"Set",
"sets",
"a",
"new",
"frame",
"of",
"a",
"Picture",
"for",
"this",
"Sprite",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/sprite.go#L39-L45 |
30,797 | faiface/pixel | sprite.go | Draw | func (s *Sprite) Draw(t Target, matrix Matrix) {
s.DrawColorMask(t, matrix, nil)
} | go | func (s *Sprite) Draw(t Target, matrix Matrix) {
s.DrawColorMask(t, matrix, nil)
} | [
"func",
"(",
"s",
"*",
"Sprite",
")",
"Draw",
"(",
"t",
"Target",
",",
"matrix",
"Matrix",
")",
"{",
"s",
".",
"DrawColorMask",
"(",
"t",
",",
"matrix",
",",
"nil",
")",
"\n",
"}"
] | // Draw draws the Sprite onto the provided Target. The Sprite will be transformed by the given Matrix.
//
// This method is equivalent to calling DrawColorMask with nil color mask. | [
"Draw",
"draws",
"the",
"Sprite",
"onto",
"the",
"provided",
"Target",
".",
"The",
"Sprite",
"will",
"be",
"transformed",
"by",
"the",
"given",
"Matrix",
".",
"This",
"method",
"is",
"equivalent",
"to",
"calling",
"DrawColorMask",
"with",
"nil",
"color",
"ma... | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/sprite.go#L60-L62 |
30,798 | faiface/pixel | sprite.go | DrawColorMask | func (s *Sprite) DrawColorMask(t Target, matrix Matrix, mask color.Color) {
dirty := false
if matrix != s.matrix {
s.matrix = matrix
dirty = true
}
if mask == nil {
mask = Alpha(1)
}
rgba := ToRGBA(mask)
if rgba != s.mask {
s.mask = rgba
dirty = true
}
if dirty {
s.calcData()
}
s.d.Draw(t)
} | go | func (s *Sprite) DrawColorMask(t Target, matrix Matrix, mask color.Color) {
dirty := false
if matrix != s.matrix {
s.matrix = matrix
dirty = true
}
if mask == nil {
mask = Alpha(1)
}
rgba := ToRGBA(mask)
if rgba != s.mask {
s.mask = rgba
dirty = true
}
if dirty {
s.calcData()
}
s.d.Draw(t)
} | [
"func",
"(",
"s",
"*",
"Sprite",
")",
"DrawColorMask",
"(",
"t",
"Target",
",",
"matrix",
"Matrix",
",",
"mask",
"color",
".",
"Color",
")",
"{",
"dirty",
":=",
"false",
"\n",
"if",
"matrix",
"!=",
"s",
".",
"matrix",
"{",
"s",
".",
"matrix",
"=",
... | // DrawColorMask draws the Sprite onto the provided Target. The Sprite will be transformed by the
// given Matrix and all of it's color will be multiplied by the given mask.
//
// If the mask is nil, a fully opaque white mask will be used, which causes no effect. | [
"DrawColorMask",
"draws",
"the",
"Sprite",
"onto",
"the",
"provided",
"Target",
".",
"The",
"Sprite",
"will",
"be",
"transformed",
"by",
"the",
"given",
"Matrix",
"and",
"all",
"of",
"it",
"s",
"color",
"will",
"be",
"multiplied",
"by",
"the",
"given",
"ma... | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/sprite.go#L68-L88 |
30,799 | faiface/pixel | compose.go | Compose | func (cm ComposeMethod) Compose(a, b RGBA) RGBA {
var fa, fb float64
switch cm {
case ComposeOver:
fa, fb = 1, 1-a.A
case ComposeIn:
fa, fb = b.A, 0
case ComposeOut:
fa, fb = 1-b.A, 0
case ComposeAtop:
fa, fb = b.A, 1-a.A
case ComposeRover:
fa, fb = 1-b.A, 1
case ComposeRin:
fa, fb = 0, a.A
case C... | go | func (cm ComposeMethod) Compose(a, b RGBA) RGBA {
var fa, fb float64
switch cm {
case ComposeOver:
fa, fb = 1, 1-a.A
case ComposeIn:
fa, fb = b.A, 0
case ComposeOut:
fa, fb = 1-b.A, 0
case ComposeAtop:
fa, fb = b.A, 1-a.A
case ComposeRover:
fa, fb = 1-b.A, 1
case ComposeRin:
fa, fb = 0, a.A
case C... | [
"func",
"(",
"cm",
"ComposeMethod",
")",
"Compose",
"(",
"a",
",",
"b",
"RGBA",
")",
"RGBA",
"{",
"var",
"fa",
",",
"fb",
"float64",
"\n\n",
"switch",
"cm",
"{",
"case",
"ComposeOver",
":",
"fa",
",",
"fb",
"=",
"1",
",",
"1",
"-",
"a",
".",
"A... | // Compose composes two colors together according to the ComposeMethod. A is the foreground, B is
// the background. | [
"Compose",
"composes",
"two",
"colors",
"together",
"according",
"to",
"the",
"ComposeMethod",
".",
"A",
"is",
"the",
"foreground",
"B",
"is",
"the",
"background",
"."
] | a68a4e38b42dde3869de57fddbaea6da106d5940 | https://github.com/faiface/pixel/blob/a68a4e38b42dde3869de57fddbaea6da106d5940/compose.go#L34-L65 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.