hiscore

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2021 License: GPL-3.0, GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Hiscore package implements the communication between a Gopher2600 high-score server and the local client. It is a proof-of-concept and is not yet fully defined.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Login

func Login(input io.Reader, output io.Writer, username string) error

Login prepares the authentication token for the hiscore server.

func Logoff

func Logoff() error

Logoff forgets the authentication token for the hiscore server.

func SetServer

func SetServer(input io.Reader, output io.Writer, server string) error

SetServer to use for hiscore storage.

Types

type Preferences added in v0.3.1

type Preferences struct {
	AuthToken prefs.String
	Server    prefs.String
	// contains filtered or unexported fields
}

func (*Preferences) Load added in v0.3.1

func (p *Preferences) Load() error

Load hiscore preferences from disk.

func (*Preferences) Save added in v0.3.1

func (p *Preferences) Save() error

Save current hiscore preferences to disk.

func (*Preferences) String added in v0.3.1

func (p *Preferences) String() string

type Session

type Session struct {
	Prefs *Preferences
	// contains filtered or unexported fields
}

Session represents a gaming session with the hi-score server. A session is started (with StartSession()) when a game starts, and concludes (with EndSession() when the game ends by uploading the game stats. Instances of the Session type can be used more than once.

func NewSession

func NewSession() (*Session, error)

NewSession is the preferred method of initialisation of the Session type.

func (*Session) EndSession

func (sess *Session) EndSession(playTime time.Duration) error

EndSession notifies the the HiScore server that a game has finished, with details of the game session (time spent, score, etc.)

func (*Session) StartSession

func (sess *Session) StartSession(name string, hash string) error

StartSession notifies the HiScore server that a game is about to start.

Jump to

Keyboard shortcuts

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