From fb65fe1fee165b0cf6f0d0fd6cc4c1b3b5d7ff62 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Mon, 29 May 2017 22:01:47 +0900 Subject: [PATCH] doc: Update: changed the path for the script location --- _docs/examplecontent.tmpl.html | 2 +- .../images/images/keyboard/keyboard.png | Bin 2153 -> 1861 bytes .../_resources/images/keyboard/keyboard.png | Bin 2153 -> 1861 bytes docs/examples/alphablending.content.html | 2 +- docs/examples/alphablending.html | 29 ++------ docs/examples/audio.content.html | 2 +- docs/examples/blocks.content.html | 2 +- docs/examples/font.content.html | 2 +- docs/examples/gamepad.content.html | 2 +- docs/examples/hsv.content.html | 2 +- docs/examples/hue.content.html | 2 +- docs/examples/infinitescroll.content.html | 2 +- docs/examples/keyboard.content.html | 2 +- docs/examples/keyboard.html | 61 +++++++++-------- docs/examples/life.content.html | 2 +- docs/examples/masking.content.html | 2 +- docs/examples/mosaic.content.html | 2 +- docs/examples/noise.content.html | 2 +- docs/examples/paint.content.html | 2 +- docs/examples/perspective.content.html | 2 +- docs/examples/perspective.html | 43 +++++------- docs/examples/piano.content.html | 2 +- docs/examples/rotate.content.html | 2 +- docs/examples/sprites.content.html | 2 +- docs/examples/sprites.html | 62 +++++++++--------- 25 files changed, 101 insertions(+), 132 deletions(-) diff --git a/_docs/examplecontent.tmpl.html b/_docs/examplecontent.tmpl.html index 3f53e3e05..7bb94e105 100644 --- a/_docs/examplecontent.tmpl.html +++ b/_docs/examplecontent.tmpl.html @@ -16,7 +16,7 @@ window.addEventListener('load', function() { var s = document.createElement('script'); var src = '{{.Example.Name}}.js'; if (isProduction()) { - src = 'https://hajimehoshi.github.io/ebiten.pagestorage/1.4/' + src; + src = 'https://hajimehoshi.github.io/ebiten.pagestorage/latest/' + src; } s.src = src; s.onload = function() { diff --git a/docs/examples/_resources/images/images/keyboard/keyboard.png b/docs/examples/_resources/images/images/keyboard/keyboard.png index 35a21dcbfab51a86950287d94f8f03d7a8c3d8bf..6dfd5782cfd64cc6fb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zr-x`MO4_#hL1V2v;t%lZ8_nH0xcPoQOQgL_bf`J9z z^n;L&DtNnnvdHI)+y3YsJ;5DRfscsd^98@c}(?gkISJYMZb0RAVL|9eCJFDAEC|A`5^ X6C=8lku>+cqyV^N=VVK<@k{zQHPq<8 diff --git a/docs/examples/_resources/images/keyboard/keyboard.png b/docs/examples/_resources/images/keyboard/keyboard.png index 35a21dcbfab51a86950287d94f8f03d7a8c3d8bf..6dfd5782cfd64cc6fbd0697568968f6f3fb74a5d 100644 GIT binary patch delta 1816 zcmb7Dc{JOJ8Wj~|CyL-vEl;hnbsW@QYJ1kEh^H!aR8z6ET5H>1FhxsGwHUlAhCu|C z+G1=;L#Qp5S{hq2sLmj@CP5^5=FB;7{(j$I-}&zS?m73KbN`T|$mCrCM49f+j@Oe) zx8CM7*Xv7V4snSGWwd%ld9rp=T|3>Pg<4YJyk=41vhenr$CM^-H!7hZp|qGy$5$Ox z_O}Ys)vGnMYIt0xi5Qk?@;cCuz+%<8p<=&P!{&*1pqu6WC}>a5O<<^1R^&B~XZyKN z1Wib>HaxNqE_$3c3b6OYCzi_4RWS!T?e<;7b|S7PS%{1U#XR#>{|(otznbgNBh?^c z{vCrD@9MBEboT=;xA8cNmLtr6*fA8K5vIks<8fJ~QUt$CmG={$g5a0S6tPwjFUKA1 zosQ2u0KfL`8av-}k>|tk?WTpgPRthA29P*gDnC?6&El^EUPE{c&wSQ%x9ogntJRTV zsqEq%39Cr2)PBl9B04qT;3S`2KBhaVW$Q}1xp^Y%Un#Zo zT+x`U$x^b#n}27~GVW!v-W(hrtUM`Q(ugc5!CK$AsfOYVs6-g8??XEV=V3|;&JIlI zI*=XY1Z;kpCb~A}h{R^O(1u&T;;uG%Mlh$BdtoilU?MqniRZK{CL6RFSX}rB(%YY+ zq~{W$ujN1#;B+Um$7gD)z=kq;7T{9QM>u#3_udd`dU0uJzM!yicu8&|HQ_!EGbUx_ zMw-jC7QUR$GK)JzR~t+qNGZ}=l8DZva3-LDS7<6syAA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r6ezBBVm0)^FK5((+9u_!JP%h9$D=5 z*dLDyba~Y_GWsxNo3HiWyHrWVYI2guaIZykao0WQ8VgH|Yu7m_$w9HU zstm#JPf7?#i{e5oG^bT!?TTV5x}(UE?ce*<>G>K=Nm>}#nemCO@T25Tl#o8l(r+=_ zomeyLb+1ZP|L4xYU!OFOWaHL<_Ry1&358L0zVKNOMwHDK*rvY1_o?hg{;G_FMCZoJ z?q9+I{wa-{bjjH3D$bPPyh-Zr-x`MO4_#hL1V2v;t%lZ8_nH0xcPoQOQgL_bf`J9z z^n;L&DtNnnvdHI)+y3YsJ;5DRfscsd^98@c}(?gkISJYMZb0RAVL|9eCJFDAEC|A`5^ X6C=8lku>+cqyV^N=VVK<@k{zQHPq<8 diff --git a/docs/examples/alphablending.content.html b/docs/examples/alphablending.content.html index 2ffe0e807..b227ac95c 100644 --- a/docs/examples/alphablending.content.html +++ b/docs/examples/alphablending.content.html @@ -16,7 +16,7 @@ window.addEventListener('load', function() { var s = document.createElement('script'); var src = 'alphablending.js'; if (isProduction()) { - src = 'https://hajimehoshi.github.io/ebiten.pagestorage/1.4/' + src; + src = 'https://hajimehoshi.github.io/ebiten.pagestorage/latest/' + src; } s.src = src; s.onload = function() { diff --git a/docs/examples/alphablending.html b/docs/examples/alphablending.html index 4eb54f659..22c4fa6ed 100644 --- a/docs/examples/alphablending.html +++ b/docs/examples/alphablending.html @@ -48,26 +48,6 @@ var ( ebitenImage *ebiten.Image ) -type imageParts struct { - diff float64 -} - -func (p *imageParts) Src(i int) (int, int, int, int) { - w, h := ebitenImage.Size() - return 0, 0, w, h -} - -func (p *imageParts) Dst(i int) (int, int, int, int) { - x := int(float64(i%10)*p.diff + 15) - y := int(float64(i/10)*p.diff + 20) - w, h := ebitenImage.Size() - return x, y, x + w, y + h -} - -func (p *imageParts) Len() int { - return 10 * 10 -} - func update(screen *ebiten.Image) error { count++ count %= ebiten.FPS * 10 @@ -84,10 +64,13 @@ func update(screen *ebiten.Image) error { screen.Fill(color.NRGBA{0x00, 0x00, 0x80, 0xff}) op := &ebiten.DrawImageOptions{} op.ColorM.Scale(1.0, 1.0, 1.0, 0.5) - op.ImageParts = &imageParts{ - diff: diff, + for i := 0; i < 10*10; i++ { + op.GeoM.Reset() + x := float64(i%10)*diff + 15 + y := float64(i/10)*diff + 20 + op.GeoM.Translate(x, y) + screen.DrawImage(ebitenImage, op) } - screen.DrawImage(ebitenImage, op) return nil } diff --git a/docs/examples/audio.content.html b/docs/examples/audio.content.html index 93c863c20..ed3b1f4b6 100644 --- a/docs/examples/audio.content.html +++ b/docs/examples/audio.content.html @@ -16,7 +16,7 @@ window.addEventListener('load', function() { var s = document.createElement('script'); var src = 'audio.js'; if (isProduction()) { - src = 'https://hajimehoshi.github.io/ebiten.pagestorage/1.4/' + src; + src = 'https://hajimehoshi.github.io/ebiten.pagestorage/latest/' + src; } s.src = src; s.onload = function() { diff --git a/docs/examples/blocks.content.html b/docs/examples/blocks.content.html index 824ef2c0b..8f9ac8fe7 100644 --- a/docs/examples/blocks.content.html +++ b/docs/examples/blocks.content.html @@ -16,7 +16,7 @@ window.addEventListener('load', function() { var s = document.createElement('script'); var src = 'blocks.js'; if (isProduction()) { - src = 'https://hajimehoshi.github.io/ebiten.pagestorage/1.4/' + src; + src = 'https://hajimehoshi.github.io/ebiten.pagestorage/latest/' + src; } s.src = src; s.onload = function() { diff --git a/docs/examples/font.content.html b/docs/examples/font.content.html index f67c3b128..1d14f7c5d 100644 --- a/docs/examples/font.content.html +++ b/docs/examples/font.content.html @@ -16,7 +16,7 @@ window.addEventListener('load', function() { var s = document.createElement('script'); var src = 'font.js'; if (isProduction()) { - src = 'https://hajimehoshi.github.io/ebiten.pagestorage/1.4/' + src; + src = 'https://hajimehoshi.github.io/ebiten.pagestorage/latest/' + src; } s.src = src; s.onload = function() { diff --git a/docs/examples/gamepad.content.html b/docs/examples/gamepad.content.html index 6303c5152..08bbfaa96 100644 --- a/docs/examples/gamepad.content.html +++ b/docs/examples/gamepad.content.html @@ -16,7 +16,7 @@ window.addEventListener('load', function() { var s = document.createElement('script'); var src = 'gamepad.js'; if (isProduction()) { - src = 'https://hajimehoshi.github.io/ebiten.pagestorage/1.4/' + src; + src = 'https://hajimehoshi.github.io/ebiten.pagestorage/latest/' + src; } s.src = src; s.onload = function() { diff --git a/docs/examples/hsv.content.html b/docs/examples/hsv.content.html index feb9ec368..49acf6650 100644 --- a/docs/examples/hsv.content.html +++ b/docs/examples/hsv.content.html @@ -16,7 +16,7 @@ window.addEventListener('load', function() { var s = document.createElement('script'); var src = 'hsv.js'; if (isProduction()) { - src = 'https://hajimehoshi.github.io/ebiten.pagestorage/1.4/' + src; + src = 'https://hajimehoshi.github.io/ebiten.pagestorage/latest/' + src; } s.src = src; s.onload = function() { diff --git a/docs/examples/hue.content.html b/docs/examples/hue.content.html index a184f3ade..9329f3086 100644 --- a/docs/examples/hue.content.html +++ b/docs/examples/hue.content.html @@ -16,7 +16,7 @@ window.addEventListener('load', function() { var s = document.createElement('script'); var src = 'hue.js'; if (isProduction()) { - src = 'https://hajimehoshi.github.io/ebiten.pagestorage/1.4/' + src; + src = 'https://hajimehoshi.github.io/ebiten.pagestorage/latest/' + src; } s.src = src; s.onload = function() { diff --git a/docs/examples/infinitescroll.content.html b/docs/examples/infinitescroll.content.html index 9811d45fa..008eadf62 100644 --- a/docs/examples/infinitescroll.content.html +++ b/docs/examples/infinitescroll.content.html @@ -16,7 +16,7 @@ window.addEventListener('load', function() { var s = document.createElement('script'); var src = 'infinitescroll.js'; if (isProduction()) { - src = 'https://hajimehoshi.github.io/ebiten.pagestorage/1.4/' + src; + src = 'https://hajimehoshi.github.io/ebiten.pagestorage/latest/' + src; } s.src = src; s.onload = function() { diff --git a/docs/examples/keyboard.content.html b/docs/examples/keyboard.content.html index 753f22ec7..d9719b45e 100644 --- a/docs/examples/keyboard.content.html +++ b/docs/examples/keyboard.content.html @@ -16,7 +16,7 @@ window.addEventListener('load', function() { var s = document.createElement('script'); var src = 'keyboard.js'; if (isProduction()) { - src = 'https://hajimehoshi.github.io/ebiten.pagestorage/1.4/' + src; + src = 'https://hajimehoshi.github.io/ebiten.pagestorage/latest/' + src; } s.src = src; s.onload = function() { diff --git a/docs/examples/keyboard.html b/docs/examples/keyboard.html index 009979b99..bd8964dd0 100644 --- a/docs/examples/keyboard.html +++ b/docs/examples/keyboard.html @@ -54,14 +54,22 @@ func init() { } var keyNames = map[ebiten.Key]string{ - ebiten.KeyBackspace: "BS", - ebiten.KeyComma: ",", - ebiten.KeyDelete: "Del", - ebiten.KeyEnter: "Enter", - ebiten.KeyEscape: "Esc", - ebiten.KeyPeriod: ".", - ebiten.KeySpace: "Space", - ebiten.KeyTab: "Tab", + ebiten.KeyBackspace: "BS", + ebiten.KeyComma: ",", + ebiten.KeyEnter: "Enter", + ebiten.KeyEscape: "Esc", + ebiten.KeyPeriod: ".", + ebiten.KeySpace: "Space", + ebiten.KeyTab: "Tab", + ebiten.KeyMinus: "-", + ebiten.KeyEqual: "=", + ebiten.KeyBackslash: "\\", + ebiten.KeyGraveAccent: "`", + ebiten.KeyLeftBracket: "[", + ebiten.KeyRightBracket: "]", + ebiten.KeySemicolon: ";", + ebiten.KeyApostrophe: "'", + ebiten.KeySlash: "/", // Arrows ebiten.KeyDown: "Down", @@ -75,26 +83,10 @@ var keyNames = map[ebiten.Key]string{ ebiten.KeyAlt: "Alt", } -type pressedKeysParts []string - -func (p pressedKeysParts) Len() int { - return len(p) -} - -func (p pressedKeysParts) Dst(i int) (x0, y0, x1, y1 int) { - k := p[i] - r, ok := keyboard.KeyRect(k) - if !ok { - return 0, 0, 0, 0 - } - return r.Min.X, r.Min.Y, r.Max.X, r.Max.Y -} - -func (p pressedKeysParts) Src(i int) (x0, y0, x1, y1 int) { - return p.Dst(i) -} - func update(screen *ebiten.Image) error { + if ebiten.IsRunningSlowly() { + return nil + } const offsetX, offsetY = 24, 40 op := &ebiten.DrawImageOptions{} op.GeoM.Translate(offsetX, offsetY) @@ -123,11 +115,18 @@ func update(screen *ebiten.Image) error { } } - op = &ebiten.DrawImageOptions{ - ImageParts: pressedKeysParts(pressed), + op = &ebiten.DrawImageOptions{} + for _, p := range pressed { + op.GeoM.Reset() + r, ok := keyboard.KeyRect(p) + if !ok { + continue + } + op.GeoM.Translate(float64(r.Min.X), float64(r.Min.Y)) + op.GeoM.Translate(offsetX, offsetY) + op.SourceRect = &r + screen.DrawImage(keyboardImage, op) } - op.GeoM.Translate(offsetX, offsetY) - screen.DrawImage(keyboardImage, op) return nil } diff --git a/docs/examples/life.content.html b/docs/examples/life.content.html index 3ca1a049c..903f5b612 100644 --- a/docs/examples/life.content.html +++ b/docs/examples/life.content.html @@ -16,7 +16,7 @@ window.addEventListener('load', function() { var s = document.createElement('script'); var src = 'life.js'; if (isProduction()) { - src = 'https://hajimehoshi.github.io/ebiten.pagestorage/1.4/' + src; + src = 'https://hajimehoshi.github.io/ebiten.pagestorage/latest/' + src; } s.src = src; s.onload = function() { diff --git a/docs/examples/masking.content.html b/docs/examples/masking.content.html index 8d0c409fd..85e592e69 100644 --- a/docs/examples/masking.content.html +++ b/docs/examples/masking.content.html @@ -16,7 +16,7 @@ window.addEventListener('load', function() { var s = document.createElement('script'); var src = 'masking.js'; if (isProduction()) { - src = 'https://hajimehoshi.github.io/ebiten.pagestorage/1.4/' + src; + src = 'https://hajimehoshi.github.io/ebiten.pagestorage/latest/' + src; } s.src = src; s.onload = function() { diff --git a/docs/examples/mosaic.content.html b/docs/examples/mosaic.content.html index 8849d1f2a..c1e427f9d 100644 --- a/docs/examples/mosaic.content.html +++ b/docs/examples/mosaic.content.html @@ -16,7 +16,7 @@ window.addEventListener('load', function() { var s = document.createElement('script'); var src = 'mosaic.js'; if (isProduction()) { - src = 'https://hajimehoshi.github.io/ebiten.pagestorage/1.4/' + src; + src = 'https://hajimehoshi.github.io/ebiten.pagestorage/latest/' + src; } s.src = src; s.onload = function() { diff --git a/docs/examples/noise.content.html b/docs/examples/noise.content.html index 0056ceac5..af439b853 100644 --- a/docs/examples/noise.content.html +++ b/docs/examples/noise.content.html @@ -16,7 +16,7 @@ window.addEventListener('load', function() { var s = document.createElement('script'); var src = 'noise.js'; if (isProduction()) { - src = 'https://hajimehoshi.github.io/ebiten.pagestorage/1.4/' + src; + src = 'https://hajimehoshi.github.io/ebiten.pagestorage/latest/' + src; } s.src = src; s.onload = function() { diff --git a/docs/examples/paint.content.html b/docs/examples/paint.content.html index 43a71feca..4865c9e22 100644 --- a/docs/examples/paint.content.html +++ b/docs/examples/paint.content.html @@ -16,7 +16,7 @@ window.addEventListener('load', function() { var s = document.createElement('script'); var src = 'paint.js'; if (isProduction()) { - src = 'https://hajimehoshi.github.io/ebiten.pagestorage/1.4/' + src; + src = 'https://hajimehoshi.github.io/ebiten.pagestorage/latest/' + src; } s.src = src; s.onload = function() { diff --git a/docs/examples/perspective.content.html b/docs/examples/perspective.content.html index 418686a11..1ada5ea0a 100644 --- a/docs/examples/perspective.content.html +++ b/docs/examples/perspective.content.html @@ -16,7 +16,7 @@ window.addEventListener('load', function() { var s = document.createElement('script'); var src = 'perspective.js'; if (isProduction()) { - src = 'https://hajimehoshi.github.io/ebiten.pagestorage/1.4/' + src; + src = 'https://hajimehoshi.github.io/ebiten.pagestorage/latest/' + src; } s.src = src; s.onload = function() { diff --git a/docs/examples/perspective.html b/docs/examples/perspective.html index 72ae0f82b..9ab9981d7 100644 --- a/docs/examples/perspective.html +++ b/docs/examples/perspective.html @@ -30,6 +30,7 @@ package main import ( + "image" _ "image/jpeg" "log" @@ -46,39 +47,25 @@ var ( gophersImage *ebiten.Image ) -type parts struct { - image *ebiten.Image -} - -func (p parts) Len() int { - _, h := p.image.Size() - return h -} - -func (p parts) Dst(i int) (x0, y0, x1, y1 int) { - w, h := p.image.Size() - width := w + i*3/4 - x := ((h - i) * 3 / 4) / 2 - return x, i, x + width, i + 1 -} - -func (p parts) Src(i int) (x0, y0, x1, y1 int) { - w, _ := p.image.Size() - return 0, i, w, i + 1 -} - func update(screen *ebiten.Image) error { if ebiten.IsRunningSlowly() { return nil } - op := &ebiten.DrawImageOptions{ - ImageParts: &parts{gophersImage}, - } + op := &ebiten.DrawImageOptions{} w, h := gophersImage.Size() - maxWidth := float64(w) + float64(h)*0.75 - op.GeoM.Translate(-maxWidth/2, -float64(h)/2) - op.GeoM.Translate(screenWidth/2, screenHeight/2) - screen.DrawImage(gophersImage, op) + for i := 0; i < h; i++ { + op.GeoM.Reset() + width := w + i*3/4 + x := ((h - i) * 3 / 4) / 2 + op.GeoM.Scale(float64(width)/float64(w), 1) + op.GeoM.Translate(float64(x), float64(i)) + maxWidth := float64(w) + float64(h)*3/4 + op.GeoM.Translate(-maxWidth/2, -float64(h)/2) + op.GeoM.Translate(screenWidth/2, screenHeight/2) + r := image.Rect(0, i, w, i+1) + op.SourceRect = &r + screen.DrawImage(gophersImage, op) + } return nil } diff --git a/docs/examples/piano.content.html b/docs/examples/piano.content.html index c8d6c45d1..2845eccb2 100644 --- a/docs/examples/piano.content.html +++ b/docs/examples/piano.content.html @@ -16,7 +16,7 @@ window.addEventListener('load', function() { var s = document.createElement('script'); var src = 'piano.js'; if (isProduction()) { - src = 'https://hajimehoshi.github.io/ebiten.pagestorage/1.4/' + src; + src = 'https://hajimehoshi.github.io/ebiten.pagestorage/latest/' + src; } s.src = src; s.onload = function() { diff --git a/docs/examples/rotate.content.html b/docs/examples/rotate.content.html index a1315feef..e5397fb53 100644 --- a/docs/examples/rotate.content.html +++ b/docs/examples/rotate.content.html @@ -16,7 +16,7 @@ window.addEventListener('load', function() { var s = document.createElement('script'); var src = 'rotate.js'; if (isProduction()) { - src = 'https://hajimehoshi.github.io/ebiten.pagestorage/1.4/' + src; + src = 'https://hajimehoshi.github.io/ebiten.pagestorage/latest/' + src; } s.src = src; s.onload = function() { diff --git a/docs/examples/sprites.content.html b/docs/examples/sprites.content.html index 00bb6abaf..155de2fe8 100644 --- a/docs/examples/sprites.content.html +++ b/docs/examples/sprites.content.html @@ -16,7 +16,7 @@ window.addEventListener('load', function() { var s = document.createElement('script'); var src = 'sprites.js'; if (isProduction()) { - src = 'https://hajimehoshi.github.io/ebiten.pagestorage/1.4/' + src; + src = 'https://hajimehoshi.github.io/ebiten.pagestorage/latest/' + src; } s.src = src; s.onload = function() { diff --git a/docs/examples/sprites.html b/docs/examples/sprites.html index c962228e2..66ce742af 100644 --- a/docs/examples/sprites.html +++ b/docs/examples/sprites.html @@ -33,6 +33,7 @@ import ( "fmt" _ "image/png" "log" + "math" "math/rand" "github.com/hajimehoshi/ebiten" @@ -42,12 +43,11 @@ import ( const ( screenWidth = 320 screenHeight = 240 + maxAngle = 256 ) var ( - ebitenImage *ebiten.Image - ebitenImageWidth = 0 - ebitenImageHeight = 0 + ebitenImage *ebiten.Image ) type Sprite struct { @@ -57,6 +57,7 @@ type Sprite struct { y int vx int vy int + angle int } func (s *Sprite) Update() { @@ -76,6 +77,8 @@ func (s *Sprite) Update() { s.y = 2*(screenHeight-s.imageHeight) - s.y s.vy = -s.vy } + s.angle++ + s.angle %= maxAngle } type Sprites struct { @@ -89,31 +92,15 @@ func (s *Sprites) Update() { } } -func (s *Sprites) Len() int { - return s.num -} - -func (s *Sprites) Dst(i int) (x0, y0, x1, y1 int) { - if s.num <= i { - return 0, 0, 0, 0 - } - ss := s.sprites[i] - return ss.x, ss.y, ss.x + ebitenImageWidth, ss.y + ebitenImageHeight -} - -func (s *Sprites) Src(i int) (x0, y0, x1, y1 int) { - if s.num <= i { - return 0, 0, 0, 0 - } - return 0, 0, ebitenImageWidth, ebitenImageHeight -} - const ( MinSprites = 0 MaxSprites = 50000 ) -var sprites = &Sprites{make([]*Sprite, MaxSprites), 500} +var ( + sprites = &Sprites{make([]*Sprite, MaxSprites), 500} + op = &ebiten.DrawImageOptions{} +) func update(screen *ebiten.Image) error { if ebiten.IsKeyPressed(ebiten.KeyLeft) { @@ -133,29 +120,41 @@ func update(screen *ebiten.Image) error { if ebiten.IsRunningSlowly() { return nil } - op := &ebiten.DrawImageOptions{ - ImageParts: sprites, + w, h := ebitenImage.Size() + for i := 0; i < sprites.num; i++ { + s := sprites.sprites[i] + op.GeoM.Reset() + op.GeoM.Translate(-float64(w)/2, -float64(h)/2) + op.GeoM.Rotate(2 * math.Pi * float64(s.angle) / maxAngle) + op.GeoM.Translate(float64(w)/2, float64(h)/2) + op.GeoM.Translate(float64(s.x), float64(s.y)) + screen.DrawImage(ebitenImage, op) } - op.ColorM.Scale(1.0, 1.0, 1.0, 0.5) - screen.DrawImage(ebitenImage, op) msg := fmt.Sprintf(`FPS: %0.2f Num of sprites: %d -Press <- or -> to change the number of sprites`, ebiten.CurrentFPS(), sprites.Len()) - ebitenutil.DebugPrint(screen, msg) +Press <- or -> to change the number of sprites`, ebiten.CurrentFPS(), sprites.num) + if err := ebitenutil.DebugPrint(screen, msg); err != nil { + return err + } return nil } func main() { var err error - ebitenImage, _, err = ebitenutil.NewImageFromFile("_resources/images/ebiten.png", ebiten.FilterNearest) + img, _, err := ebitenutil.NewImageFromFile("_resources/images/ebiten.png", ebiten.FilterNearest) if err != nil { log.Fatal(err) } - ebitenImageWidth, ebitenImageHeight = ebitenImage.Size() + w, h := img.Size() + ebitenImage, _ = ebiten.NewImage(w, h, ebiten.FilterNearest) + op := &ebiten.DrawImageOptions{} + op.ColorM.Scale(1, 1, 1, 0.5) + ebitenImage.DrawImage(img, op) for i := range sprites.sprites { w, h := ebitenImage.Size() x, y := rand.Intn(screenWidth-w), rand.Intn(screenHeight-h) vx, vy := 2*rand.Intn(2)-1, 2*rand.Intn(2)-1 + a := rand.Intn(maxAngle) sprites.sprites[i] = &Sprite{ imageWidth: w, imageHeight: h, @@ -163,6 +162,7 @@ func main() { y: y, vx: vx, vy: vy, + angle: a, } } if err := ebiten.Run(update, screenWidth, screenHeight, 2, "Sprites (Ebiten Demo)"); err != nil {