tcod

package
v0.0.0-...-d14bdea Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

libtcod-go is a go library providing bindings for libtcod

Most of the API is wrapped except: - custom containers - Go has it's own containers - threads, mutexes and semaphores - they are replaced by goroutines and channels - SDL renderer - currently Go has very cumbersome C callback mechanism

Index

Constants

View Source
const (
	BKGND_ADD         = C.TCOD_BKGND_ADD
	BKGND_ADDA        = C.TCOD_BKGND_ADDA
	BKGND_ALPH        = C.TCOD_BKGND_ALPH
	BKGND_BURN        = C.TCOD_BKGND_BURN
	BKGND_COLOR_BURN  = C.TCOD_BKGND_COLOR_BURN
	BKGND_COLOR_DODGE = C.TCOD_BKGND_COLOR_DODGE
	BKGND_DARKEN      = C.TCOD_BKGND_DARKEN
	BKGND_LIGHTEN     = C.TCOD_BKGND_LIGHTEN
	BKGND_MULTIPLY    = C.TCOD_BKGND_MULTIPLY
	BKGND_NONE        = C.TCOD_BKGND_NONE
	BKGND_OVERLAY     = C.TCOD_BKGND_OVERLAY
	BKGND_SCREEN      = C.TCOD_BKGND_SCREEN
	BKGND_SET         = C.TCOD_BKGND_SET
)

console enums

View Source
const (
	CHAR_ARROW2_E       = C.TCOD_CHAR_ARROW2_E
	CHAR_ARROW2_N       = C.TCOD_CHAR_ARROW2_N
	CHAR_ARROW2_S       = C.TCOD_CHAR_ARROW2_S
	CHAR_ARROW2_W       = C.TCOD_CHAR_ARROW2_W
	CHAR_ARROW_E        = C.TCOD_CHAR_ARROW_E
	CHAR_ARROW_N        = C.TCOD_CHAR_ARROW_N
	CHAR_ARROW_S        = C.TCOD_CHAR_ARROW_S
	CHAR_ARROW_W        = C.TCOD_CHAR_ARROW_W
	CHAR_BLOCK1         = C.TCOD_CHAR_BLOCK1
	CHAR_BLOCK2         = C.TCOD_CHAR_BLOCK2
	CHAR_BLOCK3         = C.TCOD_CHAR_BLOCK3
	CHAR_CHECKBOX_SET   = C.TCOD_CHAR_CHECKBOX_SET
	CHAR_CHECKBOX_UNSET = C.TCOD_CHAR_CHECKBOX_UNSET
	CHAR_CROSS          = C.TCOD_CHAR_CROSS
	CHAR_DARROW_H       = C.TCOD_CHAR_DARROW_H
	CHAR_DARROW_V       = C.TCOD_CHAR_DARROW_V
	CHAR_DCROSS         = C.TCOD_CHAR_DCROSS
	CHAR_DHLINE         = C.TCOD_CHAR_DHLINE
	CHAR_DNE            = C.TCOD_CHAR_DNE
	CHAR_DNW            = C.TCOD_CHAR_DNW
	CHAR_DSE            = C.TCOD_CHAR_DSE
	CHAR_DSW            = C.TCOD_CHAR_DSW
	CHAR_DTEEE          = C.TCOD_CHAR_DTEEE
	CHAR_DTEEN          = C.TCOD_CHAR_DTEEN
	CHAR_DTEES          = C.TCOD_CHAR_DTEES
	CHAR_DTEEW          = C.TCOD_CHAR_DTEEW
	CHAR_DVLINE         = C.TCOD_CHAR_DVLINE
	CHAR_HLINE          = C.TCOD_CHAR_HLINE
	CHAR_NE             = C.TCOD_CHAR_NE
	CHAR_NW             = C.TCOD_CHAR_NW
	CHAR_RADIO_SET      = C.TCOD_CHAR_RADIO_SET
	CHAR_RADIO_UNSET    = C.TCOD_CHAR_RADIO_UNSET
	CHAR_SE             = C.TCOD_CHAR_SE
	CHAR_SUBP_DIAG      = C.TCOD_CHAR_SUBP_DIAG
	CHAR_SUBP_E         = C.TCOD_CHAR_SUBP_E
	CHAR_SUBP_N         = C.TCOD_CHAR_SUBP_N
	CHAR_SUBP_NE        = C.TCOD_CHAR_SUBP_NE
	CHAR_SUBP_NW        = C.TCOD_CHAR_SUBP_NW
	CHAR_SUBP_SE        = C.TCOD_CHAR_SUBP_SE
	CHAR_SUBP_SW        = C.TCOD_CHAR_SUBP_SW
	CHAR_SW             = C.TCOD_CHAR_SW
	CHAR_TEEE           = C.TCOD_CHAR_TEEE
	CHAR_TEEN           = C.TCOD_CHAR_TEEN
	CHAR_TEES           = C.TCOD_CHAR_TEES
	CHAR_TEEW           = C.TCOD_CHAR_TEEW
	CHAR_VLINE          = C.TCOD_CHAR_VLINE
)
View Source
const (
	COLCTRL_1        = C.TCOD_COLCTRL_1
	COLCTRL_2        = C.TCOD_COLCTRL_2
	COLCTRL_3        = C.TCOD_COLCTRL_3
	COLCTRL_4        = C.TCOD_COLCTRL_4
	COLCTRL_5        = C.TCOD_COLCTRL_5
	COLCTRL_BACK_RGB = C.TCOD_COLCTRL_BACK_RGB
	COLCTRL_FORE_RGB = C.TCOD_COLCTRL_FORE_RGB
	COLCTRL_NUMBER   = C.TCOD_COLCTRL_NUMBER
	COLCTRL_STOP     = C.TCOD_COLCTRL_STOP
)
View Source
const (
	FONT_LAYOUT_ASCII_INCOL = C.TCOD_FONT_LAYOUT_ASCII_INCOL
	FONT_LAYOUT_ASCII_INROW = C.TCOD_FONT_LAYOUT_ASCII_INROW
	FONT_LAYOUT_TCOD        = C.TCOD_FONT_LAYOUT_TCOD
	FONT_TYPE_GREYSCALE     = C.TCOD_FONT_TYPE_GREYSCALE
)
View Source
const (
	K_0           = C.TCODK_0
	K_1           = C.TCODK_1
	K_2           = C.TCODK_2
	K_3           = C.TCODK_3
	K_4           = C.TCODK_4
	K_5           = C.TCODK_5
	K_6           = C.TCODK_6
	K_7           = C.TCODK_7
	K_8           = C.TCODK_8
	K_9           = C.TCODK_9
	K_ALT         = C.TCODK_ALT
	K_APPS        = C.TCODK_APPS
	K_BACKSPACE   = C.TCODK_BACKSPACE
	K_CAPSLOCK    = C.TCODK_CAPSLOCK
	K_CHAR        = C.TCODK_CHAR
	K_CONTROL     = C.TCODK_CONTROL
	K_DELETE      = C.TCODK_DELETE
	K_DOWN        = C.TCODK_DOWN
	K_END         = C.TCODK_END
	K_ENTER       = C.TCODK_ENTER
	K_ESCAPE      = C.TCODK_ESCAPE
	KEY_PRESSED   = C.TCOD_KEY_PRESSED
	KEY_RELEASED  = C.TCOD_KEY_RELEASED
	K_F1          = C.TCODK_F1
	K_F10         = C.TCODK_F10
	K_F11         = C.TCODK_F11
	K_F12         = C.TCODK_F12
	K_F2          = C.TCODK_F2
	K_F3          = C.TCODK_F3
	K_F4          = C.TCODK_F4
	K_F5          = C.TCODK_F5
	K_F6          = C.TCODK_F6
	K_F7          = C.TCODK_F7
	K_F8          = C.TCODK_F8
	K_F9          = C.TCODK_F9
	K_HOME        = C.TCODK_HOME
	K_INSERT      = C.TCODK_INSERT
	K_KP0         = C.TCODK_KP0
	K_KP1         = C.TCODK_KP1
	K_KP2         = C.TCODK_KP2
	K_KP3         = C.TCODK_KP3
	K_KP4         = C.TCODK_KP4
	K_KP5         = C.TCODK_KP5
	K_KP6         = C.TCODK_KP6
	K_KP7         = C.TCODK_KP7
	K_KP8         = C.TCODK_KP8
	K_KP9         = C.TCODK_KP9
	K_KPADD       = C.TCODK_KPADD
	K_KPDEC       = C.TCODK_KPDEC
	K_KPDIV       = C.TCODK_KPDIV
	K_KPENTER     = C.TCODK_KPENTER
	K_KPMUL       = C.TCODK_KPMUL
	K_KPSUB       = C.TCODK_KPSUB
	K_LEFT        = C.TCODK_LEFT
	K_LWIN        = C.TCODK_LWIN
	K_NONE        = C.TCODK_NONE
	K_NUMLOCK     = C.TCODK_NUMLOCK
	K_PAGEDOWN    = C.TCODK_PAGEDOWN
	K_PAGEUP      = C.TCODK_PAGEUP
	K_PAUSE       = C.TCODK_PAUSE
	K_PRINTSCREEN = C.TCODK_PRINTSCREEN
	K_RIGHT       = C.TCODK_RIGHT
	K_RWIN        = C.TCODK_RWIN
	K_SCROLLLOCK  = C.TCODK_SCROLLLOCK
	K_SHIFT       = C.TCODK_SHIFT
	K_SPACE       = C.TCODK_SPACE
	K_TAB         = C.TCODK_TAB
	K_UP          = C.TCODK_UP
)
View Source
const (
	FOV_BASIC         = C.FOV_BASIC
	FOV_DIAMOND       = C.FOV_DIAMOND
	FOV_SHADOW        = C.FOV_SHADOW
	FOV_PERMISSIVE_0  = C.FOV_PERMISSIVE_0
	FOV_PERMISSIVE_1  = C.FOV_PERMISSIVE_1
	FOV_PERMISSIVE_2  = C.FOV_PERMISSIVE_2
	FOV_PERMISSIVE_3  = C.FOV_PERMISSIVE_3
	FOV_PERMISSIVE_4  = C.FOV_PERMISSIVE_4
	FOV_PERMISSIVE_5  = C.FOV_PERMISSIVE_5
	FOV_PERMISSIVE_6  = C.FOV_PERMISSIVE_6
	FOV_PERMISSIVE_7  = C.FOV_PERMISSIVE_7
	FOV_PERMISSIVE_8  = C.FOV_PERMISSIVE_8
	FOV_RESTRICTIVE   = C.FOV_RESTRICTIVE
	NB_FOV_ALGORITHMS = C.NB_FOV_ALGORITHMS
)
View Source
const (
	RNG_MT   = C.TCOD_RNG_MT
	RNG_CMWC = C.TCOD_RNG_CMWC
)
View Source
const (
	TYPE_NONE        = C.TCOD_TYPE_NONE
	TYPE_BOOL        = C.TCOD_TYPE_BOOL
	TYPE_CHAR        = C.TCOD_TYPE_CHAR
	TYPE_INT         = C.TCOD_TYPE_INT
	TYPE_FLOAT       = C.TCOD_TYPE_FLOAT
	TYPE_STRING      = C.TCOD_TYPE_STRING
	TYPE_COLOR       = C.TCOD_TYPE_COLOR
	TYPE_DICE        = C.TCOD_TYPE_DICE
	TYPE_VALUELIST00 = C.TCOD_TYPE_VALUELIST00
	TYPE_VALUELIST01 = C.TCOD_TYPE_VALUELIST01
	TYPE_VALUELIST02 = C.TCOD_TYPE_VALUELIST02
	TYPE_VALUELIST03 = C.TCOD_TYPE_VALUELIST03
	TYPE_VALUELIST04 = C.TCOD_TYPE_VALUELIST04
	TYPE_VALUELIST05 = C.TCOD_TYPE_VALUELIST05
	TYPE_VALUELIST06 = C.TCOD_TYPE_VALUELIST06
	TYPE_VALUELIST07 = C.TCOD_TYPE_VALUELIST07
	TYPE_VALUELIST08 = C.TCOD_TYPE_VALUELIST08
	TYPE_VALUELIST09 = C.TCOD_TYPE_VALUELIST09
	TYPE_VALUELIST10 = C.TCOD_TYPE_VALUELIST10
	TYPE_VALUELIST11 = C.TCOD_TYPE_VALUELIST11
	TYPE_VALUELIST12 = C.TCOD_TYPE_VALUELIST12
	TYPE_VALUELIST13 = C.TCOD_TYPE_VALUELIST13
	TYPE_VALUELIST14 = C.TCOD_TYPE_VALUELIST14
	TYPE_VALUELIST15 = C.TCOD_TYPE_VALUELIST15
	TYPE_CUSTOM00    = C.TCOD_TYPE_CUSTOM00
	TYPE_CUSTOM01    = C.TCOD_TYPE_CUSTOM01
	TYPE_CUSTOM02    = C.TCOD_TYPE_CUSTOM02
	TYPE_CUSTOM03    = C.TCOD_TYPE_CUSTOM03
	TYPE_CUSTOM04    = C.TCOD_TYPE_CUSTOM04
	TYPE_CUSTOM05    = C.TCOD_TYPE_CUSTOM05
	TYPE_CUSTOM06    = C.TCOD_TYPE_CUSTOM06
	TYPE_CUSTOM07    = C.TCOD_TYPE_CUSTOM07
	TYPE_CUSTOM08    = C.TCOD_TYPE_CUSTOM08
	TYPE_CUSTOM09    = C.TCOD_TYPE_CUSTOM09
	TYPE_CUSTOM10    = C.TCOD_TYPE_CUSTOM10
	TYPE_CUSTOM11    = C.TCOD_TYPE_CUSTOM11
	TYPE_CUSTOM12    = C.TCOD_TYPE_CUSTOM12
	TYPE_CUSTOM13    = C.TCOD_TYPE_CUSTOM13
	TYPE_CUSTOM14    = C.TCOD_TYPE_CUSTOM14
	TYPE_CUSTOM15    = C.TCOD_TYPE_CUSTOM15
	TYPE_LIST        = C.TCOD_TYPE_LIST
)
View Source
const (
	NOISE_PERLIN  = C.TCOD_NOISE_PERLIN
	NOISE_SIMPLEX = C.TCOD_NOISE_SIMPLEX
	NOISE_WAVELET = C.TCOD_NOISE_WAVELET
	NOISE_DEFAULT = C.TCOD_NOISE_DEFAULT
)
View Source
const (
	RENDERER_GLSL   = C.TCOD_RENDERER_GLSL
	RENDERER_OPENGL = C.TCOD_RENDERER_OPENGL
	RENDERER_SDL    = C.TCOD_RENDERER_SDL
	NB_RENDERERS    = C.TCOD_NB_RENDERERS
)

