game

package
v0.0.0-...-f715dde Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinAngle       = -math.Pi
	MaxAngle       = 3 * math.Pi / 2
	AngleStep      = 0.05
	RotationOffset = math.Pi / 2
)

Variables

View Source
var (
	Debug bool
)

Functions

func DebugPrintStar

func DebugPrintStar(star Star)

DebugPrintStar prints the debug information for a star.

func DrawDebugGridOverlay

func DrawDebugGridOverlay(screen *ebiten.Image)

DrawDebugGridOverlay draws a grid overlay for debugging purposes.

Types

type GimlarGame

type GimlarGame struct {
	// contains filtered or unexported fields
}

func NewGimlarGame

func NewGimlarGame(speed float64) (*GimlarGame, error)

func (*GimlarGame) Draw

func (g *GimlarGame) Draw(screen *ebiten.Image)

func (*GimlarGame) DrawDebugGrid

func (g *GimlarGame) DrawDebugGrid(screen *ebiten.Image)

func (*GimlarGame) DrawDebugInfo

func (g *GimlarGame) DrawDebugInfo(screen *ebiten.Image)

func (*GimlarGame) GetRadius

func (g *GimlarGame) GetRadius() float64

func (*GimlarGame) Layout

func (g *GimlarGame) Layout(outsideWidth, outsideHeight int) (int, int)

func (*GimlarGame) Run

func (g *GimlarGame) Run() error

func (*GimlarGame) Update

func (g *GimlarGame) Update() error

type InputHandler

type InputHandler struct{}

InputHandler implements HandlerInterface for the real game.

func (*InputHandler) IsKeyPressed

func (rh *InputHandler) IsKeyPressed(key ebiten.Key) bool

type InputHandlerInterface

type InputHandlerInterface interface {
	IsKeyPressed(key ebiten.Key) bool
}

InputHandlerInterface defines the methods for handling input.

type MockHandler

type MockHandler struct {
	// contains filtered or unexported fields
}

MockHandler is a mock implementation of the input.Handler interface for use in unit tests.

func NewMockHandler

func NewMockHandler() *MockHandler

func (*MockHandler) IsKeyPressed

func (mh *MockHandler) IsKeyPressed(key ebiten.Key) bool

func (*MockHandler) PressKey

func (mh *MockHandler) PressKey(key ebiten.Key)

func (*MockHandler) ReleaseKey

func (mh *MockHandler) ReleaseKey(key ebiten.Key)

type MockImage

type MockImage struct {
	// contains filtered or unexported fields
}

func (*MockImage) DrawImage

func (mi *MockImage) DrawImage(image *ebiten.Image, options *ebiten.DrawImageOptions)

type Player

type Player struct {
	PlayerInput
	PlayerPosition
	PlayerSprite
	PlayerPath
	// contains filtered or unexported fields
}

func NewPlayer

func NewPlayer(input InputHandlerInterface, speed float64, spriteImage image.Image) (*Player, error)

NewPlayer creates a new instance of a player with the given input handler, speed, and sprite image. If any of the arguments are nil, an error is returned.

func (*Player) Draw

func (player *Player) Draw(screen *ebiten.Image)

func (*Player) Update

func (player *Player) Update()

type PlayerInput

type PlayerInput struct {
	// contains filtered or unexported fields
}

type PlayerPath

type PlayerPath struct {
	// contains filtered or unexported fields
}

type PlayerPosition

type PlayerPosition struct {
	Object *resolv.Object
}

type PlayerSprite

type PlayerSprite struct {
	Sprite *ebiten.Image
}

type Star

type Star struct {
	X, Y, Size, Angle, Speed float64
	Image                    *ebiten.Image
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL