From 106984e9c772428cf08a6abd304a923b25c22742 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Wed, 21 Jan 2015 00:51:55 +0900 Subject: [PATCH] Update docs --- _docs/index.tmpl.html | 20 +++++++ _docs/public/example/images/blocks/ebiten.png | Bin 2149 -> 0 bytes .../example/images/keyboard/keyboard.png | Bin 0 -> 3196 bytes _docs/public/example/keyboard.html | 56 +++++++++++++++--- _docs/public/index.html | 20 +++++++ 5 files changed, 87 insertions(+), 9 deletions(-) delete mode 100644 _docs/public/example/images/blocks/ebiten.png create mode 100644 _docs/public/example/images/keyboard/keyboard.png diff --git a/_docs/index.tmpl.html b/_docs/index.tmpl.html index 07f1eb988..d7292c062 100644 --- a/_docs/index.tmpl.html +++ b/_docs/index.tmpl.html @@ -81,6 +81,26 @@ pre {
  • v1.2.0-rc1 released. +
  • + +

    2015-??-??

    + diff --git a/_docs/public/example/images/blocks/ebiten.png b/_docs/public/example/images/blocks/ebiten.png deleted file mode 100644 index 72f89c8b221fee3811905ee2fdbe824e94bce79a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2149 zcmV-r2%7haP)3-|7Yx02e8$AWWZJju+@BIz*Yya)oiu_9#GzdaYCR7m=9{`U;kMC zPAO^5-`83>|MSYg_?!XLh@N1v$|KVHGy^7W&bybRHX zy*JZEMiDLJ*C)R0RY0OVP zk*=OS;L=8aCmdY0Uh#XC-qD|i<=&?tJ+SoRqmLw~U%E}gJ~UgQeex9Lu{!q1x8Er5 z+y8wwHWvVMjY?sgB&(mti5J8iDZ~`3TJvz8=$5e z?aZQifNdwxXdv@vNW%f#<+Ip$84nLXiLtrGxK&JVjd0gNN?-ip=loLjx%U(BA1{Gq z^~!f8y)u@^vwK{&G(z)C&1#0?fi0p2#13MU8EiI%(FAM}$sJ+}7#Ab5jBQU~$xxyw zZ7b^7NDAtK6~xOhp2E;RY$wNTzZu^c%-jXsv7=~M!>iYcMt8p$ z?znZrFIA7Or{k(KAWfTJiq5KO!2xi}H@chfN{4998pE}ec+jV&XqFB4|Rk-`B?HitEWm$~~8(1GTA>wbxY6B6AEWM062Pn3(57V^+ z;&-4qfl3Q4-;T5{Ae}|X6Yz@|zd%qZL0CanC((2f3PTX>L>y?+#O7C^cE@6|ch^I` zAN$O2K8*19Sa%8Jo#q{RvUGP6FYQv-@-%IrIBa$f6^l5426zR?&x5^;3wI;Q0xoqB zPh&{2eMb;=n6MWOx2+xVMI>8BjSrrODc*oBRFJ42)S*!uTn0fOYH}^f>5ArOJbH7oP_8@Z1vG}R2QTbJ{W@MW@KUK~{QgSZbB^(w z(rYb#eFKulV0-?}`;`crP2#k?R-&n*em};G&~O+RUxdanw77z5gm`r{TS5Kqwc;ln zL~R{S=aKjlDjBvgh>3@w;MY9iG4(Rdcg9ZHCjU<-99+=%fiXs&49!bVksLU+?I4E)-UYG?ee zzGJn~J6-@}GevI1x=#UTE$a0kHUz(bnlj=Xn&&viOB=@NFIbi)MN~uBsHibo{ZmHDB1Pc@vkW3)U+x2VJ9? zjRt=~RDH64?DpABi1oT~)$al;)6YLHF2@9=$7>_mGjJro&arI@*XoPV|12N<7}@Fo bwwk{Iw`MFuQA#B|00000NkvXXu0mjf)^#I} diff --git a/_docs/public/example/images/keyboard/keyboard.png b/_docs/public/example/images/keyboard/keyboard.png new file mode 100644 index 0000000000000000000000000000000000000000..dc3693760fc736f9649124d63431ca246b5dc7b0 GIT binary patch literal 3196 zcmd^CYgE$N9!1OXoo1`7%&4hulZMumnU!KMowPJH#aED1X=;Eym6q$Dbg_#np;Utr2Z<@LY1*0k=|d+*o#<*c*z*}rvu=j^@DS||6c zpSPviMl%oyWO?d`6M-O*f#=fvi^(@jVnKXu~hx$94+ho%?gVC?n6gO^7zv_EiUuaexNvq`EDdFm7qPhBz^y$-@$v!fbilz(oy~Pjf zI4NBWDx9NMt3&+h@|Wet1&mZWPC3~p6f(mdR(e~G4WN+AC18TSO9ptQf-c24(Y!;Sf1uKoY2dwFEu_$Rqu8dSnTfp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zR1 z3~z4IrZ5|zxjY`<**4Cfp-7H9#N8>B1hPw=ZM_H+XKN3@)By7Qlt3w)H-<+EvakxX zs=lW>v@YS$K#M)qocLIJ!3h`ScDqk))${oCGbd#bP_ow-I+FL-Ob(~72w{*$E6`Yh tPB(R0XZ$xt_}?w`e_E-BfX}XE^`> literal 0 HcmV?d00001 diff --git a/_docs/public/example/keyboard.html b/_docs/public/example/keyboard.html index b427fbcee..94a9b7fd2 100644 --- a/_docs/public/example/keyboard.html +++ b/_docs/public/example/keyboard.html @@ -41,10 +41,9 @@ pre { import ( "github.com/hajimehoshi/ebiten" "github.com/hajimehoshi/ebiten/ebitenutil" + "github.com/hajimehoshi/ebiten/example/keyboard/keyboard" "log" - "sort" "strconv" - "strings" ) const ( @@ -52,13 +51,23 @@ const ( screenHeight = 240 ) +var keyboardImage *ebiten.Image + +func init() { + var err error + keyboardImage, _, err = ebitenutil.NewImageFromFile("images/keyboard/keyboard.png", ebiten.FilterNearest) + if err != nil { + log.Fatal(err) + } +} + var keyNames = map[ebiten.Key]string{ - ebiten.KeyBackspace: "Backspace", - ebiten.KeyComma: "','", - ebiten.KeyDelete: "Delete", + ebiten.KeyBackspace: "BS", + ebiten.KeyComma: ",", + ebiten.KeyDelete: "Del", ebiten.KeyEnter: "Enter", ebiten.KeyEscape: "Esc", - ebiten.KeyPeriod: "'.'", + ebiten.KeyPeriod: ".", ebiten.KeySpace: "Space", ebiten.KeyTab: "Tab", @@ -74,7 +83,32 @@ 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 { + const offsetX, offsetY = 24, 40 + op := &ebiten.DrawImageOptions{} + op.GeoM.Translate(offsetX, offsetY) + op.ColorM.Scale(0.5, 0.5, 0.5, 1) + screen.DrawImage(keyboardImage, op) + pressed := []string{} for i := 0; i <= 9; i++ { if ebiten.IsKeyPressed(ebiten.Key(i) + ebiten.Key0) { @@ -96,9 +130,13 @@ func update(screen *ebiten.Image) error { pressed = append(pressed, name) } } - sort.Strings(pressed) - str := "Pressed Keys: " + strings.Join(pressed, ", ") - ebitenutil.DebugPrint(screen, str) + + op = &ebiten.DrawImageOptions{ + ImageParts: pressedKeysParts(pressed), + } + op.GeoM.Translate(offsetX, offsetY) + screen.DrawImage(keyboardImage, op) + return nil } diff --git a/_docs/public/index.html b/_docs/public/index.html index efcbeab3c..ad3a89749 100644 --- a/_docs/public/index.html +++ b/_docs/public/index.html @@ -107,6 +107,26 @@ pre {
  • v1.2.0-rc1 released.
    • Support for gamepads
    • +
    • Added new functions for image rendering: +
        +
      • Image.DrawFilledRect
      • +
      • Image.DrawFilledRects
      • +
      • Image.DrawLine
      • +
      • Image.DrawLines
      • +
      • Image.DrawRect
      • +
      • Image.DrawRects
      • +
      • Image.ReplacePixels
      • +
      +
    • +
    • Some bug fix
    • +
    +
  • + +

    2015-??-??

    +
      +
    • v1.1.0 released. +
        +
      • Some bug fix