mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 19:28:57 +01:00
doc: Update examples (#354)
This commit is contained in:
parent
a657cac229
commit
4770abd2fe
@ -78,7 +78,9 @@ func update(screen *ebiten.Image) error {
|
|||||||
case 240 < count:
|
case 240 < count:
|
||||||
diff = float64(480-count) * 0.2
|
diff = float64(480-count) * 0.2
|
||||||
}
|
}
|
||||||
|
if ebiten.IsRunningSlowly() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
screen.Fill(color.NRGBA{0x00, 0x00, 0x80, 0xff})
|
screen.Fill(color.NRGBA{0x00, 0x00, 0x80, 0xff})
|
||||||
op := &ebiten.DrawImageOptions{}
|
op := &ebiten.DrawImageOptions{}
|
||||||
op.ColorM.Scale(1.0, 1.0, 1.0, 0.5)
|
op.ColorM.Scale(1.0, 1.0, 1.0, 0.5)
|
||||||
|
@ -211,7 +211,9 @@ func update(screen *ebiten.Image) error {
|
|||||||
}
|
}
|
||||||
musicPlayer.updateVolume()
|
musicPlayer.updateVolume()
|
||||||
}
|
}
|
||||||
|
if ebiten.IsRunningSlowly() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
op := &ebiten.DrawImageOptions{}
|
op := &ebiten.DrawImageOptions{}
|
||||||
x, y, w, h := playerBarRect()
|
x, y, w, h := playerBarRect()
|
||||||
op.GeoM.Translate(float64(x), float64(y))
|
op.GeoM.Translate(float64(x), float64(y))
|
||||||
|
@ -102,6 +102,9 @@ func parseFont() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func update(screen *ebiten.Image) error {
|
func update(screen *ebiten.Image) error {
|
||||||
|
if ebiten.IsRunningSlowly() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
screen.DrawImage(textImage, &ebiten.DrawImageOptions{})
|
screen.DrawImage(textImage, &ebiten.DrawImageOptions{})
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -62,6 +62,9 @@ func update(screen *ebiten.Image) error {
|
|||||||
pressedButtons = append(pressedButtons, strconv.Itoa(int(b)))
|
pressedButtons = append(pressedButtons, strconv.Itoa(int(b)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ebiten.IsRunningSlowly() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
str := `Gamepad
|
str := `Gamepad
|
||||||
Axes:
|
Axes:
|
||||||
|
@ -83,6 +83,9 @@ func update(screen *ebiten.Image) error {
|
|||||||
if ebiten.IsKeyPressed(ebiten.KeyX) {
|
if ebiten.IsKeyPressed(ebiten.KeyX) {
|
||||||
valueInt++
|
valueInt++
|
||||||
}
|
}
|
||||||
|
if ebiten.IsRunningSlowly() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
hueInt = clamp(hueInt, -256, 256)
|
hueInt = clamp(hueInt, -256, 256)
|
||||||
saturationInt = clamp(saturationInt, 0, 256)
|
saturationInt = clamp(saturationInt, 0, 256)
|
||||||
valueInt = clamp(valueInt, 0, 256)
|
valueInt = clamp(valueInt, 0, 256)
|
||||||
|
@ -50,6 +50,9 @@ var (
|
|||||||
|
|
||||||
func update(screen *ebiten.Image) error {
|
func update(screen *ebiten.Image) error {
|
||||||
count++
|
count++
|
||||||
|
if ebiten.IsRunningSlowly() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
w, h := gophersImage.Size()
|
w, h := gophersImage.Size()
|
||||||
op := &ebiten.DrawImageOptions{}
|
op := &ebiten.DrawImageOptions{}
|
||||||
op.GeoM.Translate(float64(screenWidth-w)/2, float64(screenHeight-h)/2)
|
op.GeoM.Translate(float64(screenWidth-w)/2, float64(screenHeight-h)/2)
|
||||||
|
@ -101,7 +101,9 @@ func drawGroundImage(screen *ebiten.Image, ground *ebiten.Image) {
|
|||||||
|
|
||||||
func update(screen *ebiten.Image) error {
|
func update(screen *ebiten.Image) error {
|
||||||
theViewport.Move()
|
theViewport.Move()
|
||||||
|
if ebiten.IsRunningSlowly() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
updateGroundImage(groundImage)
|
updateGroundImage(groundImage)
|
||||||
drawGroundImage(screen, groundImage)
|
drawGroundImage(screen, groundImage)
|
||||||
|
|
||||||
|
@ -184,6 +184,9 @@ var (
|
|||||||
|
|
||||||
func update(screen *ebiten.Image) error {
|
func update(screen *ebiten.Image) error {
|
||||||
world.Progress()
|
world.Progress()
|
||||||
|
if ebiten.IsRunningSlowly() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
world.DrawImage(noiseImage)
|
world.DrawImage(noiseImage)
|
||||||
screen.ReplacePixels(noiseImage.Pix)
|
screen.ReplacePixels(noiseImage.Pix)
|
||||||
return nil
|
return nil
|
||||||
|
@ -77,7 +77,9 @@ func update(screen *ebiten.Image) error {
|
|||||||
spotLightY = -spotLightY + 2*maxY
|
spotLightY = -spotLightY + 2*maxY
|
||||||
spotLightVY = -spotLightVY
|
spotLightVY = -spotLightVY
|
||||||
}
|
}
|
||||||
|
if ebiten.IsRunningSlowly() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
maskImage.Clear()
|
maskImage.Clear()
|
||||||
|
|
||||||
op := &ebiten.DrawImageOptions{}
|
op := &ebiten.DrawImageOptions{}
|
||||||
|
@ -50,6 +50,9 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func update(screen *ebiten.Image) error {
|
func update(screen *ebiten.Image) error {
|
||||||
|
if ebiten.IsRunningSlowly() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
op := &ebiten.DrawImageOptions{}
|
op := &ebiten.DrawImageOptions{}
|
||||||
op.GeoM.Scale(1.0/mosaicRatio, 1.0/mosaicRatio)
|
op.GeoM.Scale(1.0/mosaicRatio, 1.0/mosaicRatio)
|
||||||
gophersRenderTarget.DrawImage(gophersImage, op)
|
gophersRenderTarget.DrawImage(gophersImage, op)
|
||||||
|
@ -71,6 +71,9 @@ func update(screen *ebiten.Image) error {
|
|||||||
noiseImage.Pix[4*i+2] = uint8(x >> 8)
|
noiseImage.Pix[4*i+2] = uint8(x >> 8)
|
||||||
noiseImage.Pix[4*i+3] = 0xff
|
noiseImage.Pix[4*i+3] = 0xff
|
||||||
}
|
}
|
||||||
|
if ebiten.IsRunningSlowly() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
screen.ReplacePixels(noiseImage.Pix)
|
screen.ReplacePixels(noiseImage.Pix)
|
||||||
ebitenutil.DebugPrint(screen, fmt.Sprintf("FPS: %f", ebiten.CurrentFPS()))
|
ebitenutil.DebugPrint(screen, fmt.Sprintf("FPS: %f", ebiten.CurrentFPS()))
|
||||||
return nil
|
return nil
|
||||||
|
@ -75,7 +75,9 @@ func update(screen *ebiten.Image) error {
|
|||||||
if drawn {
|
if drawn {
|
||||||
count++
|
count++
|
||||||
}
|
}
|
||||||
|
if ebiten.IsRunningSlowly() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
screen.DrawImage(canvasImage, nil)
|
screen.DrawImage(canvasImage, nil)
|
||||||
|
|
||||||
msg := fmt.Sprintf("(%d, %d)", mx, my)
|
msg := fmt.Sprintf("(%d, %d)", mx, my)
|
||||||
|
@ -68,6 +68,9 @@ func (p parts) Src(i int) (x0, y0, x1, y1 int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func update(screen *ebiten.Image) error {
|
func update(screen *ebiten.Image) error {
|
||||||
|
if ebiten.IsRunningSlowly() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
op := &ebiten.DrawImageOptions{
|
op := &ebiten.DrawImageOptions{
|
||||||
ImageParts: &parts{gophersImage},
|
ImageParts: &parts{gophersImage},
|
||||||
}
|
}
|
||||||
|
@ -220,7 +220,9 @@ func update(screen *ebiten.Image) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ebiten.IsRunningSlowly() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
screen.Fill(color.RGBA{0x80, 0x80, 0xc0, 0xff})
|
screen.Fill(color.RGBA{0x80, 0x80, 0xc0, 0xff})
|
||||||
screen.DrawImage(imagePiano, nil)
|
screen.DrawImage(imagePiano, nil)
|
||||||
|
|
||||||
|
@ -50,6 +50,9 @@ var (
|
|||||||
|
|
||||||
func update(screen *ebiten.Image) error {
|
func update(screen *ebiten.Image) error {
|
||||||
count++
|
count++
|
||||||
|
if ebiten.IsRunningSlowly() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
w, h := gophersImage.Size()
|
w, h := gophersImage.Size()
|
||||||
op := &ebiten.DrawImageOptions{}
|
op := &ebiten.DrawImageOptions{}
|
||||||
op.GeoM.Translate(-float64(w)/2, -float64(h)/2)
|
op.GeoM.Translate(-float64(w)/2, -float64(h)/2)
|
||||||
|
Loading…
Reference in New Issue
Block a user