renderer enum

View Source
const (
	LEFT   = C.TCOD_LEFT
	RIGHT  = C.TCOD_RIGHT
	CENTER = C.TCOD_CENTER
)

alignment enum

View Source
const (
	DISTRIBUTION_LINEAR                 = C.TCOD_DISTRIBUTION_LINEAR
	DISTRIBUTION_GAUSSIAN               = C.TCOD_DISTRIBUTION_GAUSSIAN
	DISTRIBUTION_GAUSSIAN_RANGE         = C.TCOD_DISTRIBUTION_GAUSSIAN_RANGE
	DISTRIBUTION_GAUSSIAN_INVERSE       = C.TCOD_DISTRIBUTION_GAUSSIAN_INVERSE
	DISTRIBUTION_GAUSSIAN_RANGE_INVERSE = C.TCOD_DISTRIBUTION_GAUSSIAN_RANGE_INVERSE
)

distribution for mersenne

View Source
const NOISE_DEFAULT_HURST = 0.5
View Source
const NOISE_DEFAULT_LACUNARITY = 2.0
View Source
const NOISE_MAX_DIMENSIONS = 4
View Source
const NOISE_MAX_OCTAVES = 128

Variables

This section is empty.

Functions

func Clamp

func Clamp(a, b, x int) int

func ClampF

func ClampF(a, b, x float32) float32

func ColorGenMap

func ColorGenMap(cmap []Color, nbKey int, keyColor []Color, keyIndex []int)

func If

func If(condition bool, tv, fv interface{}) interface{}

func Line

func Line(xo, yo, xd, yd int, userData interface{}, listener LineListener) bool

func LineMt

func LineMt(xo, yo, xd, yd int, listener LineListener, userData interface{}, data *BresenhamData) bool

func MouseIsCursorVisible

