mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
ebiten: refactoring: compile-time check
This commit is contained in:
parent
0bd2030be7
commit
8919bc809a
16
image.go
16
image.go
@ -527,12 +527,8 @@ type DrawTrianglesShaderOptions struct {
|
||||
AntiAlias bool
|
||||
}
|
||||
|
||||
func init() {
|
||||
var op DrawTrianglesShaderOptions
|
||||
if got, want := len(op.Images), graphics.ShaderImageCount; got != want {
|
||||
panic(fmt.Sprintf("ebiten: len((DrawTrianglesShaderOptions{}).Images) must be %d but %d", want, got))
|
||||
}
|
||||
}
|
||||
// Check the number of images.
|
||||
var _ [len(DrawTrianglesShaderOptions{}.Images)]int = [graphics.ShaderImageCount]int{}
|
||||
|
||||
// DrawTrianglesShader draws triangles with the specified vertices and their indices with the specified shader.
|
||||
//
|
||||
@ -673,12 +669,8 @@ type DrawRectShaderOptions struct {
|
||||
Images [4]*Image
|
||||
}
|
||||
|
||||
func init() {
|
||||
var op DrawRectShaderOptions
|
||||
if got, want := len(op.Images), graphics.ShaderImageCount; got != want {
|
||||
panic(fmt.Sprintf("ebiten: len((DrawRectShaderOptions{}).Images) must be %d but %d", want, got))
|
||||
}
|
||||
}
|
||||
// Check the number of images.
|
||||
var _ [len(DrawRectShaderOptions{}.Images)]int = [graphics.ShaderImageCount]int{}
|
||||
|
||||
// DrawRectShader draws a rectangle with the specified width and height with the specified shader.
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user