mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
Revert main.go as blocks.go
This commit is contained in:
parent
60e4d6f6ff
commit
7311369a07
@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
|
"github.com/hajimehoshi/ebiten/example/blocks"
|
||||||
"github.com/hajimehoshi/ebiten/ui"
|
"github.com/hajimehoshi/ebiten/ui"
|
||||||
"github.com/hajimehoshi/ebiten/ui/glfw"
|
"github.com/hajimehoshi/ebiten/ui/glfw"
|
||||||
"log"
|
"log"
|
||||||
@ -28,8 +29,8 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
u := new(glfw.UI)
|
u := new(glfw.UI)
|
||||||
game := NewGame()
|
game := blocks.NewGame()
|
||||||
if err := ui.Run(u, game, ScreenWidth, ScreenHeight, 2, "Blocks (Ebiten Demo)", 60); err != nil {
|
if err := ui.Run(u, game, blocks.ScreenWidth, blocks.ScreenHeight, 2, "Blocks (Ebiten Demo)", 60); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package main
|
package blocks
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/hajimehoshi/ebiten/graphics"
|
"github.com/hajimehoshi/ebiten/graphics"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package main
|
package blocks
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/hajimehoshi/ebiten/graphics"
|
"github.com/hajimehoshi/ebiten/graphics"
|
||||||
@ -7,7 +7,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
texturePaths["font"] = "../images/blocks/font.png"
|
texturePaths["font"] = "images/blocks/font.png"
|
||||||
}
|
}
|
||||||
|
|
||||||
const charWidth = 8
|
const charWidth = 8
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package main
|
package blocks
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/hajimehoshi/ebiten/graphics"
|
"github.com/hajimehoshi/ebiten/graphics"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package main
|
package blocks
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/hajimehoshi/ebiten/graphics"
|
"github.com/hajimehoshi/ebiten/graphics"
|
||||||
@ -10,7 +10,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
texturePaths["empty"] = "../images/blocks/empty.png"
|
texturePaths["empty"] = "images/blocks/empty.png"
|
||||||
}
|
}
|
||||||
|
|
||||||
type GameScene struct {
|
type GameScene struct {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package main
|
package blocks
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/hajimehoshi/ebiten/input"
|
"github.com/hajimehoshi/ebiten/input"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package main
|
package blocks
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/hajimehoshi/ebiten/graphics"
|
"github.com/hajimehoshi/ebiten/graphics"
|
||||||
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
texturePaths["blocks"] = "../images/blocks/blocks.png"
|
texturePaths["blocks"] = "images/blocks/blocks.png"
|
||||||
}
|
}
|
||||||
|
|
||||||
type Angle int
|
type Angle int
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package main
|
package blocks
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/hajimehoshi/ebiten/graphics"
|
"github.com/hajimehoshi/ebiten/graphics"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package main
|
package blocks
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/hajimehoshi/ebiten/graphics"
|
"github.com/hajimehoshi/ebiten/graphics"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package main
|
package blocks
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/hajimehoshi/ebiten/graphics"
|
"github.com/hajimehoshi/ebiten/graphics"
|
||||||
@ -8,7 +8,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
texturePaths["background"] = "../images/blocks/background.png"
|
texturePaths["background"] = "images/blocks/background.png"
|
||||||
}
|
}
|
||||||
|
|
||||||
type TitleScene struct {
|
type TitleScene struct {
|
||||||
|
@ -23,14 +23,14 @@ changed easily.
|
|||||||
|
|
||||||
```
|
```
|
||||||
:; cd $GOHOME/src/github.com/hajimehoshi/ebiten/example/blocks
|
:; cd $GOHOME/src/github.com/hajimehoshi/ebiten/example/blocks
|
||||||
:; go run *.go
|
:; go run blocks.go
|
||||||
```
|
```
|
||||||
|
|
||||||
### How to benchmark the example
|
### How to benchmark the example
|
||||||
|
|
||||||
```
|
```
|
||||||
:; cd $GOHOME/src/github.com/hajimehoshi/ebiten/example/blocks
|
:; cd $GOHOME/src/github.com/hajimehoshi/ebiten/example/blocks
|
||||||
:; go build -o=example *.go
|
:; go build -o=example blocks.go
|
||||||
:; ./example -cpuprofile=cpu.out
|
:; ./example -cpuprofile=cpu.out
|
||||||
:; go tool pprof ./example cpu.out
|
:; go tool pprof ./example cpu.out
|
||||||
```
|
```
|
||||||
|
@ -60,9 +60,7 @@ func (c *canvas) run(width, height, scale int) {
|
|||||||
c.window.MakeContextCurrent()
|
c.window.MakeContextCurrent()
|
||||||
glfw.SwapInterval(1)
|
glfw.SwapInterval(1)
|
||||||
for {
|
for {
|
||||||
|
(<-c.funcs)()
|
||||||
f := <-c.funcs
|
|
||||||
f()
|
|
||||||
c.funcsDone <- struct{}{}
|
c.funcsDone <- struct{}{}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
Loading…
Reference in New Issue
Block a user