Skip to content

Commit 49b71b3

Browse files
committed
removed references to ctypes
1 parent 2285864 commit 49b71b3

File tree

12 files changed

+2410
-1406
lines changed

12 files changed

+2410
-1406
lines changed

setup.py

Lines changed: 47 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -8,44 +8,50 @@
88

99
from tdl import __version__
1010

11-
setup(name='tdl',
12-
version=__version__,
13-
author='Kyle Stewart',
14-
author_email='4B796C65+pythonTDL@gmail.com',
15-
description='Pythonic port of rogue-like library libtcod.',
16-
long_description='\n'.join([open('README.rst', 'r').read(),
17-
open('CHANGELOG.rst', 'r').read()]),
18-
url='https://github.com/HexDecimal/python-tdl',
19-
download_url='https://pypi.python.org/pypi/tdl',
20-
packages=['tdl'],
21-
package_data={'tdl': ['*.txt', 'lib/*.txt', '*.bmp', '*.png', 'lib/win32/*',
22-
'lib/darwin/*.dylib', 'lib/linux*/*']},
23-
#install_requires=['ctypes'], # ctypes requirement causes issues sometimes
24-
classifiers=['Development Status :: 5 - Production/Stable',
25-
'Environment :: Win32 (MS Windows)',
26-
'Environment :: MacOS X',
27-
'Environment :: X11 Applications',
28-
'Intended Audience :: Developers',
29-
'License :: OSI Approved :: BSD License',
30-
'Natural Language :: English',
31-
'Operating System :: POSIX',
32-
'Operating System :: MacOS',
33-
'Operating System :: Microsoft :: Windows',
34-
'Programming Language :: Python :: 2.6',
35-
'Programming Language :: Python :: 2.7',
36-
'Programming Language :: Python :: 3',
37-
'Programming Language :: Python :: 3.0',
38-
'Programming Language :: Python :: 3.1',
39-
'Programming Language :: Python :: 3.2',
40-
'Programming Language :: Python :: 3.3',
41-
'Programming Language :: Python :: 3.4',
42-
'Programming Language :: Python :: Implementation :: CPython',
43-
'Programming Language :: Python :: Implementation :: PyPy',
44-
'Topic :: Games/Entertainment',
45-
'Topic :: Multimedia :: Graphics',
46-
'Topic :: Software Development :: Libraries :: Python Modules',
47-
],
48-
keywords = 'portable rogue-like rogue-likes text ctypes ASCII ANSI Unicode libtcod fov',
49-
platforms = ['Windows', 'Mac OS X', 'Linux'],
50-
license = 'New BSD License'
51-
)
11+
setup(
12+
name='tdl',
13+
version=__version__,
14+
author='Kyle Stewart',
15+
author_email='4B796C65+pythonTDL@gmail.com',
16+
description='Pythonic port of rogue-like library libtcod.',
17+
long_description='\n'.join([open('README.rst', 'r').read(),
18+
open('CHANGELOG.rst', 'r').read()]),
19+
url='https://github.com/HexDecimal/python-tdl',
20+
download_url='https://pypi.python.org/pypi/tdl',
21+
packages=['tdl'],
22+
package_data={'tdl': ['*.txt', '*.rst', 'lib/*.txt', '*.bmp', '*.png',
23+
'lib/win32/*',
24+
'lib/darwin/*.dylib',
25+
'lib/linux*/*']},
26+
setup_requires=["cffi>=1.0.0"],
27+
cffi_modules=["tdl/build_libtcod.py:ffi"],
28+
install_requires=["cffi>=1.0.0",
29+
"setuptools>=1.0.0"],
30+
classifiers=['Development Status :: 5 - Production/Stable',
31+
'Environment :: Win32 (MS Windows)',
32+
'Environment :: MacOS X',
33+
'Environment :: X11 Applications',
34+
'Intended Audience :: Developers',
35+
'License :: OSI Approved :: BSD License',
36+
'Natural Language :: English',
37+
'Operating System :: POSIX',
38+
'Operating System :: MacOS',
39+
'Operating System :: Microsoft :: Windows',
40+
'Programming Language :: Python :: 2.6',
41+
'Programming Language :: Python :: 2.7',
42+
'Programming Language :: Python :: 3',
43+
'Programming Language :: Python :: 3.0',
44+
'Programming Language :: Python :: 3.1',
45+
'Programming Language :: Python :: 3.2',
46+
'Programming Language :: Python :: 3.3',
47+
'Programming Language :: Python :: 3.4',
48+
'Programming Language :: Python :: Implementation :: CPython',
49+
'Programming Language :: Python :: Implementation :: PyPy',
50+
'Topic :: Games/Entertainment',
51+
'Topic :: Multimedia :: Graphics',
52+
'Topic :: Software Development :: Libraries :: Python Modules',
53+
],
54+
keywords = 'portable rogue-like rogue-likes text ctypes ASCII ANSI Unicode libtcod fov',
55+
platforms = ['Windows', 'Mac OS X', 'Linux'],
56+
license = 'New BSD License'
57+
)

tdl/Release/_libtcod.exp

0 Bytes
Binary file not shown.

tdl/Release/_libtcod.lib

0 Bytes
Binary file not shown.

tdl/Release/_libtcod.obj

23.5 KB
Binary file not shown.

tdl/__init__.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
import os as _os
6262

6363
#import ctypes as _ctypes
64+
import array as _array
6465
import weakref as _weakref
6566
import itertools as _itertools
6667
import textwrap as _textwrap
@@ -69,7 +70,7 @@
6970
import warnings as _warnings
7071

7172
from . import event, map, noise
72-
from .__tcod import _lib, _Color, _unpackfile
73+
from .libtcod import _unpackfile
7374
from .libtcod import _ffi, _lib
7475
from . import __style as _style
7576

@@ -104,6 +105,15 @@ def _formatChar(char):
104105
return ord(char)
105106
return int(char) # conversion faster than type check
106107

108+
_utf32_codec = {'little': 'utf-32le', 'big': 'utf-32le'}[_sys.byteorder]
109+
110+
def _format_str(string):
111+
if isinstance(string, str):
112+
array = _array.array('I')
113+
array.frombytes(string.encode(_utf32_codec))
114+
return array
115+
return string
116+
107117
_fontinitialized = False
108118
_rootinitialized = False
109119
_rootConsoleRef = None
@@ -465,11 +475,11 @@ def _drawStrGen(x=x, y=y, string=string, width=width, height=height):
465475
Iterates over ((x, y), ch) data for _set_batch, raising an
466476
error if the end of the console is reached.
467477
"""
468-
for char in string:
478+
for char in _format_str(string):
469479
if y == height:
470480
raise TDLError('End of console reached.')
471481
#batch.append(((x, y), _formatChar(char))) # ((x, y), ch)
472-
yield((x, y), _formatChar(char))
482+
yield((x, y), char)
473483
x += 1 # advance cursor
474484
if x == width: # line break
475485
x = 0

0 commit comments

Comments
 (0)