mainmenu

package
v0.3.26 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package mainmenu handles the Termacade main menu.

Index

Constants

This section is empty.

Variables

View Source
var Options = []*Option{
	{
		Game: arcade.FlowerJourney,
		Name: "Flower Journey",
		Func: func(ctx context.Context) (*router.PageInfo, error) {
			return &router.PageInfo{
				Page: router.PageArcadeGame,
				Game: arcade.FlowerJourney,
			}, nil
		},
		Neon: neonFJ,
	},
	{
		Game: arcade.MiteKnight,
		Name: "Mite Knight",
		Func: func(ctx context.Context) (*router.PageInfo, error) {
			return &router.PageInfo{
				Page: router.PageArcadeGame,
				Game: arcade.MiteKnight,
			}, nil
		},
		Neon: neonMK,
	},
	{
		Name:   "Fortmite",
		Func:   nil,
		Hidden: time.Now().Month() != time.April || time.Now().Day() != 1,
	},
	{
		Name: "High Scores",
		Func: func(ctx context.Context) (*router.PageInfo, error) {
			return &router.PageInfo{
				Page:   router.PageArcadeHighScores,
				Game:   arcade.FlowerJourney,
				HSMode: arcade.AllTime,
			}, nil
		},
		Action: "Press " + sprites.Button(input.BtnConfirm) + " to view!",
		Neon:   neonHS,
	},
	{
		Name: "Settings",
		Func: func(context.Context) (*router.PageInfo, error) {
			return &router.PageInfo{
				Page: router.PageStatic,
				Raw:  "/settings.html",
			}, nil
		},
		Action: "Press " + sprites.Button(input.BtnConfirm) + " to edit",
		Hidden: runtime.GOOS != "js",
	},
}

Options are the default Termacade main menu options.

Functions

func RenderNeon

func RenderNeon(batch *sprites.Batch, defs ...*Neon)

RenderNeon draws a neon sign to the screen.

Types

type MainMenu struct {
	Camera gfx.Camera
	CRT    crt.CRT

	Selection           int
	LastSelectionChange time.Time
	// contains filtered or unexported fields
}

MainMenu is the Termacade main menu.

func (mm *MainMenu) Run(ctx context.Context) (*router.PageInfo, error)

Run runs the Termacade main menu.

type Neon

type Neon struct {
	Rate    time.Duration
	Frames  int
	Toggle  []int
	Index   []int
	Sprite  []*sprites.Sprite
	X, Y, Z []float32
	FlipX   []bool
	Scale   float32
}

Neon is a declarative format for flashing neon signs.

type Option

type Option struct {
	Hidden bool
	Game   arcade.Game
	Name   string
	Func   func(ctx context.Context) (*router.PageInfo, error)
	Neon   []*Neon
	Action string
}

Option is a Termacade main menu option.

Jump to

Keyboard shortcuts

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