@@ -453,7 +453,7 @@ def __init__(self, width, height):
453453 self ._as_parameter_ = _lib .TCOD_console_new (width , height )
454454 self .width = width
455455 self .height = height
456- self ._typewriter = None # "typewriter" lock
456+ self ._typewriter = None # "typewriter" lock, makes sure the colors are set to the typewriter
457457 #self.clear()
458458
459459 @classmethod
@@ -463,6 +463,7 @@ def _newConsole(cls, console):
463463 self ._as_parameter_ = console
464464 self .width = _lib .TCOD_console_get_width (self )
465465 self .height = _lib .TCOD_console_get_height (self )
466+ self ._typewriter = None
466467 #self.clear()
467468 return self
468469
@@ -660,8 +661,9 @@ def __init__(self, console):
660661 self .console = self .parent .console
661662 self .cursor = (0 , 0 ) # cursor position
662663 self .scrollMode = 'scroll'
663- self .fgcolor = (255 , 255 , 255 )
664- self .bgcolor = (0 , 0 , 0 )
664+ self .fgcolor = _formatColor ((255 , 255 , 255 ))
665+ self .bgcolor = _formatColor ((0 , 0 , 0 ))
666+ self ._bgblend = 1 # SET
665667
666668 def _normalize (self , x , y ):
667669 """return the normalized the cursor position."""
@@ -695,11 +697,13 @@ def move(self, x, y):
695697 self .cursor = (x , y )
696698
697699 def setFG (self , color ):
700+ assert _iscolor (color )
698701 self .fgcolor = _formatColor (color )
699702 if self .console ._typewriter is self :
700703 _lib .TCOD_console_set_default_foreground (self .console , self .fgcolor )
701704
702705 def setBG (self , color ):
706+ assert _iscolor (color )
703707 self .bgcolor = _formatColor (color )
704708 if self .console ._typewriter is self :
705709 _lib .TCOD_console_set_default_background (self .console , self .bgcolor )
@@ -714,8 +718,11 @@ def _updateConsole(self):
714718
715719 def addChar (self , char ):
716720 x , y = self ._normalize (* self .cursor )
717- self .parent .drawChar (x , y , char , self .fgcolor , self .bgcolor )
718- self .cursor = (x + 1 , y )
721+ self .cursor = [x + 1 , y ] # advance cursor on next draw
722+ self ._updateConsole ()
723+ x , y = self .parent ._translate (x , y )
724+ _lib .TCOD_console_put_char (self .console ._as_parameter_ , x , y , _formatChar (char ), self ._bgblend )
725+
719726
720727 def addStr (self , string , lineBreak = '\n ' ):
721728 x , y = self .cursor
0 commit comments