This commit is contained in:
mattn 2022-08-03 22:40:39 +09:00 committed by GitHub
parent 1ecc34c2f2
commit 2bacecca24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 23 additions and 23 deletions

View File

@ -21,7 +21,7 @@ import (
var isGo2Cpp bool = js.Global().Get("go2cpp").Truthy() var isGo2Cpp bool = js.Global().Get("go2cpp").Truthy()
func bufferSize() int { func bufferSize() int {
// On some devices targetted by go2cpp, 8192 is not enough. Use x2 bytes. // On some devices targeted by go2cpp, 8192 is not enough. Use x2 bytes.
if isGo2Cpp { if isGo2Cpp {
return 16384 return 16384
} }

View File

@ -111,7 +111,7 @@ func (c *Camera) ScreenToWorld(posX, posY int) (float64, float64) {
inverseMatrix.Invert() inverseMatrix.Invert()
return inverseMatrix.Apply(float64(posX), float64(posY)) return inverseMatrix.Apply(float64(posX), float64(posY))
} else { } else {
// When scaling it can happend that matrix is not invertable // When scaling it can happened that matrix is not invertable
return math.NaN(), math.NaN() return math.NaN(), math.NaN()
} }
} }

View File

@ -63,7 +63,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
if g.lost { if g.lost {
// When the context is lost, skip rendering. Usually this logic should not be required, but when the // When the context is lost, skip rendering. Usually this logic should not be required, but when the
// context lost happens by the API explicitly, Draw can be called even after the data in GPU // context lost happens by the API explicitly, Draw can be called even after the data in GPU
// disappered. // disappeared.
return return
} }

View File

@ -100,7 +100,7 @@ func (m *mascot) Update() error {
m.vx16 = 64 m.vx16 = 64
} }
// Accelarate the mascot in the Y direction. // Accelerate the mascot in the Y direction.
m.vy16 += 8 m.vy16 += 8
m.y16 += m.vy16 m.y16 += m.vy16

View File