func MouseIsCursorVisible() bool

func MouseMove

func MouseMove(x, y int)

func MouseShowCursor

func MouseShowCursor(visible bool)

func NamegenDestroy

func NamegenDestroy()

delete a generator

func NamegenGenerate

func NamegenGenerate(name string) string

generate a name

func NamegenGenerateCustom

func NamegenGenerateCustom(name, rule string) string

generate a name using a custom generation rule

func NamegenGetSets

func NamegenGetSets() []string

retrieve the list of all available syllable set names

func NamegenParse

func NamegenParse(filename string, random *Random)

func RollDice

func RollDice(random *Random, s string) int

func SysClipboardGet

func SysClipboardGet() string

func SysClipboardSet

func SysClipboardSet(value string)

func SysCreateDirectory

func SysCreateDirectory(path string) bool

filesystem stuff

func SysDeleteDirectory

func SysDeleteDirectory(path string) bool

func SysDeleteFile

func SysDeleteFile(path string) bool

func SysElapsedMilliseconds

func SysElapsedMilliseconds() uint32

func SysElapsedSeconds

func SysElapsedSeconds() float32

func SysFileExists

func SysFileExists(filename string) bool

func SysForceFullscreenResolution

func SysForceFullscreenResolution(width, height int)

func SysGetCharSize

func SysGetCharSize() (w, h int)

func SysGetCurrentResolution

func SysGetCurrentResolution() (w, h int)

func SysGetDirectoryContent

func SysGetDirectoryContent(path, pattern string) []string

func SysGetFps

func SysGetFps() int

func SysGetFullscreenOffsets

func SysGetFullscreenOffsets() (offx, offy int)

func SysGetLastFrameLength

func SysGetLastFrameLength() float32

func SysGetNumCores

func SysGetNumCores() int

func SysIsDirectory

func SysIsDirectory(path string) bool

func SysSaveScreenshot

func SysSaveScreenshot()

func SysSaveScreenshotToFile

func SysSaveScreenshotToFile(filename string)

func SysSetFps

func SysSetFps(val int)

func SysSleepMilliseconds

func SysSleepMilliseconds(val uint32)

func SysUpdateChar

func SysUpdateChar(asciiCode, fontx, fonty int, img Image, x, y int)

Types

type Alignment

type Alignment C.TCOD_alignment_t

Console

type BkgndFlag

type BkgndFlag C.TCOD_bkgnd_flag_t

func BkgndAddAlpha

func BkgndAddAlpha(alpha float32) BkgndFlag

func BkgndAlpha

func BkgndAlpha(alpha float32) BkgndFlag

type BresenhamData

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

thread-safe versions

type Bsp

type Bsp struct {
	X, Y, W, H int   // node position & size
	Position   int   // position of splitting
	Level      uint8 // level in the tree
	Horizontal bool  // horizontal splitting ?
	// contains filtered or unexported fields
}

BSP Dungeon generation

func NewBspIntern

func NewBspIntern(father *Bsp, left bool) *Bsp

func NewBspWithSize

func NewBspWithSize(x, y, w, h int) (result *Bsp)

func (*Bsp) AddSon

func (self *Bsp) AddSon(son *Bsp)

func (*Bsp) Contains

func (self *Bsp) Contains(x, y int) bool

func (*Bsp) Father

func (self *Bsp) Father() *Bsp

func (*Bsp) FindNode

func (self *Bsp) FindNode(x, y int) *Bsp

func (*Bsp) IsLeaf

func (self *Bsp) IsLeaf() bool

func (*Bsp) Left

func (self *Bsp) Left() *Bsp

func (*Bsp) RemoveSons

func (self *Bsp) RemoveSons()

func (*Bsp) Resize

func (self *Bsp) Resize(x, y, w, h int)

func (*Bsp) Right

func (self *Bsp) Right() *Bsp

func (*Bsp) SplitOnce

func (self *Bsp) SplitOnce(horizontal bool, position int)

func (*Bsp) SplitRecursive

func (self *Bsp) SplitRecursive(randomizer *Random, nb int, minHSize int, minVSize int, maxHRatio float32, maxVRatio float32)

func (*Bsp) TraverseInOrder

func (self *Bsp) TraverseInOrder(listener BspListener, userData interface{}) bool

func (*Bsp) TraverseInvertedLevelOrder

func (self *Bsp) TraverseInvertedLevelOrder(listener BspListener, userData interface{}) bool

TODO can it store Go values in list structure?? maybe replace it with record

func (*Bsp) TraverseLevelOrder

func (self *Bsp) TraverseLevelOrder(listener BspListener, userData interface{}) bool

func (*Bsp) TraversePostOrder

func (self *Bsp) TraversePostOrder(listener BspListener, userData interface{}) bool

func (*Bsp) TraversePreOrder

func (self *Bsp) TraversePreOrder(listener BspListener, userData interface{}) bool

type BspListener

type BspListener func(node *Bsp, userData interface{}) bool

type Button

type Button struct {
	Widget
	// contains filtered or unexported fields
}

func (*Button) ComputeSize

func (self *Button) ComputeSize()

func (*Button) IsPressed

func (self *Button) IsPressed() bool

func (*Button) Render

func (self *Button) Render(iself IWidget)

func (*Button) SetLabel

func (self *Button) SetLabel(newLabel string)

type ColCtrl

type ColCtrl C.TCOD_colctrl_t

type Color

type Color struct {
	R uint8
	G uint8
	B uint8
}
var COLOR_BLACK Color = Color{0, 0, 0}
var COLOR_BLUE Color = Color{0, 0, 255}
var COLOR_CHARTREUSE Color = Color{127, 255, 0}
var COLOR_CYAN Color = Color{0, 255, 255}
var COLOR_DARKER_BLUE Color = Color{0, 0, 63}
var COLOR_DARKER_CHARTREUSE Color = Color{31, 63, 0}
var COLOR_DARKER_CYAN Color = Color{0, 63, 63}
var COLOR_DARKER_GREEN Color = Color{0, 63, 0}
var COLOR_DARKER_GREY Color = Color{31, 31, 31}
var COLOR_DARKER_MAGENTA Color = Color{63, 0, 63}
var COLOR_DARKER_ORANGE Color = Color{63, 31, 0}
var COLOR_DARKER_PINK Color = Color{63, 0, 31}
var COLOR_DARKER_RED Color = Color{63, 0, 0}
var COLOR_DARKER_SEA Color = Color{0, 63, 31}
var COLOR_DARKER_SKY Color = Color{0, 31, 63}
var COLOR_DARKER_VIOLET Color = Color{31, 0, 63}
var COLOR_DARKER_YELLOW Color = Color{63, 63, 0}
var COLOR_DARK_BLUE Color = Color{0, 0, 127}
var COLOR_DARK_CHARTREUSE Color = Color{63, 127, 0}
var COLOR_DARK_CYAN Color = Color{0, 127, 127}
var COLOR_DARK_GREEN Color = Color{0, 127, 0}
var COLOR_DARK_GREY Color = Color{63, 63, 63}
var COLOR_DARK_MAGENTA Color = Color{127, 0, 127}
var COLOR_DARK_ORANGE Color = Color{127, 63, 0}
var COLOR_DARK_PINK Color = Color{127, 0, 63}
var COLOR_DARK_RED Color = Color{127, 0, 0}
var COLOR_DARK_SEA Color = Color{0, 127, 63}
var COLOR_DARK_SKY Color = Color{0, 63, 127}
var COLOR_DARK_VIOLET Color = Color{63, 0, 127}
var COLOR_DARK_YELLOW Color = Color{127, 127, 0}
var COLOR_DESATURATED_BLUE Color = Color{63, 63, 127}
var COLOR_DESATURATED_CHARTREUSE Color = Color{95, 127, 63}
var COLOR_DESATURATED_CYAN Color = Color{63, 127, 127}
var COLOR_DESATURATED_GREEN Color = Color{63, 127, 63}
var COLOR_DESATURATED_MAGENTA Color = Color{127, 63, 127}
var COLOR_DESATURATED_ORANGE Color = Color{127, 95, 63}
var COLOR_DESATURATED_PINK Color = Color{127, 63, 95}
var COLOR_DESATURATED_RED Color = Color{127, 63, 63}
var COLOR_DESATURATED_SEA Color = Color{63, 127, 95}
var COLOR_DESATURATED_SKY Color = Color{63, 95, 127}
var COLOR_DESATURATED_VIOLET Color = Color{95, 63, 127}
var COLOR_DESATURATED_YELLOW Color = Color{127, 127, 63}
var COLOR_GOLD Color = Color{255, 255, 102}
var COLOR_GREEN Color = Color{0, 255, 0}
var COLOR_GREY Color = Color{128, 128, 128}
var COLOR_LIGHT_BLUE Color = Color{127, 127, 255}
var COLOR_LIGHT_CHARTREUSE Color = Color{191, 255, 127}
var COLOR_LIGHT_CYAN Color = Color{127, 255, 255}
var COLOR_LIGHT_GREEN Color = Color{127, 255, 127}
var COLOR_LIGHT_GREY Color = Color{191, 191, 191}
var COLOR_LIGHT_MAGENTA Color = Color{255, 127, 255}
var COLOR_LIGHT_ORANGE Color = Color{255, 191, 127}
var COLOR_LIGHT_PINK Color = Color{255, 127, 191}
var COLOR_LIGHT_RED Color = Color{255, 127, 127}
var COLOR_LIGHT_SEA Color = Color{127, 255, 191}
var COLOR_LIGHT_SKY Color = Color{127, 191, 255}
var COLOR_LIGHT_VIOLET Color = Color{191, 127, 255}
var COLOR_LIGHT_YELLOW Color = Color{255, 255, 127}
var COLOR_MAGENTA Color = Color{255, 0, 255}
var COLOR_ORANGE Color = Color{255, 127, 0}
var COLOR_PINK Color = Color{255, 0, 127}
var COLOR_RED Color = Color{255, 0, 0}
var COLOR_SEA Color = Color{0, 255, 127}
var COLOR_SILVER Color = Color{203, 203, 203}
var COLOR_SKY Color = Color{0, 127, 255}
var COLOR_VIOLET Color = Color{127, 0, 255}
var COLOR_WHITE Color = Color{255, 255, 255}
var COLOR_YELLOW Color = Color{255, 255, 0}

