@@ -360,7 +360,7 @@ def __init__(self):
360
360
self ._default_fg = _format_color ((255 , 255 , 255 ))
361
361
self ._default_bg = _format_color ((0 , 0 , 0 ))
362
362
self ._default_blend = _lib .TCOD_BKGND_SET
363
- self ._color_key = _ffi .NULL
363
+ self ._color_key = _ffi .new ( 'TCOD_color_t *' , ( 0 , 0 , 0 ))[ 0 ]
364
364
365
365
def _normalizePoint (self , x , y ):
366
366
"""Check if a point is in bounds and make minor adjustments.
@@ -464,7 +464,7 @@ def set_colors(self, fg=None, bg=None):
464
464
if bg is not None :
465
465
self ._default_bg = _format_color (bg , self ._default_bg )
466
466
467
- def set_color_key (self , bg = None ):
467
+ def set_color_key (self , bg = ( 0 , 0 , 0 ) ):
468
468
"""Sets the transparent color key of this instance.
469
469
470
470
@type bg: (r, g, b), int, or None
@@ -476,11 +476,8 @@ def set_color_key(self, bg=None):
476
476
@see: L{blit},
477
477
@since: 1.5.0
478
478
"""
479
- bg = _format_color (bg , - 1 )
480
- if bg == - 1 :
481
- bg = _ffi .NULL
482
- else :
483
- bg = _ffi .new ('TCOD_color_t *' , bg )
479
+ bg = Color (bg )
480
+ bg = _ffi .new ('TCOD_color_t *' , tuple (bg ))[0 ]
484
481
self ._color_key = bg
485
482
486
483
def print_str (self , string ):
0 commit comments