Rename example/internal -> example/common

This commit is contained in:
Hajime Hoshi 2015-01-26 22:20:36 +09:00
parent 2aa6ebb471
commit 714930eaf7
6 changed files with 20 additions and 20 deletions

View File

@ -16,18 +16,18 @@ package blocks
import (
"github.com/hajimehoshi/ebiten"
"github.com/hajimehoshi/ebiten/example/internal"
"github.com/hajimehoshi/ebiten/example/common"
"image/color"
)
func drawTextWithShadowCenter(rt *ebiten.Image, str string, x, y, scale int, clr color.Color, width int) error {
w := internal.ArcadeFont.TextWidth(str) * scale
w := common.ArcadeFont.TextWidth(str) * scale
x += (width - w) / 2
return internal.ArcadeFont.DrawTextWithShadow(rt, str, x, y, scale, clr)
return common.ArcadeFont.DrawTextWithShadow(rt, str, x, y, scale, clr)
}
func drawTextWithShadowRight(rt *ebiten.Image, str string, x, y, scale int, clr color.Color, width int) error {
w := internal.ArcadeFont.TextWidth(str) * scale
w := common.ArcadeFont.TextWidth(str) * scale
x += width - w
return internal.ArcadeFont.DrawTextWithShadow(rt, str, x, y, scale, clr)
return common.ArcadeFont.DrawTextWithShadow(rt, str, x, y, scale, clr)
}

View File

@ -17,7 +17,7 @@ package blocks
import (
"fmt"
"github.com/hajimehoshi/ebiten"
"github.com/hajimehoshi/ebiten/example/internal"
"github.com/hajimehoshi/ebiten/example/common"
"image/color"
"strings"
)
@ -103,7 +103,7 @@ ROTATE RIGHT: %s
msg = "OK!"
}
str := fmt.Sprintf(f, s.buttonStates[0], s.buttonStates[1], s.buttonStates[2], s.buttonStates[3], s.buttonStates[4], msg)
if err := internal.ArcadeFont.DrawTextWithShadow(screen, str, 16, 16, 1, color.White); err != nil {
if err := common.ArcadeFont.DrawTextWithShadow(screen, str, 16, 16, 1, color.White); err != nil {
return err
}
return nil

View File

@ -17,7 +17,7 @@ package blocks
import (
"github.com/hajimehoshi/ebiten"
"github.com/hajimehoshi/ebiten/ebitenutil"
"github.com/hajimehoshi/ebiten/example/internal"
"github.com/hajimehoshi/ebiten/example/common"
"image/color"
_ "image/jpeg"
"math/rand"
@ -85,7 +85,7 @@ func init() {
}
// Windows: Next
x, y = nextWindowLabelPosition()
if err := internal.ArcadeFont.DrawTextWithShadow(imageWindows, "NEXT", x, y, 1, fontColor); err != nil {
if err := common.ArcadeFont.DrawTextWithShadow(imageWindows, "NEXT", x, y, 1, fontColor); err != nil {
panic(err)
}
x, y = nextWindowPosition()
@ -127,7 +127,7 @@ func drawWindow(r *ebiten.Image, x, y, width, height int) error {
var fontColor = color.NRGBA{0x40, 0x40, 0xff, 0xff}
func drawTextBox(r *ebiten.Image, label string, x, y, width int) error {
if err := internal.ArcadeFont.DrawTextWithShadow(r, label, x, y, 1, fontColor); err != nil {
if err := common.ArcadeFont.DrawTextWithShadow(r, label, x, y, 1, fontColor); err != nil {
return err
}
y += blockWidth

View File

@ -17,7 +17,7 @@ package blocks
import (
"github.com/hajimehoshi/ebiten"
"github.com/hajimehoshi/ebiten/ebitenutil"
"github.com/hajimehoshi/ebiten/example/internal"
"github.com/hajimehoshi/ebiten/example/common"
"image/color"
)
@ -112,9 +112,9 @@ func (s *TitleScene) Draw(r *ebiten.Image) error {
}
message := "PRESS SPACE TO START"
x := (ScreenWidth - internal.ArcadeFont.TextWidth(message)) / 2
x := (ScreenWidth - common.ArcadeFont.TextWidth(message)) / 2
y := ScreenHeight - 48
if err := internal.ArcadeFont.DrawTextWithShadow(r, message, x, y, 1, color.NRGBA{0x80, 0, 0, 0xff}); err != nil {
if err := common.ArcadeFont.DrawTextWithShadow(r, message, x, y, 1, color.NRGBA{0x80, 0, 0, 0xff}); err != nil {
return err
}
return nil
@ -129,8 +129,8 @@ func (s *TitleScene) drawTitleBackground(r *ebiten.Image, c int) error {
func drawLogo(r *ebiten.Image, str string) error {
scale := 4
textWidth := internal.ArcadeFont.TextWidth(str) * scale
textWidth := common.ArcadeFont.TextWidth(str) * scale
x := (ScreenWidth - textWidth) / 2
y := 32
return internal.ArcadeFont.DrawTextWithShadow(r, str, x, y, scale, color.NRGBA{0x00, 0x00, 0x80, 0xff})
return common.ArcadeFont.DrawTextWithShadow(r, str, x, y, scale, color.NRGBA{0x00, 0x00, 0x80, 0xff})
}

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package internal
package common
import (
"github.com/hajimehoshi/ebiten"

View File

@ -18,8 +18,8 @@ package main
import (
"github.com/hajimehoshi/ebiten"
"github.com/hajimehoshi/ebiten/example/internal"
einternal "github.com/hajimehoshi/ebiten/internal"
"github.com/hajimehoshi/ebiten/example/common"
"github.com/hajimehoshi/ebiten/internal"
"image"
"image/color"
"image/draw"
@ -54,7 +54,7 @@ func drawKey(t *ebiten.Image, name string, x, y, width int) {
t.DrawLine(x, y+height-4, x+3, y+height-1, c)
t.DrawLine(x+width-1, y+height-4, x+width-4, y+height-1, c)
internal.ArcadeFont.DrawText(t, name, x+4, y+5, 1, color.White)
common.ArcadeFont.DrawText(t, name, x+4, y+5, 1, color.White)
}
func outputKeyboardImage() (map[string]image.Rectangle, error) {
@ -143,7 +143,7 @@ func KeyRect(name string) (image.Rectangle, bool) {
}`
func outputKeyRectsGo(k map[string]image.Rectangle) error {
license, err := einternal.LicenseComment()
license, err := internal.LicenseComment()
if err != nil {
return err
}