func NewColorHSV

func NewColorHSV(h, s, v float32) Color

func NewColorRGB

func NewColorRGB(r, g, b uint8) Color

func (Color) Add

func (self Color) Add(c2 Color) Color

func (Color) Darken

func (self Color) Darken(ratio float32) Color

func (Color) Equals

func (self Color) Equals(c2 Color) bool

basic operations

func (Color) GetHSV

func (self Color) GetHSV() (h, s, v float32)

func (Color) GetHue

func (self Color) GetHue() float32

func (Color) GetSaturation

func (self Color) GetSaturation() float32

func (Color) GetValue

func (self Color) GetValue() float32

func (Color) Lerp

func (self Color) Lerp(c2 Color, coef float32) Color

func (Color) Lighten

func (self Color) Lighten(ratio float32) Color

func (Color) Multiply

func (self Color) Multiply(c2 Color) Color

func (Color) MultiplyScalar

func (self Color) MultiplyScalar(value float32) Color

func (Color) ScaleHSV

func (self Color) ScaleHSV(scoef, vcoef float32) Color

func (Color) SetHSV

func (self Color) SetHSV(h float32, s float32, v float32) Color

func (Color) SetHue

func (self Color) SetHue(h float32) Color

func (Color) SetSaturation

func (self Color) SetSaturation(h float32) Color

func (Color) SetValue

func (self Color) SetValue(h float32) Color

func (Color) ShiftHue

func (self Color) ShiftHue(hshift float32) Color

func (Color) Subtract

func (self Color) Subtract(c2 Color) Color

type Console

type Console struct {
	Data C.TCOD_console_t
}

func NewConsole

func NewConsole(w, h int) *Console

func (*Console) Blit

func (self *Console) Blit(xSrc, ySrc, wSrc, hSrc int, dst IConsole, xDst, yDst int, foregroundAlpha, backgroundAlpha float32)

func (*Console) Clear

func (self *Console) Clear()

func (*Console) GetAlignment

func (self *Console) GetAlignment() Alignment

func (*Console) GetBackgroundFlag

func (self *Console) GetBackgroundFlag() BkgndFlag

func (*Console) GetChar

func (self *Console) GetChar(x, y int) int

func (*Console) GetCharBackground

func (self *Console) GetCharBackground(x, y int) Color

func (*Console) GetCharForeground

func (self *Console) GetCharForeground(x, y int) Color

func (*Console) GetData

func (self *Console) GetData() C.TCOD_console_t

func (*Console) GetDefaultBackground

func (self *Console) GetDefaultBackground() Color

func (*Console) GetDefaultForeground

func (self *Console) GetDefaultForeground() Color

func (*Console) GetHeight

func (self *Console) GetHeight() int

func (*Console) GetWidth

func (self *Console) GetWidth() int

func (*Console) HeightRect

func (self *Console) HeightRect(x, y, w, h int, fmts string, v ...interface{}) int

func (*Console) Hline

func (self *Console) Hline(x, y, l int, flag BkgndFlag)

func (*Console) Print

func (self *Console) Print(x, y int, fmts string, v ...interface{})

func (*Console) PrintEx

func (self *Console) PrintEx(x, y int, flag BkgndFlag, alignment Alignment, fmts string, v ...interface{})

func (*Console) PrintFrame

func (self *Console) PrintFrame(x, y, w, h int, empty bool, flag BkgndFlag, fmts string, v ...interface{})

func (*Console) PrintRect

func (self *Console) PrintRect(x, y, w, h int, fmts string, v ...interface{}) int

func (*Console) PrintRectEx

func (self *Console) PrintRectEx(x, y, w, h int, flag BkgndFlag, alignment Alignment, fmts string, v ...interface{}) int

func (*Console) PutChar

func (self *Console) PutChar(x, y, c int, flag BkgndFlag)

func (*Console) PutCharEx

func (self *Console) PutCharEx(x, y, c int, fore, back Color)

func (*Console) Rect

func (self *Console) Rect(x, y, w, h int, clear bool, flag BkgndFlag)

func (*Console) RenderText

func (self *Console) RenderText(text *Text)

func (*Console) SetAlignment

func (self *Console) SetAlignment(alignment Alignment)

func (*Console) SetBackgroundFlag

func (self *Console) SetBackgroundFlag(flag BkgndFlag)

func (*Console) SetChar

func (self *Console) SetChar(x, y int, c int)

func (*Console) SetCharBackground

func (self *Console) SetCharBackground(x, y int, color Color, flag BkgndFlag)

func (*Console) SetCharForeground

func (self *Console) SetCharForeground(x, y int, color Color)

func (*Console) SetDefaultBackground

func (self *Console) SetDefaultBackground(color Color)

func (*Console) SetDefaultForeground

func (self *Console) SetDefaultForeground(color Color)

func (*Console) SetKeyColor

func (self *Console) SetKeyColor(color Color)

func (*Console) Vline

func (self *Console) Vline(x, y, l int, flag BkgndFlag)

type Container

type Container struct {
	Widget
	// contains filtered or unexported fields
}

func (*Container) AddWidget

func (self *Container) AddWidget(w IWidget)

func (*Container) Clear

func (self *Container) Clear()

func (*Container) RemoveWidget

func (self *Container) RemoveWidget(w IWidget)

func (*Container) Render

func (self *Container) Render(iself IWidget)

func (*Container) Update

func (self *Container) Update(iself IWidget, k Key)

type Dice

type Dice struct {
	Data C.TCOD_dice_t
}

func NewDice

func NewDice(s string) *Dice

func (*Dice) Roll

func (self *Dice) Roll(random *Random) int

type Dijkstra

type Dijkstra struct {
	Data C.TCOD_dijkstra_t
}

func NewDijkstraUsingMap

func NewDijkstraUsingMap(m *Map, diagonalCost float32) *Dijkstra

func (*Dijkstra) Compute

func (self *Dijkstra) Compute(rootX, rootY int)

func (*Dijkstra) Get

func (self *Dijkstra) Get(index int) (x, y int)

func (*Dijkstra) GetDistance

func (self *Dijkstra) GetDistance(x, y int) float32

func (*Dijkstra) IsEmpty

func (self *Dijkstra) IsEmpty() bool

func (*Dijkstra) PathSet

func (self *Dijkstra) PathSet(x, y int) bool

func (*Dijkstra) PathWalk

func (self *Dijkstra) PathWalk() (x, y int)

