go语言游戏编程-Ebiten实现画面的填充
生活随笔
收集整理的這篇文章主要介紹了
go语言游戏编程-Ebiten实现画面的填充
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Draw
完整代碼如下:
package mainimport ("github.com/hajimehoshi/ebiten""image/color""log" )type fGame struct { }func (g *fGame) Update() error {return nil }func (g *fGame) Draw(screen *ebiten.Image) {screen.Fill(color.RGBA{R: 0xff, A: 0xff}) }func (g *fGame) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int) {return 320, 240 }func main() {ebiten.SetWindowSize(640, 480)ebiten.SetWindowTitle("Fill")if err := ebiten.RunGame(&fGame{}) ; err != nil {log.Fatal(err)} }screen.Fill(color.RGBA{R: 0xff, A: 0xff})是一個向窗口中填充顏色的函數,
實現效果:
總結
以上是生活随笔為你收集整理的go语言游戏编程-Ebiten实现画面的填充的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【Python】一种pyahocoras
- 下一篇: 作者:潘柱廷,启明星辰首席战略官。