Skip to content

Commit e58579f

Browse files
committed
removed excess whitespace
1 parent f030c57 commit e58579f

File tree

16 files changed

+344
-345
lines changed

16 files changed

+344
-345
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
* You can now configure or disable key repeating with tdl.event.setKeyRepeat
5353
* Typewriter class removed, use a Window instance for the same functionality
5454
* setColors method fixed
55-
55+
5656
1.1.4
5757
* Merged the Typewriter and MetaConsole classes,
5858
You now have a virtual cursor with Console and Window objects

dev/benchmark.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def print_result(string):
2020

2121
class Benchmark:
2222
default_frames = 100
23-
23+
2424
def run(self, console, frames=None, times=4):
2525
if times > 1:
2626
print_result('Running %s' % self.__class__.__name__)
@@ -47,46 +47,46 @@ def run(self, console, frames=None, times=4):
4747
'%i tiles drawn in %.2f seconds, %.2f characters/ms, %.2f FPS' %
4848
(self.tiles, self.total_time,self.tiles_per_second / 1000,
4949
self.total_frames / self.total_time))
50-
50+
5151
def test(self, console):
5252
for x,y in console:
5353
console.draw_char(x, y, '.')
5454
tiles += 1
5555
tdl.flush()
56-
57-
56+
57+
5858
class Benchmark_DrawChar_DefaultColor(Benchmark):
59-
59+
6060
def test(self, console):
6161
for x,y in console:
6262
console.draw_char(x, y, 'A')
6363
self.tiles += 1
6464
tdl.flush()
6565

66-
66+
6767
class Benchmark_DrawChar_NoColor(Benchmark):
68-
68+
6969
def test(self, console):
7070
for x,y in console:
7171
console.draw_char(x, y, 'B', None, None)
7272
self.tiles += 1
7373
tdl.flush()
7474

75-
75+
7676
class Benchmark_DrawStr16_DefaultColor(Benchmark):
7777
default_frames = 100
78-
78+
7979
def test(self, console):
8080
for y in range(HEIGHT):
8181
for x in range(0, WIDTH, 16):
8282
console.draw_str(x, y, '0123456789ABCDEF')
8383
self.tiles += 16
8484
tdl.flush()
8585

86-
86+
8787
class Benchmark_DrawStr16_NoColor(Benchmark):
8888
default_frames = 100
89-
89+
9090
def test(self, console):
9191
for y in range(HEIGHT):
9292
for x in range(0, WIDTH, 16):
@@ -99,7 +99,7 @@ def run_benchmark():
9999
log = open('results.log', 'a')
100100
print('', file=log)
101101
console = tdl.init(WIDTH, HEIGHT, renderer=RENDERER)
102-
102+
103103
print_result('Benchmark run on %s' % time.ctime())
104104
print_result('Running under %s %s' % (platform.python_implementation(),
105105
platform.python_version()))
@@ -112,6 +112,6 @@ def run_benchmark():
112112
#Benchmark_DrawStr16_NoColor().run(console)
113113
log.close()
114114
print('results written to results.log')
115-
115+
116116
if __name__ == '__main__':
117117
run_benchmark()

dev/noise_gen.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,3 @@
3434
else:
3535
val = int(noise.getPoint(noiseX, noiseY) * 255)
3636
noiseFile.write(bytes((val,)))
37-

dev/samples.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
"""
33
Sample pack showcasing the abilities of TDL
4-
4+
55
This example is not finished quite yet
66
"""
77

@@ -15,18 +15,18 @@
1515

