1 /* 2 * libtcod 1.5.0 3 * Copyright (c) 2008,2009 J.C.Wilk 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 J.C.Wilk 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 J.C.WILK ``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 J.C.WILK 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 module tcod.c.all; 29 30 extern (C): 31 32 // base types 33 alias ubyte uint8; 34 alias byte int8; 35 alias ushort uint16; 36 alias short int16; 37 alias uint uint32; 38 alias int int32; 39 40 const int TCOD_HEXVERSION = 0x010501; 41 const string TCOD_STRVERSION = "1.5.1"; 42 const int TCOD_TECHVERSION = 0x01050103; 43 44 /****************************************** 45 utility macros 46 ******************************************/ 47 pure T MAX(T)(T a, T b) { return (a < b) ? b : a; } 48 pure T MIN(T)(T a, T b) { return (a > b) ? b : a; } 49 pure T ABS(T)(T a) { return (a < 0) ? -a : a; } 50 pure T CLAMP(T)(T a, T b, T x) { return (x < a) ? a : ((x > b) ? b : x); } 51 pure T LERP(T)(T a, T b, T x) { return (a + x * (b - a)); } 52 53 alias const(char)* charptr; 54 version (Posix) { 55 alias const(dchar)* wchar_tptr; 56 alias dchar wchar_t; 57 } 58 version (Windows) { 59 alias const(wchar)* wchar_tptr; 60 alias wchar wchar_t; 61 } 62 63 public import tcod.c.types; 64 public import tcod.c.functions;