@ -78,8 +78,8 @@ const (
imageTypeButton imageType = iota imageTypeButton imageType = iota
imageTypeButtonPressed imageTypeButtonPressed
imageTypeTextBox imageTypeTextBox
imageTypeVScollBarBack imageTypeVScrollBarBack
imageTypeVScollBarFront imageTypeVScrollBarFront
imageTypeCheckBox imageTypeCheckBox
imageTypeCheckBoxPressed imageTypeCheckBoxPressed
imageTypeCheckBoxMark imageTypeCheckBoxMark
@ -89,8 +89,8 @@ var imageSrcRects = map[imageType]image.Rectangle{
imageTypeButton: image.Rect(0, 0, 16, 16), imageTypeButton: image.Rect(0, 0, 16, 16),
imageTypeButtonPressed: image.Rect(16, 0, 32, 16), imageTypeButtonPressed: image.Rect(16, 0, 32, 16),
imageTypeTextBox: image.Rect(0, 16, 16, 32), imageTypeTextBox: image.Rect(0, 16, 16, 32),
imageTypeVScollBarBack: image.Rect(16, 16, 24, 32), imageTypeVScrollBarBack: image.Rect(16, 16, 24, 32),
imageTypeVScollBarFront: image.Rect(24, 16, 32, 32), imageTypeVScrollBarFront: image.Rect(24, 16, 32, 32),
imageTypeCheckBox: image.Rect(0, 32, 16, 48), imageTypeCheckBox: image.Rect(0, 32, 16, 48),
imageTypeCheckBoxPressed: image.Rect(16, 32, 32, 48), imageTypeCheckBoxPressed: image.Rect(16, 32, 32, 48),
imageTypeCheckBoxMark: image.Rect(32, 32, 48, 48), imageTypeCheckBoxMark: image.Rect(32, 32, 48, 48),
@ -284,10 +284,10 @@ func (v *VScrollBar) Update(contentHeight int) {
func (v *VScrollBar) Draw(dst *ebiten.Image) { func (v *VScrollBar) Draw(dst *ebiten.Image) {
sd := image.Rect(v.X, v.Y, v.X+VScrollBarWidth, v.Y+v.Height) sd := image.Rect(v.X, v.Y, v.X+VScrollBarWidth, v.Y+v.Height)
drawNinePatches(dst, sd, imageSrcRects[imageTypeVScollBarBack]) drawNinePatches(dst, sd, imageSrcRects[imageTypeVScrollBarBack])
if v.thumbRate < 1 { if v.thumbRate < 1 {
drawNinePatches(dst, v.thumbRect(), imageSrcRects[imageTypeVScollBarFront]) drawNinePatches(dst, v.thumbRect(), imageSrcRects[imageTypeVScrollBarFront])
} }
} }

View File

@ -623,7 +623,7 @@ func BenchmarkDrawImage(b *testing.B) {
} }
} }
func TestImageLinearGradiation(t *testing.T) { func TestImageLinearGraduation(t *testing.T) {
img0 := ebiten.NewImage(2, 2) img0 := ebiten.NewImage(2, 2)
img0.ReplacePixels([]byte{ img0.ReplacePixels([]byte{
0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff,

View File

@ -164,7 +164,7 @@ func (g *nativeGamepadImpl) hatState(hat int) int {
} }
func (g *nativeGamepadImpl) vibrate(duration time.Duration, strongMagnitude float64, weakMagnitude float64) { func (g *nativeGamepadImpl) vibrate(duration time.Duration, strongMagnitude float64, weakMagnitude float64) {
// vibrationActuator is avaialble on Chrome. // vibrationActuator is available on Chrome.
if va := g.value.Get("vibrationActuator"); va.Truthy() { if va := g.value.Get("vibrationActuator"); va.Truthy() {
if !va.Get("playEffect").Truthy() { if !va.Get("playEffect").Truthy() {
return return

View File

@ -107,7 +107,7 @@ func (q *commandQueue) appendIndices(indices []uint16, offset uint16) {
q.nindices += len(indices) q.nindices += len(indices)
} }
// mustUseDifferentVertexBuffer reports whether a differnt vertex buffer must be used. // mustUseDifferentVertexBuffer reports whether a different vertex buffer must be used.
func mustUseDifferentVertexBuffer(nextNumVertexFloats, nextNumIndices int) bool { func mustUseDifferentVertexBuffer(nextNumVertexFloats, nextNumIndices int) bool {
return nextNumVertexFloats > graphics.IndicesCount*graphics.VertexFloatCount || nextNumIndices > graphics.IndicesCount return nextNumVertexFloats > graphics.IndicesCount*graphics.VertexFloatCount || nextNumIndices > graphics.IndicesCount
} }

View File

@ -33,7 +33,7 @@ import (
const frameCount = 2 const frameCount = 2
// NewGraphics creates an implementation of graphicsdriver.Graphcis for DirectX. // NewGraphics creates an implementation of graphicsdriver.Graphics for DirectX.
// The returned graphics value is nil iff the error is not nil. // The returned graphics value is nil iff the error is not nil.
func NewGraphics() (graphicsdriver.Graphics, error) { func NewGraphics() (graphicsdriver.Graphics, error) {
const is64bit = uint64(^uintptr(0)) == ^uint64(0) const is64bit = uint64(^uintptr(0)) == ^uint64(0)
@ -974,7 +974,7 @@ func (g *Graphics) SetVertices(vertices []float32, indices []uint16) (ferr error
g.vertices[g.frameIndex] = append(g.vertices[g.frameIndex], nil) g.vertices[g.frameIndex] = append(g.vertices[g.frameIndex], nil)
} }
if g.vertices[g.frameIndex][vidx] == nil { if g.vertices[g.frameIndex][vidx] == nil {
// TODO: Use the default heap for efficienty. See the official example HelloTriangle. // TODO: Use the default heap for efficiently. See the official example HelloTriangle.
vs, err := createBuffer(g.device, graphics.IndicesCount*graphics.VertexFloatCount*uint64(unsafe.Sizeof(float32(0))), _D3D12_HEAP_TYPE_UPLOAD) vs, err := createBuffer(g.device, graphics.IndicesCount*graphics.VertexFloatCount*uint64(unsafe.Sizeof(float32(0))), _D3D12_HEAP_TYPE_UPLOAD)
if err != nil { if err != nil {
return err return err

View File

@ -351,7 +351,7 @@ func init() {
creatingSystemDefaultDeviceSucceeded = ok creatingSystemDefaultDeviceSucceeded = ok
} }
// NewGraphics creates an implementation of graphicsdriver.Graphcis for Metal. // NewGraphics creates an implementation of graphicsdriver.Graphics for Metal.
// The returned graphics value is nil iff the error is not nil. // The returned graphics value is nil iff the error is not nil.
func NewGraphics() (graphicsdriver.Graphics, error) { func NewGraphics() (graphicsdriver.Graphics, error) {
// On old mac devices like iMac 2011, Metal is not supported (#779). // On old mac devices like iMac 2011, Metal is not supported (#779).

View File

@ -2,4 +2,4 @@ This is a fork of `github.com/go-gl/gl/v2.1/gl` with the below patch. This is no
The original version is generated from `github.com/hajimehoshi/glow`'s `nocgo` branch. This enables to remove dependencies on Cgo on Windows. The original version is generated from `github.com/hajimehoshi/glow`'s `nocgo` branch. This enables to remove dependencies on Cgo on Windows.
Now we are working on commiting this 'no-cgo' change to the official gl package. See https://github.com/go-gl/glow/pull/102. Now we are working on committing this 'no-cgo' change to the official gl package. See https://github.com/go-gl/glow/pull/102.

View File

@ -23,7 +23,7 @@ import (
"github.com/hajimehoshi/ebiten/v2/internal/shaderir" "github.com/hajimehoshi/ebiten/v2/internal/shaderir"
) )
// NewGraphics creates an implementation of graphicsdriver.Graphcis for OpenGL. // NewGraphics creates an implementation of graphicsdriver.Graphics for OpenGL.
// The returned graphics value is nil iff the error is not nil. // The returned graphics value is nil iff the error is not nil.
func NewGraphics() (graphicsdriver.Graphics, error) { func NewGraphics() (graphicsdriver.Graphics, error) {
if microsoftgdk.IsXbox() { if microsoftgdk.IsXbox() {

View File

@ -487,7 +487,7 @@ func (cs *compileState) parseExpr(block *block, expr ast.Expr, markLocalVariable
} }
if callee.Type != shaderir.FunctionExpr { if callee.Type != shaderir.FunctionExpr {
cs.addError(e.Pos(), fmt.Sprintf("function callee must be a funciton name but %s", e.Fun)) cs.addError(e.Pos(), fmt.Sprintf("function callee must be a function name but %s", e.Fun))
return nil, nil, nil, false return nil, nil, nil, false
} }

View File

@ -685,12 +685,12 @@ func (cs *compileState) parseFunc(block *block, d *ast.FuncDecl) (function, bool
checkVaryings := func(vs []variable) { checkVaryings := func(vs []variable) {
if len(cs.ir.Varyings) != len(vs) { if len(cs.ir.Varyings) != len(vs) {
cs.addError(d.Pos(), fmt.Sprintf("the number of vertex entry point's returning values and the number of framgent entry point's params must be the same")) cs.addError(d.Pos(), fmt.Sprintf("the number of vertex entry point's returning values and the number of fragment entry point's params must be the same"))
return return
} }
for i, t := range cs.ir.Varyings { for i, t := range cs.ir.Varyings {
if t.Main != vs[i].typ.Main { if t.Main != vs[i].typ.Main {
cs.addError(d.Pos(), fmt.Sprintf("vertex entry point's returning value types and framgent entry point's param types must match")) cs.addError(d.Pos(), fmt.Sprintf("vertex entry point's returning value types and fragment entry point's param types must match"))
} }
} }
} }

View File

@ -1315,7 +1315,7 @@ func (u *userInterfaceImpl) setWindowSizeInDIPImpl(width, height int, fullscreen
v := m.GetVideoMode() v := m.GetVideoMode()
u.window.SetMonitor(m, 0, 0, v.Width, v.Height, v.RefreshRate) u.window.SetMonitor(m, 0, 0, v.Width, v.Height, v.RefreshRate)
// Swapping buffer is necesary to prevent the image lag (#1004). // Swapping buffer is necessary to prevent the image lag (#1004).
// TODO: This might not work when vsync is disabled. // TODO: This might not work when vsync is disabled.
if u.graphicsDriver.IsGL() { if u.graphicsDriver.IsGL() {
glfw.PollEvents() glfw.PollEvents()

View File

@ -388,7 +388,7 @@ func (f faceWithLineHeight) Metrics() font.Metrics {
return m return m
} }
// Glyphs is infomation to render one glyph. // Glyphs is information to render one glyph.
type Glyph struct { type Glyph struct {
// Rune is a character for this glyph. // Rune is a character for this glyph.
Rune rune Rune rune