yaq

package module
v0.0.0-...-02c39c9 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: MIT Imports: 9 Imported by: 0

README

yaq

A terminal game engine for learning programming, inspired by spx.

Features

  • Develop games with only config files
  • Play games with users' inputted code

Install

go install github.com/zrcoder/yaq/cmd/yaq@latest

Usage

The first thing is defining your game with toml files.

mygame-dir
├── Scene1
│   └── index.toml
├── Scene2
│   ├── Level1.toml
│   ├── Level2.toml
│   └── index.toml
└── index.toml

Run the game

cd mygame-dir
yaq

Games powered by yaq

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(mode string, g Game)

func Run

func Run(path string)

Types

type Base

type Base struct {
	Editor    textarea.Model
	CfgPath   string
	Name      string `toml:"name"`
	Mode      string `toml:"mode"`
	IndexData []byte
	Rows      int `toml:"rows"`
	Columns   int `toml:"columns"`
	Keys      KeyMap
	KeysHelp  help.Model
}

func (*Base) ErrorView

func (b *Base) ErrorView(msg string) string

func (*Base) Init

func (b *Base) Init(data []byte)

func (*Base) KeysView

func (b *Base) KeysView() string

func (*Base) SucceedView

func (b *Base) SucceedView(msg string) string

type Game

type Game interface {
	SetBase(*Base)
	Run()
}

func Get

func Get(mode string) (Game, error)

type KeyMap

type KeyMap struct {
	Quit key.Binding
	Run  key.Binding
}

func (KeyMap) FullHelp

func (k KeyMap) FullHelp() [][]key.Binding

func (KeyMap) ShortHelp

func (k KeyMap) ShortHelp() []key.Binding

Directories

Path Synopsis
cmd
yaq
exported
pkg
pkg

Jump to

Keyboard shortcuts

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