func (*Dijkstra) Size

func (self *Dijkstra) Size() int

type Distribution

type Distribution C.TCOD_distribution_t

type FloatArray

type FloatArray []float32

type FovAlgorithm

type FovAlgorithm C.TCOD_fov_algorithm_t

type Gui

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

func NewGui

func NewGui(console IConsole) *Gui

func (*Gui) GetFocusedKeyboardWidget

func (self *Gui) GetFocusedKeyboardWidget() IWidget

func (*Gui) GetFocusedWidget

func (self *Gui) GetFocusedWidget() IWidget

func (*Gui) IsFocused

func (self *Gui) IsFocused(w IWidget) bool

func (*Gui) IsKeyboardFocused

func (self *Gui) IsKeyboardFocused(w IWidget) bool

func (*Gui) NewButton

func (self *Gui) NewButton(label string, tip string, callback WidgetCallback, userData interface{}) *Button

func (*Gui) NewButtonDim

func (self *Gui) NewButtonDim(x, y, width, height int, label string, tip string, callback WidgetCallback, userData interface{}) *Button

func (*Gui) NewContainer

func (self *Gui) NewContainer(x, y, w, h int) *Container

func (*Gui) NewHBox

func (self *Gui) NewHBox(x, y, padding int) *HBox

func (*Gui) NewImageWidget

func (self *Gui) NewImageWidget(x, y, w, h int) *ImageWidget

func (*Gui) NewImageWidgetWithTip

func (self *Gui) NewImageWidgetWithTip(x, y, w, h int, tip string) *ImageWidget

func (*Gui) NewLabel

func (self *Gui) NewLabel(x, y int, label string) *Label

func (*Gui) NewLabelWithTip

func (self *Gui) NewLabelWithTip(x, y int, label string, tip string) *Label

func (*Gui) NewRadioButton

func (self *Gui) NewRadioButton(label string, tip string, callback WidgetCallback, userData interface{}) *RadioButton

func (*Gui) NewRadioButtonWithTip

func (self *Gui) NewRadioButtonWithTip(x, y, width, height int, label string, tip string, callback WidgetCallback, userData interface{}) *RadioButton

func (*Gui) NewSeparator

func (self *Gui) NewSeparator(txt string) *Separator

func (*Gui) NewSeparatorWithTip

func (self *Gui) NewSeparatorWithTip(txt, tip string) *Separator

func (*Gui) NewSlider

func (self *Gui) NewSlider(x, y, w int, min, max float32, label string, tip string) *Slider

func (*Gui) NewStatusBar

func (self *Gui) NewStatusBar() *StatusBar

func (*Gui) NewStatusBarDim

func (self *Gui) NewStatusBarDim(x, y, w, h int) *StatusBar

func (*Gui) NewTextBox

func (self *Gui) NewTextBox(x, y, w, maxw int, label, value string) *TextBox

func (*Gui) NewTextBoxWithTip

func (self *Gui) NewTextBoxWithTip(x, y, w, maxw int, label, value, tip string) *TextBox

func (*Gui) NewToggleButton

func (self *Gui) NewToggleButton(label, tip string, callback WidgetCallback, userData interface{}) *ToggleButton

func (*Gui) NewToggleButtonWithTip

func (self *Gui) NewToggleButtonWithTip(x, y, width, height int, label, tip string, callback WidgetCallback, userData interface{}) *ToggleButton

func (*Gui) NewToolBar

func (self *Gui) NewToolBar(x, y int, name, tip string) *ToolBar

func (*Gui) NewToolBarWithWidth

func (self *Gui) NewToolBarWithWidth(x, y, w int, name, tip string) *ToolBar

func (*Gui) NewVBox

func (self *Gui) NewVBox(x, y, padding int) *VBox

func (*Gui) NewWidget

func (self *Gui) NewWidget() *Widget

func (*Gui) NewWidgetAt

func (self *Gui) NewWidgetAt(x, y int) *Widget

func (*Gui) NewWidgetDim

func (self *Gui) NewWidgetDim(x, y, w, h int) *Widget

func (*Gui) Register

func (self *Gui) Register(w IWidget)

func (*Gui) RenderWidgets

func (self *Gui) RenderWidgets()

func (*Gui) SetConsole

func (self *Gui) SetConsole(console IConsole)

func (*Gui) SetDefaultRadioGroup

func (self *Gui) SetDefaultRadioGroup(group int)

func (*Gui) UnSelectRadioGroup

func (self *Gui) UnSelectRadioGroup(group int)

func (*Gui) Unregister

func (self *Gui) Unregister(w IWidget)

func (*Gui) UpdateWidgets

func (self *Gui) UpdateWidgets(k Key)

type HBox

type HBox struct {
	VBox
}

func (*HBox) ComputeSize

func (self *HBox) ComputeSize()

type HeightMap

type HeightMap struct {
	Data *C.TCOD_heightmap_t
}

func NewHeightMap

func NewHeightMap(w, h int) *HeightMap

func (*HeightMap) Add

func (self *HeightMap) Add(value float32)

func (*HeightMap) AddFbm

func (self *HeightMap) AddFbm(noise *Noise, mulx, muly, addx, addy, octaves, delta, scale float32)

func (*HeightMap) AddHill

func (self *HeightMap) AddHill(hx, hy, hradius, hheight float32)

func (*HeightMap) AddHm

func (self *HeightMap) AddHm(hm1 *HeightMap, hm2 *HeightMap)

func (*HeightMap) AddVoronoi

func (self *HeightMap) AddVoronoi(nbPoints, nbCoef int, coef []float32, rnd *Random)

func (*HeightMap) Clamp

func (self *HeightMap) Clamp(min, max float32)

func (*HeightMap) Clear

func (self *HeightMap) Clear()

func (*HeightMap) Copy

func (self *HeightMap) Copy(source *HeightMap)

func (*HeightMap) CountCells

func (self *HeightMap) CountCells(min, max float32) int

func (*HeightMap) DigBezier

func (self *HeightMap) DigBezier(px, py *[4]int, startRadius, startDepth, endRadius, endDepth float32)

func (*HeightMap) DigHill

func (self *HeightMap) DigHill(hx, hy, hradius, hheight float32)

func (*HeightMap) GetHeight

func (self *HeightMap) GetHeight() int

func (*HeightMap) GetInterpolatedValue

func (self *HeightMap) GetInterpolatedValue(x, y float32) float32

func (*HeightMap) GetMinMax

func (self *HeightMap) GetMinMax() (min, max float32)

func (*HeightMap) GetNormal

func (self *HeightMap) GetNormal(x, y float32, n *[3]float32, waterLevel float32)

func (*HeightMap) GetNthValue

func (self *HeightMap) GetNthValue(nth int) float32

func (*HeightMap) GetSlope

func (self *HeightMap) GetSlope(x, y int) float32

func (*HeightMap) GetValue

func (self *HeightMap) GetValue(x, y int) float32

func (*HeightMap) GetWidth

func (self *HeightMap) GetWidth() int

func (*HeightMap) HasLandOnBorder

func (self *HeightMap) HasLandOnBorder(waterLevel float32) bool

func (*HeightMap) Islandify

func (self *HeightMap) Islandify(seaLevel float32, random *Random)

func (*HeightMap) KernelTransform

func (self *HeightMap) KernelTransform(kernelsize int, dx, dy []int, weight []float32, minLevel, maxLevel float32)

func (*HeightMap) Lerp

func (self *HeightMap) Lerp(hm1 *HeightMap, hm2 *HeightMap, coef float32)

func (*HeightMap) Multiply

func (self *HeightMap) Multiply(hm1 *HeightMap, hm2 *HeightMap)

func (*HeightMap) Normalize

func (self *HeightMap) Normalize()

func (*HeightMap) NormalizeRange

func (self *HeightMap) NormalizeRange(min, max float32)

func (*HeightMap) RainErosion

func (self *HeightMap) RainErosion(nbDrops int, erosionCoef, sedimentationCoef float32, rnd *Random)

func (*HeightMap) Scale

func (self *HeightMap) Scale(value float32)

func (*HeightMap) ScaleFbm

func (self *HeightMap) ScaleFbm(noise *Noise, mulx, muly, addx, addy, octaves, delta, scale float32)

func (*HeightMap) SetNthValue

func (self *HeightMap) SetNthValue(nth int, value float32)

func (*HeightMap) SetValue

