clock

package
v0.0.0-...-93b0430 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

type Clock struct {
	Draggable
	Config *Config
	// contains filtered or unexported fields
}

Clock is a clock that draws the time in the given font.

func NewClock

func NewClock(configuration *Config) *Clock

NewClock returns a new clock with the given configuration.

func (*Clock) Draw

func (clk *Clock) Draw(screen *ebiten.Image)

Draw draws the clock on the screen.

func (*Clock) Height

func (clk *Clock) Height() int

Height returns the height of the clock.

func (*Clock) Layout

func (clk *Clock) Layout(outsideWidth, outsideHeight int) (int, int)

Layout returns the size of the clock.

func (*Clock) LoadConfig

func (clk *Clock) LoadConfig()

func (*Clock) ShouldRedraw

func (clk *Clock) ShouldRedraw(now time.Time) bool

ShouldRedraw returns true if the clock should be redrawn.

func (*Clock) Update

func (clk *Clock) Update() error

Update checks for ebiten events and updates the clock.

func (*Clock) UpdateFontFace

func (clk *Clock) UpdateFontFace()

func (*Clock) UpdateScreenSize

func (clk *Clock) UpdateScreenSize()

func (*Clock) UpdateTimeFormat

func (clk *Clock) UpdateTimeFormat()

func (*Clock) Width

func (clk *Clock) Width() int

Widht returns the width of the clock.

type Config

type Config struct {
	Seconds  bool
	Timezone bool
	UTC      bool
	Hours24  bool

	FontSize   float64
	FontColor  color.RGBA
	Background color.RGBA
}

Config is the configuration for Clock.

func NewConfigFromFile

func NewConfigFromFile(filename string) *Config

func NewDefaultConfig

func NewDefaultConfig() *Config

NewDefaultConfig returns a new Config with default values.

func (*Config) WriteConfigToFile

func (c *Config) WriteConfigToFile(filename string) error

type Draggable

type Draggable struct {
	Count            int
	Dragging         bool
	DragStartCursorX int
	DragStartCursorY int
	CursorToWindowX  float64
	CursorToWindowY  float64
}

Draggable is a draggable screen in Ebiten.

func (*Draggable) Drag

func (d *Draggable) Drag()

Drag processess dragging logic to move the window poisition.

Jump to

Keyboard shortcuts

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