16
16
from src .ButtonGroup import ButtonGroup
17
17
from src .CommandLog import CommandLog
18
18
from src .CustomEvent import CustomEvent
19
+ from src .Point import Point
19
20
from src .Scenario import Scenario
20
21
from src import __version__
21
22
@@ -128,7 +129,7 @@ def run(self):
128
129
# Display the logo (if any)
129
130
if self .logo is not None :
130
131
self .screen .blit (self .logo ,
131
- (self .width + 69 , self .height - 85 ))
132
+ Point (self .width + 69 , self .height - 85 ))
132
133
133
134
# Display any Buttons
134
135
self .buttons .display (self .screen )
@@ -229,7 +230,7 @@ def choose_scenario(self):
229
230
temp = Button (os .path .splitext (scenario_file )[0 ],
230
231
GameWindow .BLACK ,
231
232
GameWindow .WHITE ,
232
- (width_counter , height_counter ),
233
+ Point (width_counter , height_counter ),
233
234
(120 , 120 ))
234
235
235
236
# Add temp Button to ButtonGroup
@@ -321,14 +322,16 @@ def load_scenario(self):
321
322
# - the CommandLog below the map.
322
323
self .size = (self .width + 400 , self .height + 30 )
323
324
# Create the empty CommandLog
324
- self .command_log = CommandLog ((0 , self .height ), (self .width , 30 ))
325
+ self .command_log = CommandLog (Point (0 , self .height ),
326
+ (self .width , 30 ))
325
327
else :
326
328
# Make space for:
327
329
# - the Buttons below the map.
328
330
# - the CommandLog to the right of the map.
329
331
self .size = (self .width + 30 , self .height + 400 )
330
332
# Create the empty CommandLog
331
- self .command_log = CommandLog ((self .width , 0 ), (30 , self .height ))
333
+ self .command_log = CommandLog (Point (self .width , 0 ),
334
+ (30 , self .height ))
332
335
333
336
# Only want to do this once, so sadly can't do it in the rendering
334
337
# loop without a potential race condition as
@@ -345,53 +348,53 @@ def create_buttons(self, buttons_on_the_left):
345
348
forward_button = Button ('Forward' ,
346
349
GameWindow .BLACK ,
347
350
GameWindow .WHITE ,
348
- (self .width + 140 ,
349
- float (self .height )/ 2 - 240 ),
351
+ Point (self .width + 140 ,
352
+ float (self .height )/ 2 - 240 ),
350
353
(120 , 120 ))
351
354
352
355
self .buttons .add (forward_button )
353
356
354
357
backward_button = Button ('Backward' ,
355
358
GameWindow .BLACK ,
356
359
GameWindow .WHITE ,
357
- (self .width + 140 ,
358
- float (self .height )/ 2 + 20 ),
360
+ Point (self .width + 140 ,
361
+ float (self .height )/ 2 + 20 ),
359
362
(120 , 120 ))
360
363
361
364
self .buttons .add (backward_button )
362
365
363
366
turn_left_button = Button ('Turn Left' ,
364
367
GameWindow .BLACK ,
365
368
GameWindow .WHITE ,
366
- (self .width + 10 ,
367
- float (self .height )/ 2 - 110 ),
369
+ Point (self .width + 10 ,
370
+ float (self .height )/ 2 - 110 ),
368
371
(120 , 120 ))
369
372
370
373
self .buttons .add (turn_left_button )
371
374
372
375
turn_right_button = Button ('Turn Right' ,
373
376
GameWindow .BLACK ,
374
377
GameWindow .WHITE ,
375
- (self .width + 270 ,
376
- float (self .height )/ 2 - 110 ),
378
+ Point (self .width + 270 ,
379
+ float (self .height )/ 2 - 110 ),
377
380
(120 , 120 ))
378
381
379
382
self .buttons .add (turn_right_button )
380
383
381
384
go_button = Button ('Go' ,
382
385
GameWindow .BLACK ,
383
386
GameWindow .WHITE ,
384
- (self .width + 140 ,
385
- float (self .height )/ 2 - 110 ),
387
+ Point (self .width + 140 ,
388
+ float (self .height )/ 2 - 110 ),
386
389
(120 , 120 ))
387
390
388
391
self .buttons .add (go_button )
389
392
390
393
stop_button = Button ('Stop' ,
391
394
GameWindow .WHITE ,
392
395
GameWindow .RED ,
393
- (self .width + 140 ,
394
- float (self .height )/ 2 - 110 ),
396
+ Point (self .width + 140 ,
397
+ float (self .height )/ 2 - 110 ),
395
398
(120 , 120 ),
396
399
False )
397
400
@@ -400,17 +403,17 @@ def create_buttons(self, buttons_on_the_left):
400
403
reset_button = Button ('Reset' ,
401
404
GameWindow .BLACK ,
402
405
GameWindow .WHITE ,
403
- (self .width + 10 ,
404
- float (self .height )/ 2 + 20 ),
406
+ Point (self .width + 10 ,
407
+ float (self .height )/ 2 + 20 ),
405
408
(120 , 120 ))
406
409
407
410
self .buttons .add (reset_button )
408
411
409
412
clear_button = Button ('Clear' ,
410
413
GameWindow .BLACK ,
411
414
GameWindow .WHITE ,
412
- (self .width + 270 ,
413
- float (self .height )/ 2 + 20 ),
415
+ Point (self .width + 270 ,
416
+ float (self .height )/ 2 + 20 ),
414
417
(120 , 120 ))
415
418
416
419
self .buttons .add (clear_button )
@@ -419,52 +422,53 @@ def create_buttons(self, buttons_on_the_left):
419
422
forward_button = Button ('Forward' ,
420
423
GameWindow .BLACK ,
421
424
GameWindow .WHITE ,
422
- (float (self .width )/ 2 - 60 ,
423
- self .height + 10 ),
425
+ Point (float (self .width )/ 2 - 60 ,
426
+ self .height + 10 ),
424
427
(120 , 120 ))
425
428
426
429
self .buttons .add (forward_button )
427
430
428
431
backward_button = Button ('Backward' ,
429
432
GameWindow .BLACK ,
430
433
GameWindow .WHITE ,
431
- (float (self .width )/ 2 - 60 ,
432
- self .height + 270 ),
434
+ Point (float (self .width )/ 2 - 60 ,
435
+ self .height + 270 ),
433
436
(120 , 120 ))
434
437
435
438
self .buttons .add (backward_button )
436
439
437
440
turn_left_button = Button ('Turn Left' ,
438
441
GameWindow .BLACK ,
439
442
GameWindow .WHITE ,
440
- (float (self .width )/ 2 - 190 ,
441
- self .height + 140 ),
443
+ Point (float (self .width )/ 2 - 190 ,
444
+ self .height + 140 ),
442
445
(120 , 120 ))
443
446
444
447
self .buttons .add (turn_left_button )
445
448
446
449
turn_right_button = Button ('Turn Right' ,
447
450
GameWindow .BLACK ,
448
451
GameWindow .WHITE ,
449
- (float (self .width )/ 2 + 70 ,
450
- self .height + 140 ),
452
+ Point (float (self .width )/ 2 + 70 ,
453
+ self .height + 140 ),
451
454
(120 , 120 ))
452
455
453
456
self .buttons .add (turn_right_button )
454
457
455
458
go_button = Button ('Go' ,
456
459
GameWindow .BLACK ,
457
460
GameWindow .WHITE ,
458
- (float (self .width )/ 2 - 60 , self .height + 140 ),
461
+ Point (float (self .width )/ 2 - 60 ,
462
+ self .height + 140 ),
459
463
(120 , 120 ))
460
464
461
465
self .buttons .add (go_button )
462
466
463
467
stop_button = Button ('Stop' ,
464
468
GameWindow .WHITE ,
465
469
GameWindow .RED ,
466
- (float (self .width )/ 2 - 60 ,
467
- self .height + 140 ),
470
+ Point (float (self .width )/ 2 - 60 ,
471
+ self .height + 140 ),
468
472
(120 , 120 ),
469
473
False )
470
474
@@ -473,17 +477,17 @@ def create_buttons(self, buttons_on_the_left):
473
477
reset_button = Button ('Reset' ,
474
478
GameWindow .BLACK ,
475
479
GameWindow .WHITE ,
476
- (float (self .width )/ 2 - 190 ,
477
- self .height + 270 ),
480
+ Point (float (self .width )/ 2 - 190 ,
481
+ self .height + 270 ),
478
482
(120 , 120 ))
479
483
480
484
self .buttons .add (reset_button )
481
485
482
486
clear_button = Button ('Clear' ,
483
487
GameWindow .BLACK ,
484
488
GameWindow .WHITE ,
485
- (float (self .width )/ 2 + 70 ,
486
- self .height + 270 ),
489
+ Point (float (self .width )/ 2 + 70 ,
490
+ self .height + 270 ),
487
491
(120 , 120 ))
488
492
489
493
self .buttons .add (clear_button )
0 commit comments