func (self *HeightMap) SetValue(x, y int, value float32)

type IConsole

type IConsole interface {
	GetData() C.TCOD_console_t
	GetDefaultBackground() Color
	GetDefaultForeground() Color
	SetDefaultForeground(color Color)
	SetDefaultBackground(color Color)
	Clear()
	GetCharBackground(x, y int) Color
	GetCharForeground(x, y int) Color
	SetCharBackground(x, y int, color Color, flag BkgndFlag)
	SetCharForeground(x, y int, color Color)
	SetChar(x, y int, c int)
	PutChar(x, y, c int, flag BkgndFlag)
	PutCharEx(x, y, c int, fore, back Color)
	Print(x, y int, fmts string, v ...interface{})
	PrintEx(x, y int, flag BkgndFlag, alignment Alignment, fmts string, v ...interface{})
	PrintRect(x, y, w, h int, fmts string, v ...interface{}) int
	PrintRectEx(x, y, w, h int, flag BkgndFlag, alignment Alignment, fmts string, v ...interface{}) int
	HeightRect(x, y, w, h int, fmts string, v ...interface{}) int
	SetBackgroundFlag(flag BkgndFlag)
	GetBackgroundFlag() BkgndFlag
	SetAlignment(alignment Alignment)
	GetAlignment() Alignment
	Rect(x, y, w, h int, clear bool, flag BkgndFlag)
	Hline(x, y, l int, flag BkgndFlag)
	Vline(x, y, l int, flag BkgndFlag)
	PrintFrame(x, y, w, h int, empty bool, flag BkgndFlag, fmts string, v ...interface{})
	GetChar(x, y int) int
	GetWidth() int
	GetHeight() int
	SetKeyColor(color Color)
	Blit(xSrc, ySrc, wSrc, hSrc int, dst IConsole, xDst, yDst int, foregroundAlpha, backgroundAlpha float32)
}

type IWidget

type IWidget interface {
	IsVisible() bool
	ComputeSize()
	Update(w IWidget, k Key)
	Render(w IWidget)
	GetX() int
	SetX(x int)
	GetY() int
	SetY(y int)
	GetWidth() int
	SetWidth(w int)
	GetHeight() int
	SetHeight(h int)
	GetUserData() interface{}
	SetUserData(data interface{})
	GetTip() string
	SetTip(tip string)
	GetMouseIn() bool
	SetMouseIn(mouseIn bool)
	GetMouseL() bool
	SetMouseL(mouseL bool)
	GetVisible() bool
	SetVisible(visible bool)
	SetGui(*Gui)
	GetGui() *Gui
	SetDefaultBackground(col, colFocus Color)
	SetDefaultForeground(col, colFocus Color)
	GetDefaultBackground() (col, colFocus Color)
	GetDefaultForeground() (col, colFocus Color)
	GetCurrentColors() (fore, back Color)
	// contains filtered or unexported methods
}

type Image

type Image struct {
	Data C.TCOD_image_t
}

func LoadImage

func LoadImage(filename string) *Image

func NewImage

func NewImage(width, height int) *Image

func NewImageFromConsole

func NewImageFromConsole(console *Console) *Image

func (*Image) Blit

func (self *Image) Blit(console *Console, x, y float32, bkgndFlag BkgndFlag, scalex, scaley, angle float32)

func (*Image) Blit2x

func (self *Image) Blit2x(dest *Console, dx, dy, sx, sy, w, h int)

func (*Image) BlitRect

func (self *Image) BlitRect(console *Console, x, y, w, h int, flag BkgndFlag)

func (*Image) Clear

func (self *Image) Clear(color Color)

func (*Image) GetAlpha

func (self *Image) GetAlpha(x, y int) int

func (*Image) GetMipmapPixel

func (self *Image) GetMipmapPixel(x0, y0, x1, y1 float32) Color

func (*Image) GetPixel

func (self *Image) GetPixel(x, y int) Color

func (*Image) GetSize

func (self *Image) GetSize(w, h *int)

func (*Image) Hflip

func (self *Image) Hflip()

func (*Image) Invert

func (self *Image) Invert()

func (*Image) IsPixelTransparent

func (self *Image) IsPixelTransparent(x, y int) bool

func (*Image) PutPixel

func (self *Image) PutPixel(x, y int, color Color)

func (*Image) RefreshConsole

func (self *Image) RefreshConsole(console *Console)

func (*Image) Rotate90

func (self *Image) Rotate90(numRotations int)

func (*Image) Save

func (self *Image) Save(filename string)

func (*Image) Scale

func (self *Image) Scale(neww, newh int)

func (*Image) SetKeyColor

func (self *Image) SetKeyColor(keyColor Color)

func (*Image) Vflip

func (self *Image) Vflip()

type ImageWidget

type ImageWidget struct {
	Widget
	// contains filtered or unexported fields
}

Image

func (*ImageWidget) Render

func (self *ImageWidget) Render(iself IWidget)

type Key

type Key struct {
	Vk      KeyCode
	C       byte
	Pressed bool
	LAlt    bool
	LCtrl   bool
	RAlt    bool
	RCtrl   bool
	Shift   bool
}

type KeyCode

type KeyCode C.TCOD_keycode_t

Key handling

type Label

type Label struct {
	Widget
	// contains filtered or unexported fields
}

func (*Label) ComputeSize

func (self *Label) ComputeSize()

func (*Label) Render

func (self *Label) Render(iself IWidget)

func (*Label) SetValue

func (self *Label) SetValue(label string)

type LineListener

type LineListener func(x, y int, userData interface{}) bool

type Map

type Map struct {
	Data C.TCOD_map_t
}

func NewMap

func NewMap(width, height int) *Map

func (*Map) Clear

func (self *Map) Clear(isTransparent bool, isWalkable bool)

set all cells as solid rock (cannot see through nor walk)

func (*Map) ComputeFov

func (self *Map) ComputeFov(playerX, playerY, maxRadius int, lightWalls bool, algo FovAlgorithm)

calculate the field of view (potentially visible cells from player_x,player_y)

func (*Map) Copy

func (self *Map) Copy(dest Map)

copy a map to another, reallocating it when needed

func (*Map) GetHeight

func (self *Map) GetHeight() int

func (*Map) GetNbCells

func (self *Map) GetNbCells() int

func (*Map) GetWidth

func (self *Map) GetWidth() int

func (*Map) IsInFov

func (self *Map) IsInFov(x, y int) bool

check if a cell is in the last computed field of view

func (*Map) IsTransparent

func (self *Map) IsTransparent(x, y int) bool

func (*Map) IsWalkable

func (self *Map) IsWalkable(x, y int) bool

func (*Map) SetInFov

func (self *Map) SetInFov(x, y int, fov bool)

func (*Map) SetProperties

func (self *Map) SetProperties(x, y int, isTransparent bool, isWalkable bool)

change a cell properties

type Mouse

type Mouse struct {
	X, Y           int
	Dx, Dy         int
	Cx, Cy         int
	Dcx, Dcy       int
	LButton        bool
	RButton        bool
	MButton        bool
	LButtonPressed bool
	RButtonPressed bool
	MButtonPressed bool
	WheelUp        bool
	WheelDown      bool
}

Mouse

func MouseGetStatus

func MouseGetStatus() Mouse

type Noise

type Noise struct {
	Data C.TCOD_noise_t
}

func NewNoise

func NewNoise(dimensions int, random *Random) *Noise

func NewNoiseWithOptions

func NewNoiseWithOptions(dimensions int, hurst float32, lacunarity float32, random *Random) *Noise

func (*Noise) Get

func (self *Noise) Get(f FloatArray) float32

func (*Noise) GetEx

func (self *Noise) GetEx(f FloatArray, noiseType NoiseType) float32

func (*Noise) GetFbm

func (self *Noise) GetFbm(f FloatArray, octaves float32) float32

func (*Noise) GetFbmEx

func (self *Noise) GetFbmEx(f FloatArray, octaves float32, noiseType NoiseType) float32

func (*Noise) GetTurbulence

func (self *Noise) GetTurbulence(f FloatArray, octaves float32) float32

func (*Noise) GetTurbulenceEx

func (self *Noise) GetTurbulenceEx(f FloatArray, octaves float32, noiseType NoiseType) float32

func (*Noise) SetType

func (self *Noise) SetType(noiseType NoiseType)

type NoiseType

type NoiseType C.TCOD_noise_type_t

