Skip to content

Commit 07b39e7

Browse files
committed
removed setuptools dependency
1 parent c236a4b commit 07b39e7

File tree

5 files changed

+53
-26
lines changed

5 files changed

+53
-26
lines changed

README.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This module can also be manually installed by going into the "setup.py" director
1111

1212
python setup.py install
1313

14-
Already compiled libtcod libraries are included as part of the package data. They won't need to be compiled as part of the installation, but can be replaced with newer versions if necessary.
14+
This will require that your Python installation can compile binaries.
1515

1616
=======
1717
About
@@ -28,13 +28,14 @@ Online Documentation: http://pythonhosted.org/tdl/
2828

2929
Issue Tracker: https://github.com/HexDecimal/python-tdl/issues
3030

31-
python-tdl is a ctypes port of "libtcod". You can find more about libtcod at http://roguecentral.org/doryen/libtcod/
31+
python-tdl is a cffi port of "libtcod". You can find more about libtcod at http://roguecentral.org/doryen/libtcod/
3232

3333
==============
3434
Requirements
3535
==============
3636
* Python 2.6+ or 3.x
3737
* 32 bit Windows, 32/64 bit Linux, or Mac OS/X (64 bit architecture)
38+
* An up-to-date version of the Python module: cffi
3839

3940
=========
4041
License

setup.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
version=open('tdl/version.txt', 'r').read(),
1212
author='Kyle Stewart',
1313
author_email='4B796C65+pythonTDL@gmail.com',
14-
description='Pythonic port of rogue-like library libtcod.',
14+
description='Pythonic cffi port of libtcod.',
1515
long_description='\n'.join([open('README.rst', 'r').read(),
16-
open('CHANGELOG.rst', 'r').read()]),
16+
open('CHANGELOG.rst', 'r').read()]),
1717
url='https://github.com/HexDecimal/python-tdl',
1818
download_url='https://pypi.python.org/pypi/tdl',
1919
packages=['tdl'],
@@ -23,8 +23,7 @@
2323
'lib/linux*/*']},
2424
setup_requires=["cffi>=1.0.0"],
2525
cffi_modules=["tdl/build_libtcod.py:ffi"],
26-
install_requires=["cffi>=1.0.0",
27-
"setuptools>=1.0.0"],
26+
install_requires=["cffi>=1.0.0"],
2827
classifiers=['Development Status :: 5 - Production/Stable',
2928
'Environment :: Win32 (MS Windows)',
3029
'Environment :: MacOS X',
@@ -49,7 +48,7 @@
4948
'Topic :: Multimedia :: Graphics',
5049
'Topic :: Software Development :: Libraries :: Python Modules',
5150
],
52-
keywords = 'portable rogue-like rogue-likes text ctypes ASCII ANSI Unicode libtcod fov',
51+
keywords = 'portable rogue-like rogue-likes text cffi ASCII ANSI Unicode libtcod fov',
5352
platforms = ['Windows', 'Mac OS X', 'Linux'],
5453
license = 'New BSD License'
5554
)

tdl/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070
import warnings as _warnings
7171

7272
from . import event, map, noise
73-
from .libtcod import _unpackfile
7473
from .libtcod import _ffi, _lib
7574
from . import style as _style
7675

@@ -1140,7 +1139,8 @@ def init(width, height, title=None, fullscreen=False, renderer='OPENGL'):
11401139
RENDERERS = {'GLSL': 0, 'OPENGL': 1, 'SDL': 2}
11411140
global _rootinitialized, _rootConsoleRef
11421141
if not _fontinitialized: # set the default font to the one that comes with tdl
1143-
set_font(_unpackfile('terminal8x8.png'), None, None, True, True)
1142+
set_font(_os.path.join(__path__[0], 'terminal8x8.png'),
1143+
None, None, True, True)
11441144

11451145
if renderer.upper() not in RENDERERS:
11461146
raise TDLError('No such render type "%s", expected one of "%s"' % (renderer, '", "'.join(RENDERERS)))

tdl/build_libtcod.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,50 @@
437437
int TCOD_random_dice_roll_s (TCOD_random_t mersenne, const char * s);
438438
439439
440+
// FOV
441+
442+
typedef enum {
443+
FOV_BASIC,
444+
FOV_DIAMOND,
445+
FOV_SHADOW,
446+
FOV_PERMISSIVE_0,
447+
FOV_PERMISSIVE_1,
448+
FOV_PERMISSIVE_2,
449+
FOV_PERMISSIVE_3,
450+
FOV_PERMISSIVE_4,
451+
FOV_PERMISSIVE_5,
452+
FOV_PERMISSIVE_6,
453+
FOV_PERMISSIVE_7,
454+
FOV_PERMISSIVE_8,
455+
FOV_RESTRICTIVE,
456+
NB_FOV_ALGORITHMS }TCOD_fov_algorithm_t;
457+
458+
typedef void *TCOD_map_t;
459+
460+
/* allocate a new map */
461+
TCOD_map_t TCOD_map_new(int width, int height);
462+
/* set all cells as solid rock (cannot see through nor walk) */
463+
void TCOD_map_clear(TCOD_map_t map, bool transparent, bool walkable);
464+
/* copy a map to another, reallocating it when needed */
465+
void TCOD_map_copy(TCOD_map_t source, TCOD_map_t dest);
466+
/* change a cell properties */
467+
void TCOD_map_set_properties(TCOD_map_t map, int x, int y, bool is_transparent, bool is_walkable);
468+
/* destroy a map */
469+
void TCOD_map_delete(TCOD_map_t map);
470+
471+
/* calculate the field of view (potentially visible cells from player_x,player_y) */
472+
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);
473+
/* check if a cell is in the last computed field of view */
474+
bool TCOD_map_is_in_fov(TCOD_map_t map, int x, int y);
475+
void TCOD_map_set_in_fov(TCOD_map_t map, int x, int y, bool fov);
476+
477+
/* retrieve properties from the map */
478+
bool TCOD_map_is_transparent(TCOD_map_t map, int x, int y);
479+
bool TCOD_map_is_walkable(TCOD_map_t map, int x, int y);
480+
int TCOD_map_get_width(TCOD_map_t map);
481+
int TCOD_map_get_height(TCOD_map_t map);
482+
int TCOD_map_get_nb_cells(TCOD_map_t map);
483+
440484
441485
// NOISE
442486

tdl/libtcod.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,6 @@
66

77
from . import __path__
88

9-
try: # decide how files are unpacked depending on if we have the pkg_resources module
10-
from pkg_resources import resource_filename
11-
def _unpackfile(filename):
12-
return resource_filename(__name__, filename)
13-
except ImportError:
14-
#from tdl import __path__
15-
def _unpackfile(filename):
16-
return os.path.abspath(os.path.join(__path__[0], filename))
17-
18-
def _unpackFramework(framework, path):
19-
"""get framework.tar file, remove ".tar" and add path"""
20-
return os.path.abspath(os.path.join(_unpackfile(framework)[:-4], path))
21-
22-
def _loadDLL(dll):
23-
"""shorter version of file unpacking and linking"""
24-
return ffi.LoadLibrary(_unpackfile(dll))
25-
269
def _get_library_crossplatform():
2710
bits, linkage = platform.architecture()
2811
if 'win32' in sys.platform:

0 commit comments

Comments
 (0)