1616
class SampleApp(tdl.event.App):
1717
name = ''
18-
18+
1919
def key_UP(self, event):
2020
global sampleIndex
2121
sampleIndex = (sampleIndex - 1) % len(samples)
22-
22+
2323
def key_DOWN(self, event):
2424
global sampleIndex
2525
sampleIndex = (sampleIndex - 1) % len(samples)
26-
26+
2727
class TrueColorSample(SampleApp):
2828
name = 'True Colors'
29-
29+
3030
def update(self, deltaTime):
3131
width, height = samplewin.getSize()
3232
for x in range(width):
@@ -37,10 +37,10 @@ def update(self, deltaTime):
3737
class NoiseSample(SampleApp):
3838
name = 'Noise'
3939
SPEED = 3
40-
40+
4141
NOISE_KEYS = {'1': 'PERLIN', '2': 'SIMPLEX', '3': 'WAVELET'}
4242
MODE_KEYS = {'4': 'FLAT', '5': 'FBM', '6': 'TURBULENCE'}
43-
43+
4444
def __init__(self):
4545
self.noiseType = 'PERLIN'
4646
self.noiseMode = 'FLAT'
@@ -49,10 +49,10 @@ def __init__(self):
4949
self.z = 0
5050
self.zoom = 4
5151
self.generateNoise()
52-
52+
5353
def generateNoise(self):
5454
self.noise = tdl.noise.Noise(self.noiseType, self.noiseMode, seed=42)
55-
55+
5656
def ev_KEYDOWN(self, event):
5757
if event.char in self.NOISE_KEYS:
5858
self.noiseType = self.NOISE_KEYS[event.char]
@@ -61,12 +61,12 @@ def ev_KEYDOWN(self, event):
6161
self.noiseMode = self.MODE_KEYS[event.char]
6262
print('mode set to %s' % self.noiseMode)
6363
self.generateNoise()
64-
64+
6565
def update(self, deltaTime):
6666
self.x += self.SPEED * deltaTime# * self.zoom
6767
self.y += self.SPEED * deltaTime# * self.zoom
6868
self.z += deltaTime / 4
69-
69+
7070
width, height = samplewin.getSize()
7171
for x in range(width):
7272
for y in range(height):
@@ -78,17 +78,17 @@ def update(self, deltaTime):
7878

7979
WIDTH, HEIGHT = 80, 40
8080
SAMPLE_WINDOW_RECT = (20, 10, 46, 20)
81-
81+
8282
FONT = '../fonts/X11/8x13.png'
83-
83+
8484
if __name__ == '__main__':
8585
tdl.setFont(FONT)
8686
console = tdl.init(WIDTH, HEIGHT, renderer='opengl')
8787
samplewin = tdl.Window(console, *SAMPLE_WINDOW_RECT)
88-
88+
8989
samples = [cls() for cls in [TrueColorSample, NoiseSample]]
9090
sampleIndex = 0
91-
91+
9292
while 1:
9393
console.clear()
9494
samples[sampleIndex].runOnce()

