game

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Copyright © 2022 Sylvia Waldron

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoIWad           = errors.New("no iwad was provided")
	ErrNoPWads          = errors.New("no pwads were provided")
	ErrNoPortArgs       = errors.New("no portArgs were provided")
	ErrNoEnv            = errors.New("no env was provided")
	ErrNoPort           = errors.New("no port was provided")
	ErrInvalidCompLevel = errors.New("complevel must be between -1 and 17 or 21")
	ErrInvalidSkill     = errors.New("skill must be between 1 and 5")
	ErrInvalidPWad      = errors.New("pwad doesn't exist")
)

Functions

This section is empty.

Types

type Args

type Args []string

func (*Args) Scan

func (a *Args) Scan(src interface{}) error

func (Args) String added in v0.5.1

func (a Args) String() string

func (Args) Value added in v0.1.1

func (a Args) Value() (driver.Value, error)

type CompLevel

type CompLevel int
const (
	NoCompLevel CompLevel = 0
	Doom19      CompLevel = 2
	UDoom       CompLevel = 3
	FDoom       CompLevel = 4
	Boom        CompLevel = 9
	MBF         CompLevel = 11
	MBF21       CompLevel = 21
)

func (*CompLevel) Scan

func (c *CompLevel) Scan(src interface{}) error

func (*CompLevel) Set

func (c *CompLevel) Set(v string) error

func (CompLevel) String

func (c CompLevel) String() string

func (*CompLevel) Type

func (c *CompLevel) Type() string

type Game

type Game struct {
	Name      string
	Port      *port.Port
	IWad      *iwad.IWad
	PWads     Args
	PortArgs  Args
	Env       Args
	CompLevel CompLevel
}

Game represents a Doom game.

func New

func New(name string, opts ...Option) (*Game, error)

func (*Game) Edit added in v0.3.0

func (g *Game) Edit(opts ...Option) error

func (*Game) GenearteCmd

func (g *Game) GenearteCmd(warp, episode int, pistolstart bool, skill Skill) *exec.Cmd

func (Game) String added in v0.2.1

func (g Game) String() string

type Option

type Option func(game *Game) error

func WithCompLevel

func WithCompLevel(compLevel CompLevel) Option

func WithEnv

func WithEnv(env []string) Option

func WithIWad

func WithIWad(iwad *iwad.IWad) Option

func WithPWads

func WithPWads(pwads []string) Option

func WithPortArgs

func WithPortArgs(portArgs []string) Option

func WithSourcePort

func WithSourcePort(port *port.Port) Option

type Repository

type Repository interface {
	Create(game *Game) error
	GetAll() ([]Game, error)
	GetByName(name string) (*Game, error)
	Update(updated *Game) error
	Delete(name string) error
}

type Skill

type Skill int
const (
	NoSkill Skill = iota
	Baby
	Easy
	Medium
	Hard
	Nightmare
)

func (*Skill) Scan

func (s *Skill) Scan(src interface{}) error

func (*Skill) Set

func (s *Skill) Set(v string) error

func (*Skill) String

func (s *Skill) String() string

func (*Skill) Type

func (s *Skill) Type() string

type SqliteRepository

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

func NewSqliteRepository

func NewSqliteRepository(db *db.DB) (*SqliteRepository, error)

func (*SqliteRepository) Create

func (r *SqliteRepository) Create(game *Game) error

func (*SqliteRepository) Delete

func (r *SqliteRepository) Delete(name string) error

func (*SqliteRepository) GetAll

func (r *SqliteRepository) GetAll() ([]Game, error)

func (*SqliteRepository) GetByName

func (r *SqliteRepository) GetByName(name string) (*Game, error)

func (*SqliteRepository) Update

func (r *SqliteRepository) Update(updated *Game) error

Jump to

Keyboard shortcuts

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