type Parser

type Parser struct {
	Data C.TCOD_parser_t
}

func NewParser

func NewParser() *Parser

func (*Parser) RegisterStruct

func (self *Parser) RegisterStruct(name string) ParserStruct

func (*Parser) Run

func (self *Parser) Run(filename string) []ParserProperty

TODO listeners are not supported Running parser return list of parsed properties

type ParserProperty

type ParserProperty struct {
	Name      string
	ValueType ParserValueType
	Value     interface{}
}

type ParserStruct

type ParserStruct struct {
	Data C.TCOD_parser_struct_t
}

func (ParserStruct) AddFlag

func (self ParserStruct) AddFlag(propname string)

func (ParserStruct) AddListProperty

func (self ParserStruct) AddListProperty(name string, valueType ParserValueType, mandatory bool)

func (ParserStruct) AddProperty

func (self ParserStruct) AddProperty(name string, valueType ParserValueType, mandatory bool)

func (ParserStruct) AddStructure

func (self ParserStruct) AddStructure(substruct ParserStruct)

func (ParserStruct) AddValueList

func (self ParserStruct) AddValueList(name string, valueList []string, mandatory bool)

func (ParserStruct) GetName

func (self ParserStruct) GetName() string

func (*ParserStruct) GetType

func (self *ParserStruct) GetType(propname string) ParserValueType

func (*ParserStruct) IsMandatory

func (self *ParserStruct) IsMandatory(propname string) bool

type ParserValueType

type ParserValueType C.TCOD_value_type_t

type Path

type Path struct {
	Data C.TCOD_path_t
}

Path

func NewPathUsingMap

func NewPathUsingMap(m *Map, diagonalCost float32) *Path

func (*Path) Compute

func (self *Path) Compute(ox, oy, dx, dy int) bool

func (*Path) Get

func (self *Path) Get(index int) (x, y int)

func (*Path) GetDestination

func (self *Path) GetDestination() (x, y int)

func (*Path) GetOrigin

func (self *Path) GetOrigin() (x, y int)

func (*Path) IsEmpty

func (self *Path) IsEmpty() bool

func (*Path) Size

func (self *Path) Size() int

func (*Path) Walk

func (self *Path) Walk(recalcWhenNeeded bool) (x, y int)

type Point

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

func LinePoints

func LinePoints(xo, yo, xd, yd int) []Point

returns slice of Points where the line was drawn

type RadioButton

type RadioButton struct {
	Button
	// contains filtered or unexported fields
}

func (*RadioButton) GetCurrentColors

func (self *RadioButton) GetCurrentColors() (fore, back Color)

func (*RadioButton) GetSelectionColor

func (self *RadioButton) GetSelectionColor() (fore, back Color)

func (*RadioButton) GetUseSelectionColor

func (self *RadioButton) GetUseSelectionColor() bool

func (*RadioButton) IsSelected

func (self *RadioButton) IsSelected() bool

func (*RadioButton) Render

func (self *RadioButton) Render(iself IWidget)

func (*RadioButton) Select

func (self *RadioButton) Select()

func (*RadioButton) SetGroup

func (self *RadioButton) SetGroup(group int)

func (*RadioButton) SetSelectionColor

func (self *RadioButton) SetSelectionColor(fore, back Color)

func (*RadioButton) SetUseSelectionColor

func (self *RadioButton) SetUseSelectionColor(use bool)

func (*RadioButton) UnSelect

func (self *RadioButton) UnSelect()

type RadioButtonStatic

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

func NewRadioButtonStatic

func NewRadioButtonStatic() *RadioButtonStatic

func (*RadioButtonStatic) SetDefaultGroup

func (self *RadioButtonStatic) SetDefaultGroup(group int)

func (*RadioButtonStatic) UnSelectGroup

func (self *RadioButtonStatic) UnSelectGroup(group int)

type Random

type Random struct {
	Data C.TCOD_random_t
}

func GetRandomInstance

func GetRandomInstance() *Random

func NewRandom

func NewRandom() *Random

func NewRandomFromSeed

func NewRandomFromSeed(seed uint32) *Random

func NewRandomFromSeedWithAlgo

func NewRandomFromSeedWithAlgo(seed uint32, algo RandomAlgo) *Random

func NewRandomWithAlgo

func NewRandomWithAlgo(algo RandomAlgo) *Random

func (*Random) GetDouble

func (self *Random) GetDouble(min, max float64) float64

func (*Random) GetDoubleMean

func (self *Random) GetDoubleMean(min, max, mean float64) float64

func (*Random) GetFloat

func (self *Random) GetFloat(min, max float32) float32

func (*Random) GetFloatMean

func (self *Random) GetFloatMean(min, max, mean float32) float32

func (*Random) GetInt

func (self *Random) GetInt(min, max int) int

func (*Random) GetIntMean

func (self *Random) GetIntMean(min, max, mean int) int

func (*Random) Restore

func (self *Random) Restore(backup *Random)

func (*Random) Save

func (self *Random) Save() *Random

func (*Random) SetDistribution

func (self *Random) SetDistribution(distribution Distribution)

type RandomAlgo

type RandomAlgo C.TCOD_random_algo_t

type Renderer

type Renderer C.TCOD_renderer_t

type RootConsole

type RootConsole struct {
	Console
}

func NewRootConsole

func NewRootConsole(w, h int, title string, fullscreen bool) *RootConsole

func NewRootConsoleWithFont

func NewRootConsoleWithFont(w, h int, title string, fullscreen bool, fontFile string, fontFlags, nbCharHoriz,
	nbCharVertic int, renderer Renderer) *RootConsole

func (*RootConsole) CheckForKeypress

func (self *RootConsole) CheckForKeypress(flags int) Key

func (*RootConsole) Credits

func (self *RootConsole) Credits()

func (*RootConsole) DisableKeyboardRepeat

func (self *RootConsole) DisableKeyboardRepeat()

func (*RootConsole) Flush

func (self *RootConsole) Flush()

func (*RootConsole) GetFade

func (self *RootConsole) GetFade() uint8

func (*RootConsole) GetFadingColor

func (self *RootConsole) GetFadingColor() Color

func (*RootConsole) IsFullscreen

func (self *RootConsole) IsFullscreen() bool

func (*RootConsole) IsKeyPressed

func (self *RootConsole) IsKeyPressed(keyCode KeyCode) bool

func (*RootConsole) IsWindowClosed

func (self *RootConsole) IsWindowClosed() bool

func (*RootConsole) MapAsciiCodeToFont

func (self *RootConsole) MapAsciiCodeToFont(asciiCode, fontCharX, fontCharY int)

func (*RootConsole) MapAsciiCodesToFont

func (self *RootConsole) MapAsciiCodesToFont(asciiCode, fontCharX, fontCharY int)

func (*RootConsole) MapStringToFont

func (self *RootConsole) MapStringToFont(s string, fontCharX, fontCharY int)

func (*RootConsole) RenderCredits

func (self *RootConsole) RenderCredits(x, y int, alpha bool) bool

func (*RootConsole) ResetCredits

func (self *RootConsole) ResetCredits()

func (*RootConsole) SetColorControl

func (self *RootConsole) SetColorControl(ctrl ColCtrl, fore, back Color)

func (*RootConsole) SetCustomFont

func (self *RootConsole) SetCustomFont(fontFile string, flags int, nbCharHoriz int, nbCharVertic int)

func (*RootConsole) SetDirty

func (self *RootConsole) SetDirty(x, y, w, h int)

func (*RootConsole) SetFade

func (self *RootConsole) SetFade(val uint8, fade Color)

func (*RootConsole) SetFullscreen

func (self *RootConsole) SetFullscreen(fullscreen bool)

func (*RootConsole) SetKeyboardRepeat

func (self *RootConsole) SetKeyboardRepeat(initialDelay, interval int)

func (*RootConsole) SetWindowTitle

func (self *RootConsole) SetWindowTitle(title string)

func (*RootConsole) WaitForKeypress

func (self *RootConsole) WaitForKeypress(flush bool) Key

type Separator

type Separator struct {
	Widget
	// contains filtered or unexported fields
}

Separator

func (*Separator) ComputeSize

func (self *Separator) ComputeSize()

func (*Separator) Render

func (self *Separator) Render(iself IWidget)

type Slider

type Slider struct {
	TextBox
	// contains filtered or unexported fields
}

func (*Slider) GetCurrentColors