dev/stress_test.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
"""
33
Stress test designed to test tdl under harsh conditions
4-
4+
55
Note that one of the slower parts is converting colors over ctypes so you
66
can get a bit of speed avoiding the fgcolor and bgcolor parameters.
77
Another thing slowing things down are mass calls to ctypes functions.
@@ -27,23 +27,23 @@ class StopWatch:
2727
def __init__(self):
2828
self.enterTime = None
2929
self.snapshots = []
30-
30+
3131
def __enter__(self):
3232
self.enterTime = time.clock()
33-
33+
3434
def __exit__(self, *exc):
3535
self.snapshots.append(time.clock() - self.enterTime)
3636
if len(self.snapshots) > self.MAXSNAPSHOTS:
3737
self.snapshots.pop(0)
38-
38+
3939
def getMeanTime(self):
4040
if not self.snapshots:
4141
return 0
4242
return sum(self.snapshots) / len(self.snapshots)
43-
43+
4444

4545
class TestApp(tdl.event.App):
46-
46+
4747
def __init__(self, console):
4848
self.console = console
4949
self.writer = self.console
@@ -53,22 +53,22 @@ def __init__(self, console):
5353
self.cells = list(itertools.product(range(self.width), range(self.height)))
5454
self.tick = 0
5555
self.init()
56-
56+
5757
def init(self):
5858
pass
59-
59+
6060
def ev_MOUSEDOWN(self, event):
6161
self.suspend()
62-
62+
6363
def update(self, deltaTime):
6464
self.updateTest(deltaTime)
6565
self.tick += 1
6666
#if self.tick % 50 == 0:
6767
tdl.setTitle('%s: %i FPS' % (self.__class__.__name__, tdl.getFPS()))
6868
tdl.flush()
69-
70-
class FullDrawCharTest(TestApp):
71-
69+
70+
class FullDrawCharTest(TestApp):
71+
7272
def updateTest(self, deltaTime):
7373
# getrandbits is around 5x faster than using randint
7474
bgcolors = [(random.getrandbits(7), random.getrandbits(7), random.getrandbits(7)) for _ in range(self.total)]
@@ -77,26 +77,26 @@ def updateTest(self, deltaTime):
7777
for (x,y), bgcolor, char in zip(self.cells, bgcolors, char):
7878
self.console.draw_char(x, y, char, fgcolor, bgcolor)
7979

80-
class PreCompiledColorTest(TestApp):
80+
class PreCompiledColorTest(TestApp):
8181
"""
8282
This test was to see if the cast to the ctypes Color object was a big
8383
impact on performance, turns out there's no hit with this class.
8484
"""
85-
85+
8686
def init(self):
8787
self.bgcolors = [tdl._Color(random.getrandbits(7),
8888
random.getrandbits(7),
8989
random.getrandbits(7))
9090
for _ in range(256)]
9191
self.fgcolor = tdl._Color(255, 255, 255)
92-
92+
9393
def updateTest(self, deltaTime):
9494
# getrandbits is around 5x faster than using randint
9595
char = [random.getrandbits(8) for _ in range(self.total)]
9696
for (x,y), char in zip(self.cells, char):
9797
self.console.draw_char(x, y, char,
9898
self.fgcolor, random.choice(self.bgcolors))
99-
99+
100100

101101
class CharOnlyTest(TestApp):
102102

@@ -114,17 +114,17 @@ def updateTest(self, deltaTime):
114114
for (x,y), char in zip(self.cells, char):
115115
self.writer.move(x, y)
116116
self.writer.print_str(chr(char))
117-
118-
class ColorOnlyTest(TestApp):
119-
117+
118+
class ColorOnlyTest(TestApp):
119+
120120
def updateTest(self, deltaTime):
121121
# getrandbits is around 5x faster than using randint
122122
bgcolors = [(random.getrandbits(6), random.getrandbits(6), random.getrandbits(6)) for _ in range(self.total)]
123123
for (x,y), bgcolor in zip(self.cells, bgcolors):
124124
self.console.draw_char(x, y, None, None, bgcolor)
125125

126-
class GetCharTest(TestApp):
127-
126+
class GetCharTest(TestApp):
127+
128128
def updateTest(self, deltaTime):
129129
for (x,y) in self.cells:
130130
self.console.get_char(x, y)
@@ -134,23 +134,23 @@ class SingleRectTest(TestApp):
134134
def updateTest(self, deltaTime):
135135
bgcolor = (random.getrandbits(6), random.getrandbits(6), random.getrandbits(6))
136136
self.console.draw_rect(0, 0, None, None, ' ', (255, 255, 255), bgcolor)
137-
137+
138138
class DrawStrTest(TestApp):
139139

140140
def updateTest(self, deltaTime):
141141
for y in range(self.height):
142142
bgcolor = (random.getrandbits(6), random.getrandbits(6), random.getrandbits(6))
143143
string = [random.getrandbits(8) for x in range(self.width)]
144144
self.console.draw_str(0, y, string, (255, 255, 255), bgcolor)
145-
145+
146146
class BlitScrollTest(TestApp):
147147
def updateTest(self, deltaTime):
148148
self.console.scroll(0, 1)
149149
for x in range(self.width):
150150
bgcolor = (random.getrandbits(6), random.getrandbits(6), random.getrandbits(6))
151151
ch = random.getrandbits(8)
152152
self.console.draw_char(x, 0, ch, bg=bgcolor)
153-
153+
154154
# match libtcod sample screen
155155
WIDTH = 46
156156
HEIGHT = 20
@@ -174,4 +174,4 @@ def main():
174174
# stats.reverse_order()
175175
# stats.print_stats()
176176
# os.remove('profile.prof')
177-
177+

examples/eventget.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
console.drawRect(0, HEIGHT - 1, None, None, ' ')
2929
console.drawStr(0, HEIGHT - 1, 'MOUSEMOTION event - pos=%i,%i cell=%i,%i motion=%i,%i cellmotion=%i,%i' % (event.pos + event.cell + event.motion + event.cellmotion))
3030
continue # prevent scrolling
31-
31+
3232
textWindow.scroll(0, -1)
3333
if event.type == 'KEYDOWN' or event.type == 'KEYUP':
3434
textWindow.drawStr(0, HEIGHT-3, '%s event - char=%s key=%s alt=%i control=%i shift=%i' % (event.type.ljust(7), repr(event.char), repr(event.key), event.alt, event.control, event.shift))

examples/interactive.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def main():
4545
print()
4646
print('Python %s' % sys.version)
4747
print('Press ESC to quit')
48-
48+
4949
buffer = ''
5050
commands = ['']
5151
banner = sys.ps1
@@ -58,7 +58,7 @@ def main():
5858
except tdl.TDLError:
5959
pass
6060
tdl.flush()
61-
61+
6262
for event in tdl.event.get():
6363
if event.type == 'QUIT':
6464
raise SystemExit()

0 commit comments

Comments
 (0)