mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +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:
|
||||
diff = float64(480-count) * 0.2
|
||||
}
|
||||
|
||||
if ebiten.IsRunningSlowly() {
|
||||
return nil
|
||||
}
|
||||
screen.Fill(color.NRGBA{0x00, 0x00, 0x80, 0xff})
|
||||
op := &ebiten.DrawImageOptions{}
|
||||
op.ColorM.Scale(1.0, 1.0, 1.0, 0.5)
|
||||
|
@ -211,7 +211,9 @@ func update(screen *ebiten.Image) error {
|
||||
}
|
||||
musicPlayer.updateVolume()
|
||||
}
|
||||
|
||||
if ebiten.IsRunningSlowly() {
|
||||
return nil
|
||||
}
|
||||
op := &ebiten.DrawImageOptions{}
|
||||
x, y, w, h := playerBarRect()
|
||||
op.GeoM.Translate(float64(x), float64(y))
|
||||
|
@ -102,6 +102,9 @@ func parseFont() error {
|
||||
}
|
||||
|
||||
func update(screen *ebiten.Image) error {
|
||||
if ebiten.IsRunningSlowly() {
|
||||
return nil
|
||||
}
|
||||
screen.DrawImage(textImage, &ebiten.DrawImageOptions{})
|
||||
return nil
|
||||
}
|
||||
|
@ -62,6 +62,9 @@ func update(screen *ebiten.Image) error {
|
||||
pressedButtons = append(pressedButtons, strconv.Itoa(int(b)))
|
||||
}
|
||||
}
|
||||
if ebiten.IsRunningSlowly() {
|
||||
return nil
|
||||
}
|
||||
|
||||
str := `Gamepad
|
||||
Axes:
|
||||
|
@ -83,6 +83,9 @@ func update(screen *ebiten.Image) error {
|
||||
if ebiten.IsKeyPressed(ebiten.KeyX) {
|
||||
valueInt++
|
||||
}
|
||||
if ebiten.IsRunningSlowly() {
|
||||
return nil
|
||||
}
|
||||
hueInt = clamp(hueInt, -256, 256)
|
||||
saturationInt = clamp(saturationInt, 0, 256)
|
||||
valueInt = clamp(valueInt, 0, 256)
|
||||
|
@ -50,6 +50,9 @@ var (
|
||||
|
||||
func update(screen *ebiten.Image) error {
|
||||
count++
|
||||
if ebiten.IsRunningSlowly() {
|
||||
return nil
|
||||
}
|
||||
w, h := gophersImage.Size()
|
||||
op := &ebiten.DrawImageOptions{}
|
||||
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 {
|
||||
theViewport.Move()
|
||||
|
||||
if ebiten.IsRunningSlowly() {
|
||||
return nil
|
||||
}
|
||||
updateGroundImage(groundImage)
|
||||
drawGroundImage(screen, groundImage)
|
||||
|
||||
|
@ -184,6 +184,9 @@ var (
|
||||
|
||||
func update(screen *ebiten.Image) error {
|
||||
world.Progress()
|
||||
if ebiten.IsRunningSlowly() {
|
||||
return nil
|
||||
}
|
||||
world.DrawImage(noiseImage)
|
||||
screen.ReplacePixels(noiseImage.Pix)
|
||||
return nil
|
||||
|
@ -77,7 +77,9 @@ func update(screen *ebiten.Image) error {
|
||||
spotLightY = -spotLightY + 2*maxY
|
||||
spotLightVY = -spotLightVY
|
||||
}
|
||||
|
||||
if ebiten.IsRunningSlowly() {
|
||||
return nil
|
||||
}
|
||||
maskImage.Clear()
|
||||
|
||||
op := &ebiten.DrawImageOptions{}
|
||||
|
@ -50,6 +50,9 @@ var (
|
||||
)
|
||||
|
||||
func update(screen *ebiten.Image) error {
|
||||
if ebiten.IsRunningSlowly() {
|
||||
return nil
|
||||
}
|
||||
op := &ebiten.DrawImageOptions{}
|
||||
op.GeoM.Scale(1.0/mosaicRatio, 1.0/mosaicRatio)
|
||||
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+3] = 0xff
|
||||
}
|
||||
if ebiten.IsRunningSlowly() {
|
||||
return nil
|
||||
}
|
||||
screen.ReplacePixels(noiseImage.Pix)
|
||||
ebitenutil.DebugPrint(screen, fmt.Sprintf("FPS: %f", ebiten.CurrentFPS()))
|
||||
return nil
|
||||
|
@ -75,7 +75,9 @@ func update(screen *ebiten.Image) error {
|
||||
if drawn {
|
||||
count++
|
||||
}
|
||||
|
||||
if ebiten.IsRunningSlowly() {
|
||||
return nil
|
||||
}
|
||||
screen.DrawImage(canvasImage, nil)
|
||||
|
||||
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 {
|
||||
if ebiten.IsRunningSlowly() {
|
||||
return nil
|
||||
}
|
||||
op := &ebiten.DrawImageOptions{
|
||||
ImageParts: &parts{gophersImage},
|
||||
}
|
||||
|
@ -220,7 +220,9 @@ func update(screen *ebiten.Image) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if ebiten.IsRunningSlowly() {
|
||||
return nil
|
||||
}
|
||||
screen.Fill(color.RGBA{0x80, 0x80, 0xc0, 0xff})
|
||||
screen.DrawImage(imagePiano, nil)
|
||||
|
||||
|
@ -50,6 +50,9 @@ var (
|
||||
|
||||
func update(screen *ebiten.Image) error {
|
||||
count++
|
||||
if ebiten.IsRunningSlowly() {
|
||||
return nil
|
||||
}
|
||||
w, h := gophersImage.Size()
|
||||
op := &ebiten.DrawImageOptions{}
|
||||
op.GeoM.Translate(-float64(w)/2, -float64(h)/2)
|
||||
|
Loading…
Reference in New Issue
Block a user