mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
examples/chipmunk: Fix styles
This commit is contained in:
parent
da66866b3a
commit
948c1e13fb
@ -27,12 +27,6 @@ import (
|
|||||||
"github.com/jakecoffman/cp"
|
"github.com/jakecoffman/cp"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
imageWidth = 188
|
|
||||||
imageHeight = 35
|
|
||||||
imageRowLength = 24
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
space *cp.Space
|
space *cp.Space
|
||||||
dot *ebiten.Image
|
dot *ebiten.Image
|
||||||
@ -43,10 +37,6 @@ func init() {
|
|||||||
dot.Fill(color.White)
|
dot.Fill(color.White)
|
||||||
}
|
}
|
||||||
|
|
||||||
func getPixel(x, y uint) int {
|
|
||||||
return (imageBitmap[(x>>3)+y*imageRowLength] >> (^x & 0x7)) & 1
|
|
||||||
}
|
|
||||||
|
|
||||||
func update(screen *ebiten.Image) error {
|
func update(screen *ebiten.Image) error {
|
||||||
space.Step(1.0 / ebiten.FPS)
|
space.Step(1.0 / ebiten.FPS)
|
||||||
|
|
||||||
@ -69,6 +59,11 @@ func update(screen *ebiten.Image) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getPixel(x, y uint) int {
|
||||||
|
const imageRowLength = 24
|
||||||
|
return (imageBitmap[(x>>3)+y*imageRowLength] >> (^x & 0x7)) & 1
|
||||||
|
}
|
||||||
|
|
||||||
func makeBall(x, y float64) *cp.Shape {
|
func makeBall(x, y float64) *cp.Shape {
|
||||||
body := cp.NewBody(1.0, cp.INFINITY)
|
body := cp.NewBody(1.0, cp.INFINITY)
|
||||||
body.SetPosition(cp.Vector{x, y})
|
body.SetPosition(cp.Vector{x, y})
|
||||||
@ -117,6 +112,11 @@ var imageBitmap = []int{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
const (
|
||||||
|
imageWidth = 188
|
||||||
|
imageHeight = 35
|
||||||
|
)
|
||||||
|
|
||||||
space = cp.NewSpace()
|
space = cp.NewSpace()
|
||||||
space.Iterations = 1
|
space.Iterations = 1
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user