clengine

package module
v0.0.0-...-fe670a7 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2021 License: BSD-3-Clause Imports: 6 Imported by: 0

README

clengine

Cli game engine build on top of cliw. Since cliw's recent transition to full color rendering, you need to have terminal emulator with true color support. Terminals without full color support can play games with 2 color, but still look weird. Because godocs don't want to refresh, it still shows cliw docs from around september. I will start writing docs on my website around eight of Februrary.

features

  • extensible
  • colors
  • camera movement
  • collisions
  • fast to write
  • keyboard input

terminal support

Any terminal with support of ANSI sequences and full color should work. Here is a list of terminal emulators I tested with few notes. These terminals were tested only on my pc. Some people have reported having issues in terminal, I did not have issues in.

  • kitty - best option
  • windows terminal (the new one) - best option for windows
  • st - weird line spacing
  • xfce terminal - mostly ok
  • xterm - sometimes too slow
  • gnome terminal - weird scaling
  • tty - no full color support; 2 color games work ok
  • cmd - no ANSI
  • PowerShell - no ANSI

TODO:

  • animation
  • mouse input
  • add option to not run mutlithreaded
  • genral cleanup and performance improvements
  • stop using termbox for kb input

TODO extensions:

Extensions, I want clebgine to have in the future. If you want, you can write some of them and I will feature them here.

  • ldtk support
  • texture support in wasm render
  • web rendering
  • physics engine
  • particle system
  • raycast 3d

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoCollider

func AutoCollider(pm [][]string, s string) [][]string

func AutoColliderColor

func AutoColliderColor(pm [][]string, colors []string, s string) [][]string

func DefaultRender

func DefaultRender(s *Scene)

func NewHash

func NewHash() string

Types

type Camera

type Camera struct {
	W   int
	H   int
	Pos cliw.Ve2
}

type Object

type Object struct {
	Name      string
	Type      string
	Hash      string
	Cycle     func(o *Object)
	Init      func(o *Object)
	Root      *Scene
	Custom    map[string]interface{}
	Layer     cliw.PixLayer
	Collider  [][]string
	Completed bool
	PrevPos   cliw.Ve2
	Delta     float64
	// contains filtered or unexported fields
}

func (*Object) Setup

func (o *Object) Setup()

func (*Object) Update

func (o *Object) Update() (tr string)

type Renderer

type Renderer struct {
	UI       [][]cliw.Tile
	PixMap   [][]string
	UIBottom bool
	Centered bool
	Cam      *Camera
	Render   func(r *Renderer)
}

type Scene

type Scene struct {
	WorldPix  [][]string
	CollMask  [][]string
	BlankPix  [][]string
	BlankMask [][]string
	Colliders map[cliw.Ve2]*Object
	Hashes    []string
	Objects   map[string]*Object
	MainCam   Camera
	Renderer  Renderer
	Active    bool
	Changed   bool
	Changes   []cliw.Ve2
	Pressed   rune

	KeyPress   string
	RenderFunc func(s *Scene)
	MinDelta   time.Duration
	KbProcess  func(s *Scene)
	// contains filtered or unexported fields
}

func (*Scene) Add

func (s *Scene) Add(obj Object) (hash string)

func (*Scene) Cycle

func (s *Scene) Cycle()

func (*Scene) Delete

func (s *Scene) Delete(hash string)

func (*Scene) Init

func (s *Scene) Init(objects []Object, world [][]string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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