├── LIBTCOD-CHANGELOG.md ├── LIBTCOD-CREDITS.txt ├── LIBTCOD-LICENSE.txt ├── LICENSE ├── README.md ├── data ├── cfg │ └── sample.cfg ├── fonts │ ├── README.txt │ ├── arial10x10.png │ ├── arial12x12.png │ ├── arial8x8.png │ ├── 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 │ ├── dejavu16x16_gs_tc.png │ ├── dejavu8x8_gs_tc.png │ ├── dejavu_wide12x12_gs_tc.png │ ├── dejavu_wide16x16_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 │ ├── terminal10x16_gs_ro.png │ ├── terminal10x16_gs_tc.png │ ├── terminal10x18_gs_ro.png │ ├── terminal12x12_gs_ro.png │ ├── terminal16x16_gs_ro.png │ ├── terminal7x7_gs_tc.png │ ├── terminal8x12_gs_ro.png │ ├── terminal8x12_gs_tc.png │ ├── terminal8x14_gs_ro.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 └── rexpaint │ └── test.xp ├── docs ├── index.html ├── libtcod112.html ├── libtcod15.html ├── libtcod17.html └── libtcod_cp437.html ├── libtcod.cfg ├── libtcod.nim ├── libtcod.nimble ├── libtcod ├── README.md ├── cp437.nim ├── src112 │ ├── bresenham.nim │ ├── bsp.nim │ ├── color.nim │ ├── console.nim │ ├── console_console.nim │ ├── console_drawing.nim │ ├── console_printing.nim │ ├── console_rexpaint.nim │ ├── console_types.nim │ ├── engine.nim │ ├── fov.nim │ ├── fov_types.nim │ ├── heightmap.nim │ ├── image.nim │ ├── lex.nim │ ├── libtcod_define.nim │ ├── list.nim │ ├── mersenne.nim │ ├── mersenne_types.nim │ ├── mouse.nim │ ├── mouse_types.nim │ ├── namegen.nim │ ├── noise.nim │ ├── noise_defaults.nim │ ├── parser.nim │ ├── path.nim │ ├── sys.nim │ ├── tileset.nim │ ├── tree.nim │ ├── txtfield.nim │ ├── version.nim │ ├── wrappers.nim │ └── zip.nim ├── src15 │ ├── bresenham.nim │ ├── bsp.nim │ ├── color.nim │ ├── console.nim │ ├── console_types.nim │ ├── fov.nim │ ├── fov_types.nim │ ├── heightmap.nim │ ├── image.nim │ ├── lex.nim │ ├── libtcod_define.nim │ ├── list.nim │ ├── mersenne.nim │ ├── mersenne_types.nim │ ├── mouse.nim │ ├── mouse_types.nim │ ├── namegen.nim │ ├── noise.nim │ ├── parser.nim │ ├── path.nim │ ├── sys.nim │ ├── tree.nim │ ├── txtfield.nim │ └── zip.nim └── src17 │ ├── bresenham.nim │ ├── bsp.nim │ ├── color.nim │ ├── console.nim │ ├── console_rexpaint.nim │ ├── console_types.nim │ ├── fov.nim │ ├── fov_types.nim │ ├── heightmap.nim │ ├── image.nim │ ├── lex.nim │ ├── libtcod_define.nim │ ├── list.nim │ ├── mersenne.nim │ ├── mersenne_types.nim │ ├── mouse.nim │ ├── mouse_types.nim │ ├── namegen.nim │ ├── noise.nim │ ├── noise_defaults.nim │ ├── parser.nim │ ├── path.nim │ ├── sys.nim │ ├── tree.nim │ ├── txtfield.nim │ ├── wrappers.nim │ └── zip.nim ├── samples112 ├── build_samples.bat ├── build_samples.sh ├── build_samples_debug.sh └── samples.nim ├── samples15 ├── build_samples.bat ├── build_samples.sh ├── build_samples_debug.sh └── samples.nim ├── samples17 ├── build_samples.bat ├── build_samples.sh ├── build_samples_debug.sh └── samples.nim └── terminal.png /LIBTCOD-CREDITS.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/LIBTCOD-CREDITS.txt -------------------------------------------------------------------------------- /LIBTCOD-LICENSE.txt: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright © 2008-2019, Jice and the libtcod contributors. 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 | 9 | 1. Redistributions of source code must retain the above copyright notice, 10 | this list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 24 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 | POSSIBILITY OF SUCH DAMAGE. 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | libtcod-nim 2 | Copyright (C) 2012-2019 Vladar 3 | 4 | This software is provided 'as-is', without any express or implied 5 | warranty. In no event will the authors be held liable for any damages 6 | arising from the use of this software. 7 | 8 | Permission is granted to anyone to use this software for any purpose, 9 | including commercial applications, and to alter it and redistribute it 10 | freely, subject to the following restrictions: 11 | 12 | 1. The origin of this software must not be misrepresented; you must not 13 | claim that you wrote the original software. If you use this software 14 | in a product, an acknowledgment in the product documentation would be 15 | appreciated but is not required. 16 | 2. Altered source versions must be plainly marked as such, and must not be 17 | misrepresented as being the original software. 18 | 3. This notice may not be removed or altered from any source distribution. 19 | 20 | Vladar vladar4@gmail.com 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | libtcod_nim v1.112.0 2 | ==================== 3 | 4 | libtcod_nim is a wrapper of the libtcod library for the Nim language. 5 | 6 | * libtcod homepage: http://roguecentral.org/doryen/libtcod/ 7 | * libtcod repository: https://github.com/libtcod/libtcod/ 8 | * Nim homepage: http://nim-lang.org/ 9 | * libtcod_nim docs: https://vladar4.github.io/libtcod_nim/ 10 | 11 | Libtcod, a.k.a. “The Doryen Library”, is a free, fast, portable and uncomplicated API for roguelike developers providing an advanced true color console, input, and lots of other utilities frequently used in roguelikes. 12 | 13 | You need to have dynamic library of libtcod installed: 14 | * libtcod 1.5.1: 15 | * libtcod.so.1.5.1 on Linux 16 | * libtcod-mingw.dll or libtcod-mingw-debug.dll on Windows. 17 | * libtcod 1.7.0 or 1.12.2: 18 | * libtcod.so (or libtcod.so.1.0.12 for libtcod 1.12.2) on Linux; 19 | * libtcod.dll on Windows. 20 | 21 | Also you may need SDL, SDL2, OpenGL or GLSL dynamic libraries installed, depending on used renderer. 22 | 23 | 24 | Compilation 25 | ----------- 26 | 27 | * The default complilation option is libtcod 1.12.2 (src112 directory). 28 | 29 | To use legacy versions use the following keys in your compile command: 30 | 31 | * `--define:tcod15` for libtcod 1.5.1. 32 | 33 | * `--define:tcod17` for libtcod 1.7.0. 34 | 35 | 36 | ---------------------------------------- 37 | 38 | CHANGELOG: 39 | ========== 40 | **v1.112.1** 41 | * changes and fixes for Nim v1.1+ 42 | * fixed nimble warnings 43 | 44 | **v1.112.0** 45 | * changed versioning system to reflect the latest supported libtcod version 46 | * added libtcod 1.12.2 wrapper 47 | * added optional module libtcod/cp437 48 | * changed compile keys for legacy branches 49 | * various bugfixes 50 | 51 | **v0.99** 52 | * added libtcod 1.7.0 wrapper 53 | * bugfixes for both 1.5.1 and 1.7.0 wrappers 54 | 55 | **v0.98.1** 56 | * adaptation for Nim v0.18.1 and newer (strings can't be nil anymore) 57 | 58 | **v0.98** 59 | * adaptation for new versions of Nim 60 | * more type-related fixes 61 | 62 | **v0.97** 63 | * adaptation for Nim 0.10.2 64 | * fixed data types for correct work on 64-bit systems 65 | * WideCString fix 66 | 67 | **v0.96** 68 | * fixed unicode output procedures 69 | * fixed some errata 70 | * adaptation for Nimrod 0.9.2 71 | 72 | **v0.95** 73 | * total rewrite of parser module 74 | * added `parser_get_list__property(parser, name): seq[]` functions 75 | * completed `PList` removal 76 | * tons of fixes 77 | 78 | **v0.90** 79 | * most features implemented 80 | * ported samples 81 | * started `PList` removal 82 | * added `floatArrayToPtr` template for noise procedures 83 | 84 | -------------------------------------------------------------------------------- /data/cfg/sample.cfg: -------------------------------------------------------------------------------- 1 | myStruct "struct_name" { 2 | // 3 | bool_field=true 4 | char_field='Z' 5 | int_field=24 6 | float_field=3.14 7 | string_field="hello" 8 | color_field="255,128,128" 9 | dice_field="0.5x3d5+2" 10 | 11 | // dynamically declared fields 12 | bool bool_field2=false 13 | char char_field2='@' 14 | int int_field2=4 15 | float float_field2=4.3 16 | string string_field2="world" 17 | color color_field2=#FF22CC 18 | dice dice_field2="3d20" 19 | 20 | bool_list=[true, false, true] 21 | char_list=['a', 'b', 'z'] 22 | integer_list=[13,2,-3] 23 | float_list=[5.0,2.0,-3.5] 24 | string_list=["item one","time_two"] 25 | color_list=["42,42,142","128,64,128"] 26 | // dice_list=["3d4","2d4+2","0.75x4d6-1"] 27 | 28 | // dynamically declared list fields 29 | bool[] bool_list2=[true, false, true] 30 | char[] char_list2=['a', 'b', 'z'] 31 | int[] integer_list2=[13,2,-3] 32 | float[] float_list2=[5.0,2.0,-3.5] 33 | string[] string_list2=["item one","time_two"] 34 | color[] color_list2=["42,42,142","128,64,128"] 35 | 36 | } 37 | // a completely dynamic structure (not declared at compile time) 38 | struct dynStruct { 39 | int someVar=4 40 | struct subStruct { 41 | float anotherVar=4.3 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /data/fonts/arial10x10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/arial10x10.png -------------------------------------------------------------------------------- /data/fonts/arial12x12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/arial12x12.png -------------------------------------------------------------------------------- /data/fonts/arial8x8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/arial8x8.png -------------------------------------------------------------------------------- /data/fonts/caeldera8x8_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/caeldera8x8_gs_tc.png -------------------------------------------------------------------------------- /data/fonts/celtic_garamond_10x10_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/celtic_garamond_10x10_gs_tc.png -------------------------------------------------------------------------------- /data/fonts/consolas10x10_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/consolas10x10_gs_tc.png -------------------------------------------------------------------------------- /data/fonts/consolas12x12_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/consolas12x12_gs_tc.png -------------------------------------------------------------------------------- /data/fonts/consolas8x8_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/consolas8x8_gs_tc.png -------------------------------------------------------------------------------- /data/fonts/consolas_unicode_10x10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/consolas_unicode_10x10.png -------------------------------------------------------------------------------- /data/fonts/consolas_unicode_12x12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/consolas_unicode_12x12.png -------------------------------------------------------------------------------- /data/fonts/consolas_unicode_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/consolas_unicode_16x16.png -------------------------------------------------------------------------------- /data/fonts/consolas_unicode_8x8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/consolas_unicode_8x8.png -------------------------------------------------------------------------------- /data/fonts/courier10x10_aa_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/courier10x10_aa_tc.png -------------------------------------------------------------------------------- /data/fonts/courier12x12_aa_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/courier12x12_aa_tc.png -------------------------------------------------------------------------------- /data/fonts/courier8x8_aa_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/courier8x8_aa_tc.png -------------------------------------------------------------------------------- /data/fonts/dejavu10x10_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/dejavu10x10_gs_tc.png -------------------------------------------------------------------------------- /data/fonts/dejavu12x12_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/dejavu12x12_gs_tc.png -------------------------------------------------------------------------------- /data/fonts/dejavu16x16_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/dejavu16x16_gs_tc.png -------------------------------------------------------------------------------- /data/fonts/dejavu8x8_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/dejavu8x8_gs_tc.png -------------------------------------------------------------------------------- /data/fonts/dejavu_wide12x12_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/dejavu_wide12x12_gs_tc.png -------------------------------------------------------------------------------- /data/fonts/dejavu_wide16x16_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/dejavu_wide16x16_gs_tc.png -------------------------------------------------------------------------------- /data/fonts/dundalk12x12_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/dundalk12x12_gs_tc.png -------------------------------------------------------------------------------- /data/fonts/lucida10x10_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/lucida10x10_gs_tc.png -------------------------------------------------------------------------------- /data/fonts/lucida12x12_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/lucida12x12_gs_tc.png -------------------------------------------------------------------------------- /data/fonts/lucida8x8_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/lucida8x8_gs_tc.png -------------------------------------------------------------------------------- /data/fonts/prestige10x10_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/prestige10x10_gs_tc.png -------------------------------------------------------------------------------- /data/fonts/prestige12x12_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/prestige12x12_gs_tc.png -------------------------------------------------------------------------------- /data/fonts/prestige8x8_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/prestige8x8_gs_tc.png -------------------------------------------------------------------------------- /data/fonts/terminal10x10_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/terminal10x10_gs_tc.png -------------------------------------------------------------------------------- /data/fonts/terminal10x16_gs_ro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/terminal10x16_gs_ro.png -------------------------------------------------------------------------------- /data/fonts/terminal10x16_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/terminal10x16_gs_tc.png -------------------------------------------------------------------------------- /data/fonts/terminal10x18_gs_ro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/terminal10x18_gs_ro.png -------------------------------------------------------------------------------- /data/fonts/terminal12x12_gs_ro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/terminal12x12_gs_ro.png -------------------------------------------------------------------------------- /data/fonts/terminal16x16_gs_ro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/terminal16x16_gs_ro.png -------------------------------------------------------------------------------- /data/fonts/terminal7x7_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/terminal7x7_gs_tc.png -------------------------------------------------------------------------------- /data/fonts/terminal8x12_gs_ro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/terminal8x12_gs_ro.png -------------------------------------------------------------------------------- /data/fonts/terminal8x12_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/terminal8x12_gs_tc.png -------------------------------------------------------------------------------- /data/fonts/terminal8x14_gs_ro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/terminal8x14_gs_ro.png -------------------------------------------------------------------------------- /data/fonts/terminal8x8_aa_as.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/terminal8x8_aa_as.png -------------------------------------------------------------------------------- /data/fonts/terminal8x8_aa_ro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/terminal8x8_aa_ro.png -------------------------------------------------------------------------------- /data/fonts/terminal8x8_aa_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/terminal8x8_aa_tc.png -------------------------------------------------------------------------------- /data/fonts/terminal8x8_gs_as.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/terminal8x8_gs_as.png -------------------------------------------------------------------------------- /data/fonts/terminal8x8_gs_ro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/terminal8x8_gs_ro.png -------------------------------------------------------------------------------- /data/fonts/terminal8x8_gs_tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/fonts/terminal8x8_gs_tc.png -------------------------------------------------------------------------------- /data/img/circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/img/circle.png -------------------------------------------------------------------------------- /data/img/skull.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/img/skull.png -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /data/rexpaint/test.xp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/data/rexpaint/test.xp -------------------------------------------------------------------------------- /libtcod.cfg: -------------------------------------------------------------------------------- 1 | /* 2 | Use this file to customize the behaviour of libtcod, 3 | overriding what's defined in the sample/game code. 4 | The main goal of this file is to allow the player 5 | to tweak the game in case it doesn't work properly 6 | on his system and there are no options screen/config 7 | files available in the game. 8 | */ 9 | libtcod { 10 | // uncomment to force the use of a specific renderer 11 | // renderer = "GLSL" 12 | // renderer = "OPENGL" 13 | //renderer = "SDL" 14 | 15 | // uncomment to force a specific fullscreen resolution 16 | /* 17 | fullscreen=true 18 | fullscreenWidth=1280 19 | fullscreenHeight=1024 20 | */ 21 | 22 | // uncomment to use a custom font. 23 | /* 24 | font="data/fonts/terminal8x8_gs_as.png" 25 | fontInRow=false 26 | fontGreyscale=true 27 | fontTcodLayout=false 28 | fontNbCharHoriz=16 29 | fontNbCharVertic=16 30 | */ 31 | } 32 | 33 | -------------------------------------------------------------------------------- /libtcod.nim: -------------------------------------------------------------------------------- 1 | # 2 | # BSD 3-Clause License 3 | # 4 | # Copyright © 2008-2019, Jice and the libtcod contributors. 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # 1. Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # 13 | # 2. Redistributions in binary form must reproduce the above copyright notice, 14 | # this list of conditions and the following disclaimer in the documentation 15 | # and/or other materials provided with the distribution. 16 | # 17 | # 3. Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived from 19 | # this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | # POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | 34 | 35 | # utility proc 36 | proc lerp*[T](a, b, x: T): T = 37 | return a + x * (b - a) 38 | 39 | 40 | when defined tcod15: 41 | include 42 | libtcod/src15/libtcod_define, 43 | libtcod/src15/color, 44 | libtcod/src15/console, 45 | libtcod/src15/mouse, 46 | libtcod/src15/image, 47 | libtcod/src15/sys, 48 | libtcod/src15/mersenne, 49 | libtcod/src15/noise, 50 | libtcod/src15/bresenham, 51 | libtcod/src15/tree, 52 | libtcod/src15/bsp, 53 | libtcod/src15/fov, 54 | libtcod/src15/path, 55 | libtcod/src15/heightmap, 56 | libtcod/src15/lex, 57 | libtcod/src15/parser, 58 | libtcod/src15/zip, 59 | libtcod/src15/namegen, 60 | libtcod/src15/txtfield 61 | 62 | elif defined tcod17: 63 | include 64 | libtcod/src17/libtcod_define, 65 | # 66 | libtcod/src17/color, 67 | libtcod/src17/console_types, 68 | libtcod/src17/fov_types, 69 | libtcod/src17/image, 70 | libtcod/src17/list, 71 | libtcod/src17/lex, 72 | libtcod/src17/mersenne_types, 73 | libtcod/src17/mouse_types, 74 | libtcod/src17/noise_defaults, 75 | libtcod/src17/noise, 76 | libtcod/src17/tree, 77 | # 78 | libtcod/src17/bresenham, 79 | libtcod/src17/bsp, 80 | libtcod/src17/console, 81 | libtcod/src17/console_rexpaint, 82 | libtcod/src17/fov, 83 | libtcod/src17/heightmap, 84 | libtcod/src17/mersenne, 85 | libtcod/src17/mouse, 86 | libtcod/src17/namegen, 87 | libtcod/src17/parser, 88 | libtcod/src17/path, 89 | libtcod/src17/sys, 90 | libtcod/src17/txtfield, 91 | #libtcod/src17/wrappers, 92 | libtcod/src17/zip 93 | 94 | else: # tcod112 95 | include 96 | libtcod/src112/libtcod_define, 97 | # 98 | libtcod/src112/color, 99 | libtcod/src112/console_types, 100 | libtcod/src112/console_console, 101 | libtcod/src112/fov_types, 102 | libtcod/src112/image, 103 | libtcod/src112/list, 104 | libtcod/src112/lex, 105 | libtcod/src112/mersenne_types, 106 | libtcod/src112/mouse_types, 107 | libtcod/src112/noise_defaults, 108 | libtcod/src112/noise, 109 | libtcod/src112/tree, 110 | # 111 | libtcod/src112/bresenham, 112 | libtcod/src112/bsp, 113 | libtcod/src112/console, 114 | libtcod/src112/console_drawing, 115 | libtcod/src112/console_printing, 116 | libtcod/src112/console_rexpaint, 117 | libtcod/src112/tileset, 118 | libtcod/src112/engine, 119 | libtcod/src112/fov, 120 | libtcod/src112/heightmap, 121 | libtcod/src112/mersenne, 122 | libtcod/src112/mouse, 123 | libtcod/src112/namegen, 124 | libtcod/src112/parser, 125 | libtcod/src112/path, 126 | libtcod/src112/sys, 127 | libtcod/src112/txtfield, 128 | libtcod/src112/version, 129 | #libtcod/src112/wrappers, 130 | libtcod/src112/zip 131 | 132 | -------------------------------------------------------------------------------- /libtcod.nimble: -------------------------------------------------------------------------------- 1 | # Package 2 | version = "1.112.0" 3 | author = "Vladar" 4 | description = "Wrapper of the libtcod library for the Nim language." 5 | license = "zlib" 6 | 7 | # Dependencies 8 | requires "nim >= 0.18.1", "sdl2_nim >= 0" 9 | 10 | -------------------------------------------------------------------------------- /libtcod/README.md: -------------------------------------------------------------------------------- 1 | Optional modules 2 | ================ 3 | 4 | cp437 should be imported manually. 5 | 6 | Special Characters 7 | ------------------ 8 | Additional `CHAR_` constants for different code pages: 9 | * cp437 - default "terminal" font (OEM-US or DOS Latin US) 10 | 11 | -------------------------------------------------------------------------------- /libtcod/cp437.nim: -------------------------------------------------------------------------------- 1 | ## CP437 special characters 2 | 3 | const 4 | # 0 - 127 5 | CHAR_CIRCLE*: cint = 9 6 | CHAR_CIRCLE_INV*: cint = 10 7 | CHAR_RECT*: cint = 22 8 | CHAR_DARROW_VU*: cint = 23 9 | CHAR_RIGHT_ANGLE*: cint = 28 10 | CHAR_SPACE*: cint = 32 11 | CHAR_DELETE*: cint = 127 12 | 13 | # 155 - 175 14 | CHAR_CENTS*: cint = 155 15 | CHAR_YENS*: cint = 157 16 | CHAR_PESETA*: cint = 158 17 | CHAR_SUPERA*: cint = 166 18 | CHAR_SUPERO*: cint = 167 19 | CHAR_QUESTION_INV*: cint = 168 20 | CHAR_RNOT*: cint = 169 21 | CHAR_NOT*: cint = 170 22 | CHAR_EXCLAM_INV*: cint = 173 23 | CHAR_LAQUOTE*: cint = 174 24 | CHAR_RAQUOTE*: cint = 175 25 | 26 | # single/double walls (181-216) 27 | # double horisontal 28 | CHAR_DH_TEEW*: cint = 181 29 | CHAR_DH_NE*: cint = 184 30 | CHAR_DH_SE*: cint = 190 31 | CHAR_DH_TEEE*: cint = 198 32 | CHAR_DH_TEEN*: cint = 207 33 | CHAR_DH_TEES*: cint = 209 34 | CHAR_DH_SW*: cint = 212 35 | CHAR_DH_NW*: cint = 213 36 | CHAR_DH_CROSS*: cint = 216 37 | # double vertical 38 | CHAR_DV_TEEW*: cint = 182 39 | CHAR_DV_NE*: cint = 183 40 | CHAR_DV_SE*: cint = 189 41 | CHAR_DV_TEEE*: cint = 199 42 | CHAR_DV_TEEN*: cint = 208 43 | CHAR_DV_TEES*: cint = 210 44 | CHAR_DV_SW*: cint = 211 45 | CHAR_DV_NW*: cint = 214 46 | CHAR_DV_CROSS*: cint = 215 47 | 48 | 49 | # blocks 50 | CHAR_BLOCK_F*: cint = 219 51 | CHAR_BLOCK_S*: cint = 220 52 | CHAR_BLOCK_W*: cint = 221 53 | CHAR_BLOCK_E*: cint = 222 54 | CHAR_BLOCK_N*: cint = 223 55 | 56 | # 224 - 225 57 | CHAR_ALPHA*: cint = 224 58 | CHAR_SHARPS*: cint = 225 59 | 60 | CHAR_GAMMA*: cint = 226 ## shadowed by TCOD's sub-pixel resolution kit 61 | CHAR_PI*: cint = 227 ## shadowed by TCOD's sub-pixel resolution kit 62 | CHAR_SIGMA_UP*: cint = 228## shadowed by TCOD's sub-pixel resolution kit 63 | CHAR_SIGMA*: cint = 229 ## shadowed by TCOD's sub-pixel resolution kit 64 | CHAR_MICRO*: cint = 230 ## shadowed by TCOD's sub-pixel resolution kit 65 | CHAR_TAU*: cint = 231 ## shadowed by TCOD's sub-pixel resolution kit 66 | CHAR_PHI_UP*: cint = 232 ## shadowed by TCOD's sub-pixel resolution kit 67 | 68 | # misc 69 | CHAR_THETA*: cint = 233 70 | CHAR_OMEGA*: cint = 234 71 | CHAR_DELTA*: cint = 235 72 | CHAR_INF*: cint = 236 73 | CHAR_PHI*: cint = 237 74 | CHAR_EPSILON*: cint = 238 75 | CHAR_INTERSECTION*: cint = 239 76 | CHAR_IDENTICAL*: cint = 240 77 | CHAR_PLUSMINUS*: cint = 241 78 | CHAR_GEQUAL*: cint = 242 79 | CHAR_LEQUAL*: cint = 243 80 | CHAR_TOPINT*: cint = 244 81 | CHAR_LOWINT*: cint = 245 82 | CHAR_ALMOSTEQUAL*: cint = 247 83 | CHAR_DEGREE*: cint = 248 84 | CHAR_BULLET2*: cint = 249 85 | CHAR_MDOT*: cint = 250 86 | CHAR_SQRT*: cint = 251 87 | CHAR_SUPERN*: cint = 252 88 | 89 | -------------------------------------------------------------------------------- /libtcod/src112/bresenham.nim: -------------------------------------------------------------------------------- 1 | # 2 | # BSD 3-Clause License 3 | # 4 | # Copyright © 2008-2019, Jice and the libtcod contributors. 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # 1. Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # 13 | # 2. Redistributions in binary form must reproduce the above copyright notice, 14 | # this list of conditions and the following disclaimer in the documentation 15 | # and/or other materials provided with the distribution. 16 | # 17 | # 3. Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived from 19 | # this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | # POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | 34 | type 35 | LineListener* = proc (x, y: cint): bool {.cdecl.} ## \ 36 | ## A callback to be passed to ``line`` 37 | ## 38 | ## The points given to the callback include both the starting and ending 39 | ## positions. 40 | ## 41 | ## As long as this callback returns true it will be called with the 42 | ## next ``x,y`` point on the line. 43 | 44 | proc lineInit*( 45 | xFrom, yFrom, xTo, yTo: cint) {. 46 | cdecl, importc: "TCOD_line_init", dynlib: LIB_NAME, 47 | deprecated: "This procedure is not reentrant. Use lineInitMt() instead".} 48 | 49 | proc lineStep*( 50 | xCur, yCur: ptr cint): bool {. 51 | cdecl, importc: "TCOD_line_step", dynlib: LIB_NAME, 52 | deprecated: "This procedure is not reentrant".} 53 | ## Advance one step. 54 | ## 55 | ## ``Returns`` `true` if we reach destination. 56 | 57 | proc line*( 58 | xFrom, yFrom, xTo, yTo: cint; listener: LineListener): bool {. 59 | cdecl, importc: "TCOD_line", dynlib: LIB_NAME.} 60 | ## Atomic callback procedure. Stops when the callback returns false. 61 | 62 | type 63 | BresenhamData* {.bycopy.} = object ## \ 64 | ## A struct used for computing a bresenham line. 65 | ## 66 | stepx*, stepy*: cint 67 | e*: cint 68 | deltax*, deltay*: cint 69 | origx*, origy*: cint 70 | destx*, desty*: cint 71 | 72 | proc lineInitMt*( 73 | xFrom, yFrom, xTo, yTo: cint; data: ptr BresenhamData) {. 74 | cdecl, importc: "TCOD_line_init_mt", dynlib: LIB_NAME.} 75 | 76 | proc lineStepMt*( 77 | xCur, yCur: ptr cint; data: ptr BresenhamData): bool {. 78 | cdecl, importc: "TCOD_line_step_mt", dynlib: LIB_NAME.} 79 | 80 | proc lineMt*( 81 | xFrom, yFrom, xTo, yTo: cint; 82 | listener: LineListener; data: ptr BresenhamData): bool {. 83 | cdecl, importc: "TCOD_line_mt", dynlib: LIB_NAME, 84 | deprecated: "Use line() instead".} 85 | 86 | -------------------------------------------------------------------------------- /libtcod/src112/bsp.nim: -------------------------------------------------------------------------------- 1 | # 2 | # BSD 3-Clause License 3 | # 4 | # Copyright © 2008-2019, Jice and the libtcod contributors. 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # 1. Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # 13 | # 2. Redistributions in binary form must reproduce the above copyright notice, 14 | # this list of conditions and the following disclaimer in the documentation 15 | # and/or other materials provided with the distribution. 16 | # 17 | # 3. Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived from 19 | # this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | # POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | 34 | # import mersenne_types, tree 35 | 36 | type 37 | Bsp* = ptr BspObj 38 | BspObj* {.bycopy.} = object ## \ 39 | ## 40 | tree*: TreeObj ## pseudo oop : bsp inherit tree 41 | x*, y*, w*, h*: cint ## node position & size 42 | position*: cint ## position of splitting 43 | level*: uint8 ## level in the tree 44 | horizontal*: bool ## horizontal splitting ? 45 | 46 | BspCallback* = proc (node: Bsp; userData: pointer): bool {.cdecl.} 47 | 48 | proc bspNew*(): Bsp {. 49 | cdecl, importc: "TCOD_bsp_new", dynlib: LIB_NAME.} 50 | 51 | proc bspNewWithSize*( 52 | x, y, w, h: cint): Bsp {. 53 | cdecl, importc: "TCOD_bsp_new_with_size", dynlib: LIB_NAME.} 54 | 55 | proc bspDelete_internal( 56 | node: Bsp) {. 57 | cdecl, importc: "TCOD_bsp_delete", dynlib: LIB_NAME.} 58 | 59 | proc bspDelete*(node: var Bsp) = 60 | if not (node == nil): 61 | bspDelete_internal(node) 62 | node = nil 63 | 64 | proc bspLeft*( 65 | node: Bsp): Bsp {. 66 | cdecl, importc: "TCOD_bsp_left", dynlib: LIB_NAME.} 67 | 68 | proc bspRight*( 69 | node: Bsp): Bsp {. 70 | cdecl, importc: "TCOD_bsp_right", dynlib: LIB_NAME.} 71 | 72 | proc bspFather*( 73 | node: Bsp): Bsp {. 74 | cdecl, importc: "TCOD_bsp_father", dynlib: LIB_NAME.} 75 | 76 | proc bspIsLeaf*( 77 | node: Bsp): bool {. 78 | cdecl, importc: "TCOD_bsp_is_leaf", dynlib: LIB_NAME.} 79 | 80 | proc bspTraversePreOrder*( 81 | node: Bsp; listener: BspCallback; userData: pointer = nil): bool {. 82 | cdecl, importc: "TCOD_bsp_traverse_pre_order", dynlib: LIB_NAME.} 83 | 84 | proc bspTraverseInOrder*( 85 | node: Bsp; listener: BspCallback; userData: pointer = nil): bool {. 86 | cdecl, importc: "TCOD_bsp_traverse_in_order", dynlib: LIB_NAME.} 87 | 88 | proc bspTraversePostOrder*( 89 | node: Bsp; listener: BspCallback; userData: pointer = nil): bool {. 90 | cdecl, importc: "TCOD_bsp_traverse_post_order", dynlib: LIB_NAME.} 91 | 92 | proc bspTraverseLevelOrder*( 93 | node: Bsp; listener: BspCallback; userData: pointer = nil): bool {. 94 | cdecl, importc: "TCOD_bsp_traverse_level_order", dynlib: LIB_NAME.} 95 | 96 | proc bspTraverseInvertedLevelOrder*( 97 | node: Bsp; listener: BspCallback; userData: pointer = nil): bool {. 98 | cdecl, importc: "TCOD_bsp_traverse_inverted_level_order", dynlib: LIB_NAME.} 99 | 100 | proc bspContains*( 101 | node: Bsp; x, y: cint): bool {. 102 | cdecl, importc: "TCOD_bsp_contains", dynlib: LIB_NAME.} 103 | 104 | proc bspFindNode*( 105 | node: Bsp; x, y: cint): Bsp {. 106 | cdecl, importc: "TCOD_bsp_find_node", dynlib: LIB_NAME.} 107 | 108 | proc bspResize*( 109 | node: Bsp; x, y, w, h: cint) {. 110 | cdecl, importc: "TCOD_bsp_resize", dynlib: LIB_NAME.} 111 | 112 | proc bspSplitOnce*( 113 | node: Bsp; horizontal: bool; position: cint) {. 114 | cdecl, importc: "TCOD_bsp_split_once", dynlib: LIB_NAME.} 115 | 116 | proc bspSplitRecursive*( 117 | node: Bsp; randomizer: Random; 118 | nb, minHSize, minVSize: cint; 119 | maxHRatio, maxVRatio: cfloat) {. 120 | cdecl, importc: "TCOD_bsp_split_recursive", dynlib: LIB_NAME.} 121 | 122 | proc bspRemoveSons*( 123 | node: Bsp) {. 124 | cdecl, importc: "TCOD_bsp_remove_sons", dynlib: LIB_NAME.} 125 | 126 | -------------------------------------------------------------------------------- /libtcod/src112/console.nim: -------------------------------------------------------------------------------- 1 | # 2 | # BSD 3-Clause License 3 | # 4 | # Copyright © 2008-2019, Jice and the libtcod contributors. 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # 1. Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # 13 | # 2. Redistributions in binary form must reproduce the above copyright notice, 14 | # this list of conditions and the following disclaimer in the documentation 15 | # and/or other materials provided with the distribution. 16 | # 17 | # 3. Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived from 19 | # this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | # POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | 34 | # import color, console_types, image, list 35 | 36 | template bkgndAlpha*(alpha: untyped): untyped = 37 | ((BkgndFlag)(BKGND_ALPH.uint8 or (((uint8)(alpha * 255)) shl 8))) 38 | 39 | template bkgndAddalpha*(alpha: untyped): untyped = 40 | ((BkgndFlag)(BKGND_ADDA.uint8 or (((uint8)(alpha * 255)) shl 8))) 41 | 42 | proc consoleSetCustomFont*( 43 | fontFile: cstring; 44 | flags: cint = FONT_LAYOUT_ASCII_INCOL; 45 | nbCharHoriz: cint = 0; 46 | nbCharVertic: cint = 0) {. 47 | cdecl, importc: "TCOD_console_set_custom_font", dynlib: LIB_NAME.} 48 | 49 | proc consoleMapAsciiCodeToFont*( 50 | asciiCode, fontCharX, fontCharY: cint) {. 51 | cdecl, importc: "TCOD_console_map_ascii_code_to_font", dynlib: LIB_NAME.} 52 | 53 | proc consoleMapAsciiCodesToFont*( 54 | asciiCode, nbCodes, fontCharX, fontCharY: cint) {. 55 | cdecl, importc: "TCOD_console_map_ascii_codes_to_font", dynlib: LIB_NAME.} 56 | 57 | proc consoleMapStringToFont*( 58 | s: cstring; fontCharX, fontCharY: cint) {. 59 | cdecl, importc: "TCOD_console_map_string_to_font", dynlib: LIB_NAME.} 60 | 61 | # proc consoleMapStringToFontUTF is located in the console_printing.nim 62 | 63 | proc consoleSetDirty*( 64 | x, y, w, h: cint) {. 65 | cdecl, importc: "TCOD_console_set_dirty", dynlib: LIB_NAME.} 66 | 67 | proc consoleFlush*() {. 68 | cdecl, importc: "TCOD_console_flush", dynlib: LIB_NAME.} 69 | 70 | proc consoleSetColorControl*( 71 | con: Colctrl; fore, back: Color) {. 72 | cdecl, importc: "TCOD_console_set_color_control", dynlib: LIB_NAME.} 73 | 74 | proc consoleCheckForKeypress*( 75 | flags: cint): Key {. 76 | cdecl, importc: "TCOD_console_check_for_keypress", dynlib: LIB_NAME.} 77 | 78 | proc consoleWaitForKeypress*( 79 | flush: bool): Key {. 80 | cdecl, importc: "TCOD_console_wait_for_keypress", dynlib: LIB_NAME.} 81 | 82 | proc consoleIsKeyPressed*( 83 | key: Keycode): bool {. 84 | cdecl, importc: "TCOD_console_is_key_pressed", dynlib: LIB_NAME.} 85 | 86 | proc consoleFromFile*( 87 | filename: cstring): Console {. 88 | cdecl, importc: "TCOD_console_from_file", dynlib: LIB_NAME.} 89 | ## ASCII paint file support 90 | 91 | proc consoleLoadAsc*( 92 | con: Console; filename: cstring): bool {. 93 | cdecl, importc: "TCOD_console_load_asc", dynlib: LIB_NAME.} 94 | 95 | proc consoleLoadApf*( 96 | con: Console; filename: cstring): bool {. 97 | cdecl, importc: "TCOD_console_load_apf", dynlib: LIB_NAME.} 98 | 99 | proc consoleSaveAsc*( 100 | con: Console; filename: cstring): bool {. 101 | cdecl, importc: "TCOD_console_save_asc", dynlib: LIB_NAME.} 102 | 103 | proc consoleSaveApf*( 104 | con: Console; filename: cstring): bool {. 105 | cdecl, importc: "TCOD_console_save_apf", dynlib: LIB_NAME.} 106 | 107 | proc consoleCredits*() {. 108 | cdecl, importc: "TCOD_console_credits", dynlib: LIB_NAME.} 109 | 110 | proc consoleCreditsReset*() {. 111 | cdecl, importc: "TCOD_console_credits_reset", dynlib: LIB_NAME.} 112 | 113 | proc consoleCreditsRender*( 114 | x, y: cint; alpha: bool): bool {. 115 | cdecl, importc: "TCOD_console_credits_render", dynlib: LIB_NAME.} 116 | 117 | proc consoleSetKeyboardRepeat*( 118 | initialDelay, interval: cint) {. 119 | cdecl, importc: "TCOD_console_set_keyboard_repeat", dynlib: LIB_NAME, 120 | deprecated: "This function is a stub an will do nothing".} 121 | 122 | proc consoleDisableKeyboardRepeat*() {. 123 | cdecl, importc: "TCOD_console_disable_keyboard_repeat", dynlib: LIB_NAME, 124 | deprecated: "This function is a stub and will do nothing".} 125 | 126 | -------------------------------------------------------------------------------- /libtcod/src112/console_drawing.nim: -------------------------------------------------------------------------------- 1 | # 2 | # BSD 3-Clause License 3 | # 4 | # Copyright © 2008-2019, Jice and the libtcod contributors. 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # 1. Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # 13 | # 2. Redistributions in binary form must reproduce the above copyright notice, 14 | # this list of conditions and the following disclaimer in the documentation 15 | # and/or other materials provided with the distribution. 16 | # 17 | # 3. Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived from 19 | # this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | # POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | 34 | proc consoleRect*( 35 | con: Console; x, y, w, h: cint; clear: bool; 36 | flag: BkgndFlag = BKGND_DEFAULT) {. 37 | cdecl, importc: "TCOD_console_rect", dynlib: LIB_NAME.} 38 | ## Draw a rectangle onto a console. 39 | ## 40 | ## ``con`` A console pointer. 41 | ## 42 | ## ``x`` The starting region, the left-most position being `0`. 43 | ## 44 | ## ``y`` The starting region, the top-most position being `0`. 45 | ## 46 | ## ``rw`` The width of the rectangle. 47 | ## 48 | ## ``rh`` The height of the rectangle. 49 | ## 50 | ## ``clear`` If true the drawing region will be filled with spaces. 51 | ## 52 | ## ``flag`` The blending flag to use. 53 | 54 | proc consoleHline*( 55 | con: Console; x, y, l: cint; 56 | flag: BkgndFlag = BKGND_DEFAULT) {. 57 | cdecl, importc: "TCOD_console_hline", dynlib: LIB_NAME.} 58 | ## Draw a horizontal line using the default colors. 59 | ## 60 | ## ``con`` A console pointer. 61 | ## 62 | ## ``x`` The starting X coordinate, the left-most position being `0`. 63 | ## 64 | ## ``y`` The starting Y coordinate, the top-most position being `0`. 65 | ## 66 | ## ``l`` The width of the line. 67 | ## 68 | ## ``flag`` The blending flag. 69 | ## 70 | ## This function makes assumptions about the fonts character encoding. 71 | ## It will fail if the font encoding is not `cp437`. 72 | 73 | proc consoleVline*( 74 | con: Console; x, y, l: cint; 75 | flag: BkgndFlag = BKGND_DEFAULT) {. 76 | cdecl, importc: "TCOD_console_vline", dynlib: LIB_NAME.} 77 | ## Draw a vertical line using the default colors. 78 | ## 79 | ## ``con`` A console pointer. 80 | ## 81 | ## ``x`` The starting X coordinate, the left-most position being `0`. 82 | ## 83 | ## ``y`` The starting Y coordinate, the top-most position being `0`. 84 | ## 85 | ## ``l`` The height of the line. 86 | ## 87 | ## ``flag`` The blending flag. 88 | ## 89 | ## This function makes assumptions about the fonts character encoding. 90 | ## It will fail if the font encoding is not `cp437`. 91 | 92 | -------------------------------------------------------------------------------- /libtcod/src112/console_rexpaint.nim: -------------------------------------------------------------------------------- 1 | # 2 | # BSD 3-Clause License 3 | # 4 | # Copyright © 2008-2019, Jice and the libtcod contributors. 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # 1. Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # 13 | # 2. Redistributions in binary form must reproduce the above copyright notice, 14 | # this list of conditions and the following disclaimer in the documentation 15 | # and/or other materials provided with the distribution. 16 | # 17 | # 3. Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived from 19 | # this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | # POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | 34 | # import console, console_types, list 35 | 36 | proc consoleFromXp*( 37 | filename: cstring): Console {. 38 | cdecl, importc: "TCOD_console_from_xp", dynlib: LIB_NAME.} 39 | 40 | proc consoleLoadXp*( 41 | con: Console; filename: cstring): bool {. 42 | cdecl, importc: "TCOD_console_load_xp", dynlib: LIB_NAME.} 43 | 44 | proc consoleSaveXp*( 45 | con: Console; filename: cstring; compressLevel: cint): bool {. 46 | cdecl, importc: "TCOD_console_save_xp", dynlib: LIB_NAME.} 47 | 48 | proc consoleListFromXp*( 49 | filename: cstring): List {. 50 | cdecl, importc: "TCOD_console_list_from_xp", dynlib: LIB_NAME.} 51 | 52 | proc consoleListSaveXp*( 53 | consoleList: List; filename: cstring; compressLevel: cint): bool {. 54 | cdecl, importc: "TCOD_console_list_save_xp", dynlib: LIB_NAME.} 55 | 56 | -------------------------------------------------------------------------------- /libtcod/src112/fov.nim: -------------------------------------------------------------------------------- 1 | # 2 | # BSD 3-Clause License 3 | # 4 | # Copyright © 2008-2019, Jice and the libtcod contributors. 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # 1. Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # 13 | # 2. Redistributions in binary form must reproduce the above copyright notice, 14 | # this list of conditions and the following disclaimer in the documentation 15 | # and/or other materials provided with the distribution. 16 | # 17 | # 3. Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived from 19 | # this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | # POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | 34 | # import fov_types 35 | 36 | 37 | proc mapNew*( 38 | width, height: cint): Map {. 39 | cdecl, importc: "TCOD_map_new", dynlib: LIB_NAME.} 40 | ## Allocate a new map. 41 | 42 | proc mapClear*( 43 | map: Map; transparent: bool = false; walkable: bool = false) {. 44 | cdecl, importc: "TCOD_map_clear", dynlib: LIB_NAME.} 45 | ## Set all cells as solid rock (cannot see through nor walk). 46 | 47 | proc mapCopy*( 48 | source, dest: Map) {. 49 | cdecl, importc: "TCOD_map_copy", dynlib: LIB_NAME.} 50 | ## Copy a map to another, reallocating it when needed. 51 | 52 | proc mapSetProperties*( 53 | map: Map; x, y: cint; isTransparent, isWalkable: bool) {. 54 | cdecl, importc: "TCOD_map_set_properties", dynlib: LIB_NAME.} 55 | ## Change a cell properties. 56 | 57 | proc mapDelete_internal( 58 | map: Map) {. 59 | cdecl, importc: "TCOD_map_delete", dynlib: LIB_NAME.} 60 | 61 | proc mapDelete*(map: var Map) = 62 | ## Destroy a map. 63 | ## 64 | if map != nil: 65 | mapDelete_internal(map) 66 | map = nil 67 | 68 | proc mapComputeFov*( 69 | map: Map; playerX, playerY: cint; 70 | maxRadius: cint = 0; 71 | lightWalls: bool = true; 72 | algo: FovAlgorithm = FOV_BASIC) {. 73 | cdecl, importc: "TCOD_map_compute_fov", dynlib: LIB_NAME.} 74 | ## Calculate the field of view 75 | ## (potentially visible cells from ``playerX, playerY``). 76 | 77 | proc mapIsInFov*( 78 | map: Map; x, y: cint): bool {. 79 | cdecl, importc: "TCOD_map_is_in_fov", dynlib: LIB_NAME.} 80 | ## Check if a cell is in the last computed field of view. 81 | 82 | proc mapSetInFov*( 83 | map: Map; x, y: cint; fov: bool) {. 84 | cdecl, importc: "TCOD_map_set_in_fov", dynlib: LIB_NAME.} 85 | 86 | 87 | proc mapIsTransparent*( 88 | map: Map; x, y: cint): bool {. 89 | cdecl, importc: "TCOD_map_is_transparent", dynlib: LIB_NAME.} 90 | ## Retrieve properties from the map. 91 | 92 | proc mapIsWalkable*( 93 | map: Map; x, y: cint): bool {. 94 | cdecl, importc: "TCOD_map_is_walkable", dynlib: LIB_NAME.} 95 | 96 | proc mapGetWidth*( 97 | map: Map): cint {. 98 | cdecl, importc: "TCOD_map_get_width", dynlib: LIB_NAME.} 99 | 100 | proc mapGetHeight*( 101 | map: Map): cint {. 102 | cdecl, importc: "TCOD_map_get_height", dynlib: LIB_NAME.} 103 | 104 | proc mapGetNbCells*( 105 | map: Map): cint {. 106 | cdecl, importc: "TCOD_map_get_nb_cells", dynlib: LIB_NAME.} 107 | 108 | -------------------------------------------------------------------------------- /libtcod/src112/fov_types.nim: -------------------------------------------------------------------------------- 1 | # 2 | # BSD 3-Clause License 3 | # 4 | # Copyright © 2008-2019, Jice and the libtcod contributors. 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # 1. Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # 13 | # 2. Redistributions in binary form must reproduce the above copyright notice, 14 | # this list of conditions and the following disclaimer in the documentation 15 | # and/or other materials provided with the distribution. 16 | # 17 | # 3. Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived from 19 | # this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | # POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | 34 | type 35 | MapCell* {.bycopy.} = object ## \ 36 | ## Private map cell object. 37 | transparent*: bool 38 | walkable*: bool 39 | fov*: bool 40 | 41 | Map* = ptr MapObj 42 | MapObj* {.bycopy.} = object ## \ 43 | ## Private map object. 44 | width*: cint 45 | height*: cint 46 | nbCells*: cint 47 | cells*: ptr MapCell 48 | 49 | FovAlgorithm* {.size: sizeof(cint).} = enum ## Field-of-view options. 50 | FOV_BASIC, ## \ 51 | ## FOV_BASIC : http://roguebasin.roguelikedevelopment.org/index.php?title=Ray_casting 52 | FOV_DIAMOND, ## \ 53 | ## FOV_DIAMOND : http://www.geocities.com/temerra/los_rays.html 54 | FOV_SHADOW, ## \ 55 | ## FOV_SHADOW : http://roguebasin.roguelikedevelopment.org/index.php?title=FOV_using_recursive_shadowcasting 56 | FOV_PERMISSIVE_0, ## \ 57 | ## FOV_PERMISSIVE : http://roguebasin.roguelikedevelopment.org/index.php?title=Precise_Permissive_Field_of_View 58 | FOV_PERMISSIVE_1, FOV_PERMISSIVE_2, FOV_PERMISSIVE_3, FOV_PERMISSIVE_4, 59 | FOV_PERMISSIVE_5, FOV_PERMISSIVE_6, FOV_PERMISSIVE_7, FOV_PERMISSIVE_8, 60 | FOV_RESTRICTIVE, ## \ 61 | ## FOV_RESTRICTIVE : Mingos' Restrictive Precise Angle Shadowcasting (contribution by Mingos) 62 | NB_FOV_ALGORITHMS 63 | 64 | 65 | template fov_Permissive*(x: untyped): untyped = 66 | ((FovAlgorithm)(FOV_PERMISSIVE_0 + (x))) 67 | 68 | -------------------------------------------------------------------------------- /libtcod/src112/libtcod_define.nim: -------------------------------------------------------------------------------- 1 | # 2 | # BSD 3-Clause License 3 | # 4 | # Copyright © 2008-2019, Jice and the libtcod contributors. 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # 1. Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # 13 | # 2. Redistributions in binary form must reproduce the above copyright notice, 14 | # this list of conditions and the following disclaimer in the documentation 15 | # and/or other materials provided with the distribution. 16 | # 17 | # 3. Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived from 19 | # this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | # POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | 34 | {.deadCodeElim: on.} 35 | 36 | # csize is deprecated in Nim v1.1 37 | # See Nim commit 99078d80d7abb1c47612bc70f7affbde8735066a 38 | when not declared(csize_t): 39 | type csize_t* {.importc: "size_t", nodecl.} = uint 40 | 41 | const 42 | NO_UNICODE* = false ## Disable Unicode support 43 | NO_OPENGL* = false ## Disable OpenGL support 44 | 45 | when defined(linux): 46 | const LIB_NAME* = "libtcod.so(|.1.0.12)" 47 | 48 | elif defined(MacOSX): 49 | const LIB_NAME* = "libtcod.dylib" 50 | 51 | else: # windows 52 | const LIB_NAME* = "libtcod.dll" 53 | 54 | -------------------------------------------------------------------------------- /libtcod/src112/list.nim: -------------------------------------------------------------------------------- 1 | # 2 | # BSD 3-Clause License 3 | # 4 | # Copyright © 2008-2019, Jice and the libtcod contributors. 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # 1. Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # 13 | # 2. Redistributions in binary form must reproduce the above copyright notice, 14 | # this list of conditions and the following disclaimer in the documentation 15 | # and/or other materials provided with the distribution. 16 | # 17 | # 3. Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived from 19 | # this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | # POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | 34 | type 35 | List* = pointer 36 | 37 | 38 | proc listNew*(): List {. 39 | cdecl, importc: "TCOD_list_new", dynlib: LIB_NAME.} 40 | 41 | proc listAllocate*( 42 | nbElements: cint): List {. 43 | cdecl, importc: "TCOD_list_allocate", dynlib: LIB_NAME.} 44 | 45 | proc listDuplicate*( 46 | l: List): List {. 47 | cdecl, importc: "TCOD_list_duplicate", dynlib: LIB_NAME.} 48 | 49 | proc listDelete_internal( 50 | l: List) {. 51 | cdecl, importc: "TCOD_list_delete", dynlib: LIB_NAME.} 52 | 53 | proc listDelete*(l: var List) = 54 | if not (l == nil): 55 | listDelete_internal(l) 56 | l = nil 57 | 58 | proc listPush*( 59 | l: List; elt: pointer) {. 60 | cdecl, importc: "TCOD_list_push", dynlib: LIB_NAME.} 61 | 62 | proc listPop*( 63 | l: List): pointer {. 64 | cdecl, importc: "TCOD_list_pop", dynlib: LIB_NAME.} 65 | 66 | proc listPeek*( 67 | l: List): pointer {. 68 | cdecl, importc: "TCOD_list_peek", dynlib: LIB_NAME.} 69 | 70 | proc listAddAll*( 71 | l, l2: List) {. 72 | cdecl, importc: "TCOD_list_add_all", dynlib: LIB_NAME.} 73 | 74 | proc listGet*( 75 | l: List; idx: cint): pointer {. 76 | cdecl, importc: "TCOD_list_get", dynlib: LIB_NAME.} 77 | 78 | proc listSet*( 79 | l: List; elt: pointer; idx: cint) {. 80 | cdecl, importc: "TCOD_list_set", dynlib: LIB_NAME.} 81 | 82 | proc listBegin*( 83 | l: List): ptr pointer {. 84 | cdecl, importc: "TCOD_list_begin", dynlib: LIB_NAME.} 85 | 86 | proc listEnd*( 87 | l: List): ptr pointer {. 88 | cdecl, importc: "TCOD_list_end", dynlib: LIB_NAME.} 89 | 90 | proc listReverse*( 91 | l: List) {. 92 | cdecl, importc: "TCOD_list_reverse", dynlib: LIB_NAME.} 93 | 94 | proc listRemoveIterator*( 95 | l: List; elt: ptr pointer): ptr pointer {. 96 | cdecl, importc: "TCOD_list_remove_iterator", dynlib: LIB_NAME.} 97 | 98 | proc listRemove*( 99 | l: List; elt: pointer) {. 100 | cdecl, importc: "TCOD_list_remove", dynlib: LIB_NAME.} 101 | 102 | proc listRemoveIteratorFast*( 103 | l: List; elt: ptr pointer): ptr pointer {. 104 | cdecl, importc: "TCOD_list_remove_iterator_fast", dynlib: LIB_NAME.} 105 | 106 | proc listRemoveFast*( 107 | l: List; elt: pointer) {. 108 | cdecl, importc: "TCOD_list_remove_fast", dynlib: LIB_NAME.} 109 | 110 | proc listContains*( 111 | l: List; elt: pointer): bool {. 112 | cdecl, importc: "TCOD_list_contains", dynlib: LIB_NAME.} 113 | 114 | proc listClear*( 115 | l: List) {. 116 | cdecl, importc: "TCOD_list_clear", dynlib: LIB_NAME.} 117 | 118 | proc listClearAndDelete_internal( 119 | l: List) {. 120 | cdecl, importc: "TCOD_list_clear_and_delete", dynlib: LIB_NAME.} 121 | 122 | proc listClearAndDelete*(l: var List) = 123 | if not (l == nil): 124 | listClearAndDelete_internal(l) 125 | l = nil 126 | 127 | proc listSize*( 128 | l: List): cint {. 129 | cdecl, importc: "TCOD_list_size", dynlib: LIB_NAME.} 130 | 131 | proc listInsertBefore*( 132 | l: List; elt: pointer; before: cint): ptr pointer {. 133 | cdecl, importc: "TCOD_list_insert_before", dynlib: LIB_NAME.} 134 | 135 | proc listIsEmpty*( 136 | l: List): bool {. 137 | cdecl, importc: "TCOD_list_is_empty", dynlib: LIB_NAME.} 138 | 139 | -------------------------------------------------------------------------------- /libtcod/src112/mersenne.nim: -------------------------------------------------------------------------------- 1 | # 2 | # BSD 3-Clause License 3 | # 4 | # Copyright © 2008-2019, Jice and the libtcod contributors. 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # 1. Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # 13 | # 2. Redistributions in binary form must reproduce the above copyright notice, 14 | # this list of conditions and the following disclaimer in the documentation 15 | # and/or other materials provided with the distribution. 16 | # 17 | # 3. Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived from 19 | # this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | # POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | 34 | # import mersenne_types 35 | 36 | proc randomGetInstance*(): Random {. 37 | cdecl, importc: "TCOD_random_get_instance", dynlib: LIB_NAME.} 38 | 39 | proc randomNew*( 40 | algo: RandomAlgo = RNG_CMWC): Random {. 41 | cdecl, importc: "TCOD_random_new", dynlib: LIB_NAME.} 42 | 43 | proc randomSave*( 44 | mersenne: Random): Random {. 45 | cdecl, importc: "TCOD_random_save", dynlib: LIB_NAME.} 46 | 47 | proc randomRestore*( 48 | mersenne: Random; backup: Random) {. 49 | cdecl, importc: "TCOD_random_restore", dynlib: LIB_NAME.} 50 | 51 | proc randomNewFromSeed*( 52 | algo: RandomAlgo = RNG_CMWC; seed: uint32 = 0): Random {. 53 | cdecl, importc: "TCOD_random_new_from_seed", dynlib: LIB_NAME.} 54 | 55 | proc randomDelete_internal( 56 | mersenne: Random) {. 57 | cdecl, importc: "TCOD_random_delete", dynlib: LIB_NAME.} 58 | 59 | proc randomDelete*(mersenne: var Random) = 60 | if not (mersenne == nil): 61 | randomDelete_internal(mersenne) 62 | mersenne = nil 63 | 64 | proc randomSetDistribution*( 65 | mersenne: Random; distribution: Distribution) {. 66 | cdecl, importc: "TCOD_random_set_distribution", dynlib: LIB_NAME.} 67 | 68 | proc randomGetInt*( 69 | mersenne: Random; `min`, `max`: cint): cint {. 70 | cdecl, importc: "TCOD_random_get_int", dynlib: LIB_NAME.} 71 | 72 | template randomGetChar*(mersenne: Random; `min`, `max`: char): char = 73 | (char(randomGetInt(mersenne, `min`.ord, `max`.ord))) 74 | 75 | proc randomGetFloat*( 76 | mersenne: Random; `min`, `max`: cfloat): cfloat {. 77 | cdecl, importc: "TCOD_random_get_float", dynlib: LIB_NAME.} 78 | 79 | proc randomGetDouble*( 80 | mersenne: Random; `min`, `max`: cdouble): cdouble {. 81 | cdecl, importc: "TCOD_random_get_double", dynlib: LIB_NAME.} 82 | 83 | proc randomGetIntMean*( 84 | mersenne: Random; `min`, `max`, mean: cint = 0): cint {. 85 | cdecl, importc: "TCOD_random_get_int_mean", dynlib: LIB_NAME.} 86 | 87 | proc randomGetFloatMean*( 88 | mersenne: Random; `min`, `max`, mean: cfloat = 0.0): cfloat {. 89 | cdecl, importc: "TCOD_random_get_float_mean", dynlib: LIB_NAME.} 90 | 91 | proc randomGetDoubleMean*( 92 | mersenne: Random; `min`, `max`, mean: cdouble = 0.0): cdouble {. 93 | cdecl, importc: "TCOD_random_get_double_mean", dynlib: LIB_NAME.} 94 | 95 | proc randomDiceNew*( 96 | s: cstring): Dice {. 97 | cdecl, importc: "TCOD_random_dice_new", dynlib: LIB_NAME.} 98 | 99 | proc randomDiceRoll*( 100 | mersenne: Random; dice: Dice): cint {. 101 | cdecl, importc: "TCOD_random_dice_roll", dynlib: LIB_NAME.} 102 | 103 | proc randomDiceRollS*( 104 | mersenne: Random; s: cstring): cint {. 105 | cdecl, importc: "TCOD_random_dice_roll_s", dynlib: LIB_NAME.} 106 | 107 | -------------------------------------------------------------------------------- /libtcod/src112/mersenne_types.nim: -------------------------------------------------------------------------------- 1 | # 2 | # BSD 3-Clause License 3 | # 4 | # Copyright © 2008-2019, Jice and the libtcod contributors. 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # 1. Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # 13 | # 2. Redistributions in binary form must reproduce the above copyright notice, 14 | # this list of conditions and the following disclaimer in the documentation 15 | # and/or other materials provided with the distribution. 16 | # 17 | # 3. Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived from 19 | # this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | # POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | 34 | type 35 | Random* = pointer 36 | 37 | 38 | type 39 | Dice* {.bycopy.} = object ## \ 40 | ## Dice roll. 41 | ## 42 | nbRolls*: cint 43 | nbFaces*: cint 44 | multiplier*: cfloat 45 | addsub*: cfloat 46 | 47 | 48 | # PRNG algorithms 49 | 50 | type 51 | RandomAlgo* {.size: sizeof(cint).} = enum 52 | RNG_MT 53 | RNG_CMWC 54 | 55 | Distribution* {.size: sizeof(cint).} = enum 56 | DISTRIBUTION_LINEAR 57 | DISTRIBUTION_GAUSSIAN 58 | DISTRIBUTION_GAUSSIAN_RANGE 59 | DISTRIBUTION_GAUSSIAN_INVERSE 60 | DISTRIBUTION_GAUSSIAN_RANGE_INVERSE 61 | 62 | 63 | import strutils 64 | 65 | proc repr*(dice: Dice): string = 66 | result = "" 67 | if not (dice.multiplier == 1.0): 68 | result.add(formatFloat(dice.multiplier, ffDefault, 0) & "*") 69 | result.add(repr(dice.nb_rolls) & "d" & repr(dice.nb_faces)) 70 | if not (dice.addsub == 0.0): 71 | if 0.0 < dice.addsub: 72 | result.add("+") 73 | result.add(formatFloat(dice.addsub, ffDefault, 0)) 74 | 75 | -------------------------------------------------------------------------------- /libtcod/src112/mouse.nim: -------------------------------------------------------------------------------- 1 | # 2 | # BSD 3-Clause License 3 | # 4 | # Copyright © 2008-2019, Jice and the libtcod contributors. 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # 1. Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # 13 | # 2. Redistributions in binary form must reproduce the above copyright notice, 14 | # this list of conditions and the following disclaimer in the documentation 15 | # and/or other materials provided with the distribution. 16 | # 17 | # 3. Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived from 19 | # this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | # POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | 34 | # import mouse_types 35 | 36 | proc mouseShowCursor*( 37 | visible: bool) {. 38 | cdecl, importc: "TCOD_mouse_show_cursor", dynlib: LIB_NAME.} 39 | 40 | proc mouseGetStatus*(): Mouse {. 41 | cdecl, importc: "TCOD_mouse_get_status", dynlib: LIB_NAME.} 42 | 43 | proc mouseIsCursorVisible*(): bool {. 44 | cdecl, importc: "TCOD_mouse_is_cursor_visible", dynlib: LIB_NAME.} 45 | 46 | proc mouseMove*( 47 | x, y: cint) {. 48 | cdecl, importc: "TCOD_mouse_move", dynlib: LIB_NAME.} 49 | 50 | proc mouseIncludesTouch*( 51 | enable: bool) {. 52 | cdecl, importc: "TCOD_mouse_includes_touch", dynlib: LIB_NAME.} 53 | 54 | -------------------------------------------------------------------------------- /libtcod/src112/mouse_types.nim: -------------------------------------------------------------------------------- 1 | # 2 | # BSD 3-Clause License 3 | # 4 | # Copyright © 2008-2019, Jice and the libtcod contributors. 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # 1. Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # 13 | # 2. Redistributions in binary form must reproduce the above copyright notice, 14 | # this list of conditions and the following disclaimer in the documentation 15 | # and/or other materials provided with the distribution. 16 | # 17 | # 3. Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived from 19 | # this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | # POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | 34 | type 35 | Mouse* {.bycopy.} = object ## \ 36 | ## Mouse data. 37 | ## 38 | x*, y*: cint ## absolute position 39 | dx*, dy*: cint ## movement since last update in pixels 40 | cx*, cy*: cint ## cell coordinates in the root console 41 | dcx*, dcy*: cint ## movement since last update in console cells 42 | lbutton*: bool ## left button status 43 | rbutton*: bool ## right button status 44 | mbutton*: bool ## middle button status 45 | lbuttonPressed*: bool ## left button pressed event 46 | rbuttonPressed*: bool ## right button pressed event 47 | mbuttonPressed*: bool ## middle button pressed event 48 | wheelUp*: bool ## wheel up event 49 | wheelDown*: bool ## wheel down event 50 | 51 | -------------------------------------------------------------------------------- /libtcod/src112/namegen.nim: -------------------------------------------------------------------------------- 1 | # 2 | # BSD 3-Clause License 3 | # 4 | # Copyright © 2008-2019, Jice and the libtcod contributors. 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # 1. Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # 13 | # 2. Redistributions in binary form must reproduce the above copyright notice, 14 | # this list of conditions and the following disclaimer in the documentation 15 | # and/or other materials provided with the distribution. 16 | # 17 | # 3. Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived from 19 | # this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | # POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | 34 | # 35 | # Mingos' NameGen 36 | # This file was written by Dominik "Mingos" Marczuk. 37 | # 38 | 39 | # import list, mersenne_types 40 | 41 | type 42 | Namegen* = pointer ## The generator type. 43 | 44 | 45 | proc namegenParse*( 46 | filename: cstring; random: Random = nil) {. 47 | cdecl, importc: "TCOD_namegen_parse", dynlib: LIB_NAME.} 48 | ## Parse a file with syllable sets. 49 | 50 | proc namegenGenerate*( 51 | name: cstring; allocate: bool = false): cstring {. 52 | cdecl, importc: "TCOD_namegen_generate", dynlib: LIB_NAME.} 53 | ## Generate a name. 54 | 55 | proc namegenGenerateCustom*( 56 | name, rule: cstring; allocate: bool = false): cstring {. 57 | cdecl, importc: "TCOD_namegen_generate_custom", dynlib: LIB_NAME.} 58 | ## Generate a name using a custom generation rule. 59 | 60 | proc namegenGetSets*(): List {. 61 | cdecl, importc: "TCOD_namegen_get_sets", dynlib: LIB_NAME.} 62 | ## Retrieve the list of all available syllable set names. 63 | 64 | proc namegenGetSetsSeq*(): seq[string] = 65 | ## Retrieve the list of all available syllable set names. 66 | var list = namegenGetSets() 67 | result = cstringArrayToSeq(cast[cstringArray](listBegin(list)), listSize(list)) 68 | listDelete(list) 69 | 70 | proc namegenDestroy*() {. 71 | cdecl, importc: "TCOD_namegen_destroy", dynlib: LIB_NAME.} 72 | ## Delete a generator. 73 | 74 | -------------------------------------------------------------------------------- /libtcod/src112/noise.nim: -------------------------------------------------------------------------------- 1 | # 2 | # BSD 3-Clause License 3 | # 4 | # Copyright © 2008-2019, Jice and the libtcod contributors. 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # 1. Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # 13 | # 2. Redistributions in binary form must reproduce the above copyright notice, 14 | # this list of conditions and the following disclaimer in the documentation 15 | # and/or other materials provided with the distribution. 16 | # 17 | # 3. Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived from 19 | # this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | # POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | 34 | # import mersenne_types 35 | 36 | type 37 | NoiseKind* {.size: sizeof(cint).} = enum 38 | NOISE_DEFAULT = 0, NOISE_PERLIN = 1, NOISE_SIMPLEX = 2, NOISE_WAVELET = 4 39 | 40 | Noise* = ptr NoiseObj 41 | NoiseObj* {.bycopy.} = object 42 | ndim*: cint ## Randomized map of indexes into buffer 43 | map*: array[256, cuchar] ## Random 256 x ndim buffer 44 | buffer*: array[256, array[NOISE_MAX_DIMENSIONS, cfloat]] ## fractal stuff 45 | h*: cfloat 46 | lacunarity*: cfloat 47 | exponent*: array[NOISE_MAX_OCTAVES, cfloat] 48 | waveletTileData*: ptr cfloat 49 | rand*: Random ## noise type 50 | noiseType*: NoiseKind 51 | 52 | 53 | template toPtr*(f: var openarray[cfloat]): ptr cfloat = 54 | cast[ptr cfloat](addr(f)) 55 | 56 | template floatArrayToPtr*(f: var openarray[cfloat]): ptr cfloat = toPtr(f) 57 | 58 | proc noiseNew*( 59 | dimensions: cint; hurst, lacunarity: cfloat; random: Random = nil): Noise {. 60 | cdecl, importc: "TCOD_noise_new", dynlib: LIB_NAME.} 61 | ## Create a new noise object. 62 | 63 | # simplified API 64 | 65 | proc noiseSetKind*( 66 | noise: Noise; kind: NoiseKind) {. 67 | cdecl, importc: "TCOD_noise_set_type", dynlib: LIB_NAME.} 68 | 69 | proc noiseGetEx*( 70 | noise: Noise; f: ptr cfloat; 71 | kind: NoiseKind = NOISE_DEFAULT): cfloat {. 72 | cdecl, importc: "TCOD_noise_get_ex", dynlib: LIB_NAME.} 73 | 74 | proc noiseGetFbmEx*( 75 | noise: Noise; f: ptr cfloat; octaves: cfloat; 76 | kind: NoiseKind = NOISE_DEFAULT): cfloat {. 77 | cdecl, importc: "TCOD_noise_get_fbm_ex", dynlib: LIB_NAME.} 78 | 79 | proc noiseGetTurbulenceEx*( 80 | noise: Noise; f: ptr cfloat; octaves: cfloat; 81 | kind: NoiseKind = NOISE_DEFAULT): cfloat {. 82 | cdecl, importc: "TCOD_noise_get_turbulence_ex", dynlib: LIB_NAME.} 83 | 84 | proc noiseGet*( 85 | noise: Noise; f: ptr cfloat): cfloat {. 86 | cdecl, importc: "TCOD_noise_get", dynlib: LIB_NAME.} 87 | 88 | proc noiseGetFbm*( 89 | noise: Noise; f: ptr cfloat; octaves: cfloat): cfloat {. 90 | cdecl, importc: "TCOD_noise_get_fbm", dynlib: LIB_NAME.} 91 | 92 | proc noiseGetTurbulence*( 93 | noise: Noise; f: ptr cfloat; octaves: cfloat): cfloat {. 94 | cdecl, importc: "TCOD_noise_get_turbulence", dynlib: LIB_NAME.} 95 | 96 | proc noiseDelete_internal( 97 | noise: Noise) {. 98 | cdecl, importc: "TCOD_noise_delete", dynlib: LIB_NAME.} 99 | 100 | proc noiseDelete*(noise: var Noise) = 101 | ## Delete the noise object. 102 | if noise != nil: 103 | noiseDelete_internal(noise) 104 | noise = nil 105 | 106 | -------------------------------------------------------------------------------- /libtcod/src112/noise_defaults.nim: -------------------------------------------------------------------------------- 1 | # 2 | # BSD 3-Clause License 3 | # 4 | # Copyright © 2008-2019, Jice and the libtcod contributors. 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # 1. Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # 13 | # 2. Redistributions in binary form must reproduce the above copyright notice, 14 | # this list of conditions and the following disclaimer in the documentation 15 | # and/or other materials provided with the distribution. 16 | # 17 | # 3. Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived from 19 | # this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | # POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | 34 | const 35 | NOISE_MAX_OCTAVES*: cint = 128 36 | NOISE_MAX_DIMENSIONS*: cint = 4 37 | NOISE_DEFAULT_HURST*: cfloat = 0.5 38 | NOISE_DEFAULT_LACUNARITY*: cfloat = 2.0 39 | 40 | -------------------------------------------------------------------------------- /libtcod/src112/tileset.nim: -------------------------------------------------------------------------------- 1 | # 2 | # BSD 3-Clause License 3 | # 4 | # Copyright © 2008-2019, Jice and the libtcod contributors. 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # 1. Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # 13 | # 2. Redistributions in binary form must reproduce the above copyright notice, 14 | # this list of conditions and the following disclaimer in the documentation 15 | # and/or other materials provided with the distribution. 16 | # 17 | # 3. Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived from 19 | # this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | # POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | 34 | type 35 | Tileset* = pointer 36 | 37 | 38 | proc tilesetNew*( 39 | tileWidth: cint; tileHeight: cint): Tileset {. 40 | cdecl, importc: "TCOD_tileset_new", dynlib: LIB_NAME.} 41 | ## Create a new tile-set with the given tile size. 42 | 43 | proc tilesetDelete*( 44 | tileset: Tileset) {. 45 | cdecl, importc: "TCOD_tileset_delete", dynlib: LIB_NAME.} 46 | ## Delete a tile-set. 47 | 48 | proc tilesetGetTileWidth*( 49 | tileset: Tileset): cint {. 50 | cdecl, importc: "TCOD_tileset_get_tile_width_", dynlib: LIB_NAME.} 51 | ## ``Return`` the pixel width of tiles in this tileset. 52 | ## 53 | ## ``Note:`` The tileset functions are provisional, 54 | ## the API may change in the future. 55 | 56 | proc tilesetGetTileHeight*( 57 | tileset: Tileset): cint {. 58 | cdecl, importc: "TCOD_tileset_get_tile_height_", dynlib: LIB_NAME.} 59 | ## ``Return`` the pixel height of tiles in this tileset. 60 | ## 61 | ## ``Note:`` The tileset functions are provisional, 62 | ## the API may change in the future. 63 | 64 | proc tilesetGetTile*( 65 | tileset: Tileset; codepoint: cint; buffer: ptr ColorRGBA): cint {. 66 | cdecl, importc: "TCOD_tileset_get_tile_", dynlib: LIB_NAME.} 67 | ## Fetch a tile, outputting its data to a pixel buffer. 68 | ## 69 | ## ``codepoint`` is the index for the tile. Unicode is recommend. 70 | ## 71 | ## ``buffer`` is a pointer to a contiguous row-major array of pixels. 72 | ## The tile data will be outputted here. This pointer can be `nil` 73 | ## if you only want to know if the tileset has a specific tile. 74 | ## 75 | ## ``Returns`` `0` if the tile exists. Returns a negative value on an error 76 | ## or if the tileset does not have a tile for this codepoint. 77 | ## 78 | ## ``Note:`` The tileset functions are provisional, 79 | ## the API may change in the future. 80 | 81 | proc tilesetSetTile*( 82 | tileset: Tileset; codepoint: cint; buffer: ptr ColorRGBA): cint {. 83 | cdecl, importc: "TCOD_tileset_set_tile_", dynlib: LIB_NAME.} 84 | ## Upload a tile from a pixel buffer into this tileset. 85 | ## 86 | ## ``codepoint`` is the index for the tile. Unicode is recommend. 87 | ## 88 | ## ``buffer`` is a pointer to a contiguous row-major array of pixels. 89 | ## This can not be `nil`. 90 | ## 91 | ## ``Note:`` The tileset functions are provisional, 92 | ## the API may change in the future. 93 | 94 | # 95 | # truetype 96 | # 97 | 98 | proc loadTruetypeFont*( 99 | path: cstring; tileWidth: cint; tileHeight: cint): Tileset {. 100 | cdecl, importc: "TCOD_load_truetype_font_", dynlib: LIB_NAME.} 101 | ## Return a tileset from a TrueType font file. 102 | 103 | proc tilesetLoadTruetype*( 104 | path: cstring; tileWidth: cint; tileHeight: cint): cint {. 105 | cdecl, importc: "TCOD_tileset_load_truetype_", dynlib: LIB_NAME.} 106 | ## Set the global tileset from a TrueType font file. 107 | 108 | -------------------------------------------------------------------------------- /libtcod/src112/tree.nim: -------------------------------------------------------------------------------- 1 | # 2 | # BSD 3-Clause License 3 | # 4 | # Copyright © 2008-2019, Jice and the libtcod contributors. 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # 1. Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # 13 | # 2. Redistributions in binary form must reproduce the above copyright notice, 14 | # this list of conditions and the following disclaimer in the documentation 15 | # and/or other materials provided with the distribution. 16 | # 17 | # 3. Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived from 19 | # this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | # POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | 34 | type 35 | Tree* = ptr TreeObj 36 | TreeObj* {.bycopy.} = object 37 | next*: Tree 38 | father*: Tree 39 | sons*: Tree 40 | 41 | 42 | proc treeNew*(): Tree {. 43 | cdecl, importc: "TCOD_tree_new", dynlib: LIB_NAME.} 44 | 45 | proc treeAddSon*( 46 | node, son: Tree) {. 47 | cdecl, importc: "TCOD_tree_add_son", dynlib: LIB_NAME.} 48 | 49 | -------------------------------------------------------------------------------- /libtcod/src112/txtfield.nim: -------------------------------------------------------------------------------- 1 | # 2 | # BSD 3-Clause License 3 | # 4 | # Copyright © 2008-2019, Jice and the libtcod contributors. 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # 1. Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # 13 | # 2. Redistributions in binary form must reproduce the above copyright notice, 14 | # this list of conditions and the following disclaimer in the documentation 15 | # and/or other materials provided with the distribution. 16 | # 17 | # 3. Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived from 19 | # this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | # POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | 34 | # import color, console_types 35 | 36 | type 37 | Text* = pointer 38 | 39 | 40 | proc textInit*( 41 | x, y, w, h, maxChars: cint): Text {. 42 | cdecl, importc: "TCOD_text_init", dynlib: LIB_NAME.} 43 | 44 | proc textInit2*( 45 | w, h, maxChars: cint): Text {. 46 | cdecl, importc: "TCOD_text_init2", dynlib: LIB_NAME.} 47 | 48 | proc textSetPos*( 49 | txt: Text; x, y: cint) {. 50 | cdecl, importc: "TCOD_text_set_pos", dynlib: LIB_NAME.} 51 | 52 | proc textSetProperties*( 53 | txt: Text; cursorChar, blinkInterval: cint; prompt: cstring; tabSize: cint) {. 54 | cdecl, importc: "TCOD_text_set_properties", dynlib: LIB_NAME.} 55 | 56 | proc textSetColors*( 57 | txt: Text; fore, back: Color; backTransparency: cfloat) {. 58 | cdecl, importc: "TCOD_text_set_colors", dynlib: LIB_NAME.} 59 | 60 | proc textUpdate*( 61 | txt: Text; key: Key): bool {. 62 | cdecl, importc: "TCOD_text_update", dynlib: LIB_NAME.} 63 | 64 | proc textRender*( 65 | txt: Text; con: Console) {. 66 | cdecl, importc: "TCOD_text_render", dynlib: LIB_NAME.} 67 | 68 | proc textGet*( 69 | txt: Text): cstring {. 70 | cdecl, importc: "TCOD_text_get", dynlib: LIB_NAME.} 71 | 72 | proc textReset*( 73 | txt: Text) {. 74 | cdecl, importc: "TCOD_text_reset", dynlib: LIB_NAME.} 75 | 76 | proc textDelete_internal( 77 | txt: Text) {. 78 | cdecl, importc: "TCOD_text_delete", dynlib: LIB_NAME.} 79 | 80 | proc textDelete*(txt: var Text) = 81 | if txt != nil: 82 | textDelete_internal(txt) 83 | txt = nil 84 | 85 | -------------------------------------------------------------------------------- /libtcod/src112/version.nim: -------------------------------------------------------------------------------- 1 | # 2 | # BSD 3-Clause License 3 | # 4 | # Copyright © 2008-2019, Jice and the libtcod contributors. 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # 1. Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # 13 | # 2. Redistributions in binary form must reproduce the above copyright notice, 14 | # this list of conditions and the following disclaimer in the documentation 15 | # and/or other materials provided with the distribution. 16 | # 17 | # 3. Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived from 19 | # this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | # POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | 34 | const 35 | MAJOR_VERSION* = 1 36 | MINOR_VERSION* = 12 37 | PATCHLEVEL* = 2 38 | STRVERSION* = "1.12.2" 39 | HEXVERSION* = (0x00010000 * MAJOR_VERSION + 0x00000100 * MINOR_VERSION + 40 | 0x00000001 * PATCHLEVEL) 41 | TECHVERSION* = (HEXVERSION * 0x00000100) 42 | TCOD_STRVERSIONNAME* = "libtcod " & STRVERSION 43 | 44 | WRAPPERVERSION* = "1.112.0" 45 | 46 | -------------------------------------------------------------------------------- /libtcod/src112/zip.nim: -------------------------------------------------------------------------------- 1 | # 2 | # BSD 3-Clause License 3 | # 4 | # Copyright © 2008-2019, Jice and the libtcod contributors. 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # 1. Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # 13 | # 2. Redistributions in binary form must reproduce the above copyright notice, 14 | # this list of conditions and the following disclaimer in the documentation 15 | # and/or other materials provided with the distribution. 16 | # 17 | # 3. Neither the name of the copyright holder nor the names of its 18 | # contributors may be used to endorse or promote products derived from 19 | # this software without specific prior written permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | # POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | 34 | # import color, console_types, image 35 | 36 | type 37 | Zip* = pointer 38 | 39 | 40 | proc zipNew*(): Zip {. 41 | cdecl, importc: "TCOD_zip_new", dynlib: LIB_NAME.} 42 | 43 | proc zipDelete_internal( 44 | zip: Zip) {. 45 | cdecl, importc: "TCOD_zip_delete", dynlib: LIB_NAME.} 46 | 47 | proc zipDelete*(zip: var Zip) = 48 | if zip != nil: 49 | zipDelete_internal(zip) 50 | zip = nil 51 | 52 | proc zipPutChar*( 53 | zip: Zip; val: char) {. 54 | cdecl, importc: "TCOD_zip_put_char", dynlib: LIB_NAME.} 55 | ## output interface 56 | 57 | proc zipPutInt*( 58 | zip: Zip; val: cint) {. 59 | cdecl, importc: "TCOD_zip_put_int", dynlib: LIB_NAME.} 60 | 61 | proc zipPutFloat*( 62 | zip: Zip; val: cfloat) {. 63 | cdecl, importc: "TCOD_zip_put_float", dynlib: LIB_NAME.} 64 | 65 | proc zipPutString*( 66 | zip: Zip; val: cstring) {. 67 | cdecl, importc: "TCOD_zip_put_string", dynlib: LIB_NAME.} 68 | 69 | proc zipPutColor*( 70 | zip: Zip; val: Color) {. 71 | cdecl, importc: "TCOD_zip_put_color", dynlib: LIB_NAME.} 72 | 73 | proc zipPutImage*( 74 | zip: Zip; val: Image) {. 75 | cdecl, importc: "TCOD_zip_put_image", dynlib: LIB_NAME.} 76 | 77 | proc zipPutConsole*( 78 | zip: Zip; val: Console) {. 79 | cdecl, importc: "TCOD_zip_put_console", dynlib: LIB_NAME.} 80 | 81 | proc zipPutData*( 82 | zip: Zip; nbBytes: cint; data: pointer) {. 83 | cdecl, importc: "TCOD_zip_put_data", dynlib: LIB_NAME.} 84 | 85 | proc zipGetCurrentBytes*( 86 | zip: Zip): uint32 {. 87 | cdecl, importc: "TCOD_zip_get_current_bytes", dynlib: LIB_NAME.} 88 | 89 | proc zipSaveToFile*( 90 | zip: Zip; filename: cstring): cint {. 91 | cdecl, importc: "TCOD_zip_save_to_file", dynlib: LIB_NAME.} 92 | 93 | 94 | proc zipLoadFromFile*( 95 | zip: Zip; filename: cstring): cint {. 96 | cdecl, importc: "TCOD_zip_load_from_file", dynlib: LIB_NAME.} 97 | ## input interface 98 | 99 | proc zipGetChar*( 100 | zip: Zip): char {. 101 | cdecl, importc: "TCOD_zip_get_char", dynlib: LIB_NAME.} 102 | 103 | proc zipGetInt*( 104 | zip: Zip): cint {. 105 | cdecl, importc: "TCOD_zip_get_int", dynlib: LIB_NAME.} 106 | 107 | proc zipGetFloat*( 108 | zip: Zip): cfloat {. 109 | cdecl, importc: "TCOD_zip_get_float", dynlib: LIB_NAME.} 110 | 111 | proc zipGetString*( 112 | zip: Zip): cstring {. 113 | cdecl, importc: "TCOD_zip_get_string", dynlib: LIB_NAME.} 114 | 115 | proc zipGetColor*( 116 | zip: Zip): Color {. 117 | cdecl, importc: "TCOD_zip_get_color", dynlib: LIB_NAME.} 118 | 119 | proc zipGetImage*( 120 | zip: Zip): Image {. 121 | cdecl, importc: "TCOD_zip_get_image", dynlib: LIB_NAME.} 122 | 123 | proc zipGetConsole*( 124 | zip: Zip): Console {. 125 | cdecl, importc: "TCOD_zip_get_console", dynlib: LIB_NAME.} 126 | 127 | proc zipGetData*( 128 | zip: Zip; nbBytes: cint; data: pointer): cint {. 129 | cdecl, importc: "TCOD_zip_get_data", dynlib: LIB_NAME.} 130 | 131 | proc zipGetRemainingBytes*( 132 | zip: Zip): uint32 {. 133 | cdecl, importc: "TCOD_zip_get_remaining_bytes", dynlib: LIB_NAME.} 134 | 135 | proc zipSkipBytes*(zip: Zip; nbBytes: uint32) {. 136 | cdecl, importc: "TCOD_zip_skip_bytes", dynlib: LIB_NAME.} 137 | 138 | -------------------------------------------------------------------------------- /libtcod/src15/bresenham.nim: -------------------------------------------------------------------------------- 1 | # 2 | # libtcod 1.5.1 3 | # Copyright (c) 2008,2009,2010,2012 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 | #typedef bool (*TCOD_line_listener_t) (int x, int y); 30 | type 31 | PLineListener* = proc(x, y: int): bool {.cdecl.} 32 | 33 | 34 | #TCODLIB_API void TCOD_line_init(int xFrom, int yFrom, int xTo, int yTo); 35 | proc line_init*(xFrom, yFrom, xTo, yTo: int) {.cdecl, importc: "TCOD_line_init", dynlib: LIB_NAME.} 36 | 37 | #TCODLIB_API bool TCOD_line_step(int *xCur, int *yCur); # advance one step. returns true if we reach destination 38 | proc line_step*(xCur, yCur: ptr int): bool {.cdecl, importc: "TCOD_line_step", dynlib: LIB_NAME.} 39 | 40 | # atomic callback function. Stops when the callback returns false 41 | #TCODLIB_API bool TCOD_line(int xFrom, int yFrom, int xTo, int yTo, TCOD_line_listener_t listener); 42 | proc line*(xFrom, yFrom, xTo, yTo: int, listener: PLineListener): bool {.cdecl, importc: "TCOD_line", dynlib: LIB_NAME.} 43 | 44 | 45 | # thread-safe versions 46 | type 47 | PBresenhamData* = ptr TBresenhamData 48 | TBresenhamData*{.bycopy.} = object 49 | stepx*: cint 50 | stepy*: cint 51 | e*: cint 52 | deltax*: cint 53 | deltay*: cint 54 | origx*: cint 55 | origy*: cint 56 | destx*: cint 57 | desty*: cint 58 | 59 | 60 | #TCODLIB_API void TCOD_line_init_mt(int xFrom, int yFrom, int xTo, int yTo, TCOD_bresenham_data_t *data); 61 | proc line_init_mt*(xFrom, yFrom, xTo, yTo, data: PBresenhamData) {.cdecl, importc: "TCOD_line_init_mt", dynlib: LIB_NAME.} 62 | 63 | #TCODLIB_API bool TCOD_line_step_mt(int *xCur, int *yCur, TCOD_bresenham_data_t *data); 64 | proc line_step_mt*(xCur, yCur: ptr int, data: PBresenhamData): bool {.cdecl, importc: "TCOD_line_step_mt", dynlib: LIB_NAME.} 65 | 66 | #TCODLIB_API bool TCOD_line_mt(int xFrom, int yFrom, int xTo, int yTo, TCOD_line_listener_t listener, TCOD_bresenham_data_t *data); 67 | proc line_mt*(xFrom, yFrom, xTo, yTo: int, listener: PLineListener, data: PBresenhamData): bool {.cdecl, importc: "TCOD_line_mt", dynlib: LIB_NAME.} 68 | 69 | -------------------------------------------------------------------------------- /libtcod/src15/fov.nim: -------------------------------------------------------------------------------- 1 | # 2 | # libtcod 1.5.1 3 | # Copyright (c) 2008,2009,2010,2012 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 | include 30 | fov_types 31 | 32 | 33 | type 34 | PMap* = pointer 35 | 36 | 37 | # allocate a new map 38 | #TCODLIB_API TCOD_map_t TCOD_map_new(int width, int height); 39 | proc map_new*(width, height: int): PMap {.cdecl, importc: "TCOD_map_new", dynlib: LIB_NAME.} 40 | 41 | # set all cells as solid rock (cannot see through nor walk) 42 | #TCODLIB_API void TCOD_map_clear(TCOD_map_t map, bool transparent, bool walkable); 43 | proc map_clear*(map: PMap, transparent, walkable: bool) {.cdecl, importc: "TCOD_map_clear", dynlib: LIB_NAME.} 44 | 45 | # copy a map to another, reallocating it when needed 46 | #TCODLIB_API void TCOD_map_copy(TCOD_map_t source, TCOD_map_t dest); 47 | proc map_copy*(source, dest: PMap) {.cdecl, importc: "TCOD_map_copy", dynlib: LIB_NAME.} 48 | 49 | # change a cell properties 50 | #TCODLIB_API void TCOD_map_set_properties(TCOD_map_t map, int x, int y, bool is_transparent, bool is_walkable); 51 | proc map_set_properties*(map: PMap, x, y: int, is_transparent, is_walkable: bool) {.cdecl, importc: "TCOD_map_set_properties", dynlib: LIB_NAME.} 52 | 53 | # destroy a map 54 | #TCODLIB_API void TCOD_map_delete(TCOD_map_t map); 55 | proc TCOD_map_delete(map: PMap) {.cdecl, importc: "TCOD_map_delete", dynlib: LIB_NAME.} 56 | proc map_delete*(map: var PMap) = 57 | if map != nil: 58 | TCOD_map_delete(map) 59 | map = nil 60 | 61 | 62 | # calculate the field of view (potentially visible cells from player_x,player_y) 63 | #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); 64 | proc map_compute_fov*(map: PMap, player_x, player_y: int, max_radius=0, light_walls=true, algo: TFOVAlgorithm = FOV_BASIC) {.cdecl, importc: "TCOD_map_compute_fov", dynlib: LIB_NAME.} 65 | 66 | 67 | # check if a cell is in the last computed field of view 68 | #TCODLIB_API bool TCOD_map_is_in_fov(TCOD_map_t map, int x, int y); 69 | proc map_is_in_fov*(map: PMap, x, y: int): bool {.cdecl, importc: "TCOD_map_is_in_fov", dynlib: LIB_NAME.} 70 | 71 | #TCODLIB_API void TCOD_map_set_in_fov(TCOD_map_t map, int x, int y, bool fov); 72 | proc map_set_in_fov*(map: PMap, x, y: int, fov: bool) {.cdecl, importc: "TCOD_map_set_in_fov", dynlib: LIB_NAME.} 73 | 74 | 75 | # retrieve properties from the map 76 | #TCODLIB_API bool TCOD_map_is_transparent(TCOD_map_t map, int x, int y); 77 | proc map_is_transparent*(map: PMap, x, y: int): bool {.cdecl, importc: "TCOD_map_is_transparent", dynlib: LIB_NAME.} 78 | 79 | #TCODLIB_API bool TCOD_map_is_walkable(TCOD_map_t map, int x, int y); 80 | proc map_is_walkable*(map: PMap, x, y: int): bool {.cdecl, importc: "TCOD_map_is_walkable", dynlib: LIB_NAME.} 81 | 82 | #TCODLIB_API int TCOD_map_get_width(TCOD_map_t map); 83 | proc map_get_width*(map: PMap): cint {.cdecl, importc: "TCOD_map_get_width", dynlib: LIB_NAME.} 84 | 85 | #TCODLIB_API int TCOD_map_get_height(TCOD_map_t map); 86 | proc map_get_height*(map: PMap): cint {.cdecl, importc: "TCOD_map_get_height", dynlib: LIB_NAME.} 87 | 88 | #TCODLIB_API int TCOD_map_get_nb_cells(TCOD_map_t map); 89 | proc map_get_nb_cells*(map: PMap): cint {.cdecl, importc: "TCOD_map_get_nb_cells", dynlib: LIB_NAME.} 90 | 91 | -------------------------------------------------------------------------------- /libtcod/src15/fov_types.nim: -------------------------------------------------------------------------------- 1 | # 2 | # libtcod 1.5.1 3 | # Copyright (c) 2008,2009,2010,2012 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 | ## FOV_BASIC : http://roguebasin.roguelikedevelopment.org/index.php?title=Ray_casting 29 | ## 30 | ## FOV_DIAMOND : http://www.geocities.com/temerra/los_rays.html 31 | ## 32 | ## FOV_SHADOW : http://roguebasin.roguelikedevelopment.org/index.php?title=FOV_using_recursive_shadowcasting 33 | ## 34 | ## FOV_PERMISSIVE : http://roguebasin.roguelikedevelopment.org/index.php?title=Precise_Permissive_Field_of_View 35 | ## 36 | ## FOV_RESTRICTIVE : Mingos' Restrictive Precise Angle Shadowcasting (contribution by Mingos) 37 | ## 38 | 39 | type 40 | TFOVAlgorithm* {.size: sizeof(cint).} = enum 41 | FOV_BASIC, 42 | FOV_DIAMOND, 43 | FOV_SHADOW, 44 | FOV_PERMISSIVE_0, 45 | FOV_PERMISSIVE_1, 46 | FOV_PERMISSIVE_2, 47 | FOV_PERMISSIVE_3, 48 | FOV_PERMISSIVE_4, 49 | FOV_PERMISSIVE_5, 50 | FOV_PERMISSIVE_6, 51 | FOV_PERMISSIVE_7, 52 | FOV_PERMISSIVE_8, 53 | FOV_RESTRICTIVE, 54 | NB_FOV_ALGORITHMS 55 | 56 | 57 | template FOV_Permissive*(x: untyped): untyped = 58 | TFOVAlgorithm(FOV_PERMISSIVE_0 + (x)) 59 | 60 | -------------------------------------------------------------------------------- /libtcod/src15/libtcod_define.nim: -------------------------------------------------------------------------------- 1 | # 2 | # libtcod 1.5.1 3 | # Copyright (c) 2008,2009,2010,2012 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 | {.deadCodeElim: on.} 29 | 30 | const 31 | NO_UNICODE* = false ## disable unicode support 32 | NO_OPENGL* = false ## disable opengl support 33 | 34 | when defined(linux): 35 | const LIB_NAME* = "libtcod.so.1.5.1" 36 | elif defined(MacOSX): 37 | when defined(debug): 38 | const LIB_NAME* = "libtcod_debug.dylib" 39 | else: 40 | const LIB_NAME* = "libtcod.dylib" 41 | else: # windows 42 | when defined(debug): 43 | const LIB_NAME* = "libtcod-mingw-debug.dll" 44 | else: 45 | const LIB_NAME* = "libtcod-mingw.dll" 46 | 47 | const 48 | HEXVERSION* = 0x010501 49 | STRVERSION* = "1.5.1" 50 | TECHVERSION* = 0x01050103 51 | WRAPPERVERSION* = "0.98.1" 52 | 53 | -------------------------------------------------------------------------------- /libtcod/src15/mersenne.nim: -------------------------------------------------------------------------------- 1 | # 2 | # libtcod 1.5.1 3 | # Copyright (c) 2008,2009,2010,2012 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 | include 30 | mersenne_types 31 | 32 | 33 | type 34 | PRandom* = pointer 35 | 36 | 37 | #TCODLIB_API TCOD_random_t TCOD_random_get_instance(void); 38 | proc random_get_instance*(): PRandom {.cdecl, importc: "TCOD_random_get_instance", dynlib: LIB_NAME.} 39 | 40 | #TCODLIB_API TCOD_random_t TCOD_random_new(TCOD_random_algo_t algo); 41 | proc random_new*(algo: TRandomAlgo = RNG_CMWC): PRandom {.cdecl, importc: "TCOD_random_new", dynlib: LIB_NAME.} 42 | 43 | #TCODLIB_API TCOD_random_t TCOD_random_save(TCOD_random_t mersenne); 44 | proc random_save*(mersenne: PRandom): PRandom {.cdecl, importc: "TCOD_random_save", dynlib: LIB_NAME.} 45 | 46 | #TCODLIB_API void TCOD_random_restore(TCOD_random_t mersenne, TCOD_random_t backup); 47 | proc random_restore*(mersenne, backup: PRandom) {.cdecl, importc: "TCOD_random_restore", dynlib: LIB_NAME.} 48 | 49 | #TCODLIB_API TCOD_random_t TCOD_random_new_from_seed(TCOD_random_algo_t algo, cuint seed); 50 | proc random_new_from_seed*(algo: TRandomAlgo = RNG_CMWC, seed: cuint): PRandom {.cdecl, importc: "TCOD_random_new_from_seed", dynlib: LIB_NAME.} 51 | 52 | #TCODLIB_API void TCOD_random_delete(TCOD_random_t mersenne); 53 | proc TCOD_random_delete(mersenne: PRandom) {.cdecl, importc: "TCOD_random_delete", dynlib: LIB_NAME.} 54 | proc random_delete*(mersenne: var PRandom) = 55 | if mersenne != nil: 56 | TCOD_random_delete(mersenne) 57 | mersenne = nil 58 | 59 | 60 | #TCODLIB_API void TCOD_random_set_distribution (TCOD_random_t mersenne, TCOD_distribution_t distribution); 61 | proc random_set_distribution*(mersenne: PRandom, distribution: TDistribution) {.cdecl, importc: "TCOD_random_set_distribution", dynlib: LIB_NAME.} 62 | 63 | 64 | 65 | #TCODLIB_API int TCOD_random_get_int (TCOD_random_t mersenne, int min, int max); 66 | proc random_get_int*(mersenne: PRandom, min, max: int): cint {.cdecl, importc: "TCOD_random_get_int", dynlib: LIB_NAME.} 67 | 68 | #TCODLIB_API float TCOD_random_get_float (TCOD_random_t mersenne, float min, float max); 69 | proc random_get_float*(mersenne: PRandom, min, max: cfloat): cfloat {.cdecl, importc: "TCOD_random_get_float", dynlib: LIB_NAME.} 70 | 71 | #TCODLIB_API double TCOD_random_get_double (TCOD_random_t mersenne, double min, double max); 72 | proc random_get_double*(mersenne: PRandom, min, max: cdouble): cdouble {.cdecl, importc: "TCOD_random_get_double", dynlib: LIB_NAME.} 73 | 74 | 75 | 76 | #TCODLIB_API int TCOD_random_get_int_mean (TCOD_random_t mersenne, int min, int max, int mean); 77 | proc random_get_int_mean*(mersenne: PRandom, min, max, mean: int): cint {.cdecl, importc: "TCOD_random_get_int_mean", dynlib: LIB_NAME.} 78 | 79 | #TCODLIB_API float TCOD_random_get_float_mean (TCOD_random_t mersenne, float min, float max, float mean); 80 | proc random_get_float_mean*(mersenne: PRandom, min, max, mean: cfloat): cfloat {.cdecl, importc: "TCOD_random_get_float_mean", dynlib: LIB_NAME.} 81 | 82 | #TCODLIB_API double TCOD_random_get_double_mean (TCOD_random_t mersenne, double min, double max, double mean); 83 | proc random_get_double_mean*(mersenne: PRandom, min, max, mean: cdouble): cdouble {.cdecl, importc: "TCOD_random_get_double_mean", dynlib: LIB_NAME.} 84 | 85 | 86 | 87 | #TCODLIB_API TCOD_dice_t TCOD_random_dice_new (const char * s); 88 | proc random_dice_new*(s: cstring): TDice {.cdecl, importc: "TCOD_random_dice_new", dynlib: LIB_NAME.} 89 | 90 | #TCODLIB_API int TCOD_random_dice_roll (TCOD_random_t mersenne, TCOD_dice_t dice); 91 | proc random_dice_roll*(mersenne: PRandom, dice: TDice): cint {.cdecl, importc: "TCOD_random_dice_roll", dynlib: LIB_NAME.} 92 | 93 | #TCODLIB_API int TCOD_random_dice_roll_s (TCOD_random_t mersenne, const char * s); 94 | proc random_dice_roll_s*(mersenne: PRandom, s: cstring): cint {.cdecl, importc: "TCOD_random_dice_roll_s", dynlib: LIB_NAME.} 95 | 96 | -------------------------------------------------------------------------------- /libtcod/src15/mersenne_types.nim: -------------------------------------------------------------------------------- 1 | # 2 | # libtcod 1.5.1 3 | # Copyright (c) 2008,2009,2010,2012 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 | import strutils 30 | 31 | 32 | type 33 | # dice roll 34 | TDice*{.bycopy.} = tuple[nb_rolls, nb_faces: cint, multiplier, addsub: cfloat] 35 | 36 | # PRNG algorithms 37 | TRandomAlgo* {.size: sizeof(cint).} = enum 38 | RNG_MT, 39 | RNG_CMWC 40 | 41 | TDistribution* {.size: sizeof(cint).} = enum 42 | DISTRIBUTION_LINEAR, 43 | DISTRIBUTION_GAUSSIAN, 44 | DISTRIBUTION_GAUSSIAN_RANGE, 45 | DISTRIBUTION_GAUSSIAN_INVERSE, 46 | DISTRIBUTION_GAUSSIAN_RANGE_INVERSE 47 | 48 | 49 | proc repr*(dice: TDice): string = 50 | result = "" 51 | if dice.multiplier != 1.0: 52 | result.add(formatFloat(dice.multiplier, ffDefault, 0) & "*") 53 | result.add(repr(dice.nb_rolls) & "d" & repr(dice.nb_faces)) 54 | if dice.addsub != 0.0: 55 | if dice.addsub > 0.0: 56 | result.add("+") 57 | result.add(formatFloat(dice.addsub, ffDefault, 0)) 58 | 59 | -------------------------------------------------------------------------------- /libtcod/src15/mouse.nim: -------------------------------------------------------------------------------- 1 | # 2 | # libtcod 1.5.1 3 | # Copyright (c) 2008,2009,2010,2012 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 | include 30 | mouse_types 31 | 32 | 33 | #TCODLIB_API void TCOD_mouse_show_cursor(bool visible); 34 | proc mouse_show_cursor*(visible: bool) {.cdecl, importc: "TCOD_mouse_show_cursor", dynlib: LIB_NAME.} 35 | 36 | #TCODLIB_API TCOD_mouse_t TCOD_mouse_get_status(); 37 | proc mouse_get_status*(): TMouse {.cdecl, importc: "TCOD_mouse_get_status", dynlib: LIB_NAME.} 38 | 39 | #TCODLIB_API bool TCOD_mouse_is_cursor_visible(); 40 | proc mouse_is_cursor_visible*(): bool {.cdecl, importc: "TCOD_mouse_is_cursor_visible", dynlib: LIB_NAME.} 41 | 42 | #TCODLIB_API void TCOD_mouse_move(int x, int y); 43 | proc mouse_move*(x, y: int) {.cdecl, importc: "TCOD_mouse_move", dynlib: LIB_NAME.} 44 | 45 | #TCODLIB_API void TCOD_mouse_includes_touch(bool enable); 46 | proc mouse_includes_touch*(enable: bool) {.cdecl, importc: "TCOD_mouse_includes_touch", dynlib: LIB_NAME.} 47 | 48 | -------------------------------------------------------------------------------- /libtcod/src15/mouse_types.nim: -------------------------------------------------------------------------------- 1 | # 2 | # libtcod 1.5.1 3 | # Copyright (c) 2008,2009,2010,2012 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 | # mouse data 30 | type 31 | TMouse*{.bycopy.} = object 32 | x*, y*: cint ## absolute position 33 | dx*, dy*: cint ## movement since last update in pixels 34 | cx*, cy*: cint ## cell coordinates in the root console 35 | dcx*, dcy*: cint ## movement since last update in console cells 36 | lbutton*: bool ## left button status 37 | rbutton*: bool ## right button status 38 | mbutton*: bool ## middle button status 39 | lbutton_pressed*: bool # left button pressed event 40 | rbutton_pressed*: bool # right button pressed event 41 | mbutton_pressed*: bool # middle button pressed event 42 | wheel_up*: bool # wheel up event 43 | wheel_down*: bool # wheel down event 44 | 45 | -------------------------------------------------------------------------------- /libtcod/src15/namegen.nim: -------------------------------------------------------------------------------- 1 | # 2 | # libtcod 1.5.1 3 | # Copyright (c) 2008,2009,2010,2012 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 | 33 | from list import PList, list_begin, list_size, list_delete 34 | 35 | 36 | # parse a file with syllable sets 37 | #TCODLIB_API void TCOD_namegen_parse (const char * filename, TCOD_random_t random); 38 | proc namegen_parse*(filename: cstring, random: PRandom = nil) {.cdecl, importc: "TCOD_namegen_parse", dynlib: LIB_NAME.} 39 | 40 | # generate a name 41 | #TCODLIB_API char * TCOD_namegen_generate (char * name, bool allocate); 42 | proc namegen_generate*(name: cstring, allocate=false): cstring {.cdecl, importc: "TCOD_namegen_generate", dynlib: LIB_NAME.} 43 | 44 | 45 | # generate a name using a custom generation rule 46 | #TCODLIB_API char * TCOD_namegen_generate_custom (char * name, char * rule, bool allocate); 47 | proc namegen_generate_custom*(name, rule: cstring, allocate=false): cstring {.cdecl, importc: "TCOD_namegen_generate_custom", dynlib: LIB_NAME.} 48 | 49 | 50 | # retrieve the list of all available syllable set names 51 | #TCODLIB_API TCOD_list_t TCOD_namegen_get_sets (void); 52 | proc namegen_get_sets_list(): PList {.cdecl, importc: "TCOD_namegen_get_sets", dynlib: LIB_NAME.} 53 | proc namegen_get_sets*(): seq[string] {.inline.} = 54 | var list = namegen_get_sets_list() 55 | result = cstringArrayToSeq(cast[cstringArray](list_begin(list)), list_size(list)) 56 | list_delete(list) 57 | 58 | 59 | # delete a generator 60 | #TCODLIB_API void TCOD_namegen_destroy (void); 61 | proc namegen_destroy*() {.cdecl, importc: "TCOD_namegen_destroy", dynlib: LIB_NAME.} 62 | 63 | 64 | -------------------------------------------------------------------------------- /libtcod/src15/noise.nim: -------------------------------------------------------------------------------- 1 | # 2 | # libtcod 1.5.1 3 | # Copyright (c) 2008,2009,2010,2012 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 | type 30 | PNoise* = pointer 31 | 32 | TNoiseType* {.size: sizeof(cint).} = enum 33 | NOISE_DEFAULT = 0, 34 | NOISE_PERLIN = 1, 35 | NOISE_SIMPLEX = 2, 36 | NOISE_WAVELET = 4 37 | 38 | 39 | const 40 | NOISE_MAX_OCTAVES* = 128 41 | NOISE_MAX_DIMENSIONS* = 4 42 | NOISE_DEFAULT_HURST* = 0.5'f32 43 | NOISE_DEFAULT_LACUNARITY* = 2.0'f32 44 | 45 | 46 | template floatArrayToPtr*(f: var openarray[cfloat]): ptr cfloat = 47 | cast[ptr cfloat](addr(f)) 48 | 49 | 50 | # create a new noise object 51 | #TCODLIB_API TCOD_noise_t TCOD_noise_new(int dimensions, float hurst, float lacunarity, TCOD_random_t random); 52 | proc noise_new*(dimensions: int, hurst=NOISE_DEFAULT_HURST, lacunarity=NOISE_DEFAULT_LACUNARITY, random: PRandom = nil): PNoise {.cdecl, importc: "TCOD_noise_new", dynlib: LIB_NAME.} 53 | 54 | 55 | # simplified API 56 | #TCODLIB_API void TCOD_noise_set_type (TCOD_noise_t noise, TCOD_noise_type_t type); 57 | proc noise_set_type*(noise: PNoise, noise_type=NOISE_DEFAULT) {.cdecl, importc: "TCOD_noise_set_type", dynlib: LIB_NAME.} 58 | 59 | #TCODLIB_API float TCOD_noise_get_ex (TCOD_noise_t noise, float *f, TCOD_noise_type_t type); 60 | proc noise_get_ex*(noise: PNoise, f: ptr cfloat, noise_type=NOISE_DEFAULT): cfloat {.cdecl, importc: "TCOD_noise_get_ex", dynlib: LIB_NAME.} 61 | 62 | #TCODLIB_API float TCOD_noise_get_fbm_ex (TCOD_noise_t noise, float *f, float octaves, TCOD_noise_type_t type); 63 | proc noise_get_fbm_ex*(noise: PNoise, f: ptr cfloat, octaves: cfloat, noise_type=NOISE_DEFAULT): cfloat {.cdecl, importc: "TCOD_noise_get_fbm_ex", dynlib: LIB_NAME.} 64 | 65 | #TCODLIB_API float TCOD_noise_get_turbulence_ex (TCOD_noise_t noise, float *f, float octaves, TCOD_noise_type_t type); 66 | proc noise_get_turbulence_ex*(noise: PNoise, f: ptr cfloat, octaves: cfloat, noise_type=NOISE_DEFAULT): cfloat {.cdecl, importc: "TCOD_noise_get_turbulence_ex", dynlib: LIB_NAME.} 67 | 68 | #TCODLIB_API float TCOD_noise_get (TCOD_noise_t noise, float *f); 69 | proc noise_get*(noise: PNoise, f: ptr cfloat): cfloat {.cdecl, importc: "TCOD_noise_get", dynlib: LIB_NAME.} 70 | 71 | #TCODLIB_API float TCOD_noise_get_fbm (TCOD_noise_t noise, float *f, float octaves); 72 | proc noise_get_fbm*(noise: PNoise, f: ptr cfloat, octaves: cfloat): cfloat {.cdecl, importc: "TCOD_noise_get_fbm", dynlib: LIB_NAME.} 73 | 74 | #TCODLIB_API float TCOD_noise_get_turbulence (TCOD_noise_t noise, float *f, float octaves); 75 | proc noise_get_turbulence*(noise: PNoise, f: ptr cfloat, octaves: cfloat): cfloat {.cdecl, importc: "TCOD_noise_get_turbulence", dynlib: LIB_NAME.} 76 | 77 | 78 | # delete the noise object 79 | #TCODLIB_API void TCOD_noise_delete(TCOD_noise_t noise); 80 | proc TCOD_noise_delete(noise: PNoise) {.cdecl, importc: "TCOD_noise_delete", dynlib: LIB_NAME.} 81 | proc noise_delete*(noise: var PNoise) = 82 | if noise != nil: 83 | TCOD_noise_delete(noise) 84 | noise = nil 85 | 86 | -------------------------------------------------------------------------------- /libtcod/src15/tree.nim: -------------------------------------------------------------------------------- 1 | # 2 | # libtcod 1.5.1 3 | # Copyright (c) 2008,2009,2010,2012 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 | type 30 | PTree* = ptr TTree 31 | TTree*{.bycopy.} = object 32 | next*: PTree 33 | father*: PTree 34 | sons*: PTree 35 | 36 | #TCODLIB_API TCOD_tree_t *TCOD_tree_new(); 37 | proc tree_new*(): PTree {.cdecl, importc: "TCOD_tree_new", dynlib: LIB_NAME.} 38 | 39 | #TCODLIB_API void TCOD_tree_add_son(TCOD_tree_t *node, TCOD_tree_t *son); 40 | proc tree_add_son*(node, son: PTree) {.cdecl, importc: "TCOD_tree_add_son", dynlib: LIB_NAME.} 41 | 42 | -------------------------------------------------------------------------------- /libtcod/src15/txtfield.nim: -------------------------------------------------------------------------------- 1 | # 2 | # libtcod 1.5.1 3 | # Copyright (c) 2008,2009,2010,2012 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 | type 30 | PText* = pointer 31 | 32 | 33 | #TCODLIB_API TCOD_text_t TCOD_text_init(int x, int y, int w, int h, int max_chars); 34 | proc text_init*(x, y, w, h, max_chars: int): PText {.cdecl, importc: "TCOD_text_init", dynlib: LIB_NAME.} 35 | 36 | #TCODLIB_API void TCOD_text_set_properties(TCOD_text_t txt, int cursor_char, int blink_interval, const char * prompt, int tab_size); 37 | proc text_set_properties*(txt: PText, cursor_char, blink_interval: int, prompt: cstring, tab_size: int) {.cdecl, importc: "TCOD_text_set_properties", dynlib: LIB_NAME.} 38 | 39 | #TCODLIB_API void TCOD_text_set_colors(TCOD_text_t txt, TCOD_color_t fore, TCOD_color_t back, float back_transparency); 40 | proc text_set_colors*(txt: PText, fore, back: TColor, back_transparency: cfloat) {.cdecl, importc: "TCOD_text_set_colors", dynlib: LIB_NAME.} 41 | 42 | #TCODLIB_API bool TCOD_text_update(TCOD_text_t txt, TCOD_key_t key); 43 | proc text_update*(txt: PText, key: TKey): bool {.cdecl, importc: "TCOD_text_update", dynlib: LIB_NAME.} 44 | 45 | #TCODLIB_API void TCOD_text_render(TCOD_text_t txt, TCOD_console_t con); 46 | proc text_render*(txt: PText, con: PConsole) {.cdecl, importc: "TCOD_text_render", dynlib: LIB_NAME.} 47 | 48 | #TCODLIB_API const char * TCOD_text_get(TCOD_text_t txt); 49 | proc text_get*(txt: PText): cstring {.cdecl, importc: "TCOD_text_get", dynlib: LIB_NAME.} 50 | 51 | #TCODLIB_API void TCOD_text_reset(TCOD_text_t txt); 52 | proc text_reset*(txt: PText) {.cdecl, importc: "TCOD_text_reset", dynlib: LIB_NAME.} 53 | 54 | #TCODLIB_API void TCOD_text_delete(TCOD_text_t txt); 55 | proc TCOD_text_delete(txt: PText) {.cdecl, importc: "TCOD_text_delete", dynlib: LIB_NAME.} 56 | proc text_delete*(txt: var PText) = 57 | if txt != nil: 58 | TCOD_text_delete(txt) 59 | txt = nil 60 | 61 | -------------------------------------------------------------------------------- /libtcod/src17/bresenham.nim: -------------------------------------------------------------------------------- 1 | # 2 | # libtcod 3 | # Copyright (c) 2008-2018 Jice & Mingos & rmtew 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 14 | # products derived from this software without specific prior written 15 | # permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY JICE, MINGOS AND RMTEW ``AS IS'' AND ANY 18 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | # DISCLAIMED. IN NO EVENT SHALL JICE, MINGOS OR RMTEW BE LIABLE FOR ANY 21 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | type 30 | LineListener* = proc (x, y: cint): bool {.cdecl.} ## \ 31 | ## A callback to be passed to ``line`` 32 | ## 33 | ## The points given to the callback include both the starting and ending 34 | ## positions. 35 | ## 36 | ## As long as this callback returns true it will be called with the 37 | ## next ``x,y`` point on the line. 38 | ## 39 | 40 | proc lineInit*( 41 | xFrom, yFrom, xTo, yTo: cint) {. 42 | cdecl, importc: "TCOD_line_init", dynlib: LIB_NAME, deprecated.} 43 | 44 | proc lineStep*( 45 | xCur, yCur: ptr cint): bool {. 46 | cdecl, importc: "TCOD_line_step", dynlib: LIB_NAME, deprecated.} 47 | ## Advance one step. 48 | ## 49 | ## ``Returns`` `true` if we reach destination. 50 | ## 51 | 52 | proc line*( 53 | xFrom, yFrom, xTo, yTo: cint; listener: LineListener): bool {. 54 | cdecl, importc: "TCOD_line", dynlib: LIB_NAME.} 55 | ## Atomic callback procedure. Stops when the callback returns false. 56 | ## 57 | 58 | 59 | type 60 | BresenhamData* {.bycopy.} = object ## \ 61 | ## A struct used for computing a bresenham line. 62 | ## 63 | stepx*, stepy*: cint 64 | e*: cint 65 | deltax*, deltay*: cint 66 | origx*, origy*: cint 67 | destx*, desty*: cint 68 | 69 | 70 | proc lineInitMt*( 71 | xFrom, yFrom, xTo, yTo: cint; data: ptr BresenhamData) {. 72 | cdecl, importc: "TCOD_line_init_mt", dynlib: LIB_NAME.} 73 | 74 | proc lineStepMt*( 75 | xCur, yCur: ptr cint; data: ptr BresenhamData): bool {. 76 | cdecl, importc: "TCOD_line_step_mt", dynlib: LIB_NAME.} 77 | 78 | proc lineMt*( 79 | xFrom, yFrom, xTo, yTo: cint; 80 | listener: LineListener; data: ptr BresenhamData): bool {. 81 | cdecl, importc: "TCOD_line_mt", dynlib: LIB_NAME, deprecated.} 82 | 83 | -------------------------------------------------------------------------------- /libtcod/src17/bsp.nim: -------------------------------------------------------------------------------- 1 | # 2 | # libtcod 3 | # Copyright (c) 2008-2018 Jice & Mingos & rmtew 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 14 | # products derived from this software without specific prior written 15 | # permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY JICE, MINGOS AND RMTEW ``AS IS'' AND ANY 18 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | # DISCLAIMED. IN NO EVENT SHALL JICE, MINGOS OR RMTEW BE LIABLE FOR ANY 21 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | # import mersenne_types, tree 30 | 31 | type 32 | Bsp* = ptr BspObj 33 | BspObj* {.bycopy.} = object ## \ 34 | ## 35 | tree*: TreeObj ## pseudo oop : bsp inherit tree 36 | x*, y*, w*, h*: cint ## node position & size 37 | position*: cint ## position of splitting 38 | level*: uint8 ## level in the tree 39 | horizontal*: bool ## horizontal splitting ? 40 | 41 | BspCallback* = proc (node: Bsp; userData: pointer): bool {.cdecl.} 42 | 43 | proc bspNew*(): Bsp {. 44 | cdecl, importc: "TCOD_bsp_new", dynlib: LIB_NAME.} 45 | 46 | proc bspNewWithSize*( 47 | x, y, w, h: cint): Bsp {. 48 | cdecl, importc: "TCOD_bsp_new_with_size", dynlib: LIB_NAME.} 49 | 50 | proc bspDelete_internal( 51 | node: Bsp) {. 52 | cdecl, importc: "TCOD_bsp_delete", dynlib: LIB_NAME.} 53 | 54 | proc bspDelete*(node: var Bsp) = 55 | if not (node == nil): 56 | bspDelete_internal(node) 57 | node = nil 58 | 59 | proc bspLeft*( 60 | node: Bsp): Bsp {. 61 | cdecl, importc: "TCOD_bsp_left", dynlib: LIB_NAME.} 62 | 63 | proc bspRight*( 64 | node: Bsp): Bsp {. 65 | cdecl, importc: "TCOD_bsp_right", dynlib: LIB_NAME.} 66 | 67 | proc bspFather*( 68 | node: Bsp): Bsp {. 69 | cdecl, importc: "TCOD_bsp_father", dynlib: LIB_NAME.} 70 | 71 | proc bspIsLeaf*( 72 | node: Bsp): bool {. 73 | cdecl, importc: "TCOD_bsp_is_leaf", dynlib: LIB_NAME.} 74 | 75 | proc bspTraversePreOrder*( 76 | node: Bsp; listener: BspCallback; userData: pointer = nil): bool {. 77 | cdecl, importc: "TCOD_bsp_traverse_pre_order", dynlib: LIB_NAME.} 78 | 79 | proc bspTraverseInOrder*( 80 | node: Bsp; listener: BspCallback; userData: pointer = nil): bool {. 81 | cdecl, importc: "TCOD_bsp_traverse_in_order", dynlib: LIB_NAME.} 82 | 83 | proc bspTraversePostOrder*( 84 | node: Bsp; listener: BspCallback; userData: pointer = nil): bool {. 85 | cdecl, importc: "TCOD_bsp_traverse_post_order", dynlib: LIB_NAME.} 86 | 87 | proc bspTraverseLevelOrder*( 88 | node: Bsp; listener: BspCallback; userData: pointer = nil): bool {. 89 | cdecl, importc: "TCOD_bsp_traverse_level_order", dynlib: LIB_NAME.} 90 | 91 | proc bspTraverseInvertedLevelOrder*( 92 | node: Bsp; listener: BspCallback; userData: pointer = nil): bool {. 93 | cdecl, importc: "TCOD_bsp_traverse_inverted_level_order", dynlib: LIB_NAME.} 94 | 95 | proc bspContains*( 96 | node: Bsp; x, y: cint): bool {. 97 | cdecl, importc: "TCOD_bsp_contains", dynlib: LIB_NAME.} 98 | 99 | proc bspFindNode*( 100 | node: Bsp; x, y: cint): Bsp {. 101 | cdecl, importc: "TCOD_bsp_find_node", dynlib: LIB_NAME.} 102 | 103 | proc bspResize*( 104 | node: Bsp; x, y, w, h: cint) {. 105 | cdecl, importc: "TCOD_bsp_resize", dynlib: LIB_NAME.} 106 | 107 | proc bspSplitOnce*( 108 | node: Bsp; horizontal: bool; position: cint) {. 109 | cdecl, importc: "TCOD_bsp_split_once", dynlib: LIB_NAME.} 110 | 111 | proc bspSplitRecursive*( 112 | node: Bsp; randomizer: Random; 113 | nb, minHSize, minVSize: cint; 114 | maxHRatio, maxVRatio: cfloat) {. 115 | cdecl, importc: "TCOD_bsp_split_recursive", dynlib: LIB_NAME.} 116 | 117 | proc bspRemoveSons*( 118 | node: Bsp) {. 119 | cdecl, importc: "TCOD_bsp_remove_sons", dynlib: LIB_NAME.} 120 | 121 | -------------------------------------------------------------------------------- /libtcod/src17/console_rexpaint.nim: -------------------------------------------------------------------------------- 1 | # 2 | # libtcod 3 | # Copyright (c) 2008-2018 Jice & Mingos & rmtew 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 14 | # products derived from this software without specific prior written 15 | # permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY JICE, MINGOS AND RMTEW ``AS IS'' AND ANY 18 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | # DISCLAIMED. IN NO EVENT SHALL JICE, MINGOS OR RMTEW BE LIABLE FOR ANY 21 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | # import console, console_types, list 30 | 31 | proc consoleFromXp*( 32 | filename: cstring): Console {. 33 | cdecl, importc: "TCOD_console_from_xp", dynlib: LIB_NAME.} 34 | 35 | proc consoleLoadXp*( 36 | con: Console; filename: cstring): bool {. 37 | cdecl, importc: "TCOD_console_load_xp", dynlib: LIB_NAME.} 38 | 39 | proc consoleSaveXp*( 40 | con: Console; filename: cstring; compressLevel: cint): bool {. 41 | cdecl, importc: "TCOD_console_save_xp", dynlib: LIB_NAME.} 42 | 43 | proc consoleListFromXp*( 44 | filename: cstring): List {. 45 | cdecl, importc: "TCOD_console_list_from_xp", dynlib: LIB_NAME.} 46 | 47 | proc consoleListSaveXp*( 48 | consoleList: List; filename: cstring; compressLevel: cint): bool {. 49 | cdecl, importc: "TCOD_console_list_save_xp", dynlib: LIB_NAME.} 50 | 51 | -------------------------------------------------------------------------------- /libtcod/src17/fov.nim: -------------------------------------------------------------------------------- 1 | # 2 | # libtcod 3 | # Copyright (c) 2008-2018 Jice & Mingos & rmtew 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 14 | # products derived from this software without specific prior written 15 | # permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY JICE, MINGOS AND RMTEW ``AS IS'' AND ANY 18 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | # DISCLAIMED. IN NO EVENT SHALL JICE, MINGOS OR RMTEW BE LIABLE FOR ANY 21 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | # import fov_types 30 | 31 | 32 | proc mapNew*( 33 | width, height: cint): Map {. 34 | cdecl, importc: "TCOD_map_new", dynlib: LIB_NAME.} 35 | ## Allocate a new map. 36 | 37 | proc mapClear*( 38 | map: Map; transparent: bool = false; walkable: bool = false) {. 39 | cdecl, importc: "TCOD_map_clear", dynlib: LIB_NAME.} 40 | ## Set all cells as solid rock (cannot see through nor walk). 41 | 42 | proc mapCopy*( 43 | source, dest: Map) {. 44 | cdecl, importc: "TCOD_map_copy", dynlib: LIB_NAME.} 45 | ## Copy a map to another, reallocating it when needed. 46 | 47 | proc mapSetProperties*( 48 | map: Map; x, y: cint; isTransparent, isWalkable: bool) {. 49 | cdecl, importc: "TCOD_map_set_properties", dynlib: LIB_NAME.} 50 | ## Change a cell properties. 51 | 52 | proc mapDelete_internal( 53 | map: Map) {. 54 | cdecl, importc: "TCOD_map_delete", dynlib: LIB_NAME.} 55 | 56 | proc mapDelete*(map: var Map) = 57 | ## Destroy a map. 58 | ## 59 | if map != nil: 60 | mapDelete_internal(map) 61 | map = nil 62 | 63 | proc mapComputeFov*( 64 | map: Map; playerX, playerY: cint; 65 | maxRadius: cint = 0; 66 | lightWalls: bool = true; 67 | algo: FovAlgorithm = FOV_BASIC) {. 68 | cdecl, importc: "TCOD_map_compute_fov", dynlib: LIB_NAME.} 69 | ## Calculate the field of view 70 | ## (potentially visible cells from ``player_x, player_y``). 71 | 72 | proc mapIsInFov*( 73 | map: Map; x, y: cint): bool {. 74 | cdecl, importc: "TCOD_map_is_in_fov", dynlib: LIB_NAME.} 75 | ## Check if a cell is in the last computed field of view. 76 | 77 | proc mapSetInFov*( 78 | map: Map; x, y: cint; fov: bool) {. 79 | cdecl, importc: "TCOD_map_set_in_fov", dynlib: LIB_NAME.} 80 | 81 | 82 | proc mapIsTransparent*( 83 | map: Map; x, y: cint): bool {. 84 | cdecl, importc: "TCOD_map_is_transparent", dynlib: LIB_NAME.} 85 | ## Retrieve properties from the map. 86 | 87 | proc mapIsWalkable*( 88 | map: Map; x, y: cint): bool {. 89 | cdecl, importc: "TCOD_map_is_walkable", dynlib: LIB_NAME.} 90 | 91 | proc mapGetWidth*( 92 | map: Map): cint {. 93 | cdecl, importc: "TCOD_map_get_width", dynlib: LIB_NAME.} 94 | 95 | proc mapGetHeight*( 96 | map: Map): cint {. 97 | cdecl, importc: "TCOD_map_get_height", dynlib: LIB_NAME.} 98 | 99 | proc mapGetNbCells*( 100 | map: Map): cint {. 101 | cdecl, importc: "TCOD_map_get_nb_cells", dynlib: LIB_NAME.} 102 | 103 | -------------------------------------------------------------------------------- /libtcod/src17/fov_types.nim: -------------------------------------------------------------------------------- 1 | # 2 | # libtcod 3 | # Copyright (c) 2008-2018 Jice & Mingos & rmtew 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 14 | # products derived from this software without specific prior written 15 | # permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY JICE, MINGOS AND RMTEW ``AS IS'' AND ANY 18 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | # DISCLAIMED. IN NO EVENT SHALL JICE, MINGOS OR RMTEW BE LIABLE FOR ANY 21 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | type 30 | Map* = pointer 31 | 32 | ## FOV_BASIC : http://roguebasin.roguelikedevelopment.org/index.php?title=Ray_casting 33 | ## 34 | ## FOV_DIAMOND : http://www.geocities.com/temerra/los_rays.html 35 | ## 36 | ## FOV_SHADOW : http://roguebasin.roguelikedevelopment.org/index.php?title=FOV_using_recursive_shadowcasting 37 | ## 38 | ## FOV_PERMISSIVE : http://roguebasin.roguelikedevelopment.org/index.php?title=Precise_Permissive_Field_of_View 39 | ## 40 | ## FOV_RESTRICTIVE : Mingos' Restrictive Precise Angle Shadowcasting (contribution by Mingos) 41 | ## 42 | 43 | type 44 | FovAlgorithm* {.size: sizeof(cint).} = enum 45 | FOV_BASIC, FOV_DIAMOND, FOV_SHADOW, FOV_PERMISSIVE_0, FOV_PERMISSIVE_1, 46 | FOV_PERMISSIVE_2, FOV_PERMISSIVE_3, FOV_PERMISSIVE_4, FOV_PERMISSIVE_5, 47 | FOV_PERMISSIVE_6, FOV_PERMISSIVE_7, FOV_PERMISSIVE_8, FOV_RESTRICTIVE, 48 | NB_FOV_ALGORITHMS 49 | 50 | 51 | template fov_Permissive*(x: untyped): untyped = 52 | ((FovAlgorithm)(FOV_PERMISSIVE_0 + (x))) 53 | 54 | -------------------------------------------------------------------------------- /libtcod/src17/image.nim: -------------------------------------------------------------------------------- 1 | # 2 | # libtcod 3 | # Copyright (c) 2008-2018 Jice & Mingos & rmtew 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 14 | # products derived from this software without specific prior written 15 | # permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY JICE, MINGOS AND RMTEW ``AS IS'' AND ANY 18 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | # DISCLAIMED. IN NO EVENT SHALL JICE, MINGOS OR RMTEW BE LIABLE FOR ANY 21 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | # import color, console_types 30 | 31 | type 32 | Image* = pointer 33 | 34 | 35 | proc imageNew*( 36 | width, height: cint): Image {. 37 | cdecl, importc: "TCOD_image_new", dynlib: LIB_NAME.} 38 | 39 | proc imageFromConsole*( 40 | console: Console): Image {. 41 | cdecl, importc: "TCOD_image_from_console", dynlib: LIB_NAME.} 42 | 43 | proc imageRefreshConsole*( 44 | image: Image; console: Console) {. 45 | cdecl, importc: "TCOD_image_refresh_console", dynlib: LIB_NAME.} 46 | 47 | proc imageLoad*( 48 | filename: cstring): Image {. 49 | cdecl, importc: "TCOD_image_load", dynlib: LIB_NAME.} 50 | 51 | proc imageClear*( 52 | image: Image; color: Color) {. 53 | cdecl, importc: "TCOD_image_clear", dynlib: LIB_NAME.} 54 | 55 | proc imageInvert*( 56 | image: Image) {. 57 | cdecl, importc: "TCOD_image_invert", dynlib: LIB_NAME.} 58 | 59 | proc imageHflip*( 60 | image: Image) {. 61 | cdecl, importc: "TCOD_image_hflip", dynlib: LIB_NAME.} 62 | 63 | proc imageRotate90*( 64 | image: Image; numRotations: cint = 1) {. 65 | cdecl, importc: "TCOD_image_rotate90", dynlib: LIB_NAME.} 66 | 67 | proc imageVflip*( 68 | image: Image) {. 69 | cdecl, importc: "TCOD_image_vflip", dynlib: LIB_NAME.} 70 | 71 | proc imageScale*( 72 | image: Image; neww, newh: cint) {. 73 | cdecl, importc: "TCOD_image_scale", dynlib: LIB_NAME.} 74 | 75 | proc imageSave*( 76 | image: Image; filename: cstring) {. 77 | cdecl, importc: "TCOD_image_save", dynlib: LIB_NAME.} 78 | 79 | proc imageGetSize*( 80 | image: Image; w, h: ptr cint) {. 81 | cdecl, importc: "TCOD_image_get_size", dynlib: LIB_NAME.} 82 | 83 | proc imageGetPixel*( 84 | image: Image; x, y: cint): Color {. 85 | cdecl, importc: "TCOD_image_get_pixel", dynlib: LIB_NAME.} 86 | 87 | proc imageGetAlpha*( 88 | image: Image; x, y: cint): cint {. 89 | cdecl, importc: "TCOD_image_get_alpha", dynlib: LIB_NAME.} 90 | 91 | proc imageGetMipmapPixel*( 92 | image: Image; x0, y0, x1, y1: cfloat): Color {. 93 | cdecl, importc: "TCOD_image_get_mipmap_pixel", dynlib: LIB_NAME.} 94 | 95 | proc imagePutPixel*( 96 | image: Image; x, y: cint; col: Color) {. 97 | cdecl, importc: "TCOD_image_put_pixel", dynlib: LIB_NAME.} 98 | 99 | proc imageBlit*( 100 | image: Image; console: Console; x, y: cfloat; 101 | bkgndFlag: BkgndFlag = BKGND_SET; 102 | scalex: cfloat = 1.0; 103 | scaley: cfloat = 1.0; 104 | angle: cfloat = 0.0) {. 105 | cdecl, importc: "TCOD_image_blit", dynlib: LIB_NAME.} 106 | 107 | proc imageBlitRect*( 108 | image: Image; console: Console; x, y: cint; 109 | w: cint = -1; 110 | h: cint = -1; 111 | bkgndFlag: BkgndFlag = BKGND_SET) {. 112 | cdecl, importc: "TCOD_image_blit_rect", dynlib: LIB_NAME.} 113 | 114 | proc imageBlit2x*( 115 | image: Image; dest: Console; dx, dy: cint; 116 | sx: cint = 0; 117 | sy: cint = 0; 118 | w: cint = -1; 119 | h: cint = -1) {. 120 | cdecl, importc: "TCOD_image_blit_2x", dynlib: LIB_NAME.} 121 | 122 | proc imageDelete_internal( 123 | image: Image) {. 124 | cdecl, importc: "TCOD_image_delete", dynlib: LIB_NAME.} 125 | 126 | proc imageDelete*(image: var Image) = 127 | if not (image == nil): 128 | imageDelete_internal(image) 129 | image = nil 130 | 131 | proc imageSetKeyColor*( 132 | image: Image; keyColor: Color) {. 133 | cdecl, importc: "TCOD_image_set_key_color", dynlib: LIB_NAME.} 134 | 135 | proc imageIsPixelTransparent*( 136 | image: Image; x, y: cint): bool {. 137 | cdecl, importc: "TCOD_image_is_pixel_transparent", dynlib: LIB_NAME.} 138 | 139 | -------------------------------------------------------------------------------- /libtcod/src17/libtcod_define.nim: -------------------------------------------------------------------------------- 1 | # 2 | # libtcod 3 | # Copyright (c) 2008-2018 Jice & Mingos & rmtew 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 | {.deadCodeElim: on.} 29 | 30 | # csize is deprecated in Nim v1.1 31 | # See Nim commit 99078d80d7abb1c47612bc70f7affbde8735066a 32 | when not declared(csize_t): 33 | type csize_t* {.importc: "size_t", nodecl.} = uint 34 | 35 | const 36 | NO_UNICODE* = false ## Disable Unicode support 37 | NO_OPENGL* = false ## Disable OpenGL support 38 | 39 | when defined(linux): 40 | const LIB_NAME* = "libtcod.so(|.0.0.0)" 41 | 42 | elif defined(MacOSX): 43 | const LIB_NAME* = "libtcod.dylib" 44 | 45 | else: # windows 46 | const LIB_NAME* = "libtcod.dll" 47 | 48 | const 49 | HEXVERSION* = 0x00010700 50 | STRVERSION* = "1.7.0" 51 | TECHVERSION* = 0x01070000 52 | STRVERSIONNAME* = "libtcod 1.7.0" 53 | WRAPPERVERSION* = "0.99" 54 | 55 | -------------------------------------------------------------------------------- /libtcod/src17/list.nim: -------------------------------------------------------------------------------- 1 | # 2 | # libtcod 3 | # Copyright (c) 2008-2018 Jice & Mingos & rmtew 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 14 | # products derived from this software without specific prior written 15 | # permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY JICE, MINGOS AND RMTEW ``AS IS'' AND ANY 18 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | # DISCLAIMED. IN NO EVENT SHALL JICE, MINGOS OR RMTEW BE LIABLE FOR ANY 21 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | type 30 | List* = pointer 31 | 32 | 33 | proc listNew*(): List {. 34 | cdecl, importc: "TCOD_list_new", dynlib: LIB_NAME.} 35 | 36 | proc listAllocate*( 37 | nbElements: cint): List {. 38 | cdecl, importc: "TCOD_list_allocate", dynlib: LIB_NAME.} 39 | 40 | proc listDuplicate*( 41 | l: List): List {. 42 | cdecl, importc: "TCOD_list_duplicate", dynlib: LIB_NAME.} 43 | 44 | proc listDelete_internal( 45 | l: List) {. 46 | cdecl, importc: "TCOD_list_delete", dynlib: LIB_NAME.} 47 | 48 | proc listDelete*(l: var List) = 49 | if not (l == nil): 50 | listDelete_internal(l) 51 | l = nil 52 | 53 | proc listPush*( 54 | l: List; elt: pointer) {. 55 | cdecl, importc: "TCOD_list_push", dynlib: LIB_NAME.} 56 | 57 | proc listPop*( 58 | l: List): pointer {. 59 | cdecl, importc: "TCOD_list_pop", dynlib: LIB_NAME.} 60 | 61 | proc listPeek*( 62 | l: List): pointer {. 63 | cdecl, importc: "TCOD_list_peek", dynlib: LIB_NAME.} 64 | 65 | proc listAddAll*( 66 | l, l2: List) {. 67 | cdecl, importc: "TCOD_list_add_all", dynlib: LIB_NAME.} 68 | 69 | proc listGet*( 70 | l: List; idx: cint): pointer {. 71 | cdecl, importc: "TCOD_list_get", dynlib: LIB_NAME.} 72 | 73 | proc listSet*( 74 | l: List; elt: pointer; idx: cint) {. 75 | cdecl, importc: "TCOD_list_set", dynlib: LIB_NAME.} 76 | 77 | proc listBegin*( 78 | l: List): ptr pointer {. 79 | cdecl, importc: "TCOD_list_begin", dynlib: LIB_NAME.} 80 | 81 | proc listEnd*( 82 | l: List): ptr pointer {. 83 | cdecl, importc: "TCOD_list_end", dynlib: LIB_NAME.} 84 | 85 | proc listReverse*( 86 | l: List) {. 87 | cdecl, importc: "TCOD_list_reverse", dynlib: LIB_NAME.} 88 | 89 | proc listRemoveIterator*( 90 | l: List; elt: ptr pointer): ptr pointer {. 91 | cdecl, importc: "TCOD_list_remove_iterator", dynlib: LIB_NAME.} 92 | 93 | proc listRemove*( 94 | l: List; elt: pointer) {. 95 | cdecl, importc: "TCOD_list_remove", dynlib: LIB_NAME.} 96 | 97 | proc listRemoveIteratorFast*( 98 | l: List; elt: ptr pointer): ptr pointer {. 99 | cdecl, importc: "TCOD_list_remove_iterator_fast", dynlib: LIB_NAME.} 100 | 101 | proc listRemoveFast*( 102 | l: List; elt: pointer) {. 103 | cdecl, importc: "TCOD_list_remove_fast", dynlib: LIB_NAME.} 104 | 105 | proc listContains*( 106 | l: List; elt: pointer): bool {. 107 | cdecl, importc: "TCOD_list_contains", dynlib: LIB_NAME.} 108 | 109 | proc listClear*( 110 | l: List) {. 111 | cdecl, importc: "TCOD_list_clear", dynlib: LIB_NAME.} 112 | 113 | proc listClearAndDelete_internal( 114 | l: List) {. 115 | cdecl, importc: "TCOD_list_clear_and_delete", dynlib: LIB_NAME.} 116 | 117 | proc listClearAndDelete*(l: var List) = 118 | if not (l == nil): 119 | listClearAndDelete_internal(l) 120 | l = nil 121 | 122 | proc listSize*( 123 | l: List): cint {. 124 | cdecl, importc: "TCOD_list_size", dynlib: LIB_NAME.} 125 | 126 | proc listInsertBefore*( 127 | l: List; elt: pointer; before: cint): ptr pointer {. 128 | cdecl, importc: "TCOD_list_insert_before", dynlib: LIB_NAME.} 129 | 130 | proc listIsEmpty*( 131 | l: List): bool {. 132 | cdecl, importc: "TCOD_list_is_empty", dynlib: LIB_NAME.} 133 | 134 | -------------------------------------------------------------------------------- /libtcod/src17/mersenne.nim: -------------------------------------------------------------------------------- 1 | # 2 | # libtcod 3 | # Copyright (c) 2008-2018 Jice & Mingos & rmtew 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 14 | # products derived from this software without specific prior written 15 | # permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY JICE, MINGOS AND RMTEW ``AS IS'' AND ANY 18 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | # DISCLAIMED. IN NO EVENT SHALL JICE, MINGOS OR RMTEW BE LIABLE FOR ANY 21 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | # import mersenne_types 30 | 31 | proc randomGetInstance*(): Random {. 32 | cdecl, importc: "TCOD_random_get_instance", dynlib: LIB_NAME.} 33 | 34 | proc randomNew*( 35 | algo: RandomAlgo = RNG_CMWC): Random {. 36 | cdecl, importc: "TCOD_random_new", dynlib: LIB_NAME.} 37 | 38 | proc randomSave*( 39 | mersenne: Random): Random {. 40 | cdecl, importc: "TCOD_random_save", dynlib: LIB_NAME.} 41 | 42 | proc randomRestore*( 43 | mersenne: Random; backup: Random) {. 44 | cdecl, importc: "TCOD_random_restore", dynlib: LIB_NAME.} 45 | 46 | proc randomNewFromSeed*( 47 | algo: RandomAlgo = RNG_CMWC; seed: uint32 = 0): Random {. 48 | cdecl, importc: "TCOD_random_new_from_seed", dynlib: LIB_NAME.} 49 | 50 | proc randomDelete_internal( 51 | mersenne: Random) {. 52 | cdecl, importc: "TCOD_random_delete", dynlib: LIB_NAME.} 53 | 54 | proc randomDelete*(mersenne: var Random) = 55 | if not (mersenne == nil): 56 | randomDelete_internal(mersenne) 57 | mersenne = nil 58 | 59 | proc randomSetDistribution*( 60 | mersenne: Random; distribution: Distribution) {. 61 | cdecl, importc: "TCOD_random_set_distribution", dynlib: LIB_NAME.} 62 | 63 | proc randomGetInt*( 64 | mersenne: Random; `min`, `max`: cint): cint {. 65 | cdecl, importc: "TCOD_random_get_int", dynlib: LIB_NAME.} 66 | 67 | template randomGetChar*(mersenne: Random; `min`, `max`: char): char = 68 | (char(randomGetInt(mersenne, `min`.ord, `max`.ord))) 69 | 70 | proc randomGetFloat*( 71 | mersenne: Random; `min`, `max`: cfloat): cfloat {. 72 | cdecl, importc: "TCOD_random_get_float", dynlib: LIB_NAME.} 73 | 74 | proc randomGetDouble*( 75 | mersenne: Random; `min`, `max`: cdouble): cdouble {. 76 | cdecl, importc: "TCOD_random_get_double", dynlib: LIB_NAME.} 77 | 78 | proc randomGetIntMean*( 79 | mersenne: Random; `min`, `max`, mean: cint = 0): cint {. 80 | cdecl, importc: "TCOD_random_get_int_mean", dynlib: LIB_NAME.} 81 | 82 | proc randomGetFloatMean*( 83 | mersenne: Random; `min`, `max`, mean: cfloat = 0.0): cfloat {. 84 | cdecl, importc: "TCOD_random_get_float_mean", dynlib: LIB_NAME.} 85 | 86 | proc randomGetDoubleMean*( 87 | mersenne: Random; `min`, `max`, mean: cdouble = 0.0): cdouble {. 88 | cdecl, importc: "TCOD_random_get_double_mean", dynlib: LIB_NAME.} 89 | 90 | proc randomDiceNew*( 91 | s: cstring): Dice {. 92 | cdecl, importc: "TCOD_random_dice_new", dynlib: LIB_NAME.} 93 | 94 | proc randomDiceRoll*( 95 | mersenne: Random; dice: Dice): cint {. 96 | cdecl, importc: "TCOD_random_dice_roll", dynlib: LIB_NAME.} 97 | 98 | proc randomDiceRollS*( 99 | mersenne: Random; s: cstring): cint {. 100 | cdecl, importc: "TCOD_random_dice_roll_s", dynlib: LIB_NAME.} 101 | 102 | -------------------------------------------------------------------------------- /libtcod/src17/mersenne_types.nim: -------------------------------------------------------------------------------- 1 | # 2 | # libtcod 3 | # Copyright (c) 2008-2018 Jice & Mingos & rmtew 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 14 | # products derived from this software without specific prior written 15 | # permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY JICE, MINGOS AND RMTEW ``AS IS'' AND ANY 18 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | # DISCLAIMED. IN NO EVENT SHALL JICE, MINGOS OR RMTEW BE LIABLE FOR ANY 21 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | type 30 | Random* = pointer 31 | 32 | 33 | type 34 | Dice* {.bycopy.} = object ## \ 35 | ## Dice roll. 36 | ## 37 | nbRolls*: cint 38 | nbFaces*: cint 39 | multiplier*: cfloat 40 | addsub*: cfloat 41 | 42 | 43 | # PRNG algorithms 44 | 45 | type 46 | RandomAlgo* {.size: sizeof(cint).} = enum 47 | RNG_MT 48 | RNG_CMWC 49 | 50 | Distribution* {.size: sizeof(cint).} = enum 51 | DISTRIBUTION_LINEAR 52 | DISTRIBUTION_GAUSSIAN 53 | DISTRIBUTION_GAUSSIAN_RANGE 54 | DISTRIBUTION_GAUSSIAN_INVERSE 55 | DISTRIBUTION_GAUSSIAN_RANGE_INVERSE 56 | 57 | 58 | import strutils 59 | 60 | proc repr*(dice: Dice): string = 61 | result = "" 62 | if not (dice.multiplier == 1.0): 63 | result.add(formatFloat(dice.multiplier, ffDefault, 0) & "*") 64 | result.add(repr(dice.nb_rolls) & "d" & repr(dice.nb_faces)) 65 | if not (dice.addsub == 0.0): 66 | if 0.0 < dice.addsub: 67 | result.add("+") 68 | result.add(formatFloat(dice.addsub, ffDefault, 0)) 69 | 70 | -------------------------------------------------------------------------------- /libtcod/src17/mouse.nim: -------------------------------------------------------------------------------- 1 | # 2 | # libtcod 3 | # Copyright (c) 2008-2018 Jice & Mingos & rmtew 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 14 | # products derived from this software without specific prior written 15 | # permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY JICE, MINGOS AND RMTEW ``AS IS'' AND ANY 18 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | # DISCLAIMED. IN NO EVENT SHALL JICE, MINGOS OR RMTEW BE LIABLE FOR ANY 21 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | # import mouse_types 30 | 31 | proc mouseShowCursor*( 32 | visible: bool) {. 33 | cdecl, importc: "TCOD_mouse_show_cursor", dynlib: LIB_NAME.} 34 | 35 | proc mouseGetStatus*(): Mouse {. 36 | cdecl, importc: "TCOD_mouse_get_status", dynlib: LIB_NAME.} 37 | 38 | proc mouseIsCursorVisible*(): bool {. 39 | cdecl, importc: "TCOD_mouse_is_cursor_visible", dynlib: LIB_NAME.} 40 | 41 | proc mouseMove*( 42 | x, y: cint) {. 43 | cdecl, importc: "TCOD_mouse_move", dynlib: LIB_NAME.} 44 | 45 | proc mouseIncludesTouch*( 46 | enable: bool) {. 47 | cdecl, importc: "TCOD_mouse_includes_touch", dynlib: LIB_NAME.} 48 | 49 | -------------------------------------------------------------------------------- /libtcod/src17/mouse_types.nim: -------------------------------------------------------------------------------- 1 | # 2 | # libtcod 3 | # Copyright (c) 2008-2018 Jice & Mingos & rmtew 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 14 | # products derived from this software without specific prior written 15 | # permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY JICE, MINGOS AND RMTEW ``AS IS'' AND ANY 18 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | # DISCLAIMED. IN NO EVENT SHALL JICE, MINGOS OR RMTEW BE LIABLE FOR ANY 21 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | type 30 | Mouse* {.bycopy.} = object ## \ 31 | ## Mouse data. 32 | ## 33 | x*, y*: cint ## absolute position 34 | dx*, dy*: cint ## movement since last update in pixels 35 | cx*, cy*: cint ## cell coordinates in the root console 36 | dcx*, dcy*: cint ## movement since last update in console cells 37 | lbutton*: bool ## left button status 38 | rbutton*: bool ## right button status 39 | mbutton*: bool ## middle button status 40 | lbuttonPressed*: bool ## left button pressed event 41 | rbuttonPressed*: bool ## right button pressed event 42 | mbuttonPressed*: bool ## middle button pressed event 43 | wheelUp*: bool ## wheel up event 44 | wheelDown*: bool ## wheel down event 45 | 46 | -------------------------------------------------------------------------------- /libtcod/src17/namegen.nim: -------------------------------------------------------------------------------- 1 | # 2 | # libtcod 3 | # Copyright (c) 2008-2018 Jice & Mingos & rmtew 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 14 | # products derived from this software without specific prior written 15 | # permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY JICE, MINGOS AND RMTEW ``AS IS'' AND ANY 18 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | # DISCLAIMED. IN NO EVENT SHALL JICE, MINGOS OR RMTEW BE LIABLE FOR ANY 21 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | # 29 | # Mingos' NameGen 30 | # This file was written by Dominik "Mingos" Marczuk. 31 | # 32 | 33 | # import list, mersenne_types 34 | 35 | type 36 | Namegen* = pointer ## The generator type. 37 | 38 | 39 | proc namegenParse*( 40 | filename: cstring; random: Random = nil) {. 41 | cdecl, importc: "TCOD_namegen_parse", dynlib: LIB_NAME.} 42 | ## Parse a file with syllable sets. 43 | 44 | proc namegenGenerate*( 45 | name: cstring; allocate: bool = false): cstring {. 46 | cdecl, importc: "TCOD_namegen_generate", dynlib: LIB_NAME.} 47 | ## Generate a name. 48 | 49 | proc namegenGenerateCustom*( 50 | name, rule: cstring; allocate: bool = false): cstring {. 51 | cdecl, importc: "TCOD_namegen_generate_custom", dynlib: LIB_NAME.} 52 | ## Generate a name using a custom generation rule. 53 | 54 | proc namegenGetSetsList*(): List {. 55 | cdecl, importc: "TCOD_namegen_get_sets", dynlib: LIB_NAME.} 56 | ## Retrieve the list of all available syllable set names. 57 | 58 | proc namegenGetSets*(): seq[string] = 59 | ## Retrieve the list of all available syllable set names. 60 | var list = namegenGetSetsList() 61 | result = cstringArrayToSeq(cast[cstringArray](listBegin(list)), listSize(list)) 62 | listDelete(list) 63 | 64 | proc namegenDestroy*() {. 65 | cdecl, importc: "TCOD_namegen_destroy", dynlib: LIB_NAME.} 66 | ## Delete a generator. 67 | 68 | -------------------------------------------------------------------------------- /libtcod/src17/noise.nim: -------------------------------------------------------------------------------- 1 | # 2 | # libtcod 3 | # Copyright (c) 2008-2018 Jice & Mingos & rmtew 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 14 | # products derived from this software without specific prior written 15 | # permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY JICE, MINGOS AND RMTEW ``AS IS'' AND ANY 18 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | # DISCLAIMED. IN NO EVENT SHALL JICE, MINGOS OR RMTEW BE LIABLE FOR ANY 21 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | # import mersenne_types 30 | 31 | type 32 | Noise* = pointer 33 | NoiseKind* {.size: sizeof(cint).} = enum 34 | NOISE_DEFAULT = 0, NOISE_PERLIN = 1, NOISE_SIMPLEX = 2, NOISE_WAVELET = 4 35 | 36 | 37 | template floatArrayToPtr*(f: var openarray[cfloat]): ptr cfloat = 38 | cast[ptr cfloat](addr(f)) 39 | 40 | 41 | proc noiseNew*( 42 | dimensions: cint; hurst, lacunarity: cfloat; random: Random = nil): Noise {. 43 | cdecl, importc: "TCOD_noise_new", dynlib: LIB_NAME.} 44 | ## Create a new noise object. 45 | 46 | # simplified API 47 | 48 | proc noiseSetKind*( 49 | noise: Noise; kind: NoiseKind) {. 50 | cdecl, importc: "TCOD_noise_set_type", dynlib: LIB_NAME.} 51 | 52 | proc noiseGetEx*( 53 | noise: Noise; f: ptr cfloat; 54 | kind: NoiseKind = NOISE_DEFAULT): cfloat {. 55 | cdecl, importc: "TCOD_noise_get_ex", dynlib: LIB_NAME.} 56 | 57 | proc noiseGetFbmEx*( 58 | noise: Noise; f: ptr cfloat; octaves: cfloat; 59 | kind: NoiseKind = NOISE_DEFAULT): cfloat {. 60 | cdecl, importc: "TCOD_noise_get_fbm_ex", dynlib: LIB_NAME.} 61 | 62 | proc noiseGetTurbulenceEx*( 63 | noise: Noise; f: ptr cfloat; octaves: cfloat; 64 | kind: NoiseKind = NOISE_DEFAULT): cfloat {. 65 | cdecl, importc: "TCOD_noise_get_turbulence_ex", dynlib: LIB_NAME.} 66 | 67 | proc noiseGet*( 68 | noise: Noise; f: ptr cfloat): cfloat {. 69 | cdecl, importc: "TCOD_noise_get", dynlib: LIB_NAME.} 70 | 71 | proc noiseGetFbm*( 72 | noise: Noise; f: ptr cfloat; octaves: cfloat): cfloat {. 73 | cdecl, importc: "TCOD_noise_get_fbm", dynlib: LIB_NAME.} 74 | 75 | proc noiseGetTurbulence*( 76 | noise: Noise; f: ptr cfloat; octaves: cfloat): cfloat {. 77 | cdecl, importc: "TCOD_noise_get_turbulence", dynlib: LIB_NAME.} 78 | 79 | proc noiseDelete_internal( 80 | noise: Noise) {. 81 | cdecl, importc: "TCOD_noise_delete", dynlib: LIB_NAME.} 82 | 83 | proc noiseDelete*(noise: var Noise) = 84 | ## Delete the noise object. 85 | ## 86 | if noise != nil: 87 | noiseDelete_internal(noise) 88 | noise = nil 89 | 90 | -------------------------------------------------------------------------------- /libtcod/src17/noise_defaults.nim: -------------------------------------------------------------------------------- 1 | # 2 | # libtcod 3 | # Copyright (c) 2008-2018 Jice & Mingos & rmtew 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 14 | # products derived from this software without specific prior written 15 | # permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY JICE, MINGOS AND RMTEW ``AS IS'' AND ANY 18 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | # DISCLAIMED. IN NO EVENT SHALL JICE, MINGOS OR RMTEW BE LIABLE FOR ANY 21 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | const 30 | NOISE_MAX_OCTAVES*: cint = 128 31 | NOISE_MAX_DIMENSIONS*: cint = 4 32 | NOISE_DEFAULT_HURST*: cfloat = 0.5 33 | NOISE_DEFAULT_LACUNARITY*: cfloat = 2.0 34 | 35 | -------------------------------------------------------------------------------- /libtcod/src17/tree.nim: -------------------------------------------------------------------------------- 1 | # 2 | # libtcod 3 | # Copyright (c) 2008-2018 Jice & Mingos & rmtew 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 14 | # products derived from this software without specific prior written 15 | # permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY JICE, MINGOS AND RMTEW ``AS IS'' AND ANY 18 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | # DISCLAIMED. IN NO EVENT SHALL JICE, MINGOS OR RMTEW BE LIABLE FOR ANY 21 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | type 30 | Tree* = ptr TreeObj 31 | TreeObj* {.bycopy.} = object 32 | next*: Tree 33 | father*: Tree 34 | sons*: Tree 35 | 36 | 37 | proc treeNew*(): Tree {. 38 | cdecl, importc: "TCOD_tree_new", dynlib: LIB_NAME.} 39 | 40 | proc treeAddSon*( 41 | node, son: Tree) {. 42 | cdecl, importc: "TCOD_tree_add_son", dynlib: LIB_NAME.} 43 | 44 | -------------------------------------------------------------------------------- /libtcod/src17/txtfield.nim: -------------------------------------------------------------------------------- 1 | # 2 | # libtcod 3 | # Copyright (c) 2008-2018 Jice & Mingos & rmtew 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 14 | # products derived from this software without specific prior written 15 | # permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY JICE, MINGOS AND RMTEW ``AS IS'' AND ANY 18 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | # DISCLAIMED. IN NO EVENT SHALL JICE, MINGOS OR RMTEW BE LIABLE FOR ANY 21 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | # import color, console_types 30 | 31 | type 32 | Text* = pointer 33 | 34 | 35 | proc textInit*( 36 | x, y, w, h, maxChars: cint): Text {. 37 | cdecl, importc: "TCOD_text_init", dynlib: LIB_NAME.} 38 | 39 | proc textInit2*( 40 | w, h, maxChars: cint): Text {. 41 | cdecl, importc: "TCOD_text_init2", dynlib: LIB_NAME.} 42 | 43 | proc textSetPos*( 44 | txt: Text; x, y: cint) {. 45 | cdecl, importc: "TCOD_text_set_pos", dynlib: LIB_NAME.} 46 | 47 | proc textSetProperties*( 48 | txt: Text; cursorChar, blinkInterval: cint; prompt: cstring; tabSize: cint) {. 49 | cdecl, importc: "TCOD_text_set_properties", dynlib: LIB_NAME.} 50 | 51 | proc textSetColors*( 52 | txt: Text; fore, back: Color; backTransparency: cfloat) {. 53 | cdecl, importc: "TCOD_text_set_colors", dynlib: LIB_NAME.} 54 | 55 | proc textUpdate*( 56 | txt: Text; key: Key): bool {. 57 | cdecl, importc: "TCOD_text_update", dynlib: LIB_NAME.} 58 | 59 | proc textRender*( 60 | txt: Text; con: Console) {. 61 | cdecl, importc: "TCOD_text_render", dynlib: LIB_NAME.} 62 | 63 | proc textGet*( 64 | txt: Text): cstring {. 65 | cdecl, importc: "TCOD_text_get", dynlib: LIB_NAME.} 66 | 67 | proc textReset*( 68 | txt: Text) {. 69 | cdecl, importc: "TCOD_text_reset", dynlib: LIB_NAME.} 70 | 71 | proc textDelete_internal( 72 | txt: Text) {. 73 | cdecl, importc: "TCOD_text_delete", dynlib: LIB_NAME.} 74 | 75 | proc textDelete*(txt: var Text) = 76 | if txt != nil: 77 | textDelete_internal(txt) 78 | txt = nil 79 | 80 | -------------------------------------------------------------------------------- /libtcod/src17/zip.nim: -------------------------------------------------------------------------------- 1 | # 2 | # libtcod 3 | # Copyright (c) 2008-2018 Jice & Mingos & rmtew 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 14 | # products derived from this software without specific prior written 15 | # permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY JICE, MINGOS AND RMTEW ``AS IS'' AND ANY 18 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | # DISCLAIMED. IN NO EVENT SHALL JICE, MINGOS OR RMTEW BE LIABLE FOR ANY 21 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | # import color, console_types, image 30 | 31 | type 32 | Zip* = pointer 33 | 34 | 35 | proc zipNew*(): Zip {. 36 | cdecl, importc: "TCOD_zip_new", dynlib: LIB_NAME.} 37 | 38 | proc zipDelete_internal( 39 | zip: Zip) {. 40 | cdecl, importc: "TCOD_zip_delete", dynlib: LIB_NAME.} 41 | 42 | proc zipDelete*(zip: var Zip) = 43 | if zip != nil: 44 | zipDelete_internal(zip) 45 | zip = nil 46 | 47 | proc zipPutChar*( 48 | zip: Zip; val: char) {. 49 | cdecl, importc: "TCOD_zip_put_char", dynlib: LIB_NAME.} 50 | ## output interface 51 | 52 | proc zipPutInt*( 53 | zip: Zip; val: cint) {. 54 | cdecl, importc: "TCOD_zip_put_int", dynlib: LIB_NAME.} 55 | 56 | proc zipPutFloat*( 57 | zip: Zip; val: cfloat) {. 58 | cdecl, importc: "TCOD_zip_put_float", dynlib: LIB_NAME.} 59 | 60 | proc zipPutString*( 61 | zip: Zip; val: cstring) {. 62 | cdecl, importc: "TCOD_zip_put_string", dynlib: LIB_NAME.} 63 | 64 | proc zipPutColor*( 65 | zip: Zip; val: Color) {. 66 | cdecl, importc: "TCOD_zip_put_color", dynlib: LIB_NAME.} 67 | 68 | proc zipPutImage*( 69 | zip: Zip; val: Image) {. 70 | cdecl, importc: "TCOD_zip_put_image", dynlib: LIB_NAME.} 71 | 72 | proc zipPutConsole*( 73 | zip: Zip; val: Console) {. 74 | cdecl, importc: "TCOD_zip_put_console", dynlib: LIB_NAME.} 75 | 76 | proc zipPutData*( 77 | zip: Zip; nbBytes: cint; data: pointer) {. 78 | cdecl, importc: "TCOD_zip_put_data", dynlib: LIB_NAME.} 79 | 80 | proc zipGetCurrentBytes*( 81 | zip: Zip): uint32 {. 82 | cdecl, importc: "TCOD_zip_get_current_bytes", dynlib: LIB_NAME.} 83 | 84 | proc zipSaveToFile*( 85 | zip: Zip; filename: cstring): cint {. 86 | cdecl, importc: "TCOD_zip_save_to_file", dynlib: LIB_NAME.} 87 | 88 | 89 | proc zipLoadFromFile*( 90 | zip: Zip; filename: cstring): cint {. 91 | cdecl, importc: "TCOD_zip_load_from_file", dynlib: LIB_NAME.} 92 | ## input interface 93 | 94 | proc zipGetChar*( 95 | zip: Zip): char {. 96 | cdecl, importc: "TCOD_zip_get_char", dynlib: LIB_NAME.} 97 | 98 | proc zipGetInt*( 99 | zip: Zip): cint {. 100 | cdecl, importc: "TCOD_zip_get_int", dynlib: LIB_NAME.} 101 | 102 | proc zipGetFloat*( 103 | zip: Zip): cfloat {. 104 | cdecl, importc: "TCOD_zip_get_float", dynlib: LIB_NAME.} 105 | 106 | proc zipGetString*( 107 | zip: Zip): cstring {. 108 | cdecl, importc: "TCOD_zip_get_string", dynlib: LIB_NAME.} 109 | 110 | proc zipGetColor*( 111 | zip: Zip): Color {. 112 | cdecl, importc: "TCOD_zip_get_color", dynlib: LIB_NAME.} 113 | 114 | proc zipGetImage*( 115 | zip: Zip): Image {. 116 | cdecl, importc: "TCOD_zip_get_image", dynlib: LIB_NAME.} 117 | 118 | proc zipGetConsole*( 119 | zip: Zip): Console {. 120 | cdecl, importc: "TCOD_zip_get_console", dynlib: LIB_NAME.} 121 | 122 | proc zipGetData*( 123 | zip: Zip; nbBytes: cint; data: pointer): cint {. 124 | cdecl, importc: "TCOD_zip_get_data", dynlib: LIB_NAME.} 125 | 126 | proc zipGetRemainingBytes*( 127 | zip: Zip): uint32 {. 128 | cdecl, importc: "TCOD_zip_get_remaining_bytes", dynlib: LIB_NAME.} 129 | 130 | proc zipSkipBytes*(zip: Zip; nbBytes: uint32) {. 131 | cdecl, importc: "TCOD_zip_skip_bytes", dynlib: LIB_NAME.} 132 | 133 | -------------------------------------------------------------------------------- /samples112/build_samples.bat: -------------------------------------------------------------------------------- 1 | nim c -d:debug --deadCodeElim:on samples.nim 2 | 3 | -------------------------------------------------------------------------------- /samples112/build_samples.sh: -------------------------------------------------------------------------------- 1 | nim c -d:release --opt:speed samples.nim 2 | 3 | -------------------------------------------------------------------------------- /samples112/build_samples_debug.sh: -------------------------------------------------------------------------------- 1 | nim c -d:debug samples.nim 2 | 3 | -------------------------------------------------------------------------------- /samples15/build_samples.bat: -------------------------------------------------------------------------------- 1 | nim c -d:debug --deadCodeElim:on --define:tcod15 samples.nim 2 | 3 | -------------------------------------------------------------------------------- /samples15/build_samples.sh: -------------------------------------------------------------------------------- 1 | nim c -d:release --opt:speed --define:tcod15 samples.nim 2 | 3 | -------------------------------------------------------------------------------- /samples15/build_samples_debug.sh: -------------------------------------------------------------------------------- 1 | nim c -d:debug --define:tcod15 samples.nim 2 | 3 | -------------------------------------------------------------------------------- /samples17/build_samples.bat: -------------------------------------------------------------------------------- 1 | nim c -d:debug --deadCodeElim:on --define:tcod17 samples.nim 2 | 3 | -------------------------------------------------------------------------------- /samples17/build_samples.sh: -------------------------------------------------------------------------------- 1 | nim c -d:release --opt:speed --define:tcod17 samples.nim 2 | 3 | -------------------------------------------------------------------------------- /samples17/build_samples_debug.sh: -------------------------------------------------------------------------------- 1 | nim c -d:debug --define:tcod17 samples.nim 2 | 3 | -------------------------------------------------------------------------------- /terminal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vladar4/libtcod_nim/3f9be2188ff08fa503af9f9d8cc83ac0a1dffc1f/terminal.png --------------------------------------------------------------------------------