func (self *Slider) GetCurrentColors() (fore, back Color)

func (*Slider) Render

func (self *Slider) Render(iself IWidget)

func (*Slider) SetCallback

func (self *Slider) SetCallback(callback SliderCallback, data interface{})

func (*Slider) SetFormat

func (self *Slider) SetFormat(fmt string)

func (*Slider) SetMinMax

func (self *Slider) SetMinMax(min, max float32)

func (*Slider) SetSensitivity

func (self *Slider) SetSensitivity(sensitivity float32)

func (*Slider) SetValue

func (self *Slider) SetValue(value float32)

func (*Slider) Update

func (self *Slider) Update(iself IWidget, k Key)

type SliderCallback

type SliderCallback func(w IWidget, val float32, data interface{})

type StatusBar

type StatusBar struct {
	Widget
}

Status bar

func (*StatusBar) Render

func (self *StatusBar) Render(iself IWidget)

type Text

type Text struct {
	Data C.TCOD_text_t
}

Text field TODO this is available only in debug version? (1.5.0)

func NewText

func NewText(x, y, w, h, maxChars int) *Text

func (*Text) Get

func (self *Text) Get() string

func (*Text) Render

func (self *Text) Render(console IConsole)

func (*Text) Reset

func (self *Text) Reset()

func (*Text) SetColors

func (self *Text) SetColors(fore, back Color, backTransparency float32)

func (*Text) SetProperties

func (self *Text) SetProperties(cursorChar int, blinkInterval int, prompt string, tabSize int)

func (*Text) Update

func (self *Text) Update(key Key)

type TextBox

type TextBox struct {
	Widget
	// contains filtered or unexported fields
}

func (*TextBox) GetBlinkingDelay

func (self *TextBox) GetBlinkingDelay() float32

func (*TextBox) GetText

func (self *TextBox) GetText() string

func (*TextBox) Render

func (self *TextBox) Render(iself IWidget)

func (*TextBox) SetBlinkingDelay

func (self *TextBox) SetBlinkingDelay(delay float32)

func (*TextBox) SetCallback

func (self *TextBox) SetCallback(callback TextBoxCallback, data interface{})

func (*TextBox) SetText

func (self *TextBox) SetText(txt string)

func (*TextBox) Update

func (self *TextBox) Update(iself IWidget, k Key)

type TextBoxCallback

type TextBoxCallback func(w IWidget, val string, data interface{})

type TextBoxStatic

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

func NewTextBoxStatic

func NewTextBoxStatic() *TextBoxStatic

type ToggleButton

type ToggleButton struct {
	Button
	// contains filtered or unexported fields
}

func (*ToggleButton) IsPressed

func (self *ToggleButton) IsPressed() bool

func (*ToggleButton) Render

func (self *ToggleButton) Render(iself IWidget)

func (*ToggleButton) SetPressed

func (self *ToggleButton) SetPressed(val bool)

type ToolBar

type ToolBar struct {
	Container
	// contains filtered or unexported fields
}

func (*ToolBar) AddSeparator

func (self *ToolBar) AddSeparator(txt string)

func (*ToolBar) AddSeparatorWithTip

func (self *ToolBar) AddSeparatorWithTip(txt string, tip string)

func (*ToolBar) ComputeSize

func (self *ToolBar) ComputeSize()

func (*ToolBar) GetShouldPrintFrame

func (self *ToolBar) GetShouldPrintFrame() bool

func (*ToolBar) Render

func (self *ToolBar) Render(iself IWidget)

func (*ToolBar) SetName

func (self *ToolBar) SetName(name string)

func (*ToolBar) SetShouldPrintFrame

func (self *ToolBar) SetShouldPrintFrame(value bool)

type VBox

type VBox struct {
	Container
	// contains filtered or unexported fields
}

VBox

func (*VBox) ComputeSize

func (self *VBox) ComputeSize()

type Widget

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

func (*Widget) ComputeSize

func (self *Widget) ComputeSize()

func (*Widget) Delete

func (self *Widget) Delete()

func (*Widget) GetCurrentColors

func (self *Widget) GetCurrentColors() (fore, back Color)

func (*Widget) GetDefaultBackground

func (self *Widget) GetDefaultBackground() (col, colFocus Color)

func (*Widget) GetDefaultForeground

func (self *Widget) GetDefaultForeground() (col, colFocus Color)

func (*Widget) GetGui

func (self *Widget) GetGui() *Gui

func (*Widget) GetHeight

func (self *Widget) GetHeight() int

func (*Widget) GetMouseIn

func (self *Widget) GetMouseIn() bool

func (*Widget) GetMouseL

func (self *Widget) GetMouseL() bool

func (*Widget) GetTip

func (self *Widget) GetTip() string

func (*Widget) GetUserData

func (self *Widget) GetUserData() interface{}

func (*Widget) GetVisible

func (self *Widget) GetVisible() bool

func (*Widget) GetWidth

func (self *Widget) GetWidth() int

func (*Widget) GetX

func (self *Widget) GetX() int

func (*Widget) GetY

func (self *Widget) GetY() int

func (*Widget) IsVisible

func (self *Widget) IsVisible() bool

func (*Widget) Move

func (self *Widget) Move(x, y int)

func (*Widget) Render

func (self *Widget) Render(iself IWidget)

func (*Widget) SetDefaultBackground

func (self *Widget) SetDefaultBackground(col, colFocus Color)

func (*Widget) SetDefaultForeground

func (self *Widget) SetDefaultForeground(col, colFocus Color)

func (*Widget) SetGui

func (self *Widget) SetGui(gui *Gui)

func (*Widget) SetHeight

func (self *Widget) SetHeight(h int)

func (*Widget) SetMouseIn

func (self *Widget) SetMouseIn(mouseIn bool)

func (*Widget) SetMouseL

func (self *Widget) SetMouseL(mouseL bool)

func (*Widget) SetTip

func (self *Widget) SetTip(tip string)

func (*Widget) SetUserData

func (self *Widget) SetUserData(data interface{})

func (*Widget) SetVisible

func (self *Widget) SetVisible(visible bool)

func (*Widget) SetWidth

func (self *Widget) SetWidth(w int)

func (*Widget) SetX

func (self *Widget) SetX(x int)

func (*Widget) SetY

func (self *Widget) SetY(y int)

func (*Widget) Update

func (self *Widget) Update(iself IWidget, k Key)

both self and iself denote the same object here we emulate inheritance in go function receives self as receiver and as first param in interface

type WidgetCallback

type WidgetCallback func(w IWidget, userData interface{})

type Zip

type Zip struct {
	Data C.TCOD_zip_t
}

func NewZip

func NewZip() *Zip

func (*Zip) GetChar

func (self *Zip) GetChar() byte

func (*Zip) GetColor

func (self *Zip) GetColor() Color

func (*Zip) GetConsole

func (self *Zip) GetConsole() *Console

func (*Zip) GetCurrentBytes

func (self *Zip) GetCurrentBytes() uint32

func (*Zip) GetData

func (self *Zip) GetData(nbBytes int, data unsafe.Pointer) int

func (*Zip) GetFloat

func (self *Zip) GetFloat() float32

func (*Zip) GetImage

func (self *Zip) GetImage() *Image

func (*Zip) GetInt

func (self *Zip) GetInt() int

func (*Zip) GetRemainingBytes

func (self *Zip) GetRemainingBytes() uint32

func (*Zip) GetString

func (self *Zip) GetString() string

func (*Zip) LoadFromFile

func (self *Zip) LoadFromFile(filename string)

func (*Zip) PutChar

func (self *Zip) PutChar(val byte)

func (*Zip) PutColor

func (self *Zip) PutColor(val Color)

func (*Zip) PutConsole

func (self *Zip) PutConsole(val *Console)

func (*Zip) PutData

func (self *Zip) PutData(nbBytes int, data unsafe.Pointer)

func (*Zip) PutFloat

func (self *Zip) PutFloat(val float32)

func (*Zip) PutImage

func (self *Zip) PutImage(val *Image)

func (*Zip) PutInt

func (self *Zip) PutInt(val int)

func (*Zip) PutString

func (self *Zip) PutString(val string)

func (*Zip) SaveToFile

func (self *Zip) SaveToFile(filename string)

func (*Zip) SkipBytes

func (self *Zip) SkipBytes(nbBytes uint32)

Jump to

Keyboard shortcuts

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