Documentation
¶
Overview ¶
Package gui provides the graphical interface of the game world.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Editor ¶
type Editor struct {
// contains filtered or unexported fields
}
Editor implements the ebiten.Game interface and manages the Map-Editor.
func (*Editor) Draw ¶
func (e *Editor) Draw(screen *ebiten.Image)
Draw draws the img screen by one frame.
The give argument represents a screen image. The updated content is adopted as the img screen.
func (*Editor) Layout ¶
Layout accepts a native outside size in device-independent pixels and returns the img logical screen size.
On desktops, the outside is a window or a monitor (fullscreen mode). On browsers, the outside is a body element. On mobiles, the outside is the view's size.
Even though the outside size and the screen size differ, the rendering scale is automatically adjusted to fit with the outside.
Layout is called almost every frame.
It is ensured that Layout is invoked before Update is called in the first frame.
If Layout returns non-positive numbers, the caller can panic.
You can return a fixed screen size if you don't care, or you can also return a calculated screen size adjusted with the given outside size.
func (*Editor) Update ¶
Update updates an img by one tick. The given argument represents a screen image.
Update updates only the img logic and Draw draws the screen.
In the first frame, it is ensured that Update is called at least once before Draw. You can use Update to initialize the img state.
After the first frame, Update might not be called or might be called once or more for one frame. The frequency is determined by the current TPS (tick-per-second).
type Game ¶
type Game struct {
// contains filtered or unexported fields
}
Game implements the ebiten.Game interface and manages the GUI.
func (*Game) Draw ¶
func (g *Game) Draw(screen *ebiten.Image)
Draw draws the img screen by one frame.
The give argument represents a screen image. The updated content is adopted as the img screen.
func (*Game) Layout ¶
Layout accepts a native outside size in device-independent pixels and returns the img logical screen size.
On desktops, the outside is a window or a monitor (fullscreen mode). On browsers, the outside is a body element. On mobiles, the outside is the view's size.
Even though the outside size and the screen size differ, the rendering scale is automatically adjusted to fit with the outside.
Layout is called almost every frame.
It is ensured that Layout is invoked before Update is called in the first frame.
If Layout returns non-positive numbers, the caller can panic.
You can return a fixed screen size if you don't care, or you can also return a calculated screen size adjusted with the given outside size.
func (*Game) Update ¶
Update updates an img by one tick. The given argument represents a screen image.
Update updates only the img logic and Draw draws the screen.
In the first frame, it is ensured that Update is called at least once before Draw. You can use Update to initialize the img state.
After the first frame, Update might not be called or might be called once or more for one frame. The frequency is determined by the current TPS (tick-per-second).