gypsy

package module
v0.0.0-...-72da09b Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2019 License: MIT Imports: 6 Imported by: 1

README

random-gypsy

An adventure game

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(s Story, opts ...HandlerOpt) http.Handler

NewHandler returns a type that implements htt.Handler

Types

type Chapter

type Chapter struct {
	Title   string   `json:"title"`
	Story   []string `json:"story"`
	Options []Option `json:"options"`
}

Chapter structure of the chapter

type HandlerOpt

type HandlerOpt func(h *handler)

func WithTemplate

func WithTemplate(t *template.Template) HandlerOpt

type Option

type Option struct {
	Text string `json:"text"`
	Arc  string `json:"arc"`
}

Option structure of option

type Story

type Story map[string]Chapter

Story the story type

func JSONStory

func JSONStory(r io.Reader) (Story, error)

JSONStory decodes the io reader and returns a story map

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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