├── .gitignore ├── LICENSE ├── README ├── hmtool ├── main.go └── terminal.png ├── sample ├── asciiart.go ├── data │ ├── ascii │ │ ├── alert_wolf.dat │ │ ├── avatar.dat │ │ ├── black_dragon.dat │ │ ├── blood_elf.dat │ │ ├── blue_dragon.dat │ │ ├── conan.dat │ │ ├── elves.dat │ │ ├── great_dragon.dat │ │ ├── grey_wolf.dat │ │ ├── ice_dragon.dat │ │ ├── lich_king.dat │ │ ├── priest.dat │ │ ├── purple_butterfly.dat │ │ ├── reaper.dat │ │ ├── samurai.dat │ │ ├── tiger.dat │ │ ├── unicorn_man.dat │ │ ├── vampire.dat │ │ └── wolf_howling.dat │ ├── cfg │ │ └── sample.cfg │ ├── fonts │ │ ├── README.txt │ │ ├── arial10x10.png │ │ ├── arial12x12.png │ │ ├── arial8x8.png │ │ ├── ascii.py │ │ ├── ascii.txt │ │ ├── caeldera8x8_gs_tc.png │ │ ├── celtic_garamond_10x10_gs_tc.png │ │ ├── consolas10x10_gs_tc.png │ │ ├── consolas12x12_gs_tc.png │ │ ├── consolas8x8_gs_tc.png │ │ ├── consolas_unicode_10x10.png │ │ ├── consolas_unicode_12x12.png │ │ ├── consolas_unicode_16x16.png │ │ ├── consolas_unicode_8x8.png │ │ ├── courier10x10_aa_tc.png │ │ ├── courier12x12_aa_tc.png │ │ ├── courier8x8_aa_tc.png │ │ ├── dejavu10x10_gs_tc.png │ │ ├── dejavu12x12_gs_tc.png │ │ ├── dejavu8x8_gs_tc.png │ │ ├── dundalk12x12_gs_tc.png │ │ ├── lucida10x10_gs_tc.png │ │ ├── lucida12x12_gs_tc.png │ │ ├── lucida8x8_gs_tc.png │ │ ├── prestige10x10_gs_tc.png │ │ ├── prestige12x12_gs_tc.png │ │ ├── prestige8x8_gs_tc.png │ │ ├── terminal10x10_gs_tc.png │ │ ├── terminal10x18.png │ │ ├── terminal7x7_gs_tc.png │ │ ├── terminal8x15.png │ │ ├── terminal8x8.png │ │ ├── terminal8x8_aa_as.png │ │ ├── terminal8x8_aa_ro.png │ │ ├── terminal8x8_aa_tc.png │ │ ├── terminal8x8_gs_as.png │ │ ├── terminal8x8_gs_ro.png │ │ └── terminal8x8_gs_tc.png │ ├── img │ │ ├── circle.png │ │ └── skull.png │ └── namegen │ │ ├── README.txt │ │ ├── jice_celtic.cfg │ │ ├── jice_fantasy.cfg │ │ ├── jice_mesopotamian.cfg │ │ ├── jice_norse.cfg │ │ ├── jice_region.cfg │ │ ├── jice_town.cfg │ │ ├── mingos_demon.cfg │ │ ├── mingos_dwarf.cfg │ │ ├── mingos_norse.cfg │ │ ├── mingos_standard.cfg │ │ └── mingos_town.cfg ├── main.go └── terminal.png └── tcod ├── gui.go ├── include ├── bresenham.h ├── bsp.h ├── color.h ├── console.h ├── console_types.h ├── fov.h ├── fov_types.h ├── heightmap.h ├── image.h ├── lex.h ├── libtcod.h ├── libtcod_int.h ├── list.h ├── mersenne.h ├── mersenne_types.h ├── mouse.h ├── mouse_types.h ├── namegen.h ├── noise.h ├── noise_defaults.h ├── parser.h ├── path.h ├── sys.h ├── tree.h ├── txtfield.h ├── wrappers.h └── zip.h ├── tcod.go └── tcod_defs.go /.gitignore: -------------------------------------------------------------------------------- 1 | *.8 2 | _cgo_defun.c 3 | _cgo_gotypes.go 4 | _cgo_.so 5 | *.o 6 | _obj/ 7 | *.sw* 8 | tcod.cgo1.go 9 | sample/sample 10 | hmtool/hmtool 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2010 Adam Folmert 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | What is it 2 | ---------- 3 | libtcod-go is a set of Go bindings for the libtcod library 4 | 5 | libtcod (http://roguecentral.org/doryen/libtcod/) is an open-source, cross-platform C 6 | library for writing roguelike games 7 | It provides many utilities frequently used in roguelike games, like 8 | - truecolor console (SDL and OpenGL backends) 9 | - keyboard/mouse input 10 | - misc algorithms (line drawing, pathfinding, field of view, dungeon generation) 11 | - terrain and noise generators 12 | - widget toolkit 13 | - config parser 14 | - name generator 15 | etc. 16 | 17 | Go (http://golang.org/) is a programming language released in 2009 by Google. 18 | It is a static language with dynamic feel, compiles to native code, has clean syntax (somewhat 19 | between C and Python) with garbage collection and language support for unicode 20 | and concurrency. 21 | 22 | Most of libtcod API (version 1.5.1) is wrapped in Go, with some parts fully ported to enable easier 23 | callbacks. In addition, the demo and terrain-generation tool were also fully ported to 24 | serve as examples on how to use the library. 25 | 26 | 27 | Installation 28 | ------------ 29 | To build the bindings, you will need the libtcod library and Go language installed. 30 | Please refer to http://golang.org/doc/install.html for Go installation 31 | and to http://doryen.eptalys.net/libtcod/download/ for libtcod installation. 32 | 33 | You can obtain libtcod-go by running `go get github.com/afolmert/libtcod-go/tcod`, 34 | and use the library in your programs with `import "github.com/afolmert/libtcod-go/tcod"`. 35 | 36 | The sample program and hmtool program can be built by running `go build` from 37 | within their respective directories, and then running the `./sample` and `./hmtool` 38 | binaries respectively. This is preferred to using `go get` or `go install` to 39 | install these binaries because they use data and images from their source directory 40 | and `go install` has no way to install these. 41 | 42 | 43 | Documentation 44 | -------------- 45 | Although there is no documentation for the bindings themselves, the bindings API 46 | does not differ much from the original library, so the original documentation should 47 | be very helpful (http://doryen.eptalys.net/data/libtcod/doc/1.5.1/index2.html?c=true). 48 | 49 | The samples and hmtool program also use many parts of the API so they also could be 50 | helpful to get started. 51 | 52 | 53 | Bugs 54 | ----- 55 | Original API parts missing from Go bindings: 56 | - custom containers (TCOD_list_t) - alternatives exist in Go 57 | - thread/mutexes functions - alternatives exist in Go 58 | - SDL callback renderer - callbacks from C are currently cumbersome in Go 59 | 60 | The bindings have been tested on 32bit and 64bit Linux with 8g and 6g compilers. 61 | There may still be some issues on other platforms. 62 | 63 | Please report any problems and other bugs to afolmert (at) gmail (dot) com 64 | 65 | 66 | Credits 67 | -------- 68 | Thanks to: 69 | Go Authors for the Go language 70 | Jice, Mingos and others for the libtcod library 71 | Chris Hamons for API design ideas in the libtcod-net bindings 72 | Felipe Bichued for comments and ideas 73 | Alex Ogier for patches updating to Go 1.2 74 | -------------------------------------------------------------------------------- /hmtool/terminal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/hmtool/terminal.png -------------------------------------------------------------------------------- /sample/asciiart.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "compress/zlib" 5 | "encoding/gob" 6 | . "github.com/afolmert/libtcod-go/tcod" 7 | "io/ioutil" 8 | "os" 9 | "path" 10 | "strings" 11 | ) 12 | 13 | type Transition uint8 14 | 15 | type MoveTransition uint8 16 | 17 | // Transitions 18 | const ( 19 | INSTANT = iota 20 | FADE_IN 21 | MOVE_IN 22 | RANDOMIZE 23 | NB_TRANSITIONS 24 | ) 25 | 26 | // Move transitions 27 | const ( 28 | MOVE_UP = iota 29 | MOVE_DOWN 30 | MOVE_LEFT 31 | MOVE_RIGHT 32 | NB_MOVE_TRANSITIONS 33 | ) 34 | 35 | const TRANSITION_TIME = 700 // time in milliseconds 36 | 37 | type IAsciiArt interface { 38 | Render(console IConsole, transition Transition, first bool) 39 | } 40 | 41 | type AsciiArtGallery struct { 42 | secondary IConsole 43 | firstTime int // time in milliseconds when first render occurred 44 | moveTransition MoveTransition 45 | arts []IAsciiArt 46 | artfiles []string 47 | last int 48 | loadedArtsChan chan bool 49 | loadedArts bool 50 | } 51 | 52 | // TODO switch to go version from May 2010 53 | // TODO decode ascii arts , 54 | // TODO store as binary file 55 | // CODE LenName Name WIDTH, HEIGHT OFFSETX OFFSETY and stream of colors 56 | 57 | type AsciiArt struct { 58 | name string 59 | chars []string 60 | colors [][]Color 61 | width, height int 62 | offsetX, offsetY int 63 | } 64 | 65 | var asciiArts []IAsciiArt 66 | 67 | var aas *AsciiArtGallery 68 | 69 | func NewAsciiArtGallery() *AsciiArtGallery { 70 | result := &AsciiArtGallery{} 71 | result.loadedArts = false 72 | result.loadedArtsChan = make(chan bool) 73 | result.goLoadAsciiArts() 74 | return result 75 | } 76 | 77 | func (self *AsciiArtGallery) isArtsLoaded() bool { 78 | // if arts not loaded then wait for loading 79 | if !self.loadedArts { 80 | if _, ok := <-self.loadedArtsChan; ok { 81 | self.loadedArts = true 82 | } 83 | } 84 | return self.loadedArts 85 | } 86 | 87 | // loads ascii arts from data directory 88 | func (self *AsciiArtGallery) goLoadAsciiArts() { 89 | self.loadedArts = false 90 | go func() { 91 | files := []string{} 92 | entries, err := ioutil.ReadDir("data/ascii") 93 | if err != nil { 94 | panic("Cannot read files from data/ascii") 95 | } 96 | for _, f := range entries { 97 | if strings.HasSuffix(f.Name(), ".dat") { 98 | files = append(files, path.Join("data/ascii", f.Name())) 99 | } 100 | } 101 | 102 | self.arts = make([]IAsciiArt, len(files)) 103 | self.artfiles = files 104 | self.loadedArtsChan <- true 105 | }() 106 | } 107 | 108 | func (self *AsciiArtGallery) getAsciiArt(id int) IAsciiArt { 109 | var result IAsciiArt 110 | if self.arts[id] == nil { 111 | art, err := NewAsciiArtFromFile(self.artfiles[id]) 112 | if err != nil { 113 | panic("Cannot load ascii file " + self.artfiles[id]) 114 | } 115 | self.arts[id] = art 116 | } 117 | result = self.arts[id] 118 | return result 119 | } 120 | 121 | // select random ASCII art but not the one before 122 | func (self *AsciiArtGallery) randomAsciiArt() IAsciiArt { 123 | if self.isArtsLoaded() { 124 | var id int 125 | 126 | // find id to return 127 | if len(self.arts) == 0 { 128 | panic("No arts found!") 129 | } else if len(self.arts) == 1 { 130 | id = 0 131 | } else { 132 | for { 133 | id = random.GetInt(0, len(self.arts)-1) 134 | if self.last != id { 135 | break 136 | } 137 | } 138 | self.last = id 139 | } 140 | return self.getAsciiArt(id) 141 | 142 | } 143 | return nil 144 | } 145 | 146 | func NewAsciiArtFromFile(fname string) (art IAsciiArt, err error) { 147 | 148 | fin, err := os.Open(fname) 149 | if err != nil { 150 | return nil, err 151 | } 152 | i, err := zlib.NewReader(fin) 153 | defer i.Close() 154 | if err != nil { 155 | return nil, err 156 | } 157 | d := gob.NewDecoder(i) 158 | a := AsciiArt{} 159 | d.Decode(&a) 160 | return &a, nil 161 | 162 | } 163 | 164 | func (self *AsciiArt) PutChar(console IConsole, x, y int) { 165 | color := self.colors[y+self.offsetY][x+self.offsetX] 166 | // char := int(self.chars[y+self.offsetY][x+self.offsetX]) 167 | console.PutChar(x, y, 'x', BKGND_SET) 168 | console.SetCharForeground(x, y, color) 169 | console.SetCharBackground(x, y, COLOR_BLACK, BKGND_SET) 170 | 171 | } 172 | 173 | func (self *AsciiArt) Draw(console IConsole) { 174 | console.SetDefaultBackground(COLOR_BLACK) 175 | console.Clear() 176 | for x := 0; x < min(console.GetWidth(), self.width); x++ { 177 | for y := 0; y < min(console.GetHeight(), self.height); y++ { 178 | self.PutChar(console, x, y) 179 | } 180 | } 181 | } 182 | 183 | func (self *AsciiArt) Render(console IConsole, transition Transition, first bool) { 184 | if first { 185 | aas.firstTime = int(SysElapsedMilliseconds()) 186 | } 187 | elapsed := int(SysElapsedMilliseconds()) - aas.firstTime 188 | 189 | switch transition { 190 | 191 | case INSTANT: 192 | { 193 | self.Draw(console) 194 | 195 | } 196 | case RANDOMIZE: 197 | { 198 | if first { 199 | console.SetDefaultBackground(COLOR_BLACK) 200 | } 201 | for i := 0; i < 500; i++ { 202 | x := random.GetInt(0, console.GetWidth()-1) 203 | y := random.GetInt(0, console.GetHeight()-1) 204 | 205 | // if in our picture then draw it 206 | if x < self.width && y < self.height { 207 | self.PutChar(console, x, y) 208 | } else { 209 | // else draw black background 210 | console.PutChar(x, y, ' ', BKGND_SET) 211 | console.SetCharForeground(x, y, COLOR_BLACK) 212 | console.SetCharBackground(x, y, COLOR_BLACK, BKGND_SET) 213 | } 214 | } 215 | 216 | } 217 | case FADE_IN: 218 | { 219 | if first { 220 | aas.secondary = NewConsole(console.GetWidth(), console.GetHeight()) 221 | console.Blit(0, 0, console.GetWidth(), console.GetHeight(), aas.secondary, 0, 0, 1.0, 1.0) 222 | } 223 | console.SetDefaultBackground(COLOR_BLACK) 224 | console.Clear() 225 | // fade out old 226 | if elapsed <= TRANSITION_TIME { 227 | alpha := 1.0 - float32(elapsed)/TRANSITION_TIME 228 | aas.secondary.Blit(0, 0, console.GetWidth(), console.GetHeight(), console, 0, 0, alpha, alpha) 229 | // fade in new 230 | } else { 231 | self.Draw(aas.secondary) 232 | alpha := minf((float32(elapsed)-TRANSITION_TIME)/TRANSITION_TIME, 1) 233 | aas.secondary.Blit(0, 0, console.GetWidth(), console.GetHeight(), console, 0, 0, alpha, alpha) 234 | } 235 | 236 | } 237 | case MOVE_IN: 238 | { 239 | if first { 240 | aas.secondary = NewConsole(console.GetWidth(), console.GetHeight()) 241 | aas.moveTransition = MoveTransition(random.GetInt(0, NB_MOVE_TRANSITIONS-1)) 242 | self.Draw(aas.secondary) 243 | } 244 | widthPart := max(1, min(console.GetWidth(), int(float32(elapsed)/TRANSITION_TIME*float32(console.GetWidth())))) 245 | heightPart := max(1, min(console.GetHeight(), int(float32(elapsed)/TRANSITION_TIME*float32(console.GetHeight())))) 246 | 247 | switch aas.moveTransition { 248 | case MOVE_LEFT: 249 | aas.secondary.Blit( 250 | 0, 0, widthPart, console.GetHeight(), 251 | console, 0, 0, 1.0, 1.0) 252 | case MOVE_RIGHT: 253 | aas.secondary.Blit( 254 | console.GetWidth()-widthPart, 0, widthPart, console.GetHeight(), 255 | console, console.GetWidth()-widthPart, 0, 1.0, 1.0) 256 | case MOVE_DOWN: 257 | aas.secondary.Blit(0, 0, console.GetWidth(), heightPart, 258 | console, 0, 0, 1.0, 1.0) 259 | case MOVE_UP: 260 | aas.secondary.Blit( 261 | 0, console.GetHeight()-heightPart, console.GetWidth(), heightPart, 262 | console, 0, console.GetHeight()-heightPart, 1.0, 1.0) 263 | 264 | } 265 | 266 | } 267 | default: 268 | { 269 | // do nothing 270 | self.Render(console, FADE_IN, first) 271 | // TODO 272 | // rain/driple -> transitions -> similar to MOVE_IN transitions but for each streak sepreately 273 | // with different speed 274 | // fade in 275 | // have 2 consoles -> save current as screenshot 276 | // // and fill then new one and blit it 277 | // move in -> <- 278 | // rain driple like matrix effect 279 | } 280 | } 281 | } 282 | -------------------------------------------------------------------------------- /sample/data/ascii/alert_wolf.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/ascii/alert_wolf.dat -------------------------------------------------------------------------------- /sample/data/ascii/avatar.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/ascii/avatar.dat -------------------------------------------------------------------------------- /sample/data/ascii/black_dragon.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/ascii/black_dragon.dat -------------------------------------------------------------------------------- /sample/data/ascii/blood_elf.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/ascii/blood_elf.dat -------------------------------------------------------------------------------- /sample/data/ascii/blue_dragon.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/ascii/blue_dragon.dat -------------------------------------------------------------------------------- /sample/data/ascii/conan.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/ascii/conan.dat -------------------------------------------------------------------------------- /sample/data/ascii/elves.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/ascii/elves.dat -------------------------------------------------------------------------------- /sample/data/ascii/great_dragon.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/ascii/great_dragon.dat -------------------------------------------------------------------------------- /sample/data/ascii/grey_wolf.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/ascii/grey_wolf.dat -------------------------------------------------------------------------------- /sample/data/ascii/ice_dragon.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/ascii/ice_dragon.dat -------------------------------------------------------------------------------- /sample/data/ascii/lich_king.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/ascii/lich_king.dat -------------------------------------------------------------------------------- /sample/data/ascii/priest.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/ascii/priest.dat -------------------------------------------------------------------------------- /sample/data/ascii/purple_butterfly.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/ascii/purple_butterfly.dat -------------------------------------------------------------------------------- /sample/data/ascii/reaper.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/ascii/reaper.dat -------------------------------------------------------------------------------- /sample/data/ascii/samurai.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/ascii/samurai.dat -------------------------------------------------------------------------------- /sample/data/ascii/tiger.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/ascii/tiger.dat -------------------------------------------------------------------------------- /sample/data/ascii/unicorn_man.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/ascii/unicorn_man.dat -------------------------------------------------------------------------------- /sample/data/ascii/vampire.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/ascii/vampire.dat -------------------------------------------------------------------------------- /sample/data/ascii/wolf_howling.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/ascii/wolf_howling.dat -------------------------------------------------------------------------------- /sample/data/cfg/sample.cfg: -------------------------------------------------------------------------------- 1 | item_type "blade" { // structure's type : 'item_type'. structure's name : 'blade' 2 | cost=300 // an integer property 3 | weight=3.5 // a float property 4 | deal_damage=true // a boolean property 5 | damages="3d6+2" // a dice property 6 | damaged_color="128,96,96" // another color property, using rrr,ggg,bbb syntax 7 | damage_type="slash" // a string property 8 | states="starving" // a string list property 9 | abstract // a flag (simplified boolean property) 10 | advances=[1.0, 2.1, 3.2] // float list 11 | features=["strong", "extra-power", "vorpal"] // string list 12 | } 13 | 14 | video { 15 | mode="800x600" 16 | fullscreen=false 17 | } 18 | input { 19 | mouse { 20 | sensibility=0.5 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /sample/data/fonts/README.txt: -------------------------------------------------------------------------------- 1 | This directory contains antialiased fonts for libtcod. 2 | These fonts are in public domain. 3 | 4 | The file names are composed with : 5 | __.png 6 | : aa 32 bits png with alpha channel 7 | gs 24 bits or greyscale PNG 8 | : as standard ASCII layout 9 | ro standard ASCII layout in row 10 | tc TCOD layout 11 | 12 | The terminal8x8 font is provided is every possible format as en example. 13 | You can try them with the provided samples : 14 | 15 | ./samples_c -font fonts/terminal8x8_aa_as.png -font-nb-char 16 16 16 | ./samples_c -font fonts/terminal8x8_aa_ro.png -font-nb-char 16 16 -font-in-row 17 | ./samples_c -font fonts/terminal8x8_aa_tc.png -font-nb-char 32 8 -font-tcod 18 | ./samples_c -font fonts/terminal8x8_gs_as.png -font-nb-char 16 16 -font-greyscale 19 | ./samples_c -font fonts/terminal8x8_gs_ro.png -font-nb-char 16 16 -font-greyscale -font-in-row 20 | ./samples_c -font fonts/terminal8x8_gs_tc.png -font-nb-char 32 8 -font-greyscale -font-tcod 21 | 22 | The libtcod 1.3.2 (non antialiased) terminal font is still there and still works : 23 | ./samples_c -font terminal.png -font-nb-char 16 16 24 | 25 | All other fonts are provided only in gs_tc format (greyscale, TCOD layout). 26 | To try them : 27 | 28 | Terminal fonts with different size (you can use them as template to create new fonts) : 29 | ./samples_c -font fonts/terminal7x7_gs_tc.png -font-nb-char 32 8 -font-greyscale -font-tcod 30 | ./samples_c -font fonts/terminal10x10_gs_tc.png -font-nb-char 32 8 -font-greyscale -font-tcod 31 | 32 | Custom fonts : 33 | ./samples_c -font fonts/caeldera8x8_gs_tc.png -font-nb-char 32 8 -font-greyscale -font-tcod 34 | ./samples_c -font fonts/lucida8x8_gs_tc.png -font-nb-char 32 8 -font-greyscale -font-tcod 35 | ./samples_c -font fonts/celtic_garamond_10x10_gs_tc.png -font-nb-char 32 8 -font-greyscale -font-tcod 36 | ./samples_c -font fonts/dundalk12x12_gs_tc.png -font-nb-char 32 8 -font-greyscale -font-tcod 37 | -------------------------------------------------------------------------------- /sample/data/fonts/arial10x10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/arial10x10.png -------------------------------------------------------------------------------- /sample/data/fonts/arial12x12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/arial12x12.png -------------------------------------------------------------------------------- /sample/data/fonts/arial8x8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/arial8x8.png -------------------------------------------------------------------------------- /sample/data/fonts/ascii.py: -------------------------------------------------------------------------------- 1 | from sys import stdout 2 | 3 | for i in range(16): 4 | for j in range(16): 5 | n = i*16+j 6 | if 32 <= n < 128: 7 | c = chr(n) 8 | else: 9 | c = '.' 10 | stdout.write(c) 11 | stdout.write('\n') 12 | -------------------------------------------------------------------------------- /sample/data/fonts/ascii.txt: -------------------------------------------------------------------------------- 1 | ................ 2 | ................ 3 | !"#$%&'()*+,-./ 4 | 0123456789:;<=>? 5 | @ABCDEFGHIJKLMNO 6 | PQRSTUVWXYZ[\]^_ 7 | `abcdefghijklmno 8 | pqrstuvwxyz{|}~. 9 | ................ 10 | ................ 11 | ................ 12 | ................ 13 | ................ 14 | ................ 15 | ................ 16 | ................ 17 | -------------------------------------------------------------------------------- /sample/data/fonts/caeldera8x8_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/caeldera8x8_gs_tc.png -------------------------------------------------------------------------------- /sample/data/fonts/celtic_garamond_10x10_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/celtic_garamond_10x10_gs_tc.png -------------------------------------------------------------------------------- /sample/data/fonts/consolas10x10_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/consolas10x10_gs_tc.png -------------------------------------------------------------------------------- /sample/data/fonts/consolas12x12_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/consolas12x12_gs_tc.png -------------------------------------------------------------------------------- /sample/data/fonts/consolas8x8_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/consolas8x8_gs_tc.png -------------------------------------------------------------------------------- /sample/data/fonts/consolas_unicode_10x10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/consolas_unicode_10x10.png -------------------------------------------------------------------------------- /sample/data/fonts/consolas_unicode_12x12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/consolas_unicode_12x12.png -------------------------------------------------------------------------------- /sample/data/fonts/consolas_unicode_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/consolas_unicode_16x16.png -------------------------------------------------------------------------------- /sample/data/fonts/consolas_unicode_8x8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/consolas_unicode_8x8.png -------------------------------------------------------------------------------- /sample/data/fonts/courier10x10_aa_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/courier10x10_aa_tc.png -------------------------------------------------------------------------------- /sample/data/fonts/courier12x12_aa_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/courier12x12_aa_tc.png -------------------------------------------------------------------------------- /sample/data/fonts/courier8x8_aa_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/courier8x8_aa_tc.png -------------------------------------------------------------------------------- /sample/data/fonts/dejavu10x10_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/dejavu10x10_gs_tc.png -------------------------------------------------------------------------------- /sample/data/fonts/dejavu12x12_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/dejavu12x12_gs_tc.png -------------------------------------------------------------------------------- /sample/data/fonts/dejavu8x8_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/dejavu8x8_gs_tc.png -------------------------------------------------------------------------------- /sample/data/fonts/dundalk12x12_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/dundalk12x12_gs_tc.png -------------------------------------------------------------------------------- /sample/data/fonts/lucida10x10_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/lucida10x10_gs_tc.png -------------------------------------------------------------------------------- /sample/data/fonts/lucida12x12_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/lucida12x12_gs_tc.png -------------------------------------------------------------------------------- /sample/data/fonts/lucida8x8_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/lucida8x8_gs_tc.png -------------------------------------------------------------------------------- /sample/data/fonts/prestige10x10_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/prestige10x10_gs_tc.png -------------------------------------------------------------------------------- /sample/data/fonts/prestige12x12_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/prestige12x12_gs_tc.png -------------------------------------------------------------------------------- /sample/data/fonts/prestige8x8_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/prestige8x8_gs_tc.png -------------------------------------------------------------------------------- /sample/data/fonts/terminal10x10_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/terminal10x10_gs_tc.png -------------------------------------------------------------------------------- /sample/data/fonts/terminal10x18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/terminal10x18.png -------------------------------------------------------------------------------- /sample/data/fonts/terminal7x7_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/terminal7x7_gs_tc.png -------------------------------------------------------------------------------- /sample/data/fonts/terminal8x15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/terminal8x15.png -------------------------------------------------------------------------------- /sample/data/fonts/terminal8x8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/terminal8x8.png -------------------------------------------------------------------------------- /sample/data/fonts/terminal8x8_aa_as.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/terminal8x8_aa_as.png -------------------------------------------------------------------------------- /sample/data/fonts/terminal8x8_aa_ro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/terminal8x8_aa_ro.png -------------------------------------------------------------------------------- /sample/data/fonts/terminal8x8_aa_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/terminal8x8_aa_tc.png -------------------------------------------------------------------------------- /sample/data/fonts/terminal8x8_gs_as.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/terminal8x8_gs_as.png -------------------------------------------------------------------------------- /sample/data/fonts/terminal8x8_gs_ro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/terminal8x8_gs_ro.png -------------------------------------------------------------------------------- /sample/data/fonts/terminal8x8_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/fonts/terminal8x8_gs_tc.png -------------------------------------------------------------------------------- /sample/data/img/circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/img/circle.png -------------------------------------------------------------------------------- /sample/data/img/skull.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/data/img/skull.png -------------------------------------------------------------------------------- /sample/data/namegen/README.txt: -------------------------------------------------------------------------------- 1 | /* 2 | * Collections of syllables and other data used for name generation. 3 | * 4 | * All the strings must be enclosed between quotation marks, with no semicolon 5 | * at the end. 6 | * 7 | * SYLLABLE SETS: 8 | * Please use only latin characters, apostrophes and dashes for syllables. All 9 | * other characters will be treated as separators between syllables, eg. "ish" 10 | * and "is'h" are syllables, but "|sh" and "ish!" aren't (the erroneous 11 | * syllables will be read as "sh" and "ish", respectively). If you wish to use 12 | * a special character, please write it after a slash, eg. a semicolon will need 13 | * to be written as "/;" in order to be correctly parsed. Beware: a slash at the 14 | * end of a string will not trigger an error whatsoever, but the final syllable 15 | * will not be added to the list at all. Spaces are a special case: they can be 16 | * triggered either with the above method, or with a single underscore: "\ " and 17 | * "_" are both valid and will produce a space. 18 | * 19 | * PHONEME SETS: 20 | * Phoneme sets should be single characters or digraphs. Please use lowercase 21 | * characters only. "ch" and "tz" are valid consonants, but "Ch" or "trz" are 22 | * not. They will be rejected upon generating phoneme lists. 23 | * 24 | * RULES: 25 | * These denote how a word is generated. A rule is a string consisting of 26 | * normal characters [a-z,A-Z,',-], special characters preceded by a slash (see 27 | * the notes concerning syllables), underscores to denote spaces and wildcards. 28 | * Wildcards are preceded by a dollar sign. Here's the full list: 29 | * "$P" - a random Pre syllable 30 | * "$s" - a random Start syllable 31 | * "$m" - a random Middle syllable 32 | * "$e" - a random End syllable 33 | * "$p" - a random Post syllable 34 | * "$v" - a random vocal 35 | * "$c" - a random consonant 36 | * "$?" - a random phoneme 37 | * So, if we hav the following data: 38 | * syllablesStart = "Ivan" 39 | * syllablesEnd = "Terrible" 40 | * rules = "$s_the_$e" 41 | * the generator will output "Ivan the Terrible". 42 | * The wildcards may also include an integer number. This number marks the per 43 | * cent chance of actually appearing the related wildcard has. The number is 44 | * placed after the asterisk, but before the corresponding character. For 45 | * instance, "*50m" means "50% chance of adding a Middle syllable". 46 | * If multiple rules are specified, they should be separated by characters that 47 | * are not special character or wildcard indicators. A comma is a legible 48 | * separator. 49 | * A rule may be preceded by a special wildcard consisting of a per cent sign 50 | * "%" and an integer number. This means the per cent chance of picking this 51 | * rule should the RNG encounter it. For instance, if two rules are specified, 52 | * each will have 50% chance of being chosen. However, if one of them is 53 | * preceded by the "%50" sign, it will actually have a 100/2*50% = 25% chance of 54 | * being selected (100/2 is the initial chance any single rule from a set of two 55 | * will be picked, for five rules this would be 100/5, etc.). 56 | * The rules are a mandatory field. Also, any field thai it references are to be 57 | * included as well, lest it produce errors or, in the best of cases, generate 58 | * an empty syllable as output. 59 | * 60 | * Don't get paranoid about controlling whether the syllables are repeated. The 61 | * program will ignore repeated entries anyway. This applies to phonemes too. 62 | * 63 | * Please make sure you have enough syllables specified to ensure variety in the 64 | * generated names. A string with 512 characters should be sufficient in most 65 | * cases. Anything below that is a risk of making the names predictable. 66 | * 67 | * I hope this little tool is both fun and useful for you. Take care! 68 | * 69 | * -Mingos 70 | */ 71 | -------------------------------------------------------------------------------- /sample/data/namegen/jice_celtic.cfg: -------------------------------------------------------------------------------- 1 | //Celtic names from Jice's "The Cave" 2 | name "Celtic male" { 3 | syllablesStart = "Aen, Agno, All, Ba, Beo, Brig, Ci, Cre, Dan, Del, Ela, Eo, En, Er, Et, In, Io, Morr, Nem, Nu, Og, Or, Ta" 4 | syllablesMiddle = "a, ar, ba, bo, ch, d, ig" 5 | syllablesEnd = "aid, ain, an, and, th, ed, eth, gus, lam, lor, man, od, t, thach" 6 | rules = "$s$m$e, $s$e" 7 | } 8 | 9 | name "Celtic female" { 10 | syllablesStart = "Aen, Agno, All, Ba, Beo, Brig, Ci, Cre, Dan, Del, Ela, Eo, En, Er, Et, In, Io, Morr, Nem, Nu, Og, Or, Ta" 11 | syllablesMiddle = "a, ar, ba, bo, ch, d, ig" 12 | syllablesEnd = "ai, an, da, id, iu, ma, me, na, ne, tha" 13 | rules = "$s$m$e, $s$e" 14 | } 15 | 16 | -------------------------------------------------------------------------------- /sample/data/namegen/jice_fantasy.cfg: -------------------------------------------------------------------------------- 1 | //Fantasy names from Jice's "The Cave" 2 | name "Fantasy male" { 3 | syllablesStart = "Aer, An, Ar, Ban, Bar, Ber, Beth, Bett, Cut, Dan, Dar, Dell, Der, Edr, Er, Eth, Ett, Fin, Ian, Iarr, Ill, Jed, Kan, Kar, Ker, Kurr, Kyr, Man, Mar, Mer, Mir, Tsal, Tser, Tsir, Van, Var, Yur, Yyr" 4 | syllablesMiddle = "al, an, ar, el, en, ess, ian, onn, or" 5 | syllablesEnd = "ai, an, ar, ath, en, eo, ian, is, u, or" 6 | illegal = "orar, arrar" 7 | rules = "$s$m$e, $s$e" 8 | } 9 | 10 | name "Fantasy female" { 11 | syllablesStart = "Aer, An, Ar, Ban, Bar, Ber, Beth, Bett, Cut, Dan, Dar, Dell, Der, Edr, Er, Eth, Ett, Fin, Ian, Iarr, Ill, Jed, Kan, Kar, Ker, Kurr, Kyr, Man, Mar, Mer, Mir, Tsal, Tser, Tsir, Van, Var, Yur, Yyr" 12 | syllablesMiddle = "al, an, ar, el, en, ess, ian, onn, or" 13 | syllablesEnd = "a, ae, aelle, ai, ea, i, ia, u, wen, wyn" 14 | illegal = "arrar" 15 | rules = "$s$m$e, $s$e" 16 | } 17 | 18 | -------------------------------------------------------------------------------- /sample/data/namegen/jice_mesopotamian.cfg: -------------------------------------------------------------------------------- 1 | //Mesopotamian names from Jice's "The Cave" 2 | name "Mesopotamian male" { 3 | syllablesStart = "A, Ann, Ash, E', En, Er, Gil, In, Ir, Ish, Mar, Ni, Nin, Re, Ti, Ur" 4 | syllablesMiddle = "am, an, du, esh, gam, gir, ka, ki, li, un, ur, ta" 5 | syllablesEnd = "aki, al, ar, at, du, eph, esh, il, im, ki, nu, uk, ur, uz" 6 | illegal = "aa, e'e" 7 | rules = "$s$m$e, $s$e" 8 | } 9 | 10 | name "Mesopotamian female" { 11 | syllablesStart = "A, Ann, Ash, E', En, Er, Gil, In, Ir, Ish, Mar, Ni, Nin, Re, Ti, Ur" 12 | syllablesMiddle = "am, an, du, esh, gam, gir, ka, ki, li, un, ur, ta" 13 | syllablesEnd = "ag, il, la, na, sag, su, ta" 14 | illegal = "aa, e'e" 15 | rules = "$s$m$e, $s$e" 16 | } 17 | 18 | -------------------------------------------------------------------------------- /sample/data/namegen/jice_norse.cfg: -------------------------------------------------------------------------------- 1 | //Norse names from Jice's "The Cave" 2 | name "Norse male" { 3 | syllablesStart = "Al, Ae, As, Bi, Fen, Ha, Hag, Ho, Hu, Iv, Jot, Ma, Mio, Mu, Nid, Ors, Ra, Sta, Svar, Tys, Vae, Van, Vol, Y, Ygg" 4 | syllablesMiddle = "an, ar, ba, da, dra, gar, na, tal" 5 | syllablesEnd = "ad, ald, agr, ar, ard, eyr, far, frost, heim, hogg, in, mir, nar, nir, or, osk, rir, sil, sir, ttir, urd" 6 | illegal = "yor, yar, yad, yin" 7 | rules = "$s$m$e, $s$e" 8 | } 9 | 10 | name "Norse female" { 11 | syllablesStart = "Al, Ae, As, Bi, Fen, Ha, Hag, Ho, Hu, Iv, Jot, Ma, Mio, Mu, Nid, Ors, Ra, Sta, Svar, Tys, Vae, Van, Vol, Y, Ygg" 12 | syllablesMiddle = "an, ar, ba, da, dra, gar, na, tal" 13 | syllablesEnd = "a, la, li, va" 14 | illegal = "raa, ya, aea, aea" 15 | rules = "$s$m$e, $s$e" 16 | } 17 | 18 | -------------------------------------------------------------------------------- /sample/data/namegen/jice_region.cfg: -------------------------------------------------------------------------------- 1 | //Region names from Jice's "The Cave" 2 | name "region" { 3 | syllablesStart = "Act, Afr, Ag, Agr, Alb, Am, An, Angl, Ant, As, Asys, Asis, At, Atl, Brund, Cath, Cor, Dan, Eb, Eg, Er, Esc, Esp, Est, Eth, Eur, Flor, It, Lyr, Mal, Mir, Myr, Nor, Pel, Rom, Seg, Sib, Sylv, Terr, Tir, Tr, Tyr, Xan" 4 | syllablesMiddle = "ad, ag, al, an, and, ant, anth, ar, ard, as, at, atr, eg, en, ent, ern, et, ian, in, itr, on, op, ov, ur, ymn, yr" 5 | syllablesEnd = "a, aia, ana, as, ea, ene, eos, esia, ia, iad, ias, is, ium, ius, on, ona, or, ova, um, us, ya" 6 | rules = "$s$m$e, $s$e" 7 | } 8 | -------------------------------------------------------------------------------- /sample/data/namegen/jice_town.cfg: -------------------------------------------------------------------------------- 1 | //Town names from Jice's "The Cave" 2 | name "town" { 3 | syllablesStart = "Ael, Ash, Barrow, Bel, Black, Clear, Cold, Crystal, Deep, Edge, Falcon, Fair, Fall, Glass, Gold, Ice, Iron, Mill, Moon, Mor, Ray, Red, Rock, Rose, Shadow, Silver, Spell, Spring, Stone, Strong, Summer, Swyn, Wester, Winter" 4 | syllablesEnd = "ash, burn, barrow, bridge, castle, cliff, coast, crest, dale, dell, dor, fall, field, ford, fort, gate, haven, hill, hold, hollow, iron, lake, marsh, mill, mist, mount, moor, pond, shade, shore, summer, town, wick" 5 | rules = "$s$e" 6 | } 7 | -------------------------------------------------------------------------------- /sample/data/namegen/mingos_demon.cfg: -------------------------------------------------------------------------------- 1 | //Demon names 2 | name "demon male" { 3 | phonemesVocals = "a, e, i, o, u" 4 | syllablesStart = "Aam, Ab, Ad, Ahr, Alas, Al-A'w, All, Al-M, Ap, As, Ast, Az, Bal, Bal S, Bag, Balb, Ban, Bansh, Baph, Barb, Bath, Bazt, Be'L, Beel, Beelz, Bel, Belph, Ber, Bh, Bifr, Biul, Bush, Caac, Cagn, Caim, Chalk, Char, Chem, Coal, Dag, Dant, Decer, Demog, Dev, Dj, Dragh, Elig, Emp, Errt, Etr, Ett, Eur, Euryn, Gorg, Graph, Grig, Haag, Halph, Haur, Hoeth, Ifr, Inc, Ibl, Ith, Kabh, Kas, Kokb', Kray, Lab, Lam, Lech, Leg, Lil, Lioth, Lix, Luc, Mal, Malph, Mamm, March, Mast, Math, Meph, Merm, Mol, Murm, Naam, Naph, Nek, Neph, Neq, Nix, Noud, Onom, Onos, Orc, Orob, Oul, Paim, Phen, Pont, Proc, Rah, Rak, Raksh, Ram, Rang, Raum, Raz, Rimm, Rub, Rus, Sabn, Salps, Sam, Sat, Sc, Scarm, Seer, Sem, Set, Shait, Shax, Shed, Shez, Sidr, Sitr, Sth, Succ, Surg, Tann, Tart, Tch, Teer, Thamm, Thub, Tlal, Tsab, Val, Vap, Vass, Vep, Verr, Vin, Vol, Vual, Xaph, Xiph, Xitr, Zaeb, Zim, Ziz, Zaln" 5 | syllablesMiddle = "b'ae, ba, be, chi, dra, du, ga, ghi, go, lia, ma, mba, mu, n'e, na, nti, nzu, phe, pho, r'e, rba, rgo, ssa, thi, tryu, ttu, tzi, v-e, vna, xra, ya" 6 | syllablesEnd = "b'ael, bel, bub, bur, bus, ces, chus, dai, ddon, des, dhaka, el, fer, flas, gion, gon, gor, klet, kor, ksha, kuth, laas, lech, les, lion, lith, loch, lsu, mael, math, mejes, meus, mon, moth, mmut, mosh, nai, nar, neus, nex, nias, nnin, nomos, phas, r'el, raal, rept, res, rgon, riax, rith, rius, rous, rus, ruth, sias, stor, swath, tath, than, the, thra, tryus, tura, vart, ztuk" 7 | rules = "$s$v$35m$10m$e" 8 | } 9 | 10 | name "demon female" { 11 | phonemesVocals = "a, e, i, o, u" 12 | syllablesStart = "Aam, Ab, Ad, Ahr, Alas, Al-A'w, All, Al-M, Ap, As, Ast, Az, Bal, Bal S, Bag, Balb, Ban, Bansh, Baph, Barb, Bath, Bazt, Be'L, Beel, Beelz, Bel, Belph, Ber, Bh, Bifr, Biul, Bush, Caac, Cagn, Caim, Chalk, Char, Chem, Coal, Dag, Dant, Decer, Demog, Dev, Dj, Dragh, Elig, Emp, Errt, Etr, Ett, Eur, Euryn, Gorg, Graph, Grig, Haag, Halph, Haur, Hoeth, Ifr, Inc, Ibl, Ith, Kabh, Kas, Kokb', Kray, Lab, Lam, Lech, Leg, Lil, Lioth, Lix, Luc, Mal, Malph, Mamm, March, Mast, Math, Meph, Merm, Mol, Murm, Naam, Naph, Nek, Neph, Neq, Nix, Noud, Onom, Onos, Orc, Orob, Oul, Paim, Phen, Pont, Proc, Rah, Rak, Raksh, Ram, Rang, Raum, Raz, Rimm, Rub, Rus, Sabn, Salps, Sam, Sat, Sc, Scarm, Seer, Sem, Set, Shait, Shax, Shed, Shez, Sidr, Sitr, Sth, Succ, Surg, Tann, Tart, Tch, Teer, Thamm, Thub, Tlal, Tsab, Val, Vap, Vass, Vep, Verr, Vin, Vol, Vual, Xaph, Xiph, Xitr, Zaeb, Zim, Ziz, Zaln" 13 | syllablesMiddle = "b'ae, ba, be, chi, dra, du, ga, ghi, go, lia, ma, mba, mu, n'e, na, nti, nzu, phe, pho, r'e, rba, rgo, ssa, thi, tryu, ttu, tzi, v-e, vna, xra, ya" 14 | syllablesEnd = "b'a, bel, bua, bure, buth, cess, chia, dai, ddea, dea, dhaka, el, fea, fla, gia, goa, gora, klath, kore, ksha, kua, laal, lexa, less, lia, lith, loth, lsa, mara, math, maja, mea, moa, moth, mmuth, mosh, na, nai, neuth, nex, nia, nnine, nomoa, pha, r'el, raala, repte, reshe, rgona, riaxe, rith, rish, rothe, rushe, ruth, sia, stora, swath, tath, thann, the, thra, trya, tura, varte, ztura" 15 | rules = "$s$v$35m$10m$e" 16 | } 17 | -------------------------------------------------------------------------------- /sample/data/namegen/mingos_dwarf.cfg: -------------------------------------------------------------------------------- 1 | //dwarf names 2 | name "dwarf male" { 3 | syllablesStart = "A, An, Ba, Bi, Bo, Bom, Da, Dar, De, Do, Du, Due, Duer, Dwa, Fa, Fal, Fi, Fre, Fun, Ga, Gar, Gim, Glo, Go, Gom, Gro, Gwar, Ib, Jor, Ka, Ki, Kil, Lo, Mar, Na, Nal, O, Ras, Ren, Ro, Ta, Tar, Tel, Thi, Tho, Thon, Thra, Tor, Von, We, Wer, Yen, Yur" 4 | syllablesEnd = "bil, bin, bur, char, den, dir, dur, fri, fur, in, li, lin, mil, mur, ni, nur, ran, ri, ril, rimm, rin, thur, tri, ulf, un, ur, vi, vil, vim, vin, vri" 5 | rules = "$s$e" 6 | illegal = "rur, ueu" 7 | } 8 | 9 | name "dwarf female" { 10 | syllablesStart = "A, An, Ba, Bi, Bo, Bom, Da, Dar, De, Do, Du, Due, Duer, Dwa, Fa, Fal, Fi, Fre, Fun, Ga, Gar, Gim, Glo, Go, Gom, Gro, Gwar, Ib, Jor, Ka, Ki, Kil, Lo, Mar, Na, Nal, O, Ras, Ren, Ro, Ta, Tar, Tel, Thi, Tho, Thon, Thra, Tor, Von, We, Wer, Yen, Yur" 11 | syllablesEnd = "al, ali, ba, bida, bra, da, deth, di, fra, gret, hild, iess, kala, la, laani, li, lona, ma, mae, mala, na, nuda, ra, ta, tala, tu, tuna, vada, vara, ya" 12 | rules = "$s$e" 13 | illegal = "dueal, frefra, grogret" 14 | } 15 | 16 | //surnames have semantic information. Here, they're separated into three 17 | //somewhat coherent sets and either is chosen 18 | name "dwarf surname" { 19 | //1st set - smith & Mr.Muscle surnames 20 | syllablesPre = "Boulder, Bronze, Coal, Copper, Gem, Granite, Hammer, Iron, Marble, Metal, Rock, Steel, Stone, Thunder" 21 | syllablesPost = "bender, breaker, carver, club, crusher, cutter, digger, fist, foot, forger, heart, smasher, smith" 22 | //2nd set - warrior surnames 23 | syllablesStart = "Bear, Boar, Dragon, Giant, Goblin, Elf, Ettin, Foe, Kobold, Ogre, Orc,Spider, Troll, Wolf" 24 | syllablesEnd = "bane, basher, _Battler, _Beheader, boxer, _Butcher, choker, cleaver, crusher, cutter, doom, eater, _Executioner, _Fighter, _Garrotter, grapple, _Gutter, hammer, killer, mauler, masher, ripper, slasher, slayer, slicer, smasher, _Strangler, striker, _Wrestler" 25 | //3rd set - heroic and general 26 | phonemesVocals = "Black, Blood, Bronze, Fire, Firm, Grey, Hard, Ice, Iron, Moon, Oak, Onyx, Red, Steel, Stone, Strong, Thunder, White" 27 | phonemesConsonants = "axe, beard, blade, brand, cheek, fist, foot, hair, hammer, hand, head, heart, pick, shield, spear, spike, sword" 28 | rules = "$P$p, $s$e, $v$c" 29 | } -------------------------------------------------------------------------------- /sample/data/namegen/mingos_norse.cfg: -------------------------------------------------------------------------------- 1 | //Norse names. Most of them are syllables extracted from names that 2 | //actually appear in Norse written texts. Norse names consist of two parts, 3 | //which is easy to reflect in a generator such as this one. 4 | name "Mingos Norse male" { 5 | //these are ready-made names 6 | syllablesPre = "Aunn, Bjoern, Bjolfr, Bjorr, Boltr, Byulfr, Erik, Erpr, Eykr, Feitr, Fotr, Froekn, Gaukr, Gauss, Gils, Gimp, Griss, Gyi, Haegwin, Haengr, Hakon, Hand, Harekr, Hattr, Haukr, Helf, Hjalli, Hjaerne, Hjarrandi, Hnaki, Hneitr, Hrafn, Jarl, Karl, Kar-Toki, Kaun, Kilfisr, Kiuli, Knut, Knutr, Krakr, Leifr, Lokki, Manni, Mar, Moegr, Naemr, Nagli, Nef-Bjoern, Njall, Oelfun, Oenn, Oern, Rafn, Roki, Skjalf, Skog, Spjall, Sveinn, Tannr, Trani, Trjonn, Utryggr, Vagn, Varg, Ve-Finnr, Voettr, Vragi, Vrai" 7 | //and these are syllables to stick together 8 | syllablesStart = "Ab, Adal, Adi, Alf, An, And, Ans, Arn, Arm, Ask, Au, Audh, Ba, Bae, Bag, Bal, Bar, Bas, Bein, Berg, Bern, Bjad, Bjarn, Bjart, Boan, Boed, Boerk, Bogg, Bor, Bot, Bram, Bran, Bratt, Brei, Bro, Brunn, Bukk, Dag, Djur, Dor, Duf, Dun, Ed, Ei, Ein, Ekk, Ey, Fa, Fad, Fal, Far, Fast, Fen, Finn, Fjall, Fjoel, Flae, Fol, Folk, Foest, Frey, Frid, Frost, Ful, Fuld, Gaes, Geir, Gag, Gal, Gam, Gar, Gaut, Geir, Ginn, Gis, Gjaf, Gjal, God, Gnaudi, Gny, Gret, Grim, Grom, Grum, Gud, Gull, Gunn, Gutt, Gyll, Gyr, Ha, Haf, Hag, Hagn, Half, Hall, Ham, Har, Haur, Hedin, Hef, Heg, Heil, Hein, Hel, Hildi, Hjall, Hjalm, Hjoer, Hlif, Hloed, Hoeg, Hoegg, Hoer, Hoes, Hol, Holm, Hord, Horn, Hrad, Hrafn, Hring, Hroeng, Hross, Hug, Hul, Hum, Hus, Hvit, Hyr, Igul, Illu, In, Ingi, Is, Ja, Jar, Jarn, Jat, Jo, Joefur, Kjoet, Kol, Kon, Lamb, Lids, Lik, Ljot, Lyd, Nadd, Nef, Odal, Odd, Oeg, Oel, Oen, Oeng, Oes, Rad, Rafn, Ragn, Rask, Reid, Reyr, Roegn, Rok, Run, Sae, Sig, Skae, Skjald, Skjoeld, Skol, Slag, Snae, Soel, Soend, Spjall, Stafn, Stark, Stein, Stig, Stod, Stygg, Styr, Sunn, Svein, Svart, Svarta, Tid, Tindr, Tjoer, Trygg, Tyr, Thyr, Ud, Ulf, Yngv, Vae, Val, Varg, Ve, Ved, Vest, Vetr, Vid, Vig, Vik" 9 | syllablesEnd = "adr, afr, all, andi, arfr, arr, astr, autr, bi, beinn, bert, bjoern, bodi, bodr, bori, brandr, burinn, burt, daenni, dan, di, din, diarfr, dinn, dr, dridr, dur, eifr, eirr, fast, fasti, fastr, fidr, fill, fing, fingr, finnr, fli, fri, frimr, fuss, gall, geir, geirr, gils, gir, gisl, glir, glumr, grimr, gripr, gur, guri, haldr, hegn, hjalmr, hjoefr, hjofr, hoefdi, hoess, hofdi, horir, horr, hoess, hvatr, ilir, ill, ingr, inn, jadr, jarn, jarr, jartan, jartr, joern, jofr, karl, kell, ketill, kirr, kuldr, kull, kundr, kunnr, laugr, lan, leifr, leikr, li, lidi, lidr, lingr, madr, maer, mann, marr, mingr, modr, mr, mund, mundr, nall, narr, nefr, nir, niutr, olfr, ormr, phorr, pli, r, raeifr, radr, rik, rikr, ring, rinn, rir, roedr, rudr, rukr, si, sir, skegg, skeggi, sjall, steinn, styrr, sur, tir, tyr, utr, ulf, ulfr, undr, ungr, urd, urdr, valdr, vandi, vandill, veinr, ver, vett, vi, vidr, vifr, vind, vindr, vi, vini, vir, visl" 10 | rules = "$s$e, %10$P" 11 | illegal = "bjarnbj, gp, vv, aea, aee, aeo, drd" 12 | } 13 | 14 | name "Mingos Norse female" { 15 | syllablesStart = "A, Aer, Aerin, Aes, Aet, Afri, Agaer, Ager, Al, Alf, Alm, Arinn, Arn, As, Au, Aud, Bau, Be, Beg, Berg, Bir, Bjol, Bod, Bol, Bor, Borg, Bot, Bri, Brun, Bryn, Bus, Dag, Dis, Dom, Dor, Dot, Dri, Dyr, Ed, Ei, Em, Emb, Engil, Er, Es, Ev, Ey, Fal, Fast, Fin, Fjol, Fjor, Fjot, Folk, Frey, Frid, Frost, Gaut, Geir, Ger, Gil, Ginn, Gis, Gjaf, Gre, Grim, Gud, Gy, Gyd, Haf, Hall, Haur, Hedin, Heil, Heim, Hel, Her, Hidin, Hil, Hildi, Hjalm, Hjor, Hlad, Hlif, Holm, Hrim, Hrod, Hun, Igul, In, Ingi, Ingil, Is, Jar, Jo, Jofur, Jor, Jut, Ljuf, Lofn, Mal, Malm, Mar, Mat, Matt, Mund, Nid, Odd, Ol, Olm, Ot, Rad, Ragn, Rand, Rann, Regin, Run, Sal, Sae, Sig, Skjald, Sol, Stein, Svan, Svein, Tid, Ulf, Vet, Val, Ve, Vig, Vil, Yng" 16 | syllablesEnd = "bjorg, borg, da, dis, disa, disla, dora, eida, erna, fasta, finna, frida, frosta, fura, ga, gard, gauta, geid, gerda, gida, gret, grid, grima, gudr, gunn, gunna, heidr, hilda, ja, la, laug, lina, linn, ma, maer, rida, run, ta, trid, trida, truda, unn, ve, velda, vi, vilda, vina" 17 | illegal = "ii, iei, edeid, tg, ee, vev" 18 | rules = "$s$e" 19 | } 20 | -------------------------------------------------------------------------------- /sample/data/namegen/mingos_standard.cfg: -------------------------------------------------------------------------------- 1 | //Names based on syllables from J.R.R. Tolkien's and David Eddings' novels. 2 | name "male" { 3 | phonemesVocals = "a, e, i, o, u, y" 4 | phonemesConsonants = "b, c, ch, ck, cz, d, dh, f, g, gh, h, j, k, kh, l, m, n, p, ph, q, r, rh, s, sh, t, th, ts, tz, v, w, x, z, zh" 5 | syllablesStart = "Aer, Al, Am, An, Ar, Arm, Arth, B, Bal, Bar, Be, Bel, Ber, Bok, Bor, Bran, Breg, Bren, Brod, Cam, Chal, Cham, Ch, Cuth, Dag, Daim, Dair, Del, Dr, Dur, Duv, Ear, Elen, Er, Erel, Erem, Fal, Ful, Gal, G, Get, Gil, Gor, Grin, Gun, H, Hal, Han, Har, Hath, Hett, Hur, Iss, Khel, K, Kor, Lel, Lor, M, Mal, Man, Mard, N, Ol, Radh, Rag, Relg, Rh, Run, Sam, Tarr, T, Tor, Tul, Tur, Ul, Ulf, Unr, Ur, Urth, Yar, Z, Zan, Zer" 6 | syllablesMiddle = "de, do, dra, du, duna, ga, go, hara, kaltho, la, latha, le, ma, nari, ra, re, rego, ro, rodda, romi, rui, sa, to, ya, zila" 7 | syllablesEnd = "bar, bers, blek, chak, chik, dan, dar, das, dig, dil, din, dir, dor, dur, fang, fast, gar, gas, gen, gorn, grim, gund, had, hek, hell, hir, hor, kan, kath, khad, kor, lach, lar, ldil, ldir, leg, len, lin, mas, mnir, ndil, ndur, neg, nik, ntir, rab, rach, rain, rak, ran, rand, rath, rek, rig, rim, rin, rion, sin, sta, stir, sus, tar, thad, thel, tir, von, vor, yon, zor" 8 | rules = "$s$v$35m$10m$e" 9 | } 10 | 11 | name "female" { 12 | phonemesVocals = "a, e, i, o, u, y" 13 | syllablesStart = "Ad, Aer, Ar, Bel, Bet, Beth, Ce'N, Cyr, Eilin, El, Em, Emel, G, Gl, Glor, Is, Isl, Iv, Lay, Lis, May, Ner, Pol, Por, Sal, Sil, Vel, Vor, X, Xan, Xer, Yv, Zub" 14 | syllablesMiddle = "bre, da, dhe, ga, lda, le, lra, mi, ra, ri, ria, re, se, ya" 15 | syllablesEnd = "ba, beth, da, kira, laith, lle, ma, mina, mira, na, nn, nne, nor, ra, rin, ssra, ta, th, tha, thra, tira, tta, vea, vena, we, wen, wyn" 16 | rules = "$s$v$35m$10m$e" 17 | } 18 | -------------------------------------------------------------------------------- /sample/data/namegen/mingos_town.cfg: -------------------------------------------------------------------------------- 1 | //Town names. The town name construction is based on real British town names, 2 | //although many starting syllables are made up. 3 | name "Mingos town" { 4 | syllablesPre = "East, Fort, Great, High, Lower, Middle, Mount, New, North, Old, Royal, Saint, South, Upper, West" 5 | syllablesStart = "Ales, Apple, Ash, Bald, Bay, Bed, Bell, Birdling, Black, Blue, Bow, Bran, Brass, Bright, Brown, Bruns, Bulls, Camp, Cherry, Clark, Clarks, Clay, Clear, Copper, Corn, Cross, Crystal, Dark, Deep, Deer, Drac, Eagle, Earth, Elk, Elles, Elm, Ester, Ewes, Fair, Falcon, Ferry, Fire, Fleet, Fox, Gold, Grand, Green, Grey, Guild, Hammer, Hart, Hawks, Hay, Haze, Hazel, Hemlock, Ice, Iron, Kent, Kings, Knox, Layne, Lint, Lor, Mable, Maple, Marble, Mare, Marsh, Mist, Mor, Mud, Nor, Oak, Orms, Ox, Oxen, Pear, Pine, Pitts, Port, Purple, Red, Rich, Roch, Rock, Rose, Ross, Rye, Salis, Salt, Shadow, Silver, Skeg, Smith, Snow, Sows, Spring, Spruce, Staff, Star, Steel, Still, Stock, Stone, Strong, Summer, Swan, Swine, Sword, Yellow, Val, Wart, Water, Well, Wheat, White, Wild, Winter, Wolf, Wool, Wor" 6 | syllablesEnd = "bank, borne, borough, brook, burg, burgh, bury, castle, cester, cliff, crest, croft, dale, dam, dorf, edge, field, ford, gate, grad, hall, ham, hollow, holm, hurst, keep, kirk, land, ley, lyn, mere, mill, minster, mont, moor, mouth, ness, pool, river, shire, shore, side, stead, stoke, ston, thorpe, ton, town, vale, ville, way, wich, wick, wood, worth" 7 | syllablesPost = "Annex, Barrens, Barrow, Corner, Cove, Crossing, Dell, Dales, Estates, Forest, Furnace, Grove, Haven, Heath, Hill, Junction, Landing, Meadow, Park, Plain, Point, Reserve, Retreat, Ridge, Springs, View, Village, Wells, Woods" 8 | rules = "$15P_$s$e_$15p" 9 | } 10 | -------------------------------------------------------------------------------- /sample/terminal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/afolmert/libtcod-go/d14bdea44b08aa05e5ff3a1fa414c6de1db3fadf/sample/terminal.png -------------------------------------------------------------------------------- /tcod/include/bresenham.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libtcod 1.5.1 3 | * Copyright (c) 2008,2009,2010 Jice & Mingos 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * The name of Jice or Mingos may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY JICE AND MINGOS ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL JICE OR MINGOS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef _TCOD_BRESENHAM_H 29 | #define _TCOD_BRESENHAM_H 30 | 31 | typedef bool (*TCOD_line_listener_t) (int x, int y); 32 | 33 | TCODLIB_API void TCOD_line_init(int xFrom, int yFrom, int xTo, int yTo); 34 | TCODLIB_API bool TCOD_line_step(int *xCur, int *yCur); /* advance one step. returns true if we reach destination */ 35 | /* atomic callback function. Stops when the callback returns false */ 36 | TCODLIB_API bool TCOD_line(int xFrom, int yFrom, int xTo, int yTo, TCOD_line_listener_t listener); 37 | 38 | /* thread-safe versions */ 39 | typedef struct { 40 | int stepx; 41 | int stepy; 42 | int e; 43 | int deltax; 44 | int deltay; 45 | int origx; 46 | int origy; 47 | int destx; 48 | int desty; 49 | } TCOD_bresenham_data_t; 50 | 51 | TCODLIB_API void TCOD_line_init_mt(int xFrom, int yFrom, int xTo, int yTo, TCOD_bresenham_data_t *data); 52 | TCODLIB_API bool TCOD_line_step_mt(int *xCur, int *yCur, TCOD_bresenham_data_t *data); 53 | TCODLIB_API bool TCOD_line_mt(int xFrom, int yFrom, int xTo, int yTo, TCOD_line_listener_t listener, TCOD_bresenham_data_t *data); 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /tcod/include/bsp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libtcod 1.5.1 3 | * Copyright (c) 2008,2009,2010 Jice & Mingos 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * The name of Jice or Mingos may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY JICE AND MINGOS ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL JICE OR MINGOS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef _TCOD_BSP_H 29 | #define _TCOD_BSP_H 30 | 31 | typedef struct { 32 | TCOD_tree_t tree; /* pseudo oop : bsp inherit tree */ 33 | int x,y,w,h; /* node position & size */ 34 | int position; /* position of splitting */ 35 | uint8 level; /* level in the tree */ 36 | bool horizontal; /* horizontal splitting ? */ 37 | } TCOD_bsp_t; 38 | 39 | typedef bool (*TCOD_bsp_callback_t)(TCOD_bsp_t *node, void *userData); 40 | 41 | TCODLIB_API TCOD_bsp_t *TCOD_bsp_new(); 42 | TCODLIB_API TCOD_bsp_t *TCOD_bsp_new_with_size(int x,int y,int w, int h); 43 | TCODLIB_API void TCOD_bsp_delete(TCOD_bsp_t *node); 44 | 45 | TCODLIB_API TCOD_bsp_t * TCOD_bsp_left(TCOD_bsp_t *node); 46 | TCODLIB_API TCOD_bsp_t * TCOD_bsp_right(TCOD_bsp_t *node); 47 | TCODLIB_API TCOD_bsp_t * TCOD_bsp_father(TCOD_bsp_t *node); 48 | 49 | TCODLIB_API bool TCOD_bsp_is_leaf(TCOD_bsp_t *node); 50 | TCODLIB_API bool TCOD_bsp_traverse_pre_order(TCOD_bsp_t *node, TCOD_bsp_callback_t listener, void *userData); 51 | TCODLIB_API bool TCOD_bsp_traverse_in_order(TCOD_bsp_t *node, TCOD_bsp_callback_t listener, void *userData); 52 | TCODLIB_API bool TCOD_bsp_traverse_post_order(TCOD_bsp_t *node, TCOD_bsp_callback_t listener, void *userData); 53 | TCODLIB_API bool TCOD_bsp_traverse_level_order(TCOD_bsp_t *node, TCOD_bsp_callback_t listener, void *userData); 54 | TCODLIB_API bool TCOD_bsp_traverse_inverted_level_order(TCOD_bsp_t *node, TCOD_bsp_callback_t listener, void *userData); 55 | TCODLIB_API bool TCOD_bsp_contains(TCOD_bsp_t *node, int x, int y); 56 | TCODLIB_API TCOD_bsp_t * TCOD_bsp_find_node(TCOD_bsp_t *node, int x, int y); 57 | TCODLIB_API void TCOD_bsp_resize(TCOD_bsp_t *node, int x,int y, int w, int h); 58 | TCODLIB_API void TCOD_bsp_split_once(TCOD_bsp_t *node, bool horizontal, int position); 59 | TCODLIB_API void TCOD_bsp_split_recursive(TCOD_bsp_t *node, TCOD_random_t randomizer, int nb, 60 | int minHSize, int minVSize, float maxHRatio, float maxVRatio); 61 | TCODLIB_API void TCOD_bsp_remove_sons(TCOD_bsp_t *node); 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /tcod/include/color.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libtcod 1.5.1 3 | * Copyright (c) 2008,2009,2010 Jice & Mingos 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * The name of Jice or Mingos may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY JICE AND MINGOS ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL JICE OR MINGOS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef _TCOD_COLOR_H 29 | #define _TCOD_COLOR_H 30 | 31 | typedef struct { 32 | uint8 r,g,b; 33 | } TCOD_color_t; 34 | 35 | /* constructors */ 36 | TCODLIB_API TCOD_color_t TCOD_color_RGB(uint8 r, uint8 g, uint8 b); 37 | TCODLIB_API TCOD_color_t TCOD_color_HSV(float h, float s, float v); 38 | /* basic operations */ 39 | TCODLIB_API bool TCOD_color_equals (TCOD_color_t c1, TCOD_color_t c2); 40 | TCODLIB_API TCOD_color_t TCOD_color_add (TCOD_color_t c1, TCOD_color_t c2); 41 | TCODLIB_API TCOD_color_t TCOD_color_subtract (TCOD_color_t c1, TCOD_color_t c2); 42 | TCODLIB_API TCOD_color_t TCOD_color_multiply (TCOD_color_t c1, TCOD_color_t c2); 43 | TCODLIB_API TCOD_color_t TCOD_color_multiply_scalar (TCOD_color_t c1, float value); 44 | TCODLIB_API TCOD_color_t TCOD_color_lerp (TCOD_color_t c1, TCOD_color_t c2, float coef); 45 | /* HSV transformations */ 46 | TCODLIB_API void TCOD_color_set_HSV (TCOD_color_t *c,float h, float s, float v); 47 | TCODLIB_API void TCOD_color_get_HSV (TCOD_color_t c,float * h, float * s, float * v); 48 | TCODLIB_API float TCOD_color_get_hue (TCOD_color_t c); 49 | TCODLIB_API void TCOD_color_set_hue (TCOD_color_t *c, float h); 50 | TCODLIB_API float TCOD_color_get_saturation (TCOD_color_t c); 51 | TCODLIB_API void TCOD_color_set_saturation (TCOD_color_t *c, float s); 52 | TCODLIB_API float TCOD_color_get_value (TCOD_color_t c); 53 | TCODLIB_API void TCOD_color_set_value (TCOD_color_t *c, float v); 54 | TCODLIB_API void TCOD_color_shift_hue (TCOD_color_t *c, float hshift); 55 | TCODLIB_API void TCOD_color_scale_HSV (TCOD_color_t *c, float scoef, float vcoef); 56 | /* color map */ 57 | TCODLIB_API void TCOD_color_gen_map(TCOD_color_t *map, int nb_key, TCOD_color_t const *key_color, int const *key_index); 58 | 59 | /* color names */ 60 | enum { 61 | TCOD_COLOR_RED, 62 | TCOD_COLOR_FLAME, 63 | TCOD_COLOR_ORANGE, 64 | TCOD_COLOR_AMBER, 65 | TCOD_COLOR_YELLOW, 66 | TCOD_COLOR_LIME, 67 | TCOD_COLOR_CHARTREUSE, 68 | TCOD_COLOR_GREEN, 69 | TCOD_COLOR_SEA, 70 | TCOD_COLOR_TURQUOISE, 71 | TCOD_COLOR_CYAN, 72 | TCOD_COLOR_SKY, 73 | TCOD_COLOR_AZURE, 74 | TCOD_COLOR_BLUE, 75 | TCOD_COLOR_HAN, 76 | TCOD_COLOR_VIOLET, 77 | TCOD_COLOR_PURPLE, 78 | TCOD_COLOR_FUCHSIA, 79 | TCOD_COLOR_MAGENTA, 80 | TCOD_COLOR_PINK, 81 | TCOD_COLOR_CRIMSON, 82 | TCOD_COLOR_NB 83 | }; 84 | 85 | /* color levels */ 86 | enum { 87 | TCOD_COLOR_DESATURATED, 88 | TCOD_COLOR_LIGHTEST, 89 | TCOD_COLOR_LIGHTER, 90 | TCOD_COLOR_LIGHT, 91 | TCOD_COLOR_NORMAL, 92 | TCOD_COLOR_DARK, 93 | TCOD_COLOR_DARKER, 94 | TCOD_COLOR_DARKEST, 95 | TCOD_COLOR_LEVELS 96 | }; 97 | 98 | /* color array */ 99 | extern TCODLIB_API const TCOD_color_t TCOD_colors[TCOD_COLOR_NB][TCOD_COLOR_LEVELS]; 100 | 101 | /* grey levels */ 102 | extern TCODLIB_API const TCOD_color_t TCOD_black; 103 | extern TCODLIB_API const TCOD_color_t TCOD_darkest_grey; 104 | extern TCODLIB_API const TCOD_color_t TCOD_darker_grey; 105 | extern TCODLIB_API const TCOD_color_t TCOD_dark_grey; 106 | extern TCODLIB_API const TCOD_color_t TCOD_grey; 107 | extern TCODLIB_API const TCOD_color_t TCOD_light_grey; 108 | extern TCODLIB_API const TCOD_color_t TCOD_lighter_grey; 109 | extern TCODLIB_API const TCOD_color_t TCOD_lightest_grey; 110 | extern TCODLIB_API const TCOD_color_t TCOD_darkest_gray; 111 | extern TCODLIB_API const TCOD_color_t TCOD_darker_gray; 112 | extern TCODLIB_API const TCOD_color_t TCOD_dark_gray; 113 | extern TCODLIB_API const TCOD_color_t TCOD_gray; 114 | extern TCODLIB_API const TCOD_color_t TCOD_light_gray; 115 | extern TCODLIB_API const TCOD_color_t TCOD_lighter_gray; 116 | extern TCODLIB_API const TCOD_color_t TCOD_lightest_gray; 117 | extern TCODLIB_API const TCOD_color_t TCOD_white; 118 | 119 | /* sepia */ 120 | extern TCODLIB_API const TCOD_color_t TCOD_darkest_sepia; 121 | extern TCODLIB_API const TCOD_color_t TCOD_darker_sepia; 122 | extern TCODLIB_API const TCOD_color_t TCOD_dark_sepia; 123 | extern TCODLIB_API const TCOD_color_t TCOD_sepia; 124 | extern TCODLIB_API const TCOD_color_t TCOD_light_sepia; 125 | extern TCODLIB_API const TCOD_color_t TCOD_lighter_sepia; 126 | extern TCODLIB_API const TCOD_color_t TCOD_lightest_sepia; 127 | 128 | /* standard colors */ 129 | extern TCODLIB_API const TCOD_color_t TCOD_red; 130 | extern TCODLIB_API const TCOD_color_t TCOD_flame; 131 | extern TCODLIB_API const TCOD_color_t TCOD_orange; 132 | extern TCODLIB_API const TCOD_color_t TCOD_amber; 133 | extern TCODLIB_API const TCOD_color_t TCOD_yellow; 134 | extern TCODLIB_API const TCOD_color_t TCOD_lime; 135 | extern TCODLIB_API const TCOD_color_t TCOD_chartreuse; 136 | extern TCODLIB_API const TCOD_color_t TCOD_green; 137 | extern TCODLIB_API const TCOD_color_t TCOD_sea; 138 | extern TCODLIB_API const TCOD_color_t TCOD_turquoise; 139 | extern TCODLIB_API const TCOD_color_t TCOD_cyan; 140 | extern TCODLIB_API const TCOD_color_t TCOD_sky; 141 | extern TCODLIB_API const TCOD_color_t TCOD_azure; 142 | extern TCODLIB_API const TCOD_color_t TCOD_blue; 143 | extern TCODLIB_API const TCOD_color_t TCOD_han; 144 | extern TCODLIB_API const TCOD_color_t TCOD_violet; 145 | extern TCODLIB_API const TCOD_color_t TCOD_purple; 146 | extern TCODLIB_API const TCOD_color_t TCOD_fuchsia; 147 | extern TCODLIB_API const TCOD_color_t TCOD_magenta; 148 | extern TCODLIB_API const TCOD_color_t TCOD_pink; 149 | extern TCODLIB_API const TCOD_color_t TCOD_crimson; 150 | 151 | /* dark colors */ 152 | extern TCODLIB_API const TCOD_color_t TCOD_dark_red; 153 | extern TCODLIB_API const TCOD_color_t TCOD_dark_flame; 154 | extern TCODLIB_API const TCOD_color_t TCOD_dark_orange; 155 | extern TCODLIB_API const TCOD_color_t TCOD_dark_amber; 156 | extern TCODLIB_API const TCOD_color_t TCOD_dark_yellow; 157 | extern TCODLIB_API const TCOD_color_t TCOD_dark_lime; 158 | extern TCODLIB_API const TCOD_color_t TCOD_dark_chartreuse; 159 | extern TCODLIB_API const TCOD_color_t TCOD_dark_green; 160 | extern TCODLIB_API const TCOD_color_t TCOD_dark_sea; 161 | extern TCODLIB_API const TCOD_color_t TCOD_dark_turquoise; 162 | extern TCODLIB_API const TCOD_color_t TCOD_dark_cyan; 163 | extern TCODLIB_API const TCOD_color_t TCOD_dark_sky; 164 | extern TCODLIB_API const TCOD_color_t TCOD_dark_azure; 165 | extern TCODLIB_API const TCOD_color_t TCOD_dark_blue; 166 | extern TCODLIB_API const TCOD_color_t TCOD_dark_han; 167 | extern TCODLIB_API const TCOD_color_t TCOD_dark_violet; 168 | extern TCODLIB_API const TCOD_color_t TCOD_dark_purple; 169 | extern TCODLIB_API const TCOD_color_t TCOD_dark_fuchsia; 170 | extern TCODLIB_API const TCOD_color_t TCOD_dark_magenta; 171 | extern TCODLIB_API const TCOD_color_t TCOD_dark_pink; 172 | extern TCODLIB_API const TCOD_color_t TCOD_dark_crimson; 173 | 174 | /* darker colors */ 175 | extern TCODLIB_API const TCOD_color_t TCOD_darker_red; 176 | extern TCODLIB_API const TCOD_color_t TCOD_darker_flame; 177 | extern TCODLIB_API const TCOD_color_t TCOD_darker_orange; 178 | extern TCODLIB_API const TCOD_color_t TCOD_darker_amber; 179 | extern TCODLIB_API const TCOD_color_t TCOD_darker_yellow; 180 | extern TCODLIB_API const TCOD_color_t TCOD_darker_lime; 181 | extern TCODLIB_API const TCOD_color_t TCOD_darker_chartreuse; 182 | extern TCODLIB_API const TCOD_color_t TCOD_darker_green; 183 | extern TCODLIB_API const TCOD_color_t TCOD_darker_sea; 184 | extern TCODLIB_API const TCOD_color_t TCOD_darker_turquoise; 185 | extern TCODLIB_API const TCOD_color_t TCOD_darker_cyan; 186 | extern TCODLIB_API const TCOD_color_t TCOD_darker_sky; 187 | extern TCODLIB_API const TCOD_color_t TCOD_darker_azure; 188 | extern TCODLIB_API const TCOD_color_t TCOD_darker_blue; 189 | extern TCODLIB_API const TCOD_color_t TCOD_darker_han; 190 | extern TCODLIB_API const TCOD_color_t TCOD_darker_violet; 191 | extern TCODLIB_API const TCOD_color_t TCOD_darker_purple; 192 | extern TCODLIB_API const TCOD_color_t TCOD_darker_fuchsia; 193 | extern TCODLIB_API const TCOD_color_t TCOD_darker_magenta; 194 | extern TCODLIB_API const TCOD_color_t TCOD_darker_pink; 195 | extern TCODLIB_API const TCOD_color_t TCOD_darker_crimson; 196 | 197 | /* darkest colors */ 198 | extern TCODLIB_API const TCOD_color_t TCOD_darkest_red; 199 | extern TCODLIB_API const TCOD_color_t TCOD_darkest_flame; 200 | extern TCODLIB_API const TCOD_color_t TCOD_darkest_orange; 201 | extern TCODLIB_API const TCOD_color_t TCOD_darkest_amber; 202 | extern TCODLIB_API const TCOD_color_t TCOD_darkest_yellow; 203 | extern TCODLIB_API const TCOD_color_t TCOD_darkest_lime; 204 | extern TCODLIB_API const TCOD_color_t TCOD_darkest_chartreuse; 205 | extern TCODLIB_API const TCOD_color_t TCOD_darkest_green; 206 | extern TCODLIB_API const TCOD_color_t TCOD_darkest_sea; 207 | extern TCODLIB_API const TCOD_color_t TCOD_darkest_turquoise; 208 | extern TCODLIB_API const TCOD_color_t TCOD_darkest_cyan; 209 | extern TCODLIB_API const TCOD_color_t TCOD_darkest_sky; 210 | extern TCODLIB_API const TCOD_color_t TCOD_darkest_azure; 211 | extern TCODLIB_API const TCOD_color_t TCOD_darkest_blue; 212 | extern TCODLIB_API const TCOD_color_t TCOD_darkest_han; 213 | extern TCODLIB_API const TCOD_color_t TCOD_darkest_violet; 214 | extern TCODLIB_API const TCOD_color_t TCOD_darkest_purple; 215 | extern TCODLIB_API const TCOD_color_t TCOD_darkest_fuchsia; 216 | extern TCODLIB_API const TCOD_color_t TCOD_darkest_magenta; 217 | extern TCODLIB_API const TCOD_color_t TCOD_darkest_pink; 218 | extern TCODLIB_API const TCOD_color_t TCOD_darkest_crimson; 219 | 220 | /* light colors */ 221 | extern TCODLIB_API const TCOD_color_t TCOD_light_red; 222 | extern TCODLIB_API const TCOD_color_t TCOD_light_flame; 223 | extern TCODLIB_API const TCOD_color_t TCOD_light_orange; 224 | extern TCODLIB_API const TCOD_color_t TCOD_light_amber; 225 | extern TCODLIB_API const TCOD_color_t TCOD_light_yellow; 226 | extern TCODLIB_API const TCOD_color_t TCOD_light_lime; 227 | extern TCODLIB_API const TCOD_color_t TCOD_light_chartreuse; 228 | extern TCODLIB_API const TCOD_color_t TCOD_light_green; 229 | extern TCODLIB_API const TCOD_color_t TCOD_light_sea; 230 | extern TCODLIB_API const TCOD_color_t TCOD_light_turquoise; 231 | extern TCODLIB_API const TCOD_color_t TCOD_light_cyan; 232 | extern TCODLIB_API const TCOD_color_t TCOD_light_sky; 233 | extern TCODLIB_API const TCOD_color_t TCOD_light_azure; 234 | extern TCODLIB_API const TCOD_color_t TCOD_light_blue; 235 | extern TCODLIB_API const TCOD_color_t TCOD_light_han; 236 | extern TCODLIB_API const TCOD_color_t TCOD_light_violet; 237 | extern TCODLIB_API const TCOD_color_t TCOD_light_purple; 238 | extern TCODLIB_API const TCOD_color_t TCOD_light_fuchsia; 239 | extern TCODLIB_API const TCOD_color_t TCOD_light_magenta; 240 | extern TCODLIB_API const TCOD_color_t TCOD_light_pink; 241 | extern TCODLIB_API const TCOD_color_t TCOD_light_crimson; 242 | 243 | /* lighter colors */ 244 | extern TCODLIB_API const TCOD_color_t TCOD_lighter_red; 245 | extern TCODLIB_API const TCOD_color_t TCOD_lighter_flame; 246 | extern TCODLIB_API const TCOD_color_t TCOD_lighter_orange; 247 | extern TCODLIB_API const TCOD_color_t TCOD_lighter_amber; 248 | extern TCODLIB_API const TCOD_color_t TCOD_lighter_yellow; 249 | extern TCODLIB_API const TCOD_color_t TCOD_lighter_lime; 250 | extern TCODLIB_API const TCOD_color_t TCOD_lighter_chartreuse; 251 | extern TCODLIB_API const TCOD_color_t TCOD_lighter_green; 252 | extern TCODLIB_API const TCOD_color_t TCOD_lighter_sea; 253 | extern TCODLIB_API const TCOD_color_t TCOD_lighter_turquoise; 254 | extern TCODLIB_API const TCOD_color_t TCOD_lighter_cyan; 255 | extern TCODLIB_API const TCOD_color_t TCOD_lighter_sky; 256 | extern TCODLIB_API const TCOD_color_t TCOD_lighter_azure; 257 | extern TCODLIB_API const TCOD_color_t TCOD_lighter_blue; 258 | extern TCODLIB_API const TCOD_color_t TCOD_lighter_han; 259 | extern TCODLIB_API const TCOD_color_t TCOD_lighter_violet; 260 | extern TCODLIB_API const TCOD_color_t TCOD_lighter_purple; 261 | extern TCODLIB_API const TCOD_color_t TCOD_lighter_fuchsia; 262 | extern TCODLIB_API const TCOD_color_t TCOD_lighter_magenta; 263 | extern TCODLIB_API const TCOD_color_t TCOD_lighter_pink; 264 | extern TCODLIB_API const TCOD_color_t TCOD_lighter_crimson; 265 | 266 | /* lightest colors */ 267 | extern TCODLIB_API const TCOD_color_t TCOD_lightest_red; 268 | extern TCODLIB_API const TCOD_color_t TCOD_lightest_flame; 269 | extern TCODLIB_API const TCOD_color_t TCOD_lightest_orange; 270 | extern TCODLIB_API const TCOD_color_t TCOD_lightest_amber; 271 | extern TCODLIB_API const TCOD_color_t TCOD_lightest_yellow; 272 | extern TCODLIB_API const TCOD_color_t TCOD_lightest_lime; 273 | extern TCODLIB_API const TCOD_color_t TCOD_lightest_chartreuse; 274 | extern TCODLIB_API const TCOD_color_t TCOD_lightest_green; 275 | extern TCODLIB_API const TCOD_color_t TCOD_lightest_sea; 276 | extern TCODLIB_API const TCOD_color_t TCOD_lightest_turquoise; 277 | extern TCODLIB_API const TCOD_color_t TCOD_lightest_cyan; 278 | extern TCODLIB_API const TCOD_color_t TCOD_lightest_sky; 279 | extern TCODLIB_API const TCOD_color_t TCOD_lightest_azure; 280 | extern TCODLIB_API const TCOD_color_t TCOD_lightest_blue; 281 | extern TCODLIB_API const TCOD_color_t TCOD_lightest_han; 282 | extern TCODLIB_API const TCOD_color_t TCOD_lightest_violet; 283 | extern TCODLIB_API const TCOD_color_t TCOD_lightest_purple; 284 | extern TCODLIB_API const TCOD_color_t TCOD_lightest_fuchsia; 285 | extern TCODLIB_API const TCOD_color_t TCOD_lightest_magenta; 286 | extern TCODLIB_API const TCOD_color_t TCOD_lightest_pink; 287 | extern TCODLIB_API const TCOD_color_t TCOD_lightest_crimson; 288 | 289 | /* desaturated */ 290 | extern TCODLIB_API const TCOD_color_t TCOD_desaturated_red; 291 | extern TCODLIB_API const TCOD_color_t TCOD_desaturated_flame; 292 | extern TCODLIB_API const TCOD_color_t TCOD_desaturated_orange; 293 | extern TCODLIB_API const TCOD_color_t TCOD_desaturated_amber; 294 | extern TCODLIB_API const TCOD_color_t TCOD_desaturated_yellow; 295 | extern TCODLIB_API const TCOD_color_t TCOD_desaturated_lime; 296 | extern TCODLIB_API const TCOD_color_t TCOD_desaturated_chartreuse; 297 | extern TCODLIB_API const TCOD_color_t TCOD_desaturated_green; 298 | extern TCODLIB_API const TCOD_color_t TCOD_desaturated_sea; 299 | extern TCODLIB_API const TCOD_color_t TCOD_desaturated_turquoise; 300 | extern TCODLIB_API const TCOD_color_t TCOD_desaturated_cyan; 301 | extern TCODLIB_API const TCOD_color_t TCOD_desaturated_sky; 302 | extern TCODLIB_API const TCOD_color_t TCOD_desaturated_azure; 303 | extern TCODLIB_API const TCOD_color_t TCOD_desaturated_blue; 304 | extern TCODLIB_API const TCOD_color_t TCOD_desaturated_han; 305 | extern TCODLIB_API const TCOD_color_t TCOD_desaturated_violet; 306 | extern TCODLIB_API const TCOD_color_t TCOD_desaturated_purple; 307 | extern TCODLIB_API const TCOD_color_t TCOD_desaturated_fuchsia; 308 | extern TCODLIB_API const TCOD_color_t TCOD_desaturated_magenta; 309 | extern TCODLIB_API const TCOD_color_t TCOD_desaturated_pink; 310 | extern TCODLIB_API const TCOD_color_t TCOD_desaturated_crimson; 311 | 312 | /* metallic */ 313 | extern TCODLIB_API const TCOD_color_t TCOD_brass; 314 | extern TCODLIB_API const TCOD_color_t TCOD_copper; 315 | extern TCODLIB_API const TCOD_color_t TCOD_gold; 316 | extern TCODLIB_API const TCOD_color_t TCOD_silver; 317 | 318 | /* miscellaneous */ 319 | extern TCODLIB_API const TCOD_color_t TCOD_celadon; 320 | extern TCODLIB_API const TCOD_color_t TCOD_peach; 321 | 322 | #endif 323 | -------------------------------------------------------------------------------- /tcod/include/console.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libtcod 1.5.1 3 | * Copyright (c) 2008,2009,2010 Jice & Mingos 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * The name of Jice or Mingos may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY JICE AND MINGOS ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL JICE OR MINGOS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef _TCOD_CONSOLE_H 29 | #define _TCOD_CONSOLE_H 30 | 31 | #include "console_types.h" 32 | 33 | #define TCOD_BKGND_ALPHA(alpha) ((TCOD_bkgnd_flag_t)(TCOD_BKGND_ALPH|(((uint8)(alpha*255))<<8))) 34 | #define TCOD_BKGND_ADDALPHA(alpha) ((TCOD_bkgnd_flag_t)(TCOD_BKGND_ADDA|(((uint8)(alpha*255))<<8))) 35 | 36 | typedef void * TCOD_console_t; 37 | 38 | TCODLIB_API void TCOD_console_init_root(int w, int h, const char * title, bool fullscreen, TCOD_renderer_t renderer); 39 | TCODLIB_API void TCOD_console_set_window_title(const char *title); 40 | TCODLIB_API void TCOD_console_set_fullscreen(bool fullscreen); 41 | TCODLIB_API bool TCOD_console_is_fullscreen(); 42 | TCODLIB_API bool TCOD_console_is_window_closed(); 43 | 44 | TCODLIB_API void TCOD_console_set_custom_font(const char *fontFile, int flags,int nb_char_horiz, int nb_char_vertic); 45 | TCODLIB_API void TCOD_console_map_ascii_code_to_font(int asciiCode, int fontCharX, int fontCharY); 46 | TCODLIB_API void TCOD_console_map_ascii_codes_to_font(int asciiCode, int nbCodes, int fontCharX, int fontCharY); 47 | TCODLIB_API void TCOD_console_map_string_to_font(const char *s, int fontCharX, int fontCharY); 48 | 49 | TCODLIB_API void TCOD_console_set_dirty(int x, int y, int w, int h); 50 | TCODLIB_API void TCOD_console_set_default_background(TCOD_console_t con,TCOD_color_t col); 51 | TCODLIB_API void TCOD_console_set_default_foreground(TCOD_console_t con,TCOD_color_t col); 52 | TCODLIB_API void TCOD_console_clear(TCOD_console_t con); 53 | TCODLIB_API void TCOD_console_set_char_background(TCOD_console_t con,int x, int y, TCOD_color_t col, TCOD_bkgnd_flag_t flag); 54 | TCODLIB_API void TCOD_console_set_char_foreground(TCOD_console_t con,int x, int y, TCOD_color_t col); 55 | TCODLIB_API void TCOD_console_set_char(TCOD_console_t con,int x, int y, int c); 56 | TCODLIB_API void TCOD_console_put_char(TCOD_console_t con,int x, int y, int c, TCOD_bkgnd_flag_t flag); 57 | TCODLIB_API void TCOD_console_put_char_ex(TCOD_console_t con,int x, int y, int c, TCOD_color_t fore, TCOD_color_t back); 58 | 59 | TCODLIB_API void TCOD_console_set_background_flag(TCOD_console_t con,TCOD_bkgnd_flag_t flag); 60 | TCODLIB_API TCOD_bkgnd_flag_t TCOD_console_get_background_flag(TCOD_console_t con); 61 | TCODLIB_API void TCOD_console_set_alignment(TCOD_console_t con,TCOD_alignment_t alignment); 62 | TCODLIB_API TCOD_alignment_t TCOD_console_get_alignment(TCOD_console_t con); 63 | TCODLIB_API void TCOD_console_print(TCOD_console_t con,int x, int y, const char *fmt, ...); 64 | TCODLIB_API void TCOD_console_print_ex(TCOD_console_t con,int x, int y, TCOD_bkgnd_flag_t flag, TCOD_alignment_t alignment, const char *fmt, ...); 65 | TCODLIB_API int TCOD_console_print_rect(TCOD_console_t con,int x, int y, int w, int h, const char *fmt, ...); 66 | TCODLIB_API int TCOD_console_print_rect_ex(TCOD_console_t con,int x, int y, int w, int h, TCOD_bkgnd_flag_t flag, TCOD_alignment_t alignment, const char *fmt, ...); 67 | TCODLIB_API int TCOD_console_get_height_rect(TCOD_console_t con,int x, int y, int w, int h, const char *fmt, ...); 68 | 69 | TCODLIB_API void TCOD_console_rect(TCOD_console_t con,int x, int y, int w, int h, bool clear, TCOD_bkgnd_flag_t flag); 70 | TCODLIB_API void TCOD_console_hline(TCOD_console_t con,int x,int y, int l, TCOD_bkgnd_flag_t flag); 71 | TCODLIB_API void TCOD_console_vline(TCOD_console_t con,int x,int y, int l, TCOD_bkgnd_flag_t flag); 72 | TCODLIB_API void TCOD_console_print_frame(TCOD_console_t con,int x,int y,int w,int h, bool empty, TCOD_bkgnd_flag_t flag, const char *fmt, ...); 73 | 74 | #ifndef NO_UNICODE 75 | /* unicode support */ 76 | TCODLIB_API void TCOD_console_map_string_to_font_utf(const wchar_t *s, int fontCharX, int fontCharY); 77 | TCODLIB_API void TCOD_console_print_utf(TCOD_console_t con,int x, int y, const wchar_t *fmt, ...); 78 | TCODLIB_API void TCOD_console_print_ex_utf(TCOD_console_t con,int x, int y, TCOD_bkgnd_flag_t flag, TCOD_alignment_t alignment, const wchar_t *fmt, ...); 79 | TCODLIB_API int TCOD_console_print_rect_utf(TCOD_console_t con,int x, int y, int w, int h, const wchar_t *fmt, ...); 80 | TCODLIB_API int TCOD_console_print_rect_ex_utf(TCOD_console_t con,int x, int y, int w, int h, TCOD_bkgnd_flag_t flag, TCOD_alignment_t alignment, const wchar_t *fmt, ...); 81 | TCODLIB_API int TCOD_console_get_height_rect_utf(TCOD_console_t con,int x, int y, int w, int h, const wchar_t *fmt, ...); 82 | #endif 83 | 84 | 85 | TCODLIB_API TCOD_color_t TCOD_console_get_default_background(TCOD_console_t con); 86 | TCODLIB_API TCOD_color_t TCOD_console_get_default_foreground(TCOD_console_t con); 87 | TCODLIB_API TCOD_color_t TCOD_console_get_char_background(TCOD_console_t con,int x, int y); 88 | TCODLIB_API TCOD_color_t TCOD_console_get_char_foreground(TCOD_console_t con,int x, int y); 89 | TCODLIB_API int TCOD_console_get_char(TCOD_console_t con,int x, int y); 90 | 91 | TCODLIB_API void TCOD_console_set_fade(uint8 val, TCOD_color_t fade); 92 | TCODLIB_API uint8 TCOD_console_get_fade(); 93 | TCODLIB_API TCOD_color_t TCOD_console_get_fading_color(); 94 | 95 | TCODLIB_API void TCOD_console_flush(); 96 | 97 | TCODLIB_API void TCOD_console_set_color_control(TCOD_colctrl_t con, TCOD_color_t fore, TCOD_color_t back); 98 | 99 | TCODLIB_API TCOD_key_t TCOD_console_check_for_keypress(int flags); 100 | TCODLIB_API TCOD_key_t TCOD_console_wait_for_keypress(bool flush); 101 | TCODLIB_API void TCOD_console_set_keyboard_repeat(int initial_delay, int interval); 102 | TCODLIB_API void TCOD_console_disable_keyboard_repeat(); 103 | TCODLIB_API bool TCOD_console_is_key_pressed(TCOD_keycode_t key); 104 | 105 | TCODLIB_API TCOD_console_t TCOD_console_new(int w, int h); 106 | TCODLIB_API int TCOD_console_get_width(TCOD_console_t con); 107 | TCODLIB_API int TCOD_console_get_height(TCOD_console_t con); 108 | TCODLIB_API void TCOD_console_set_key_color(TCOD_console_t con,TCOD_color_t col); 109 | TCODLIB_API void TCOD_console_blit(TCOD_console_t src,int xSrc, int ySrc, int wSrc, int hSrc, TCOD_console_t dst, int xDst, int yDst, float foreground_alpha, float background_alpha); 110 | TCODLIB_API void TCOD_console_delete(TCOD_console_t console); 111 | 112 | TCODLIB_API void TCOD_console_credits(); 113 | TCODLIB_API void TCOD_console_credits_reset(); 114 | TCODLIB_API bool TCOD_console_credits_render(int x, int y, bool alpha); 115 | 116 | #endif 117 | -------------------------------------------------------------------------------- /tcod/include/console_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libtcod 1.5.1 3 | * Copyright (c) 2008,2009,2010 Jice & Mingos 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * The name of Jice or Mingos may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY JICE AND MINGOS ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL JICE OR MINGOS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef _TCOD_CONSOLE_TYPES_H 29 | #define _TCOD_CONSOLE_TYPES_H 30 | 31 | typedef enum { 32 | TCODK_NONE, 33 | TCODK_ESCAPE, 34 | TCODK_BACKSPACE, 35 | TCODK_TAB, 36 | TCODK_ENTER, 37 | TCODK_SHIFT, 38 | TCODK_CONTROL, 39 | TCODK_ALT, 40 | TCODK_PAUSE, 41 | TCODK_CAPSLOCK, 42 | TCODK_PAGEUP, 43 | TCODK_PAGEDOWN, 44 | TCODK_END, 45 | TCODK_HOME, 46 | TCODK_UP, 47 | TCODK_LEFT, 48 | TCODK_RIGHT, 49 | TCODK_DOWN, 50 | TCODK_PRINTSCREEN, 51 | TCODK_INSERT, 52 | TCODK_DELETE, 53 | TCODK_LWIN, 54 | TCODK_RWIN, 55 | TCODK_APPS, 56 | TCODK_0, 57 | TCODK_1, 58 | TCODK_2, 59 | TCODK_3, 60 | TCODK_4, 61 | TCODK_5, 62 | TCODK_6, 63 | TCODK_7, 64 | TCODK_8, 65 | TCODK_9, 66 | TCODK_KP0, 67 | TCODK_KP1, 68 | TCODK_KP2, 69 | TCODK_KP3, 70 | TCODK_KP4, 71 | TCODK_KP5, 72 | TCODK_KP6, 73 | TCODK_KP7, 74 | TCODK_KP8, 75 | TCODK_KP9, 76 | TCODK_KPADD, 77 | TCODK_KPSUB, 78 | TCODK_KPDIV, 79 | TCODK_KPMUL, 80 | TCODK_KPDEC, 81 | TCODK_KPENTER, 82 | TCODK_F1, 83 | TCODK_F2, 84 | TCODK_F3, 85 | TCODK_F4, 86 | TCODK_F5, 87 | TCODK_F6, 88 | TCODK_F7, 89 | TCODK_F8, 90 | TCODK_F9, 91 | TCODK_F10, 92 | TCODK_F11, 93 | TCODK_F12, 94 | TCODK_NUMLOCK, 95 | TCODK_SCROLLLOCK, 96 | TCODK_SPACE, 97 | TCODK_CHAR 98 | } TCOD_keycode_t; 99 | 100 | /* key data : special code or character */ 101 | typedef struct { 102 | TCOD_keycode_t vk; /* key code */ 103 | char c; /* character if vk == TCODK_CHAR else 0 */ 104 | bool pressed ; /* does this correspond to a key press or key release event ? */ 105 | bool lalt ; 106 | bool lctrl ; 107 | bool ralt ; 108 | bool rctrl ; 109 | bool shift ; 110 | } TCOD_key_t; 111 | 112 | typedef enum { 113 | /* single walls */ 114 | TCOD_CHAR_HLINE=196, 115 | TCOD_CHAR_VLINE=179, 116 | TCOD_CHAR_NE=191, 117 | TCOD_CHAR_NW=218, 118 | TCOD_CHAR_SE=217, 119 | TCOD_CHAR_SW=192, 120 | TCOD_CHAR_TEEW=180, 121 | TCOD_CHAR_TEEE=195, 122 | TCOD_CHAR_TEEN=193, 123 | TCOD_CHAR_TEES=194, 124 | TCOD_CHAR_CROSS=197, 125 | /* double walls */ 126 | TCOD_CHAR_DHLINE=205, 127 | TCOD_CHAR_DVLINE=186, 128 | TCOD_CHAR_DNE=187, 129 | TCOD_CHAR_DNW=201, 130 | TCOD_CHAR_DSE=188, 131 | TCOD_CHAR_DSW=200, 132 | TCOD_CHAR_DTEEW=185, 133 | TCOD_CHAR_DTEEE=204, 134 | TCOD_CHAR_DTEEN=202, 135 | TCOD_CHAR_DTEES=203, 136 | TCOD_CHAR_DCROSS=206, 137 | /* blocks */ 138 | TCOD_CHAR_BLOCK1=176, 139 | TCOD_CHAR_BLOCK2=177, 140 | TCOD_CHAR_BLOCK3=178, 141 | /* arrows */ 142 | TCOD_CHAR_ARROW_N=24, 143 | TCOD_CHAR_ARROW_S=25, 144 | TCOD_CHAR_ARROW_E=26, 145 | TCOD_CHAR_ARROW_W=27, 146 | /* arrows without tail */ 147 | TCOD_CHAR_ARROW2_N=30, 148 | TCOD_CHAR_ARROW2_S=31, 149 | TCOD_CHAR_ARROW2_E=16, 150 | TCOD_CHAR_ARROW2_W=17, 151 | /* double arrows */ 152 | TCOD_CHAR_DARROW_H=29, 153 | TCOD_CHAR_DARROW_V=18, 154 | /* GUI stuff */ 155 | TCOD_CHAR_CHECKBOX_UNSET=224, 156 | TCOD_CHAR_CHECKBOX_SET=225, 157 | TCOD_CHAR_RADIO_UNSET=9, 158 | TCOD_CHAR_RADIO_SET=10, 159 | /* sub-pixel resolution kit */ 160 | TCOD_CHAR_SUBP_NW=226, 161 | TCOD_CHAR_SUBP_NE=227, 162 | TCOD_CHAR_SUBP_N=228, 163 | TCOD_CHAR_SUBP_SE=229, 164 | TCOD_CHAR_SUBP_DIAG=230, 165 | TCOD_CHAR_SUBP_E=231, 166 | TCOD_CHAR_SUBP_SW=232, 167 | /* miscellaneous */ 168 | TCOD_CHAR_SMILIE = 1, 169 | TCOD_CHAR_SMILIE_INV = 2, 170 | TCOD_CHAR_HEART = 3, 171 | TCOD_CHAR_DIAMOND = 4, 172 | TCOD_CHAR_CLUB = 5, 173 | TCOD_CHAR_SPADE = 6, 174 | TCOD_CHAR_BULLET = 7, 175 | TCOD_CHAR_BULLET_INV = 8, 176 | TCOD_CHAR_MALE = 11, 177 | TCOD_CHAR_FEMALE = 12, 178 | TCOD_CHAR_NOTE = 13, 179 | TCOD_CHAR_NOTE_DOUBLE = 14, 180 | TCOD_CHAR_LIGHT = 15, 181 | TCOD_CHAR_EXCLAM_DOUBLE = 19, 182 | TCOD_CHAR_PILCROW = 20, 183 | TCOD_CHAR_SECTION = 21, 184 | TCOD_CHAR_POUND = 156, 185 | TCOD_CHAR_MULTIPLICATION = 158, 186 | TCOD_CHAR_FUNCTION = 159, 187 | TCOD_CHAR_RESERVED = 169, 188 | TCOD_CHAR_HALF = 171, 189 | TCOD_CHAR_ONE_QUARTER = 172, 190 | TCOD_CHAR_COPYRIGHT = 184, 191 | TCOD_CHAR_CENT = 189, 192 | TCOD_CHAR_YEN = 190, 193 | TCOD_CHAR_CURRENCY = 207, 194 | TCOD_CHAR_THREE_QUARTERS = 243, 195 | TCOD_CHAR_DIVISION = 246, 196 | TCOD_CHAR_GRADE = 248, 197 | TCOD_CHAR_UMLAUT = 249, 198 | TCOD_CHAR_POW1 = 251, 199 | TCOD_CHAR_POW3 = 252, 200 | TCOD_CHAR_POW2 = 253, 201 | TCOD_CHAR_BULLET_SQUARE = 254, 202 | /* diacritics */ 203 | } TCOD_chars_t; 204 | 205 | typedef enum { 206 | TCOD_COLCTRL_1 = 1, 207 | TCOD_COLCTRL_2, 208 | TCOD_COLCTRL_3, 209 | TCOD_COLCTRL_4, 210 | TCOD_COLCTRL_5, 211 | TCOD_COLCTRL_NUMBER=5, 212 | TCOD_COLCTRL_FORE_RGB, 213 | TCOD_COLCTRL_BACK_RGB, 214 | TCOD_COLCTRL_STOP 215 | } TCOD_colctrl_t; 216 | 217 | typedef enum { 218 | TCOD_BKGND_NONE, 219 | TCOD_BKGND_SET, 220 | TCOD_BKGND_MULTIPLY, 221 | TCOD_BKGND_LIGHTEN, 222 | TCOD_BKGND_DARKEN, 223 | TCOD_BKGND_SCREEN, 224 | TCOD_BKGND_COLOR_DODGE, 225 | TCOD_BKGND_COLOR_BURN, 226 | TCOD_BKGND_ADD, 227 | TCOD_BKGND_ADDA, 228 | TCOD_BKGND_BURN, 229 | TCOD_BKGND_OVERLAY, 230 | TCOD_BKGND_ALPH, 231 | TCOD_BKGND_DEFAULT 232 | } TCOD_bkgnd_flag_t; 233 | 234 | typedef enum { 235 | TCOD_KEY_PRESSED=1, 236 | TCOD_KEY_RELEASED=2, 237 | } TCOD_key_status_t; 238 | 239 | /* custom font flags */ 240 | typedef enum { 241 | TCOD_FONT_LAYOUT_ASCII_INCOL=1, 242 | TCOD_FONT_LAYOUT_ASCII_INROW=2, 243 | TCOD_FONT_TYPE_GREYSCALE=4, 244 | TCOD_FONT_TYPE_GRAYSCALE=4, 245 | TCOD_FONT_LAYOUT_TCOD=8, 246 | } TCOD_font_flags_t; 247 | 248 | typedef enum { 249 | TCOD_RENDERER_GLSL, 250 | TCOD_RENDERER_OPENGL, 251 | TCOD_RENDERER_SDL, 252 | TCOD_NB_RENDERERS, 253 | } TCOD_renderer_t; 254 | 255 | typedef enum { 256 | TCOD_LEFT, 257 | TCOD_RIGHT, 258 | TCOD_CENTER 259 | } TCOD_alignment_t; 260 | 261 | #endif /* _TCOD_CONSOLE_TYPES_H */ 262 | -------------------------------------------------------------------------------- /tcod/include/fov.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libtcod 1.5.1 3 | * Copyright (c) 2008,2009,2010 Jice & Mingos 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * The name of Jice or Mingos may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY JICE AND MINGOS ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL JICE OR MINGOS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef _TCOD_FOV_H 29 | #define _TCOD_FOV_H 30 | 31 | typedef void *TCOD_map_t; 32 | 33 | #include "fov_types.h" 34 | 35 | /* allocate a new map */ 36 | TCODLIB_API TCOD_map_t TCOD_map_new(int width, int height); 37 | /* set all cells as solid rock (cannot see through nor walk) */ 38 | TCODLIB_API void TCOD_map_clear(TCOD_map_t map, bool transparent, bool walkable); 39 | /* copy a map to another, reallocating it when needed */ 40 | TCODLIB_API void TCOD_map_copy(TCOD_map_t source, TCOD_map_t dest); 41 | /* change a cell properties */ 42 | TCODLIB_API void TCOD_map_set_properties(TCOD_map_t map, int x, int y, bool is_transparent, bool is_walkable); 43 | /* destroy a map */ 44 | TCODLIB_API void TCOD_map_delete(TCOD_map_t map); 45 | 46 | /* calculate the field of view (potentially visible cells from player_x,player_y) */ 47 | TCODLIB_API void TCOD_map_compute_fov(TCOD_map_t map, int player_x, int player_y, int max_radius, bool light_walls, TCOD_fov_algorithm_t algo); 48 | /* check if a cell is in the last computed field of view */ 49 | TCODLIB_API bool TCOD_map_is_in_fov(TCOD_map_t map, int x, int y); 50 | TCODLIB_API void TCOD_map_set_in_fov(TCOD_map_t map, int x, int y, bool fov); 51 | 52 | /* retrieve properties from the map */ 53 | TCODLIB_API bool TCOD_map_is_transparent(TCOD_map_t map, int x, int y); 54 | TCODLIB_API bool TCOD_map_is_walkable(TCOD_map_t map, int x, int y); 55 | TCODLIB_API int TCOD_map_get_width(TCOD_map_t map); 56 | TCODLIB_API int TCOD_map_get_height(TCOD_map_t map); 57 | TCODLIB_API int TCOD_map_get_nb_cells(TCOD_map_t map); 58 | #endif 59 | -------------------------------------------------------------------------------- /tcod/include/fov_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libtcod 1.5.1 3 | * Copyright (c) 2008,2009,2010 Jice & Mingos 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * The name of Jice or Mingos may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY JICE AND MINGOS ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL JICE OR MINGOS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef _TCOD_FOV_TYPES_H 29 | #define _TCOD_FOV_TYPES_H 30 | 31 | /* FOV_BASIC : http://roguebasin.roguelikedevelopment.org/index.php?title=Ray_casting 32 | FOV_DIAMOND : http://www.geocities.com/temerra/los_rays.html 33 | FOV_SHADOW : http://roguebasin.roguelikedevelopment.org/index.php?title=FOV_using_recursive_shadowcasting 34 | FOV_PERMISSIVE : http://roguebasin.roguelikedevelopment.org/index.php?title=Precise_Permissive_Field_of_View 35 | FOV_RESTRICTIVE : Mingos' Restrictive Precise Angle Shadowcasting (contribution by Mingos) */ 36 | 37 | typedef enum { 38 | FOV_BASIC, 39 | FOV_DIAMOND, 40 | FOV_SHADOW, 41 | FOV_PERMISSIVE_0, 42 | FOV_PERMISSIVE_1, 43 | FOV_PERMISSIVE_2, 44 | FOV_PERMISSIVE_3, 45 | FOV_PERMISSIVE_4, 46 | FOV_PERMISSIVE_5, 47 | FOV_PERMISSIVE_6, 48 | FOV_PERMISSIVE_7, 49 | FOV_PERMISSIVE_8, 50 | FOV_RESTRICTIVE, 51 | NB_FOV_ALGORITHMS } TCOD_fov_algorithm_t; 52 | #define FOV_PERMISSIVE(x) ((TCOD_fov_algorithm_t)(FOV_PERMISSIVE_0 + (x))) 53 | 54 | #endif /* _TCOD_FOV_TYPES_H */ 55 | -------------------------------------------------------------------------------- /tcod/include/heightmap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libtcod 1.5.1 3 | * Copyright (c) 2008,2009,2010 Jice & Mingos 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * The name of Jice or Mingos may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY JICE AND MINGOS ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL JICE OR MINGOS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef _TCOD_HEIGHTMAP_H 28 | #define _TCOD_HEIGHTMAP_H 29 | 30 | typedef struct { 31 | int w,h; 32 | float *values; 33 | } TCOD_heightmap_t; 34 | 35 | TCODLIB_API TCOD_heightmap_t *TCOD_heightmap_new(int w,int h); 36 | TCODLIB_API void TCOD_heightmap_delete(TCOD_heightmap_t *hm); 37 | 38 | TCODLIB_API float TCOD_heightmap_get_value(const TCOD_heightmap_t *hm, int x, int y); 39 | TCODLIB_API float TCOD_heightmap_get_interpolated_value(const TCOD_heightmap_t *hm, float x, float y); 40 | TCODLIB_API void TCOD_heightmap_set_value(TCOD_heightmap_t *hm, int x, int y, float value); 41 | TCODLIB_API float TCOD_heightmap_get_slope(const TCOD_heightmap_t *hm, int x, int y); 42 | TCODLIB_API void TCOD_heightmap_get_normal(const TCOD_heightmap_t *hm, float x, float y, float n[3], float waterLevel); 43 | TCODLIB_API int TCOD_heightmap_count_cells(const TCOD_heightmap_t *hm, float min, float max); 44 | TCODLIB_API bool TCOD_heightmap_has_land_on_border(const TCOD_heightmap_t *hm, float waterLevel); 45 | TCODLIB_API void TCOD_heightmap_get_minmax(const TCOD_heightmap_t *hm, float *min, float *max); 46 | 47 | TCODLIB_API void TCOD_heightmap_copy(const TCOD_heightmap_t *hm_source,TCOD_heightmap_t *hm_dest); 48 | TCODLIB_API void TCOD_heightmap_add(TCOD_heightmap_t *hm, float value); 49 | TCODLIB_API void TCOD_heightmap_scale(TCOD_heightmap_t *hm, float value); 50 | TCODLIB_API void TCOD_heightmap_clamp(TCOD_heightmap_t *hm, float min, float max); 51 | TCODLIB_API void TCOD_heightmap_normalize(TCOD_heightmap_t *hm, float min, float max); 52 | TCODLIB_API void TCOD_heightmap_clear(TCOD_heightmap_t *hm); 53 | TCODLIB_API void TCOD_heightmap_lerp_hm(const TCOD_heightmap_t *hm1, const TCOD_heightmap_t *hm2, TCOD_heightmap_t *hmres, float coef); 54 | TCODLIB_API void TCOD_heightmap_add_hm(const TCOD_heightmap_t *hm1, const TCOD_heightmap_t *hm2, TCOD_heightmap_t *hmres); 55 | TCODLIB_API void TCOD_heightmap_multiply_hm(const TCOD_heightmap_t *hm1, const TCOD_heightmap_t *hm2, TCOD_heightmap_t *hmres); 56 | 57 | TCODLIB_API void TCOD_heightmap_add_hill(TCOD_heightmap_t *hm, float hx, float hy, float hradius, float hheight); 58 | TCODLIB_API void TCOD_heightmap_dig_hill(TCOD_heightmap_t *hm, float hx, float hy, float hradius, float hheight); 59 | TCODLIB_API void TCOD_heightmap_dig_bezier(TCOD_heightmap_t *hm, int px[4], int py[4], float startRadius, float startDepth, float endRadius, float endDepth); 60 | TCODLIB_API void TCOD_heightmap_rain_erosion(TCOD_heightmap_t *hm, int nbDrops,float erosionCoef,float sedimentationCoef,TCOD_random_t rnd); 61 | /* TCODLIB_API void TCOD_heightmap_heat_erosion(TCOD_heightmap_t *hm, int nbPass,float minSlope,float erosionCoef,float sedimentationCoef,TCOD_random_t rnd); */ 62 | TCODLIB_API void TCOD_heightmap_kernel_transform(TCOD_heightmap_t *hm, int kernelsize, const int *dx, const int *dy, const float *weight, float minLevel,float maxLevel); 63 | TCODLIB_API void TCOD_heightmap_add_voronoi(TCOD_heightmap_t *hm, int nbPoints, int nbCoef, const float *coef,TCOD_random_t rnd); 64 | /* TCODLIB_API void TCOD_heightmap_mid_point_deplacement(TCOD_heightmap_t *hm, TCOD_random_t rnd); */ 65 | TCODLIB_API void TCOD_heightmap_add_fbm(TCOD_heightmap_t *hm, TCOD_noise_t noise,float mulx, float muly, float addx, float addy, float octaves, float delta, float scale); 66 | TCODLIB_API void TCOD_heightmap_scale_fbm(TCOD_heightmap_t *hm, TCOD_noise_t noise,float mulx, float muly, float addx, float addy, float octaves, float delta, float scale); 67 | TCODLIB_API void TCOD_heightmap_islandify(TCOD_heightmap_t *hm, float seaLevel,TCOD_random_t rnd); 68 | 69 | #endif 70 | 71 | -------------------------------------------------------------------------------- /tcod/include/image.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libtcod 1.5.1 3 | * Copyright (c) 2008,2009,2010 Jice & Mingos 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * The name of Jice or Mingos may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY JICE AND MINGOS ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL JICE OR MINGOS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | typedef void *TCOD_image_t; 29 | 30 | TCODLIB_API TCOD_image_t TCOD_image_new(int width, int height); 31 | TCODLIB_API TCOD_image_t TCOD_image_from_console(TCOD_console_t console); 32 | TCODLIB_API void TCOD_image_refresh_console(TCOD_image_t image, TCOD_console_t console); 33 | TCODLIB_API TCOD_image_t TCOD_image_load(const char *filename); 34 | TCODLIB_API void TCOD_image_clear(TCOD_image_t image, TCOD_color_t color); 35 | TCODLIB_API void TCOD_image_invert(TCOD_image_t image); 36 | TCODLIB_API void TCOD_image_hflip(TCOD_image_t image); 37 | TCODLIB_API void TCOD_image_rotate90(TCOD_image_t image, int numRotations); 38 | TCODLIB_API void TCOD_image_vflip(TCOD_image_t image); 39 | TCODLIB_API void TCOD_image_scale(TCOD_image_t image, int neww, int newh); 40 | TCODLIB_API void TCOD_image_save(TCOD_image_t image, const char *filename); 41 | TCODLIB_API void TCOD_image_get_size(TCOD_image_t image, int *w,int *h); 42 | TCODLIB_API TCOD_color_t TCOD_image_get_pixel(TCOD_image_t image,int x, int y); 43 | TCODLIB_API int TCOD_image_get_alpha(TCOD_image_t image,int x, int y); 44 | TCODLIB_API TCOD_color_t TCOD_image_get_mipmap_pixel(TCOD_image_t image,float x0,float y0, float x1, float y1); 45 | TCODLIB_API void TCOD_image_put_pixel(TCOD_image_t image,int x, int y,TCOD_color_t col); 46 | TCODLIB_API void TCOD_image_blit(TCOD_image_t image, TCOD_console_t console, float x, float y, 47 | TCOD_bkgnd_flag_t bkgnd_flag, float scalex, float scaley, float angle); 48 | TCODLIB_API void TCOD_image_blit_rect(TCOD_image_t image, TCOD_console_t console, int x, int y, int w, int h, 49 | TCOD_bkgnd_flag_t bkgnd_flag); 50 | TCODLIB_API void TCOD_image_blit_2x(TCOD_image_t image, TCOD_console_t dest, int dx, int dy, int sx, int sy, int w, int h); 51 | TCODLIB_API void TCOD_image_delete(TCOD_image_t image); 52 | TCODLIB_API void TCOD_image_set_key_color(TCOD_image_t image, TCOD_color_t key_color); 53 | TCODLIB_API bool TCOD_image_is_pixel_transparent(TCOD_image_t image, int x, int y); 54 | 55 | -------------------------------------------------------------------------------- /tcod/include/lex.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libtcod 1.5.1 3 | * Copyright (c) 2008,2009,2010 Jice & Mingos 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * The name of Jice or Mingos may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY JICE AND MINGOS ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL JICE OR MINGOS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef _TCOD_LEX_H 29 | #define _TCOD_LEX_H 30 | /* 31 | * This is a libtcod internal module. 32 | * Use at your own risks... 33 | */ 34 | 35 | #define TCOD_LEX_FLAG_NOCASE 1 36 | #define TCOD_LEX_FLAG_NESTING_COMMENT 2 37 | #define TCOD_LEX_FLAG_TOKENIZE_COMMENTS 4 38 | 39 | #define TCOD_LEX_ERROR -1 40 | #define TCOD_LEX_UNKNOWN 0 41 | #define TCOD_LEX_SYMBOL 1 42 | #define TCOD_LEX_KEYWORD 2 43 | #define TCOD_LEX_IDEN 3 44 | #define TCOD_LEX_STRING 4 45 | #define TCOD_LEX_INTEGER 5 46 | #define TCOD_LEX_FLOAT 6 47 | #define TCOD_LEX_CHAR 7 48 | #define TCOD_LEX_EOF 8 49 | #define TCOD_LEX_COMMENT 9 50 | 51 | #define TCOD_LEX_MAX_SYMBOLS 100 52 | #define TCOD_LEX_SYMBOL_SIZE 5 53 | #define TCOD_LEX_MAX_KEYWORDS 100 54 | #define TCOD_LEX_KEYWORD_SIZE 20 55 | 56 | typedef struct { 57 | int file_line, token_type, token_int_val, token_idx; 58 | float token_float_val; 59 | char *tok; 60 | int toklen; 61 | char lastStringDelim; 62 | char *pos; 63 | char *buf; 64 | char *filename; 65 | char *last_javadoc_comment; 66 | /* private stuff */ 67 | int nb_symbols, nb_keywords, flags; 68 | char symbols[ TCOD_LEX_MAX_SYMBOLS][ TCOD_LEX_SYMBOL_SIZE ], 69 | keywords[ TCOD_LEX_MAX_KEYWORDS ][ TCOD_LEX_KEYWORD_SIZE ]; 70 | const char *simpleCmt; 71 | const char *cmtStart, *cmtStop, *javadocCmtStart; 72 | const char *stringDelim; 73 | bool javadoc_read; 74 | bool allocBuf; 75 | bool savept; /* is this object a savepoint (no free in destructor) */ 76 | } TCOD_lex_t; 77 | 78 | TCODLIB_API TCOD_lex_t *TCOD_lex_new_intern(); 79 | TCODLIB_API TCOD_lex_t *TCOD_lex_new(const char **symbols, const char **keywords, const char *simpleComment, 80 | const char *commentStart, const char *commentStop, const char *javadocCommentStart, const char *stringDelim, int flags); 81 | TCODLIB_API void TCOD_lex_delete(TCOD_lex_t *lex); 82 | 83 | TCODLIB_API void TCOD_lex_set_data_buffer(TCOD_lex_t *lex,char *dat); 84 | TCODLIB_API bool TCOD_lex_set_data_file(TCOD_lex_t *lex,const char *filename); 85 | 86 | TCODLIB_API int TCOD_lex_parse(TCOD_lex_t *lex); 87 | TCODLIB_API int TCOD_lex_parse_until_token_type(TCOD_lex_t *lex,int token_type); 88 | TCODLIB_API int TCOD_lex_parse_until_token_value(TCOD_lex_t *lex,const char *token_value); 89 | 90 | TCODLIB_API bool TCOD_lex_expect_token_type(TCOD_lex_t *lex,int token_type); 91 | TCODLIB_API bool TCOD_lex_expect_token_value(TCOD_lex_t *lex,int token_type,const char *token_value); 92 | 93 | TCODLIB_API void TCOD_lex_savepoint(TCOD_lex_t *lex,TCOD_lex_t *savept); 94 | TCODLIB_API void TCOD_lex_restore(TCOD_lex_t *lex,TCOD_lex_t *savept); 95 | TCODLIB_API char *TCOD_lex_get_last_javadoc(TCOD_lex_t *lex); 96 | TCODLIB_API const char *TCOD_lex_get_token_name(int token_type); 97 | TCODLIB_API char *TCOD_lex_get_last_error(); 98 | 99 | TCODLIB_API int TCOD_lex_hextoint(char c); 100 | 101 | #endif 102 | -------------------------------------------------------------------------------- /tcod/include/libtcod.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libtcod 1.5.1 3 | * Copyright (c) 2008,2009,2010 Jice & Mingos 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * The name of Jice or Mingos may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY JICE AND MINGOS ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL JICE OR MINGOS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef _TCODLIB_H 29 | #define _TCODLIB_H 30 | 31 | /* uncomment to disable unicode support */ 32 | /*#define NO_UNICODE */ 33 | 34 | /* uncomment to disable opengl support */ 35 | /*#define NO_OPENGL */ 36 | 37 | /* os identification 38 | TCOD_WINDOWS : OS is windows 39 | TCOD_LINUX : OS is Linux 40 | TCOD_MACOSX : OS is Mac OS X 41 | TCOD_HAIKU : OS is Haiku */ 42 | 43 | /* compiler identification 44 | TCOD_VISUAL_STUDIO : compiler is Microsoft Visual Studio 45 | TCOD_MINGW32 : compiler is Mingw32 46 | TCOD_GCC : compiler is gcc/g++ */ 47 | 48 | /* word size 49 | TCOD_64BITS : 64 bits OS 50 | TCOD_WIN64 : 64 bits Windows 51 | TCOD_WIN32 : 32 bits Windows 52 | TCOD_LINUX64 : 64 bits Linux 53 | TCOD_LINUX32 : 32 bits Linux */ 54 | 55 | #if defined( _MSC_VER ) 56 | # define TCOD_VISUAL_STUDIO 57 | # define TCOD_WINDOWS 58 | # ifdef _WIN64 59 | # define TCOD_WIN64 60 | # define TCOD_64BITS 61 | # else 62 | # define TCOD_WIN32 63 | # endif 64 | #elif defined( __MINGW32__ ) 65 | # define TCOD_WINDOWS 66 | # define TCOD_MINGW32 67 | # define TCOD_WIN32 68 | #elif defined( __HAIKU__ ) 69 | # define TCOD_HAIKU 70 | # define TCOD_GCC 71 | # if __WORDSIZE == 64 72 | # define TCOD_64BITS 73 | # endif 74 | #elif defined( __linux ) 75 | # define TCOD_LINUX 76 | # define TCOD_GCC 77 | # if __WORDSIZE == 64 78 | # define TCOD_LINUX64 79 | # define TCOD_64BITS 80 | # else 81 | # define TCOD_LINUX32 82 | # endif 83 | #elif defined (__APPLE__) && defined (__MACH__) 84 | # define TCOD_MACOSX 85 | # define TCOD_GCC 86 | #endif 87 | 88 | /* unicode rendering functions support */ 89 | #ifndef NO_UNICODE 90 | #include 91 | #endif 92 | 93 | /* This is a hack. SDL by default want you to rename your main statement, and insert it's own first 94 | It does that to handle some init code. However, libtcod handles that for you. If we did this 95 | wrappers like libtcod-net would be hosed, since there is no main statement there. */ 96 | #ifdef TCOD_MACOSX 97 | #define _SDL_main_h 98 | #include "SDL/SDL.h" 99 | #endif 100 | 101 | /* base types */ 102 | typedef unsigned char uint8; 103 | typedef char int8; 104 | typedef unsigned short uint16; 105 | typedef short int16; 106 | typedef unsigned int uint32; 107 | typedef int int32; 108 | /* int with the same size as a pointer (32 or 64 depending on OS) */ 109 | typedef long intptr; 110 | typedef unsigned long uintptr; 111 | 112 | #define TCOD_HEXVERSION 0x010501 113 | #define TCOD_STRVERSION "1.5.1" 114 | #define TCOD_TECHVERSION 0x01050101 115 | 116 | /* bool support for C */ 117 | #ifndef __cplusplus 118 | #ifndef bool 119 | typedef uint8 bool; 120 | #define false ((bool)0) 121 | #define true ((bool)1) 122 | #endif 123 | #else 124 | /* in C++ all C functions prototypes should use uint8 instead of bool */ 125 | #define bool uint8 126 | #endif 127 | 128 | /* DLL export */ 129 | #ifdef TCOD_WINDOWS 130 | #ifdef LIBTCOD_EXPORTS 131 | #define TCODLIB_API __declspec(dllexport) 132 | #else 133 | #define TCODLIB_API __declspec(dllimport) 134 | #endif 135 | #else 136 | #define TCODLIB_API 137 | #endif 138 | 139 | #ifdef __cplusplus 140 | extern "C" { 141 | #endif 142 | 143 | /* ansi C lacks support for those functions */ 144 | TCODLIB_API char *TCOD_strdup(const char *s); 145 | TCODLIB_API int TCOD_strcasecmp(const char *s1, const char *s2); 146 | TCODLIB_API int TCOD_strncasecmp(const char *s1, const char *s2, size_t n); 147 | 148 | #if defined(TCOD_WINDOWS) 149 | char *strcasestr (const char *haystack, const char *needle); 150 | #endif 151 | #if defined(TCOD_LINUX) || defined(TCOD_HAIKU) 152 | #define vsnwprintf vswprintf 153 | #endif 154 | #ifdef TCOD_MACOSX 155 | #define vsnwprintf vswprintf 156 | #endif 157 | #ifdef TCOD_WINDOWS 158 | #define vsnwprintf _vsnwprintf 159 | #endif 160 | 161 | /****************************************** 162 | utility macros 163 | ******************************************/ 164 | #define MAX(a,b) ((a)<(b)?(b):(a)) 165 | #define MIN(a,b) ((a)>(b)?(b):(a)) 166 | #define ABS(a) ((a)<0?-(a):(a)) 167 | #define CLAMP(a, b, x) ((x) < (a) ? (a) : ((x) > (b) ? (b) : (x))) 168 | #define LERP(a, b, x) ( a + x * (b - a) ) 169 | 170 | #include "list.h" 171 | #include "color.h" 172 | #include "console.h" 173 | #include "image.h" 174 | #include "sys.h" 175 | #include "mersenne.h" 176 | #include "mouse.h" 177 | #include "bresenham.h" 178 | #include "noise.h" 179 | #include "fov.h" 180 | #include "path.h" 181 | #include "lex.h" 182 | #include "parser.h" 183 | #include "tree.h" 184 | #include "bsp.h" 185 | #include "heightmap.h" 186 | #include "zip.h" 187 | #include "namegen.h" 188 | #include "txtfield.h" 189 | #ifdef __cplusplus 190 | #undef bool 191 | } 192 | #endif 193 | 194 | #endif 195 | -------------------------------------------------------------------------------- /tcod/include/libtcod_int.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libtcod 1.5.1 3 | * Copyright (c) 2008,2009,2010 Jice & Mingos 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * The name of Jice or Mingos may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY JICE AND MINGOS ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL JICE OR MINGOS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef _TCODLIB_INT_H 29 | #define _TCODLIB_INT_H 30 | #include 31 | #include 32 | /* tcodlib internal stuff */ 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* a cell in the console */ 38 | typedef struct { 39 | int c; /* character ascii code */ 40 | int cf; /* character number in font */ 41 | TCOD_color_t fore; /* foreground color */ 42 | TCOD_color_t back; /* background color */ 43 | uint8 dirt; /* cell modified since last flush ? */ 44 | } char_t; 45 | 46 | /* TCODConsole non public data */ 47 | typedef struct { 48 | char_t *buf; /* current console */ 49 | char_t *oldbuf; /* console for last frame */ 50 | /* console width and height (in characters,not pixels) */ 51 | int w,h; 52 | /* default background operator for print & print_rect functions */ 53 | TCOD_bkgnd_flag_t bkgnd_flag; 54 | /* default alignment for print & print_rect functions */ 55 | TCOD_alignment_t alignment; 56 | /* foreground (text), background and key colors */ 57 | TCOD_color_t fore,back,key; 58 | uint8 fade; 59 | bool haskey; /* a key color has been defined */ 60 | } TCOD_console_data_t; 61 | 62 | /* fov internal stuff */ 63 | typedef struct { 64 | bool transparent:1; 65 | bool walkable:1; 66 | bool fov:1; 67 | } cell_t; 68 | typedef struct { 69 | int width; 70 | int height; 71 | int nbcells; 72 | cell_t *cells; 73 | } map_t; 74 | 75 | /* pseudorandom number generator toolkit */ 76 | typedef struct { 77 | /* algorithm identifier */ 78 | TCOD_random_algo_t algo; 79 | /* distribution */ 80 | TCOD_distribution_t distribution; 81 | /* Mersenne Twister stuff */ 82 | uint32 mt[624]; 83 | int cur_mt; 84 | /* Complementary-Multiply-With-Carry stuff */ 85 | /* shared with Generalised Feedback Shift Register */ 86 | uint32 Q[4096], c; 87 | int cur; 88 | } mersenne_data_t; 89 | 90 | typedef struct { 91 | /* number of characters in the bitmap font */ 92 | int fontNbCharHoriz; 93 | int fontNbCharVertic; 94 | /* font type and layout */ 95 | bool font_tcod_layout; 96 | bool font_in_row; 97 | bool font_greyscale; 98 | /* character size in font */ 99 | int font_width; 100 | int font_height; 101 | char font_file[512]; 102 | char window_title[512]; 103 | /* ascii code to tcod layout converter */ 104 | int *ascii_to_tcod; 105 | /* the root console */ 106 | TCOD_console_data_t *root; 107 | /* nb chars in the font */ 108 | int max_font_chars; 109 | /* fullscreen data */ 110 | bool fullscreen; 111 | int fullscreen_offsetx; 112 | int fullscreen_offsety; 113 | /* asked by the user */ 114 | int fullscreen_width; 115 | int fullscreen_height; 116 | /* actual resolution */ 117 | int actual_fullscreen_width; 118 | int actual_fullscreen_height; 119 | /* renderer to use */ 120 | TCOD_renderer_t renderer; 121 | /* user post-processing callback */ 122 | SDL_renderer_t sdl_cbk; 123 | /* fading data */ 124 | TCOD_color_t fading_color; 125 | uint8 fade; 126 | } TCOD_internal_context_t; 127 | 128 | extern TCOD_internal_context_t TCOD_ctx; 129 | 130 | #ifdef NDEBUG 131 | #define TCOD_IF(x) if (x) 132 | #define TCOD_IFNOT(x) if (!(x)) 133 | #define TCOD_ASSERT(x) 134 | #define TCOD_LOG(x) 135 | #else 136 | #define TCOD_IF(x) assert(x); 137 | #define TCOD_IFNOT(x) assert(x); if (0) 138 | #define TCOD_ASSERT(x) assert(x) 139 | #define TCOD_LOG(x) printf x 140 | #endif 141 | 142 | #ifndef NO_OPENGL 143 | /* opengl utilities */ 144 | void TCOD_opengl_init_attributes(); 145 | bool TCOD_opengl_init_state(int conw, int conh, void *font_tex); 146 | bool TCOD_opengl_init_shaders(); 147 | bool TCOD_opengl_render(int oldFade, bool *ascii_updated, char_t *console_buffer, char_t *prev_console_buffer); 148 | void TCOD_opengl_swap(); 149 | void * TCOD_opengl_get_screen(); 150 | #endif 151 | 152 | /* fov internal stuff */ 153 | void TCOD_map_compute_fov_circular_raycasting(TCOD_map_t map, int player_x, int player_y, int max_radius, bool light_walls); 154 | void TCOD_map_compute_fov_diamond_raycasting(TCOD_map_t map, int player_x, int player_y, int max_radius, bool light_walls); 155 | void TCOD_map_compute_fov_recursive_shadowcasting(TCOD_map_t map, int player_x, int player_y, int max_radius, bool light_walls); 156 | void TCOD_map_compute_fov_permissive2(TCOD_map_t map, int player_x, int player_y, int max_radius, bool light_walls, int fovType); 157 | void TCOD_map_compute_fov_restrictive_shadowcasting(TCOD_map_t map, int player_x, int player_y, int max_radius, bool light_walls); 158 | void TCOD_map_postproc(map_t *map,int x0,int y0, int x1, int y1, int dx, int dy); 159 | 160 | /* TCODConsole non public methods*/ 161 | bool TCOD_console_init(TCOD_console_t con,const char *title, bool fullscreen); 162 | int TCOD_console_print_internal(TCOD_console_t con,int x,int y, int w, int h, TCOD_bkgnd_flag_t flag, TCOD_alignment_t align, char *msg, bool can_split, bool count_only); 163 | int TCOD_console_stringLength(const char *s); 164 | char * TCOD_console_forward(char *s,int l); 165 | void TCOD_console_set_window_closed(); 166 | char *TCOD_console_vsprint(const char *fmt, va_list ap); 167 | char_t *TCOD_console_get_buf(TCOD_console_t con); 168 | /* fatal errors */ 169 | void TCOD_fatal(const char *fmt, ...); 170 | void TCOD_fatal_nopar(const char *msg); 171 | 172 | /* TCODSystem non public methods */ 173 | void TCOD_sys_startup(); 174 | bool TCOD_sys_init(int w,int h, char_t *buf, char_t *oldbuf, bool fullscreen); 175 | void TCOD_sys_set_custom_font(const char *font_name,int nb_ch, int nb_cv,int flags); 176 | void TCOD_sys_map_ascii_to_font(int asciiCode, int fontCharX, int fontCharY); 177 | void *TCOD_sys_create_bitmap_for_console(TCOD_console_t console); 178 | void TCOD_sys_save_bitmap(void *bitmap, const char *filename); 179 | void *TCOD_sys_create_bitmap(int width, int height, TCOD_color_t *buf); 180 | void TCOD_sys_delete_bitmap(void *bitmap); 181 | void TCOD_sys_console_to_bitmap(void *bitmap, int console_width, int console_height, char_t *console_buffer, char_t *prev_console_buffer); 182 | void TCOD_sys_set_keyboard_repeat(int initial_delay, int interval); 183 | TCODLIB_API void *TCOD_sys_get_surface(int width, int height, bool alpha); 184 | void TCOD_sys_save_fps(); 185 | void TCOD_sys_restore_fps(); 186 | 187 | /* switch fullscreen mode */ 188 | void TCOD_sys_set_fullscreen(bool fullscreen); 189 | void TCOD_sys_flush(bool render); 190 | TCOD_key_t TCOD_sys_check_for_keypress(int flags); 191 | TCOD_key_t TCOD_sys_wait_for_keypress(bool flush); 192 | bool TCOD_sys_is_key_pressed(TCOD_keycode_t key); 193 | void TCOD_sys_set_window_title(const char *title); 194 | /* close the window */ 195 | void TCOD_sys_term(); 196 | 197 | /* UTF-8 stuff */ 198 | #ifndef NO_UNICODE 199 | wchar_t *TCOD_console_vsprint_utf(const wchar_t *fmt, va_list ap); 200 | int TCOD_console_print_internal_utf(TCOD_console_t con,int x,int y, int rw, int rh, TCOD_bkgnd_flag_t flag, 201 | TCOD_alignment_t align, wchar_t *msg, bool can_split, bool count_only); 202 | #endif 203 | 204 | /* image manipulation */ 205 | TCODLIB_API void *TCOD_sys_load_image(const char *filename); 206 | void TCOD_sys_get_image_size(const void *image, int *w,int *h); 207 | TCOD_color_t TCOD_sys_get_image_pixel(const void *image,int x, int y); 208 | int TCOD_sys_get_image_alpha(const void *image,int x, int y); 209 | bool TCOD_sys_check_magic_number(const char *filename, int size, uint8 *data); 210 | 211 | /* TCOD_list nonpublic methods */ 212 | void TCOD_list_set_size(TCOD_list_t l, int size); 213 | 214 | /* color values */ 215 | #define TCOD_BLACK 0,0,0 216 | #define TCOD_DARKEST_GREY 31,31,31 217 | #define TCOD_DARKER_GREY 63,63,63 218 | #define TCOD_DARK_GREY 95,95,95 219 | #define TCOD_GREY 127,127,127 220 | #define TCOD_LIGHT_GREY 159,159,159 221 | #define TCOD_LIGHTER_GREY 191,191,191 222 | #define TCOD_LIGHTEST_GREY 223,223,223 223 | #define TCOD_WHITE 255,255,255 224 | 225 | #define TCOD_DARKEST_SEPIA 31,24,15 226 | #define TCOD_DARKER_SEPIA 63,50,31 227 | #define TCOD_DARK_SEPIA 94,75,47 228 | #define TCOD_SEPIA 127,101,63 229 | #define TCOD_LIGHT_SEPIA 158,134,100 230 | #define TCOD_LIGHTER_SEPIA 191,171,143 231 | #define TCOD_LIGHTEST_SEPIA 222,211,195 232 | 233 | /* desaturated */ 234 | #define TCOD_DESATURATED_RED 127,63,63 235 | #define TCOD_DESATURATED_FLAME 127,79,63 236 | #define TCOD_DESATURATED_ORANGE 127,95,63 237 | #define TCOD_DESATURATED_AMBER 127,111,63 238 | #define TCOD_DESATURATED_YELLOW 127,127,63 239 | #define TCOD_DESATURATED_LIME 111,127,63 240 | #define TCOD_DESATURATED_CHARTREUSE 95,127,63 241 | #define TCOD_DESATURATED_GREEN 63,127,63 242 | #define TCOD_DESATURATED_SEA 63,127,95 243 | #define TCOD_DESATURATED_TURQUOISE 63,127,111 244 | #define TCOD_DESATURATED_CYAN 63,127,127 245 | #define TCOD_DESATURATED_SKY 63,111,127 246 | #define TCOD_DESATURATED_AZURE 63,95,127 247 | #define TCOD_DESATURATED_BLUE 63,63,127 248 | #define TCOD_DESATURATED_HAN 79,63,127 249 | #define TCOD_DESATURATED_VIOLET 95,63,127 250 | #define TCOD_DESATURATED_PURPLE 111,63,127 251 | #define TCOD_DESATURATED_FUCHSIA 127,63,127 252 | #define TCOD_DESATURATED_MAGENTA 127,63,111 253 | #define TCOD_DESATURATED_PINK 127,63,95 254 | #define TCOD_DESATURATED_CRIMSON 127,63,79 255 | 256 | /* lightest */ 257 | #define TCOD_LIGHTEST_RED 255,191,191 258 | #define TCOD_LIGHTEST_FLAME 255,207,191 259 | #define TCOD_LIGHTEST_ORANGE 255,223,191 260 | #define TCOD_LIGHTEST_AMBER 255,239,191 261 | #define TCOD_LIGHTEST_YELLOW 255,255,191 262 | #define TCOD_LIGHTEST_LIME 239,255,191 263 | #define TCOD_LIGHTEST_CHARTREUSE 223,255,191 264 | #define TCOD_LIGHTEST_GREEN 191,255,191 265 | #define TCOD_LIGHTEST_SEA 191,255,223 266 | #define TCOD_LIGHTEST_TURQUOISE 191,255,239 267 | #define TCOD_LIGHTEST_CYAN 191,255,255 268 | #define TCOD_LIGHTEST_SKY 191,239,255 269 | #define TCOD_LIGHTEST_AZURE 191,223,255 270 | #define TCOD_LIGHTEST_BLUE 191,191,255 271 | #define TCOD_LIGHTEST_HAN 207,191,255 272 | #define TCOD_LIGHTEST_VIOLET 223,191,255 273 | #define TCOD_LIGHTEST_PURPLE 239,191,255 274 | #define TCOD_LIGHTEST_FUCHSIA 255,191,255 275 | #define TCOD_LIGHTEST_MAGENTA 255,191,239 276 | #define TCOD_LIGHTEST_PINK 255,191,223 277 | #define TCOD_LIGHTEST_CRIMSON 255,191,207 278 | 279 | /* lighter */ 280 | #define TCOD_LIGHTER_RED 255,127,127 281 | #define TCOD_LIGHTER_FLAME 255,159,127 282 | #define TCOD_LIGHTER_ORANGE 255,191,127 283 | #define TCOD_LIGHTER_AMBER 255,223,127 284 | #define TCOD_LIGHTER_YELLOW 255,255,127 285 | #define TCOD_LIGHTER_LIME 223,255,127 286 | #define TCOD_LIGHTER_CHARTREUSE 191,255,127 287 | #define TCOD_LIGHTER_GREEN 127,255,127 288 | #define TCOD_LIGHTER_SEA 127,255,191 289 | #define TCOD_LIGHTER_TURQUOISE 127,255,223 290 | #define TCOD_LIGHTER_CYAN 127,255,255 291 | #define TCOD_LIGHTER_SKY 127,223,255 292 | #define TCOD_LIGHTER_AZURE 127,191,255 293 | #define TCOD_LIGHTER_BLUE 127,127,255 294 | #define TCOD_LIGHTER_HAN 159,127,255 295 | #define TCOD_LIGHTER_VIOLET 191,127,255 296 | #define TCOD_LIGHTER_PURPLE 223,127,255 297 | #define TCOD_LIGHTER_FUCHSIA 255,127,255 298 | #define TCOD_LIGHTER_MAGENTA 255,127,223 299 | #define TCOD_LIGHTER_PINK 255,127,191 300 | #define TCOD_LIGHTER_CRIMSON 255,127,159 301 | 302 | /* light */ 303 | #define TCOD_LIGHT_RED 255,63,63 304 | #define TCOD_LIGHT_FLAME 255,111,63 305 | #define TCOD_LIGHT_ORANGE 255,159,63 306 | #define TCOD_LIGHT_AMBER 255,207,63 307 | #define TCOD_LIGHT_YELLOW 255,255,63 308 | #define TCOD_LIGHT_LIME 207,255,63 309 | #define TCOD_LIGHT_CHARTREUSE 159,255,63 310 | #define TCOD_LIGHT_GREEN 63,255,63 311 | #define TCOD_LIGHT_SEA 63,255,159 312 | #define TCOD_LIGHT_TURQUOISE 63,255,207 313 | #define TCOD_LIGHT_CYAN 63,255,255 314 | #define TCOD_LIGHT_SKY 63,207,255 315 | #define TCOD_LIGHT_AZURE 63,159,255 316 | #define TCOD_LIGHT_BLUE 63,63,255 317 | #define TCOD_LIGHT_HAN 111,63,255 318 | #define TCOD_LIGHT_VIOLET 159,63,255 319 | #define TCOD_LIGHT_PURPLE 207,63,255 320 | #define TCOD_LIGHT_FUCHSIA 255,63,255 321 | #define TCOD_LIGHT_MAGENTA 255,63,207 322 | #define TCOD_LIGHT_PINK 255,63,159 323 | #define TCOD_LIGHT_CRIMSON 255,63,111 324 | 325 | /* normal */ 326 | #define TCOD_RED 255,0,0 327 | #define TCOD_FLAME 255,63,0 328 | #define TCOD_ORANGE 255,127,0 329 | #define TCOD_AMBER 255,191,0 330 | #define TCOD_YELLOW 255,255,0 331 | #define TCOD_LIME 191,255,0 332 | #define TCOD_CHARTREUSE 127,255,0 333 | #define TCOD_GREEN 0,255,0 334 | #define TCOD_SEA 0,255,127 335 | #define TCOD_TURQUOISE 0,255,191 336 | #define TCOD_CYAN 0,255,255 337 | #define TCOD_SKY 0,191,255 338 | #define TCOD_AZURE 0,127,255 339 | #define TCOD_BLUE 0,0,255 340 | #define TCOD_HAN 63,0,255 341 | #define TCOD_VIOLET 127,0,255 342 | #define TCOD_PURPLE 191,0,255 343 | #define TCOD_FUCHSIA 255,0,255 344 | #define TCOD_MAGENTA 255,0,191 345 | #define TCOD_PINK 255,0,127 346 | #define TCOD_CRIMSON 255,0,63 347 | 348 | /* dark */ 349 | #define TCOD_DARK_RED 191,0,0 350 | #define TCOD_DARK_FLAME 191,47,0 351 | #define TCOD_DARK_ORANGE 191,95,0 352 | #define TCOD_DARK_AMBER 191,143,0 353 | #define TCOD_DARK_YELLOW 191,191,0 354 | #define TCOD_DARK_LIME 143,191,0 355 | #define TCOD_DARK_CHARTREUSE 95,191,0 356 | #define TCOD_DARK_GREEN 0,191,0 357 | #define TCOD_DARK_SEA 0,191,95 358 | #define TCOD_DARK_TURQUOISE 0,191,143 359 | #define TCOD_DARK_CYAN 0,191,191 360 | #define TCOD_DARK_SKY 0,143,191 361 | #define TCOD_DARK_AZURE 0,95,191 362 | #define TCOD_DARK_BLUE 0,0,191 363 | #define TCOD_DARK_HAN 47,0,191 364 | #define TCOD_DARK_VIOLET 95,0,191 365 | #define TCOD_DARK_PURPLE 143,0,191 366 | #define TCOD_DARK_FUCHSIA 191,0,191 367 | #define TCOD_DARK_MAGENTA 191,0,143 368 | #define TCOD_DARK_PINK 191,0,95 369 | #define TCOD_DARK_CRIMSON 191,0,47 370 | 371 | /* darker */ 372 | #define TCOD_DARKER_RED 127,0,0 373 | #define TCOD_DARKER_FLAME 127,31,0 374 | #define TCOD_DARKER_ORANGE 127,63,0 375 | #define TCOD_DARKER_AMBER 127,95,0 376 | #define TCOD_DARKER_YELLOW 127,127,0 377 | #define TCOD_DARKER_LIME 95,127,0 378 | #define TCOD_DARKER_CHARTREUSE 63,127,0 379 | #define TCOD_DARKER_GREEN 0,127,0 380 | #define TCOD_DARKER_SEA 0,127,63 381 | #define TCOD_DARKER_TURQUOISE 0,127,95 382 | #define TCOD_DARKER_CYAN 0,127,127 383 | #define TCOD_DARKER_SKY 0,95,127 384 | #define TCOD_DARKER_AZURE 0,63,127 385 | #define TCOD_DARKER_BLUE 0,0,127 386 | #define TCOD_DARKER_HAN 31,0,127 387 | #define TCOD_DARKER_VIOLET 63,0,127 388 | #define TCOD_DARKER_PURPLE 95,0,127 389 | #define TCOD_DARKER_FUCHSIA 127,0,127 390 | #define TCOD_DARKER_MAGENTA 127,0,95 391 | #define TCOD_DARKER_PINK 127,0,63 392 | #define TCOD_DARKER_CRIMSON 127,0,31 393 | 394 | /* darkest */ 395 | #define TCOD_DARKEST_RED 63,0,0 396 | #define TCOD_DARKEST_FLAME 63,15,0 397 | #define TCOD_DARKEST_ORANGE 63,31,0 398 | #define TCOD_DARKEST_AMBER 63,47,0 399 | #define TCOD_DARKEST_YELLOW 63,63,0 400 | #define TCOD_DARKEST_LIME 47,63,0 401 | #define TCOD_DARKEST_CHARTREUSE 31,63,0 402 | #define TCOD_DARKEST_GREEN 0,63,0 403 | #define TCOD_DARKEST_SEA 0,63,31 404 | #define TCOD_DARKEST_TURQUOISE 0,63,47 405 | #define TCOD_DARKEST_CYAN 0,63,63 406 | #define TCOD_DARKEST_SKY 0,47,63 407 | #define TCOD_DARKEST_AZURE 0,31,63 408 | #define TCOD_DARKEST_BLUE 0,0,63 409 | #define TCOD_DARKEST_HAN 15,0,63 410 | #define TCOD_DARKEST_VIOLET 31,0,63 411 | #define TCOD_DARKEST_PURPLE 47,0,63 412 | #define TCOD_DARKEST_FUCHSIA 63,0,63 413 | #define TCOD_DARKEST_MAGENTA 63,0,47 414 | #define TCOD_DARKEST_PINK 63,0,31 415 | #define TCOD_DARKEST_CRIMSON 63,0,15 416 | 417 | /* metallic */ 418 | #define TCOD_BRASS 191,151,96 419 | #define TCOD_COPPER 197,136,124 420 | #define TCOD_GOLD 229,191,0 421 | #define TCOD_SILVER 203,203,203 422 | 423 | /* miscellaneous */ 424 | #define TCOD_CELADON 172,255,175 425 | #define TCOD_PEACH 255,159,127 426 | 427 | #ifdef __cplusplus 428 | } 429 | #endif 430 | #endif 431 | 432 | -------------------------------------------------------------------------------- /tcod/include/list.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libtcod 1.5.1 3 | * Copyright (c) 2008,2009,2010 Jice & Mingos 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * The name of Jice or Mingos may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY JICE AND MINGOS ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL JICE OR MINGOS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef _TCOD_LIST_H 29 | #define _TCOD_LIST_H 30 | 31 | typedef void *TCOD_list_t; 32 | 33 | TCODLIB_API TCOD_list_t TCOD_list_new(); 34 | TCODLIB_API TCOD_list_t TCOD_list_allocate(int nb_elements); 35 | TCODLIB_API TCOD_list_t TCOD_list_duplicate(TCOD_list_t l); 36 | TCODLIB_API void TCOD_list_delete(TCOD_list_t l); 37 | TCODLIB_API void TCOD_list_push(TCOD_list_t l, const void * elt); 38 | TCODLIB_API void * TCOD_list_pop(TCOD_list_t l); 39 | TCODLIB_API void * TCOD_list_peek(TCOD_list_t l); 40 | TCODLIB_API void TCOD_list_add_all(TCOD_list_t l, TCOD_list_t l2); 41 | TCODLIB_API void * TCOD_list_get(TCOD_list_t l,int idx); 42 | TCODLIB_API void TCOD_list_set(TCOD_list_t l,const void *elt, int idx); 43 | TCODLIB_API void ** TCOD_list_begin(TCOD_list_t l); 44 | TCODLIB_API void ** TCOD_list_end(TCOD_list_t l); 45 | TCODLIB_API void TCOD_list_reverse(TCOD_list_t l); 46 | TCODLIB_API void **TCOD_list_remove_iterator(TCOD_list_t l, void **elt); 47 | TCODLIB_API void TCOD_list_remove(TCOD_list_t l, const void * elt); 48 | TCODLIB_API void **TCOD_list_remove_iterator_fast(TCOD_list_t l, void **elt); 49 | TCODLIB_API void TCOD_list_remove_fast(TCOD_list_t l, const void * elt); 50 | TCODLIB_API bool TCOD_list_contains(TCOD_list_t l,const void * elt); 51 | TCODLIB_API void TCOD_list_clear(TCOD_list_t l); 52 | TCODLIB_API void TCOD_list_clear_and_delete(TCOD_list_t l); 53 | TCODLIB_API int TCOD_list_size(TCOD_list_t l); 54 | TCODLIB_API void ** TCOD_list_insert_before(TCOD_list_t l,const void *elt,int before); 55 | TCODLIB_API bool TCOD_list_is_empty(TCOD_list_t l); 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /tcod/include/mersenne.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libtcod 1.5.1 3 | * Copyright (c) 2008,2009,2010 Jice & Mingos 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * The name of Jice or Mingos may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY JICE AND MINGOS ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL JICE OR MINGOS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef _TCOD_RANDOM_H 29 | #define _TCOD_RANDOM_H 30 | 31 | #include "mersenne_types.h" 32 | 33 | typedef void *TCOD_random_t; 34 | 35 | TCODLIB_API TCOD_random_t TCOD_random_get_instance(void); 36 | TCODLIB_API TCOD_random_t TCOD_random_new(TCOD_random_algo_t algo); 37 | TCODLIB_API TCOD_random_t TCOD_random_save(TCOD_random_t mersenne); 38 | TCODLIB_API void TCOD_random_restore(TCOD_random_t mersenne, TCOD_random_t backup); 39 | TCODLIB_API TCOD_random_t TCOD_random_new_from_seed(TCOD_random_algo_t algo, uint32 seed); 40 | TCODLIB_API void TCOD_random_delete(TCOD_random_t mersenne); 41 | 42 | TCODLIB_API void TCOD_random_set_distribution (TCOD_random_t mersenne, TCOD_distribution_t distribution); 43 | 44 | TCODLIB_API int TCOD_random_get_int (TCOD_random_t mersenne, int min, int max); 45 | TCODLIB_API float TCOD_random_get_float (TCOD_random_t mersenne, float min, float max); 46 | TCODLIB_API double TCOD_random_get_double (TCOD_random_t mersenne, double min, double max); 47 | 48 | TCODLIB_API int TCOD_random_get_int_mean (TCOD_random_t mersenne, int min, int max, int mean); 49 | TCODLIB_API float TCOD_random_get_float_mean (TCOD_random_t mersenne, float min, float max, float mean); 50 | TCODLIB_API double TCOD_random_get_double_mean (TCOD_random_t mersenne, double min, double max, double mean); 51 | 52 | TCODLIB_API TCOD_dice_t TCOD_random_dice_new (const char * s); 53 | TCODLIB_API int TCOD_random_dice_roll (TCOD_random_t mersenne, TCOD_dice_t dice); 54 | TCODLIB_API int TCOD_random_dice_roll_s (TCOD_random_t mersenne, const char * s); 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /tcod/include/mersenne_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libtcod 1.5.1 3 | * Copyright (c) 2008,2009,2010 Jice & Mingos 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * The name of Jice or Mingos may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY JICE AND MINGOS ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL JICE OR MINGOS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef _TCOD_RANDOM_TYPES_H 29 | #define _TCOD_RANDOM_TYPES_H 30 | 31 | /* dice roll */ 32 | typedef struct { 33 | int nb_rolls; 34 | int nb_faces; 35 | float multiplier; 36 | float addsub; 37 | } TCOD_dice_t; 38 | 39 | /* PRNG algorithms */ 40 | typedef enum { 41 | TCOD_RNG_MT, 42 | TCOD_RNG_CMWC 43 | } TCOD_random_algo_t; 44 | 45 | typedef enum { 46 | TCOD_DISTRIBUTION_LINEAR, 47 | TCOD_DISTRIBUTION_GAUSSIAN, 48 | TCOD_DISTRIBUTION_GAUSSIAN_RANGE, 49 | TCOD_DISTRIBUTION_GAUSSIAN_INVERSE, 50 | TCOD_DISTRIBUTION_GAUSSIAN_RANGE_INVERSE 51 | } TCOD_distribution_t; 52 | 53 | #endif /* _TCOD_RANDOM_TYPES_H */ 54 | -------------------------------------------------------------------------------- /tcod/include/mouse.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libtcod 1.5.1 3 | * Copyright (c) 2008,2009,2010 Jice & Mingos 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * The name of Jice or Mingos may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY JICE AND MINGOS ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL JICE OR MINGOS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef _TCOD_MOUSE_H 29 | #define _TCOD_MOUSE_H 30 | 31 | #include "mouse_types.h" 32 | 33 | TCODLIB_API void TCOD_mouse_show_cursor(bool visible); 34 | TCODLIB_API TCOD_mouse_t TCOD_mouse_get_status(); 35 | TCODLIB_API bool TCOD_mouse_is_cursor_visible(); 36 | TCODLIB_API void TCOD_mouse_move(int x, int y); 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /tcod/include/mouse_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libtcod 1.5.1 3 | * Copyright (c) 2008,2009,2010 Jice & Mingos 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * The name of Jice or Mingos may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY JICE AND MINGOS ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL JICE OR MINGOS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef _TCOD_MOUSE_TYPES_H 29 | #define _TCOD_MOUSE_TYPES_H 30 | 31 | /* mouse data */ 32 | typedef struct { 33 | int x,y; /* absolute position */ 34 | int dx,dy; /* movement since last update in pixels */ 35 | int cx,cy; /* cell coordinates in the root console */ 36 | int dcx,dcy; /* movement since last update in console cells */ 37 | bool lbutton ; /* left button status */ 38 | bool rbutton ; /* right button status */ 39 | bool mbutton ; /* middle button status */ 40 | bool lbutton_pressed ; /* left button pressed event */ 41 | bool rbutton_pressed ; /* right button pressed event */ 42 | bool mbutton_pressed ; /* middle button pressed event */ 43 | bool wheel_up ; /* wheel up event */ 44 | bool wheel_down ; /* wheel down event */ 45 | } TCOD_mouse_t; 46 | 47 | #endif /* _TCOD_MOUSE_TYPES_H */ 48 | -------------------------------------------------------------------------------- /tcod/include/namegen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libtcod 1.5.1 3 | * Copyright (c) 2008,2009,2010 Jice & Mingos 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * The name of Jice or Mingos may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY JICE AND MINGOS ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL JICE OR MINGOS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | /* 28 | * Mingos' NameGen 29 | * This file was written by Dominik "Mingos" Marczuk. 30 | */ 31 | 32 | #ifndef _TCOD_NAMEGEN_H 33 | #define _TCOD_NAMEGEN_H 34 | 35 | /* the generator typedef */ 36 | typedef void * TCOD_namegen_t; 37 | 38 | /* parse a file with syllable sets */ 39 | TCODLIB_API void TCOD_namegen_parse (const char * filename, TCOD_random_t random); 40 | /* generate a name */ 41 | TCODLIB_API char * TCOD_namegen_generate (char * name, bool allocate); 42 | /* generate a name using a custom generation rule */ 43 | TCODLIB_API char * TCOD_namegen_generate_custom (char * name, char * rule, bool allocate); 44 | /* retrieve the list of all available syllable set names */ 45 | TCODLIB_API TCOD_list_t TCOD_namegen_get_sets (void); 46 | /* delete a generator */ 47 | TCODLIB_API void TCOD_namegen_destroy (void); 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /tcod/include/noise.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libtcod 1.5.1 3 | * Copyright (c) 2008,2009,2010 Jice & Mingos 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * The name of Jice or Mingos may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY JICE AND MINGOS ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL JICE OR MINGOS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef _TCOD_PERLIN_H 29 | #define _TCOD_PERLIN_H 30 | 31 | typedef void *TCOD_noise_t; 32 | 33 | typedef enum { 34 | TCOD_NOISE_PERLIN = 1, 35 | TCOD_NOISE_SIMPLEX = 2, 36 | TCOD_NOISE_WAVELET = 4, 37 | TCOD_NOISE_DEFAULT = 0 38 | } TCOD_noise_type_t; 39 | 40 | #include "noise_defaults.h" 41 | 42 | /* create a new noise object */ 43 | TCODLIB_API TCOD_noise_t TCOD_noise_new(int dimensions, float hurst, float lacunarity, TCOD_random_t random); 44 | 45 | /* simplified API */ 46 | TCODLIB_API void TCOD_noise_set_type (TCOD_noise_t noise, TCOD_noise_type_t type); 47 | TCODLIB_API float TCOD_noise_get_ex (TCOD_noise_t noise, float *f, TCOD_noise_type_t type); 48 | TCODLIB_API float TCOD_noise_get_fbm_ex (TCOD_noise_t noise, float *f, float octaves, TCOD_noise_type_t type); 49 | TCODLIB_API float TCOD_noise_get_turbulence_ex (TCOD_noise_t noise, float *f, float octaves, TCOD_noise_type_t type); 50 | TCODLIB_API float TCOD_noise_get (TCOD_noise_t noise, float *f); 51 | TCODLIB_API float TCOD_noise_get_fbm (TCOD_noise_t noise, float *f, float octaves); 52 | TCODLIB_API float TCOD_noise_get_turbulence (TCOD_noise_t noise, float *f, float octaves); 53 | /* delete the noise object */ 54 | TCODLIB_API void TCOD_noise_delete(TCOD_noise_t noise); 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /tcod/include/noise_defaults.h: -------------------------------------------------------------------------------- 1 | #ifndef _TCOD_NOISE_DEFAULTS 2 | #define _TCOD_NOISE_DEFAULTS 3 | 4 | #define TCOD_NOISE_MAX_OCTAVES 128 5 | #define TCOD_NOISE_MAX_DIMENSIONS 4 6 | #define TCOD_NOISE_DEFAULT_HURST 0.5f 7 | #define TCOD_NOISE_DEFAULT_LACUNARITY 2.0f 8 | 9 | #endif /* _TCOD_NOISE_DEFAULTS */ 10 | -------------------------------------------------------------------------------- /tcod/include/parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libtcod 1.5.1 3 | * Copyright (c) 2008,2009,2010 Jice & Mingos 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * The name of Jice or Mingos may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY JICE AND MINGOS ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL JICE OR MINGOS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef _TCOD_PARSER_H 29 | #define _TCOD_PARSER_H 30 | 31 | /* generic type */ 32 | typedef enum { 33 | TCOD_TYPE_NONE, 34 | TCOD_TYPE_BOOL, 35 | TCOD_TYPE_CHAR, 36 | TCOD_TYPE_INT, 37 | TCOD_TYPE_FLOAT, 38 | TCOD_TYPE_STRING, 39 | TCOD_TYPE_COLOR, 40 | TCOD_TYPE_DICE, 41 | TCOD_TYPE_VALUELIST00, 42 | TCOD_TYPE_VALUELIST01, 43 | TCOD_TYPE_VALUELIST02, 44 | TCOD_TYPE_VALUELIST03, 45 | TCOD_TYPE_VALUELIST04, 46 | TCOD_TYPE_VALUELIST05, 47 | TCOD_TYPE_VALUELIST06, 48 | TCOD_TYPE_VALUELIST07, 49 | TCOD_TYPE_VALUELIST08, 50 | TCOD_TYPE_VALUELIST09, 51 | TCOD_TYPE_VALUELIST10, 52 | TCOD_TYPE_VALUELIST11, 53 | TCOD_TYPE_VALUELIST12, 54 | TCOD_TYPE_VALUELIST13, 55 | TCOD_TYPE_VALUELIST14, 56 | TCOD_TYPE_VALUELIST15, 57 | TCOD_TYPE_CUSTOM00, 58 | TCOD_TYPE_CUSTOM01, 59 | TCOD_TYPE_CUSTOM02, 60 | TCOD_TYPE_CUSTOM03, 61 | TCOD_TYPE_CUSTOM04, 62 | TCOD_TYPE_CUSTOM05, 63 | TCOD_TYPE_CUSTOM06, 64 | TCOD_TYPE_CUSTOM07, 65 | TCOD_TYPE_CUSTOM08, 66 | TCOD_TYPE_CUSTOM09, 67 | TCOD_TYPE_CUSTOM10, 68 | TCOD_TYPE_CUSTOM11, 69 | TCOD_TYPE_CUSTOM12, 70 | TCOD_TYPE_CUSTOM13, 71 | TCOD_TYPE_CUSTOM14, 72 | TCOD_TYPE_CUSTOM15, 73 | TCOD_TYPE_LIST=1024 74 | } TCOD_value_type_t; 75 | 76 | /* generic value */ 77 | typedef union { 78 | bool b; 79 | char c; 80 | int32 i; 81 | float f; 82 | char *s; 83 | TCOD_color_t col; 84 | TCOD_dice_t dice; 85 | TCOD_list_t list; 86 | void *custom; 87 | } TCOD_value_t; 88 | 89 | /* parser structures */ 90 | typedef void *TCOD_parser_struct_t; 91 | TCODLIB_API const char *TCOD_struct_get_name(TCOD_parser_struct_t def); 92 | TCODLIB_API void TCOD_struct_add_property(TCOD_parser_struct_t def, const char *name,TCOD_value_type_t type, bool mandatory); 93 | TCODLIB_API void TCOD_struct_add_list_property(TCOD_parser_struct_t def, const char *name,TCOD_value_type_t type, bool mandatory); 94 | TCODLIB_API void TCOD_struct_add_value_list(TCOD_parser_struct_t def,const char *name, const char **value_list, bool mandatory); 95 | TCODLIB_API void TCOD_struct_add_value_list_sized(TCOD_parser_struct_t def,const char *name, const char **value_list, int size, bool mandatory); 96 | TCODLIB_API void TCOD_struct_add_flag(TCOD_parser_struct_t def,const char *propname); 97 | TCODLIB_API void TCOD_struct_add_structure(TCOD_parser_struct_t def,TCOD_parser_struct_t sub_structure); 98 | TCODLIB_API bool TCOD_struct_is_mandatory(TCOD_parser_struct_t def,const char *propname); 99 | TCODLIB_API TCOD_value_type_t TCOD_struct_get_type(TCOD_parser_struct_t def, const char *propname); 100 | 101 | 102 | /* parser listener */ 103 | typedef struct { 104 | bool (*new_struct)(TCOD_parser_struct_t str,const char *name); 105 | bool (*new_flag)(const char *name); 106 | bool (*new_property)(const char *propname, TCOD_value_type_t type, TCOD_value_t value); 107 | bool (*end_struct)(TCOD_parser_struct_t str, const char *name); 108 | void (*error)(const char *msg); 109 | } TCOD_parser_listener_t; 110 | 111 | /* a custom type parser */ 112 | typedef TCOD_value_t (*TCOD_parser_custom_t)(TCOD_lex_t *lex, TCOD_parser_listener_t *listener, TCOD_parser_struct_t str, char *propname); 113 | 114 | /* the parser */ 115 | typedef void *TCOD_parser_t; 116 | 117 | TCODLIB_API TCOD_parser_t TCOD_parser_new(); 118 | TCODLIB_API TCOD_parser_struct_t TCOD_parser_new_struct(TCOD_parser_t parser, char *name); 119 | TCODLIB_API TCOD_value_type_t TCOD_parser_new_custom_type(TCOD_parser_t parser,TCOD_parser_custom_t custom_type_parser); 120 | TCODLIB_API void TCOD_parser_run(TCOD_parser_t parser, const char *filename, TCOD_parser_listener_t *listener); 121 | TCODLIB_API void TCOD_parser_delete(TCOD_parser_t parser); 122 | /* error during parsing. can be called by the parser listener */ 123 | TCODLIB_API void TCOD_parser_error(const char *msg, ...); 124 | /* default parser listener */ 125 | TCODLIB_API bool TCOD_parser_get_bool_property(TCOD_parser_t parser, const char *name); 126 | TCODLIB_API int TCOD_parser_get_char_property(TCOD_parser_t parser, const char *name); 127 | TCODLIB_API int TCOD_parser_get_int_property(TCOD_parser_t parser, const char *name); 128 | TCODLIB_API float TCOD_parser_get_float_property(TCOD_parser_t parser, const char *name); 129 | TCODLIB_API const char * TCOD_parser_get_string_property(TCOD_parser_t parser, const char *name); 130 | TCODLIB_API TCOD_color_t TCOD_parser_get_color_property(TCOD_parser_t parser, const char *name); 131 | TCODLIB_API TCOD_dice_t TCOD_parser_get_dice_property(TCOD_parser_t parser, const char *name); 132 | TCODLIB_API void TCOD_parser_get_dice_property_py(TCOD_parser_t parser, const char *name, TCOD_dice_t *dice); 133 | TCODLIB_API void * TCOD_parser_get_custom_property(TCOD_parser_t parser, const char *name); 134 | TCODLIB_API TCOD_list_t TCOD_parser_get_list_property(TCOD_parser_t parser, const char *name, TCOD_value_type_t type); 135 | 136 | /* parser internals (may be used by custom type parsers) */ 137 | /* parser structures */ 138 | typedef struct { 139 | char *name; /* entity type name */ 140 | /* list of flags */ 141 | TCOD_list_t flags; 142 | /* list of properties (name, type, mandatory) */ 143 | TCOD_list_t props; 144 | /* list of value lists */ 145 | TCOD_list_t lists; 146 | /* list of sub-structures */ 147 | TCOD_list_t structs; 148 | } TCOD_struct_int_t; 149 | /* the parser */ 150 | typedef struct { 151 | /* list of structures */ 152 | TCOD_list_t structs; 153 | /* list of custom type parsers */ 154 | TCOD_parser_custom_t customs[16]; 155 | /* fatal error occured */ 156 | bool fatal; 157 | /* list of properties if default listener is used */ 158 | TCOD_list_t props; 159 | } TCOD_parser_int_t; 160 | TCODLIB_API TCOD_value_t TCOD_parse_bool_value(); 161 | TCODLIB_API TCOD_value_t TCOD_parse_char_value(); 162 | TCODLIB_API TCOD_value_t TCOD_parse_integer_value(); 163 | TCODLIB_API TCOD_value_t TCOD_parse_float_value(); 164 | TCODLIB_API TCOD_value_t TCOD_parse_string_value(); 165 | TCODLIB_API TCOD_value_t TCOD_parse_color_value(); 166 | TCODLIB_API TCOD_value_t TCOD_parse_dice_value(); 167 | TCODLIB_API TCOD_value_t TCOD_parse_value_list_value(TCOD_struct_int_t *def,int listnum); 168 | TCODLIB_API TCOD_value_t TCOD_parse_property_value(TCOD_parser_int_t *parser, TCOD_parser_struct_t def, char *propname, bool list); 169 | 170 | #endif 171 | -------------------------------------------------------------------------------- /tcod/include/path.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libtcod 1.5.1 3 | * Copyright (c) 2008,2009,2010 Jice & Mingos 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * The name of Jice or Mingos may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY JICE AND MINGOS ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL JICE OR MINGOS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef _TCOD_PATH_H 29 | #define _TCOD_PATH_H 30 | 31 | typedef float (*TCOD_path_func_t)( int xFrom, int yFrom, int xTo, int yTo, void *user_data ); 32 | typedef void *TCOD_path_t; 33 | 34 | TCODLIB_API TCOD_path_t TCOD_path_new_using_map(TCOD_map_t map, float diagonalCost); 35 | TCODLIB_API TCOD_path_t TCOD_path_new_using_function(int map_width, int map_height, TCOD_path_func_t func, void *user_data, float diagonalCost); 36 | 37 | TCODLIB_API bool TCOD_path_compute(TCOD_path_t path, int ox,int oy, int dx, int dy); 38 | TCODLIB_API bool TCOD_path_walk(TCOD_path_t path, int *x, int *y, bool recalculate_when_needed); 39 | TCODLIB_API bool TCOD_path_is_empty(TCOD_path_t path); 40 | TCODLIB_API int TCOD_path_size(TCOD_path_t path); 41 | TCODLIB_API void TCOD_path_reverse(TCOD_path_t path); 42 | TCODLIB_API void TCOD_path_get(TCOD_path_t path, int index, int *x, int *y); 43 | TCODLIB_API void TCOD_path_get_origin(TCOD_path_t path, int *x, int *y); 44 | TCODLIB_API void TCOD_path_get_destination(TCOD_path_t path, int *x, int *y); 45 | TCODLIB_API void TCOD_path_delete(TCOD_path_t path); 46 | 47 | /* Dijkstra stuff - by Mingos*/ 48 | 49 | typedef void *TCOD_dijkstra_t; 50 | 51 | TCODLIB_API TCOD_dijkstra_t TCOD_dijkstra_new (TCOD_map_t map, float diagonalCost); 52 | TCODLIB_API TCOD_dijkstra_t TCOD_dijkstra_new_using_function(int map_width, int map_height, TCOD_path_func_t func, void *user_data, float diagonalCost); 53 | TCODLIB_API void TCOD_dijkstra_compute (TCOD_dijkstra_t dijkstra, int root_x, int root_y); 54 | TCODLIB_API float TCOD_dijkstra_get_distance (TCOD_dijkstra_t dijkstra, int x, int y); 55 | TCODLIB_API bool TCOD_dijkstra_path_set (TCOD_dijkstra_t dijkstra, int x, int y); 56 | TCODLIB_API bool TCOD_dijkstra_is_empty(TCOD_dijkstra_t path); 57 | TCODLIB_API int TCOD_dijkstra_size(TCOD_dijkstra_t path); 58 | TCODLIB_API void TCOD_dijkstra_reverse(TCOD_dijkstra_t path); 59 | TCODLIB_API void TCOD_dijkstra_get(TCOD_dijkstra_t path, int index, int *x, int *y); 60 | TCODLIB_API bool TCOD_dijkstra_path_walk (TCOD_dijkstra_t dijkstra, int *x, int *y); 61 | TCODLIB_API void TCOD_dijkstra_delete (TCOD_dijkstra_t dijkstra); 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /tcod/include/sys.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libtcod 1.5.1 3 | * Copyright (c) 2008,2009,2010 Jice & Mingos 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * The name of Jice or Mingos may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY JICE AND MINGOS ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL JICE OR MINGOS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef _TCOD_SYS_H 29 | #define _TCOD_SYS_H 30 | 31 | TCODLIB_API uint32 TCOD_sys_elapsed_milli(); 32 | TCODLIB_API float TCOD_sys_elapsed_seconds(); 33 | TCODLIB_API void TCOD_sys_sleep_milli(uint32 val); 34 | TCODLIB_API void TCOD_sys_save_screenshot(const char *filename); 35 | TCODLIB_API void TCOD_sys_force_fullscreen_resolution(int width, int height); 36 | TCODLIB_API void TCOD_sys_set_renderer(TCOD_renderer_t renderer); 37 | TCODLIB_API TCOD_renderer_t TCOD_sys_get_renderer(); 38 | TCODLIB_API void TCOD_sys_set_fps(int val); 39 | TCODLIB_API int TCOD_sys_get_fps(); 40 | TCODLIB_API float TCOD_sys_get_last_frame_length(); 41 | TCODLIB_API void TCOD_sys_get_current_resolution(int *w, int *h); 42 | TCODLIB_API void TCOD_sys_get_fullscreen_offsets(int *offx, int *offy); 43 | TCODLIB_API void TCOD_sys_update_char(int asciiCode, int fontx, int fonty, TCOD_image_t img, int x, int y); 44 | TCODLIB_API void TCOD_sys_get_char_size(int *w, int *h); 45 | 46 | /* filesystem stuff */ 47 | TCODLIB_API bool TCOD_sys_create_directory(const char *path); 48 | TCODLIB_API bool TCOD_sys_delete_file(const char *path); 49 | TCODLIB_API bool TCOD_sys_delete_directory(const char *path); 50 | TCODLIB_API bool TCOD_sys_is_directory(const char *path); 51 | TCODLIB_API TCOD_list_t TCOD_sys_get_directory_content(const char *path, const char *pattern); 52 | TCODLIB_API bool TCOD_sys_file_exists(const char * filename, ...); 53 | 54 | /* clipboard */ 55 | TCODLIB_API void TCOD_sys_clipboard_set(const char *value); 56 | TCODLIB_API char *TCOD_sys_clipboard_get(); 57 | 58 | /* thread stuff */ 59 | typedef void *TCOD_thread_t; 60 | typedef void *TCOD_semaphore_t; 61 | typedef void *TCOD_mutex_t; 62 | typedef void *TCOD_cond_t; 63 | /* threads */ 64 | TCODLIB_API TCOD_thread_t TCOD_thread_new(int (*func)(void *), void *data); 65 | TCODLIB_API void TCOD_thread_delete(TCOD_thread_t th); 66 | TCODLIB_API int TCOD_sys_get_num_cores(); 67 | TCODLIB_API void TCOD_thread_wait(TCOD_thread_t th); 68 | /* mutex */ 69 | TCODLIB_API TCOD_mutex_t TCOD_mutex_new(); 70 | TCODLIB_API void TCOD_mutex_in(TCOD_mutex_t mut); 71 | TCODLIB_API void TCOD_mutex_out(TCOD_mutex_t mut); 72 | TCODLIB_API void TCOD_mutex_delete(TCOD_mutex_t mut); 73 | /* semaphore */ 74 | TCODLIB_API TCOD_semaphore_t TCOD_semaphore_new(int initVal); 75 | TCODLIB_API void TCOD_semaphore_lock(TCOD_semaphore_t sem); 76 | TCODLIB_API void TCOD_semaphore_unlock(TCOD_semaphore_t sem); 77 | TCODLIB_API void TCOD_semaphore_delete( TCOD_semaphore_t sem); 78 | /* condition */ 79 | TCODLIB_API TCOD_cond_t TCOD_condition_new(); 80 | TCODLIB_API void TCOD_condition_signal(TCOD_cond_t sem); 81 | TCODLIB_API void TCOD_condition_broadcast(TCOD_cond_t sem); 82 | TCODLIB_API void TCOD_condition_wait(TCOD_cond_t sem, TCOD_mutex_t mut); 83 | TCODLIB_API void TCOD_condition_delete( TCOD_cond_t sem); 84 | /* SDL renderer callback */ 85 | typedef void (*SDL_renderer_t) (void *sdl_surface); 86 | TCODLIB_API void TCOD_sys_register_SDL_renderer(SDL_renderer_t renderer); 87 | #endif 88 | -------------------------------------------------------------------------------- /tcod/include/tree.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libtcod 1.5.1 3 | * Copyright (c) 2008,2009,2010 Jice & Mingos 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * The name of Jice or Mingos may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY JICE AND MINGOS ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL JICE OR MINGOS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef _TCOD_TREE_H 29 | #define _TCOD_TREE_H 30 | 31 | typedef struct _TCOD_tree_t { 32 | struct _TCOD_tree_t *next; 33 | struct _TCOD_tree_t *father; 34 | struct _TCOD_tree_t *sons; 35 | } TCOD_tree_t; 36 | 37 | TCODLIB_API TCOD_tree_t *TCOD_tree_new(); 38 | TCODLIB_API void TCOD_tree_add_son(TCOD_tree_t *node, TCOD_tree_t *son); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /tcod/include/txtfield.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libtcod 1.5.1 3 | * Copyright (c) 2008,2009,2010 Jice & Mingos 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * The name of Jice or Mingos may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY JICE AND MINGOS ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL JICE OR MINGOS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | 29 | #ifndef _TCOD_TEXT_H_ 30 | #define _TCOD_TEXT_H_ 31 | 32 | typedef void * TCOD_text_t; 33 | 34 | TCODLIB_API TCOD_text_t TCOD_text_init(int x, int y, int w, int h, int max_chars); 35 | TCODLIB_API void TCOD_text_set_properties(TCOD_text_t txt, int cursor_char, int blink_interval, const char * prompt, int tab_size); 36 | TCODLIB_API void TCOD_text_set_colors(TCOD_text_t txt, TCOD_color_t fore, TCOD_color_t back, float back_transparency); 37 | TCODLIB_API bool TCOD_text_update(TCOD_text_t txt, TCOD_key_t key); 38 | TCODLIB_API void TCOD_text_render(TCOD_text_t txt, TCOD_console_t con); 39 | TCODLIB_API const char * TCOD_text_get(TCOD_text_t txt); 40 | TCODLIB_API void TCOD_text_reset(TCOD_text_t txt); 41 | TCODLIB_API void TCOD_text_delete(TCOD_text_t txt); 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /tcod/include/wrappers.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libtcod 1.5.1 3 | * Copyright (c) 2008,2009,2010 Jice & Mingos 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * The name of Jice or Mingos may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY JICE AND MINGOS ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL JICE OR MINGOS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef WRAPPERS_H 28 | #define WRAPPERS_H 29 | 30 | /* wrappers to ease other languages integration */ 31 | typedef unsigned int colornum_t; 32 | 33 | /* color module */ 34 | TCODLIB_API bool TCOD_color_equals_wrapper (colornum_t c1, colornum_t c2); 35 | TCODLIB_API colornum_t TCOD_color_add_wrapper (colornum_t c1, 36 | colornum_t c2); 37 | TCODLIB_API colornum_t TCOD_color_subtract_wrapper (colornum_t c1, 38 | colornum_t c2); 39 | TCODLIB_API colornum_t TCOD_color_multiply_wrapper (colornum_t c1, 40 | colornum_t c2); 41 | TCODLIB_API colornum_t TCOD_color_multiply_scalar_wrapper (colornum_t c1, 42 | float value); 43 | TCODLIB_API colornum_t TCOD_color_lerp_wrapper(colornum_t c1, 44 | colornum_t c2, float coef); 45 | TCODLIB_API void TCOD_color_get_HSV_wrapper(colornum_t c,float * h, 46 | float * s, float * v); 47 | TCODLIB_API float TCOD_color_get_hue_ (colornum_t c); 48 | TCODLIB_API float TCOD_color_get_saturation_ (colornum_t c); 49 | TCODLIB_API float TCOD_color_get_value_ (colornum_t c); 50 | 51 | /* console module */ 52 | /* TCODLIB_API void TCOD_console_set_custom_font_wrapper(const char *fontFile, 53 | int char_width, int char_height, int nb_char_horiz, 54 | int nb_char_vertic, bool chars_by_row, 55 | colornum_t key_color); */ 56 | 57 | TCODLIB_API void TCOD_console_set_default_background_wrapper(TCOD_console_t con, 58 | colornum_t col); 59 | TCODLIB_API void TCOD_console_set_default_foreground_wrapper(TCOD_console_t con, 60 | colornum_t col); 61 | TCODLIB_API colornum_t TCOD_console_get_default_background_wrapper(TCOD_console_t con); 62 | TCODLIB_API colornum_t TCOD_console_get_default_foreground_wrapper(TCOD_console_t con); 63 | TCODLIB_API colornum_t TCOD_console_get_char_background_wrapper(TCOD_console_t con, 64 | int x, int y); 65 | TCODLIB_API void TCOD_console_set_char_background_wrapper(TCOD_console_t con,int x, int y, 66 | colornum_t col, 67 | TCOD_bkgnd_flag_t flag); 68 | TCODLIB_API colornum_t TCOD_console_get_char_foreground_wrapper (TCOD_console_t con, 69 | int x, int y); 70 | TCODLIB_API void TCOD_console_set_char_foreground_wrapper(TCOD_console_t con,int x, int y, 71 | colornum_t col); 72 | TCODLIB_API void TCOD_console_put_char_ex_wrapper(TCOD_console_t con, int x, 73 | int y, int c, colornum_t fore, colornum_t back); 74 | TCODLIB_API void TCOD_console_set_fade_wrapper(uint8 val, colornum_t fade); 75 | TCODLIB_API colornum_t TCOD_console_get_fading_color_wrapper(); 76 | TCODLIB_API void TCOD_console_set_color_control_wrapper(TCOD_colctrl_t con, 77 | colornum_t fore, 78 | colornum_t back); 79 | TCODLIB_API bool TCOD_console_check_for_keypress_wrapper(TCOD_key_t *holder, 80 | int flags); 81 | TCODLIB_API void TCOD_console_wait_for_keypress_wrapper(TCOD_key_t *holder, 82 | bool flush); 83 | TCODLIB_API uint32 TCOD_console_check_for_keypress_bitfield (int flags); 84 | TCODLIB_API uint32 TCOD_console_wait_for_keypress_bitfield (bool flush); 85 | TCODLIB_API void TCOD_console_fill_background(TCOD_console_t con, int *r, int *g, int *b); 86 | TCODLIB_API void TCOD_console_fill_foreground(TCOD_console_t con, int *r, int *g, int *b); 87 | TCODLIB_API void TCOD_console_fill_char(TCOD_console_t con, char *arr); 88 | 89 | TCODLIB_API void TCOD_console_double_hline(TCOD_console_t con,int x,int y, int l, 90 | TCOD_bkgnd_flag_t flag); 91 | TCODLIB_API void TCOD_console_double_vline(TCOD_console_t con,int x,int y, 92 | int l, TCOD_bkgnd_flag_t flag); 93 | TCODLIB_API void TCOD_console_print_double_frame(TCOD_console_t con,int x,int y, 94 | int w,int h, bool empty, 95 | TCOD_bkgnd_flag_t flag, 96 | const char *fmt, ...); 97 | 98 | TCODLIB_API char *TCOD_console_print_return_string(TCOD_console_t con,int x, 99 | int y, int rw, int rh, 100 | TCOD_bkgnd_flag_t flag, 101 | TCOD_alignment_t align, char *msg, 102 | bool can_split, 103 | bool count_only); 104 | TCODLIB_API void console_set_key_color_wrapper (TCOD_console_t con, colornum_t c); 105 | 106 | /* image module */ 107 | 108 | TCODLIB_API void TCOD_image_clear_wrapper(TCOD_image_t image, 109 | colornum_t color); 110 | TCODLIB_API colornum_t TCOD_image_get_pixel_wrapper(TCOD_image_t image, 111 | int x, int y); 112 | TCODLIB_API colornum_t TCOD_image_get_mipmap_pixel_wrapper(TCOD_image_t image, 113 | float x0,float y0, float x1, float y1); 114 | TCODLIB_API void TCOD_image_put_pixel_wrapper(TCOD_image_t image,int x, int y, 115 | colornum_t col); 116 | TCODLIB_API void TCOD_image_set_key_color_wrapper(TCOD_image_t image, 117 | colornum_t key_color); 118 | 119 | /* mouse module */ 120 | TCODLIB_API void TCOD_mouse_get_status_wrapper(TCOD_mouse_t *holder); 121 | TCODLIB_API int TCOD_mouse_get_x(); 122 | TCODLIB_API int TCOD_mouse_get_y(); 123 | TCODLIB_API int TCOD_mouse_get_cx(); 124 | TCODLIB_API int TCOD_mouse_get_cy(); 125 | TCODLIB_API int TCOD_mouse_get_dx(); 126 | TCODLIB_API int TCOD_mouse_get_dy(); 127 | TCODLIB_API int TCOD_mouse_get_dcx(); 128 | TCODLIB_API int TCOD_mouse_get_dcy(); 129 | TCODLIB_API uint32 TCOD_mouse_get_lbutton(); 130 | TCODLIB_API uint32 TCOD_mouse_get_mbutton(); 131 | TCODLIB_API uint32 TCOD_mouse_get_rbutton(); 132 | TCODLIB_API uint32 TCOD_mouse_get_lbutton_pressed(); 133 | TCODLIB_API uint32 TCOD_mouse_get_mbutton_pressed(); 134 | TCODLIB_API uint32 TCOD_mouse_get_rbutton_pressed(); 135 | 136 | /* parser module */ 137 | TCODLIB_API colornum_t TCOD_parser_get_color_property_wrapper(TCOD_parser_t parser, const char *name); 138 | 139 | /* namegen module */ 140 | TCODLIB_API int TCOD_namegen_get_nb_sets_wrapper(); 141 | TCODLIB_API void TCOD_namegen_get_sets_wrapper(char **sets); 142 | 143 | /* sys module */ 144 | TCODLIB_API int TCOD_sys_get_current_resolution_x(); 145 | TCODLIB_API int TCOD_sys_get_current_resolution_y(); 146 | 147 | #endif /* WRAPPERS_H */ 148 | 149 | -------------------------------------------------------------------------------- /tcod/include/zip.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libtcod 1.5.1 3 | * Copyright (c) 2008,2009,2010 Jice & Mingos 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * The name of Jice or Mingos may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY JICE AND MINGOS ``AS IS'' AND ANY 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | * DISCLAIMED. IN NO EVENT SHALL JICE OR MINGOS BE LIABLE FOR ANY 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef _TCOD_ZIP_H 29 | #define _TCOD_ZIP_H 30 | 31 | typedef void *TCOD_zip_t; 32 | 33 | TCODLIB_API TCOD_zip_t TCOD_zip_new(); 34 | TCODLIB_API void TCOD_zip_delete(TCOD_zip_t zip); 35 | 36 | /* output interface */ 37 | TCODLIB_API void TCOD_zip_put_char(TCOD_zip_t zip, char val); 38 | TCODLIB_API void TCOD_zip_put_int(TCOD_zip_t zip, int val); 39 | TCODLIB_API void TCOD_zip_put_float(TCOD_zip_t zip, float val); 40 | TCODLIB_API void TCOD_zip_put_string(TCOD_zip_t zip, const char *val); 41 | TCODLIB_API void TCOD_zip_put_color(TCOD_zip_t zip, const TCOD_color_t val); 42 | TCODLIB_API void TCOD_zip_put_image(TCOD_zip_t zip, const TCOD_image_t val); 43 | TCODLIB_API void TCOD_zip_put_console(TCOD_zip_t zip, const TCOD_console_t val); 44 | TCODLIB_API void TCOD_zip_put_data(TCOD_zip_t zip, int nbBytes, const void *data); 45 | TCODLIB_API uint32 TCOD_zip_get_current_bytes(TCOD_zip_t zip); 46 | TCODLIB_API int TCOD_zip_save_to_file(TCOD_zip_t zip, const char *filename); 47 | 48 | /* input interface */ 49 | TCODLIB_API int TCOD_zip_load_from_file(TCOD_zip_t zip, const char *filename); 50 | TCODLIB_API char TCOD_zip_get_char(TCOD_zip_t zip); 51 | TCODLIB_API int TCOD_zip_get_int(TCOD_zip_t zip); 52 | TCODLIB_API float TCOD_zip_get_float(TCOD_zip_t zip); 53 | TCODLIB_API const char *TCOD_zip_get_string(TCOD_zip_t zip); 54 | TCODLIB_API TCOD_color_t TCOD_zip_get_color(TCOD_zip_t zip); 55 | TCODLIB_API TCOD_image_t TCOD_zip_get_image(TCOD_zip_t zip); 56 | TCODLIB_API TCOD_console_t TCOD_zip_get_console(TCOD_zip_t zip); 57 | TCODLIB_API int TCOD_zip_get_data(TCOD_zip_t zip, int nbBytes, void *data); 58 | TCODLIB_API uint32 TCOD_zip_get_remaining_bytes(TCOD_zip_t zip); 59 | TCODLIB_API void TCOD_zip_skip_bytes(TCOD_zip_t zip, uint32 nbBytes); 60 | 61 | #endif 62 | 63 | -------------------------------------------------------------------------------- /tcod/tcod_defs.go: -------------------------------------------------------------------------------- 1 | package tcod 2 | 3 | /* 4 | #include "include/libtcod.h" 5 | #include "include/libtcod_int.h" 6 | */ 7 | import "C" 8 | 9 | /* console enums */ 10 | const ( 11 | BKGND_ADD = C.TCOD_BKGND_ADD 12 | BKGND_ADDA = C.TCOD_BKGND_ADDA 13 | BKGND_ALPH = C.TCOD_BKGND_ALPH 14 | BKGND_BURN = C.TCOD_BKGND_BURN 15 | BKGND_COLOR_BURN = C.TCOD_BKGND_COLOR_BURN 16 | BKGND_COLOR_DODGE = C.TCOD_BKGND_COLOR_DODGE 17 | BKGND_DARKEN = C.TCOD_BKGND_DARKEN 18 | BKGND_LIGHTEN = C.TCOD_BKGND_LIGHTEN 19 | BKGND_MULTIPLY = C.TCOD_BKGND_MULTIPLY 20 | BKGND_NONE = C.TCOD_BKGND_NONE 21 | BKGND_OVERLAY = C.TCOD_BKGND_OVERLAY 22 | BKGND_SCREEN = C.TCOD_BKGND_SCREEN 23 | BKGND_SET = C.TCOD_BKGND_SET 24 | ) 25 | 26 | const ( 27 | CHAR_ARROW2_E = C.TCOD_CHAR_ARROW2_E 28 | CHAR_ARROW2_N = C.TCOD_CHAR_ARROW2_N 29 | CHAR_ARROW2_S = C.TCOD_CHAR_ARROW2_S 30 | CHAR_ARROW2_W = C.TCOD_CHAR_ARROW2_W 31 | CHAR_ARROW_E = C.TCOD_CHAR_ARROW_E 32 | CHAR_ARROW_N = C.TCOD_CHAR_ARROW_N 33 | CHAR_ARROW_S = C.TCOD_CHAR_ARROW_S 34 | CHAR_ARROW_W = C.TCOD_CHAR_ARROW_W 35 | CHAR_BLOCK1 = C.TCOD_CHAR_BLOCK1 36 | CHAR_BLOCK2 = C.TCOD_CHAR_BLOCK2 37 | CHAR_BLOCK3 = C.TCOD_CHAR_BLOCK3 38 | CHAR_CHECKBOX_SET = C.TCOD_CHAR_CHECKBOX_SET 39 | CHAR_CHECKBOX_UNSET = C.TCOD_CHAR_CHECKBOX_UNSET 40 | CHAR_CROSS = C.TCOD_CHAR_CROSS 41 | CHAR_DARROW_H = C.TCOD_CHAR_DARROW_H 42 | CHAR_DARROW_V = C.TCOD_CHAR_DARROW_V 43 | CHAR_DCROSS = C.TCOD_CHAR_DCROSS 44 | CHAR_DHLINE = C.TCOD_CHAR_DHLINE 45 | CHAR_DNE = C.TCOD_CHAR_DNE 46 | CHAR_DNW = C.TCOD_CHAR_DNW 47 | CHAR_DSE = C.TCOD_CHAR_DSE 48 | CHAR_DSW = C.TCOD_CHAR_DSW 49 | CHAR_DTEEE = C.TCOD_CHAR_DTEEE 50 | CHAR_DTEEN = C.TCOD_CHAR_DTEEN 51 | CHAR_DTEES = C.TCOD_CHAR_DTEES 52 | CHAR_DTEEW = C.TCOD_CHAR_DTEEW 53 | CHAR_DVLINE = C.TCOD_CHAR_DVLINE 54 | CHAR_HLINE = C.TCOD_CHAR_HLINE 55 | CHAR_NE = C.TCOD_CHAR_NE 56 | CHAR_NW = C.TCOD_CHAR_NW 57 | CHAR_RADIO_SET = C.TCOD_CHAR_RADIO_SET 58 | CHAR_RADIO_UNSET = C.TCOD_CHAR_RADIO_UNSET 59 | CHAR_SE = C.TCOD_CHAR_SE 60 | CHAR_SUBP_DIAG = C.TCOD_CHAR_SUBP_DIAG 61 | CHAR_SUBP_E = C.TCOD_CHAR_SUBP_E 62 | CHAR_SUBP_N = C.TCOD_CHAR_SUBP_N 63 | CHAR_SUBP_NE = C.TCOD_CHAR_SUBP_NE 64 | CHAR_SUBP_NW = C.TCOD_CHAR_SUBP_NW 65 | CHAR_SUBP_SE = C.TCOD_CHAR_SUBP_SE 66 | CHAR_SUBP_SW = C.TCOD_CHAR_SUBP_SW 67 | CHAR_SW = C.TCOD_CHAR_SW 68 | CHAR_TEEE = C.TCOD_CHAR_TEEE 69 | CHAR_TEEN = C.TCOD_CHAR_TEEN 70 | CHAR_TEES = C.TCOD_CHAR_TEES 71 | CHAR_TEEW = C.TCOD_CHAR_TEEW 72 | CHAR_VLINE = C.TCOD_CHAR_VLINE 73 | ) 74 | 75 | const ( 76 | COLCTRL_1 = C.TCOD_COLCTRL_1 77 | COLCTRL_2 = C.TCOD_COLCTRL_2 78 | COLCTRL_3 = C.TCOD_COLCTRL_3 79 | COLCTRL_4 = C.TCOD_COLCTRL_4 80 | COLCTRL_5 = C.TCOD_COLCTRL_5 81 | COLCTRL_BACK_RGB = C.TCOD_COLCTRL_BACK_RGB 82 | COLCTRL_FORE_RGB = C.TCOD_COLCTRL_FORE_RGB 83 | COLCTRL_NUMBER = C.TCOD_COLCTRL_NUMBER 84 | COLCTRL_STOP = C.TCOD_COLCTRL_STOP 85 | ) 86 | 87 | const ( 88 | FONT_LAYOUT_ASCII_INCOL = C.TCOD_FONT_LAYOUT_ASCII_INCOL 89 | FONT_LAYOUT_ASCII_INROW = C.TCOD_FONT_LAYOUT_ASCII_INROW 90 | FONT_LAYOUT_TCOD = C.TCOD_FONT_LAYOUT_TCOD 91 | FONT_TYPE_GREYSCALE = C.TCOD_FONT_TYPE_GREYSCALE 92 | ) 93 | 94 | const ( 95 | K_0 = C.TCODK_0 96 | K_1 = C.TCODK_1 97 | K_2 = C.TCODK_2 98 | K_3 = C.TCODK_3 99 | K_4 = C.TCODK_4 100 | K_5 = C.TCODK_5 101 | K_6 = C.TCODK_6 102 | K_7 = C.TCODK_7 103 | K_8 = C.TCODK_8 104 | K_9 = C.TCODK_9 105 | K_ALT = C.TCODK_ALT 106 | K_APPS = C.TCODK_APPS 107 | K_BACKSPACE = C.TCODK_BACKSPACE 108 | K_CAPSLOCK = C.TCODK_CAPSLOCK 109 | K_CHAR = C.TCODK_CHAR 110 | K_CONTROL = C.TCODK_CONTROL 111 | K_DELETE = C.TCODK_DELETE 112 | K_DOWN = C.TCODK_DOWN 113 | K_END = C.TCODK_END 114 | K_ENTER = C.TCODK_ENTER 115 | K_ESCAPE = C.TCODK_ESCAPE 116 | KEY_PRESSED = C.TCOD_KEY_PRESSED 117 | KEY_RELEASED = C.TCOD_KEY_RELEASED 118 | K_F1 = C.TCODK_F1 119 | K_F10 = C.TCODK_F10 120 | K_F11 = C.TCODK_F11 121 | K_F12 = C.TCODK_F12 122 | K_F2 = C.TCODK_F2 123 | K_F3 = C.TCODK_F3 124 | K_F4 = C.TCODK_F4 125 | K_F5 = C.TCODK_F5 126 | K_F6 = C.TCODK_F6 127 | K_F7 = C.TCODK_F7 128 | K_F8 = C.TCODK_F8 129 | K_F9 = C.TCODK_F9 130 | K_HOME = C.TCODK_HOME 131 | K_INSERT = C.TCODK_INSERT 132 | K_KP0 = C.TCODK_KP0 133 | K_KP1 = C.TCODK_KP1 134 | K_KP2 = C.TCODK_KP2 135 | K_KP3 = C.TCODK_KP3 136 | K_KP4 = C.TCODK_KP4 137 | K_KP5 = C.TCODK_KP5 138 | K_KP6 = C.TCODK_KP6 139 | K_KP7 = C.TCODK_KP7 140 | K_KP8 = C.TCODK_KP8 141 | K_KP9 = C.TCODK_KP9 142 | K_KPADD = C.TCODK_KPADD 143 | K_KPDEC = C.TCODK_KPDEC 144 | K_KPDIV = C.TCODK_KPDIV 145 | K_KPENTER = C.TCODK_KPENTER 146 | K_KPMUL = C.TCODK_KPMUL 147 | K_KPSUB = C.TCODK_KPSUB 148 | K_LEFT = C.TCODK_LEFT 149 | K_LWIN = C.TCODK_LWIN 150 | K_NONE = C.TCODK_NONE 151 | K_NUMLOCK = C.TCODK_NUMLOCK 152 | K_PAGEDOWN = C.TCODK_PAGEDOWN 153 | K_PAGEUP = C.TCODK_PAGEUP 154 | K_PAUSE = C.TCODK_PAUSE 155 | K_PRINTSCREEN = C.TCODK_PRINTSCREEN 156 | K_RIGHT = C.TCODK_RIGHT 157 | K_RWIN = C.TCODK_RWIN 158 | K_SCROLLLOCK = C.TCODK_SCROLLLOCK 159 | K_SHIFT = C.TCODK_SHIFT 160 | K_SPACE = C.TCODK_SPACE 161 | K_TAB = C.TCODK_TAB 162 | K_UP = C.TCODK_UP 163 | ) 164 | 165 | /* fov enums */ 166 | 167 | const ( 168 | FOV_BASIC = C.FOV_BASIC 169 | FOV_DIAMOND = C.FOV_DIAMOND 170 | FOV_SHADOW = C.FOV_SHADOW 171 | FOV_PERMISSIVE_0 = C.FOV_PERMISSIVE_0 172 | FOV_PERMISSIVE_1 = C.FOV_PERMISSIVE_1 173 | FOV_PERMISSIVE_2 = C.FOV_PERMISSIVE_2 174 | FOV_PERMISSIVE_3 = C.FOV_PERMISSIVE_3 175 | FOV_PERMISSIVE_4 = C.FOV_PERMISSIVE_4 176 | FOV_PERMISSIVE_5 = C.FOV_PERMISSIVE_5 177 | FOV_PERMISSIVE_6 = C.FOV_PERMISSIVE_6 178 | FOV_PERMISSIVE_7 = C.FOV_PERMISSIVE_7 179 | FOV_PERMISSIVE_8 = C.FOV_PERMISSIVE_8 180 | FOV_RESTRICTIVE = C.FOV_RESTRICTIVE 181 | NB_FOV_ALGORITHMS = C.NB_FOV_ALGORITHMS 182 | ) 183 | 184 | /* random enums */ 185 | 186 | const ( 187 | RNG_MT = C.TCOD_RNG_MT 188 | RNG_CMWC = C.TCOD_RNG_CMWC 189 | ) 190 | 191 | const ( 192 | TYPE_NONE = C.TCOD_TYPE_NONE 193 | TYPE_BOOL = C.TCOD_TYPE_BOOL 194 | TYPE_CHAR = C.TCOD_TYPE_CHAR 195 | TYPE_INT = C.TCOD_TYPE_INT 196 | TYPE_FLOAT = C.TCOD_TYPE_FLOAT 197 | TYPE_STRING = C.TCOD_TYPE_STRING 198 | TYPE_COLOR = C.TCOD_TYPE_COLOR 199 | TYPE_DICE = C.TCOD_TYPE_DICE 200 | TYPE_VALUELIST00 = C.TCOD_TYPE_VALUELIST00 201 | TYPE_VALUELIST01 = C.TCOD_TYPE_VALUELIST01 202 | TYPE_VALUELIST02 = C.TCOD_TYPE_VALUELIST02 203 | TYPE_VALUELIST03 = C.TCOD_TYPE_VALUELIST03 204 | TYPE_VALUELIST04 = C.TCOD_TYPE_VALUELIST04 205 | TYPE_VALUELIST05 = C.TCOD_TYPE_VALUELIST05 206 | TYPE_VALUELIST06 = C.TCOD_TYPE_VALUELIST06 207 | TYPE_VALUELIST07 = C.TCOD_TYPE_VALUELIST07 208 | TYPE_VALUELIST08 = C.TCOD_TYPE_VALUELIST08 209 | TYPE_VALUELIST09 = C.TCOD_TYPE_VALUELIST09 210 | TYPE_VALUELIST10 = C.TCOD_TYPE_VALUELIST10 211 | TYPE_VALUELIST11 = C.TCOD_TYPE_VALUELIST11 212 | TYPE_VALUELIST12 = C.TCOD_TYPE_VALUELIST12 213 | TYPE_VALUELIST13 = C.TCOD_TYPE_VALUELIST13 214 | TYPE_VALUELIST14 = C.TCOD_TYPE_VALUELIST14 215 | TYPE_VALUELIST15 = C.TCOD_TYPE_VALUELIST15 216 | TYPE_CUSTOM00 = C.TCOD_TYPE_CUSTOM00 217 | TYPE_CUSTOM01 = C.TCOD_TYPE_CUSTOM01 218 | TYPE_CUSTOM02 = C.TCOD_TYPE_CUSTOM02 219 | TYPE_CUSTOM03 = C.TCOD_TYPE_CUSTOM03 220 | TYPE_CUSTOM04 = C.TCOD_TYPE_CUSTOM04 221 | TYPE_CUSTOM05 = C.TCOD_TYPE_CUSTOM05 222 | TYPE_CUSTOM06 = C.TCOD_TYPE_CUSTOM06 223 | TYPE_CUSTOM07 = C.TCOD_TYPE_CUSTOM07 224 | TYPE_CUSTOM08 = C.TCOD_TYPE_CUSTOM08 225 | TYPE_CUSTOM09 = C.TCOD_TYPE_CUSTOM09 226 | TYPE_CUSTOM10 = C.TCOD_TYPE_CUSTOM10 227 | TYPE_CUSTOM11 = C.TCOD_TYPE_CUSTOM11 228 | TYPE_CUSTOM12 = C.TCOD_TYPE_CUSTOM12 229 | TYPE_CUSTOM13 = C.TCOD_TYPE_CUSTOM13 230 | TYPE_CUSTOM14 = C.TCOD_TYPE_CUSTOM14 231 | TYPE_CUSTOM15 = C.TCOD_TYPE_CUSTOM15 232 | TYPE_LIST = C.TCOD_TYPE_LIST 233 | ) 234 | 235 | /* noise enum */ 236 | 237 | const ( 238 | NOISE_PERLIN = C.TCOD_NOISE_PERLIN 239 | NOISE_SIMPLEX = C.TCOD_NOISE_SIMPLEX 240 | NOISE_WAVELET = C.TCOD_NOISE_WAVELET 241 | NOISE_DEFAULT = C.TCOD_NOISE_DEFAULT 242 | ) 243 | 244 | /* renderer enum */ 245 | const ( 246 | RENDERER_GLSL = C.TCOD_RENDERER_GLSL 247 | RENDERER_OPENGL = C.TCOD_RENDERER_OPENGL 248 | RENDERER_SDL = C.TCOD_RENDERER_SDL 249 | NB_RENDERERS = C.TCOD_NB_RENDERERS 250 | ) 251 | 252 | /* alignment enum */ 253 | const ( 254 | LEFT = C.TCOD_LEFT 255 | RIGHT = C.TCOD_RIGHT 256 | CENTER = C.TCOD_CENTER 257 | ) 258 | 259 | /* distribution for mersenne */ 260 | const ( 261 | DISTRIBUTION_LINEAR = C.TCOD_DISTRIBUTION_LINEAR 262 | DISTRIBUTION_GAUSSIAN = C.TCOD_DISTRIBUTION_GAUSSIAN 263 | DISTRIBUTION_GAUSSIAN_RANGE = C.TCOD_DISTRIBUTION_GAUSSIAN_RANGE 264 | DISTRIBUTION_GAUSSIAN_INVERSE = C.TCOD_DISTRIBUTION_GAUSSIAN_INVERSE 265 | DISTRIBUTION_GAUSSIAN_RANGE_INVERSE = C.TCOD_DISTRIBUTION_GAUSSIAN_RANGE_INVERSE 266 | ) 267 | --------------------------------------------------------------------------------