@@ -118,7 +118,7 @@ def on_draw(self) -> None:
118118 self .slide_corner_colors ()
119119 self .interpolate_corner_colors ()
120120 self .darken_background_characters ()
121- self .randomize_sample_conole ()
121+ self .randomize_sample_console ()
122122 self .print_banner ()
123123
124124 def slide_corner_colors (self ) -> None :
@@ -143,7 +143,7 @@ def darken_background_characters(self) -> None:
143143 sample_console .fg [:] = sample_console .bg [:]
144144 sample_console .fg [:] //= 2
145145
146- def randomize_sample_conole (self ) -> None :
146+ def randomize_sample_console (self ) -> None :
147147 # randomize sample console characters
148148 sample_console .ch [:] = np .random .randint (
149149 low = ord ("a" ),
@@ -406,7 +406,7 @@ def on_draw(self) -> None:
406406 rect_h = 13
407407 if self .implementation == tcod .noise .Implementation .SIMPLE :
408408 rect_h = 10
409- sample_console .draw_semigraphics (self .img )
409+ sample_console .draw_semigraphics (np . asarray ( self .img ) )
410410 sample_console .draw_rect (
411411 2 ,
412412 2 ,
@@ -669,7 +669,7 @@ def __init__(self) -> None:
669669 self .using_astar = True
670670 self .recalculate = False
671671 self .busy = 0.0
672- self .oldchar = " "
672+ self .old_char = " "
673673
674674 self .map = tcod .map .Map (SAMPLE_SCREEN_WIDTH , SAMPLE_SCREEN_HEIGHT )
675675 for y in range (SAMPLE_SCREEN_HEIGHT ):
@@ -778,33 +778,33 @@ def on_draw(self) -> None:
778778 def ev_keydown (self , event : tcod .event .KeyDown ) -> None :
779779 if event .sym == tcod .event .KeySym .i and self .dy > 0 :
780780 # destination move north
781- libtcodpy .console_put_char (sample_console , self .dx , self .dy , self .oldchar , libtcodpy .BKGND_NONE )
781+ libtcodpy .console_put_char (sample_console , self .dx , self .dy , self .old_char , libtcodpy .BKGND_NONE )
782782 self .dy -= 1
783- self .oldchar = sample_console .ch [self .dx , self .dy ]
783+ self .old_char = sample_console .ch [self .dx , self .dy ]
784784 libtcodpy .console_put_char (sample_console , self .dx , self .dy , "+" , libtcodpy .BKGND_NONE )
785785 if SAMPLE_MAP [self .dx , self .dy ] == " " :
786786 self .recalculate = True
787787 elif event .sym == tcod .event .KeySym .k and self .dy < SAMPLE_SCREEN_HEIGHT - 1 :
788788 # destination move south
789- libtcodpy .console_put_char (sample_console , self .dx , self .dy , self .oldchar , libtcodpy .BKGND_NONE )
789+ libtcodpy .console_put_char (sample_console , self .dx , self .dy , self .old_char , libtcodpy .BKGND_NONE )
790790 self .dy += 1
791- self .oldchar = sample_console .ch [self .dx , self .dy ]
791+ self .old_char = sample_console .ch [self .dx , self .dy ]
792792 libtcodpy .console_put_char (sample_console , self .dx , self .dy , "+" , libtcodpy .BKGND_NONE )
793793 if SAMPLE_MAP [self .dx , self .dy ] == " " :
794794 self .recalculate = True
795795 elif event .sym == tcod .event .KeySym .j and self .dx > 0 :
796796 # destination move west
797- libtcodpy .console_put_char (sample_console , self .dx , self .dy , self .oldchar , libtcodpy .BKGND_NONE )
797+ libtcodpy .console_put_char (sample_console , self .dx , self .dy , self .old_char , libtcodpy .BKGND_NONE )
798798 self .dx -= 1
799- self .oldchar = sample_console .ch [self .dx , self .dy ]
799+ self .old_char = sample_console .ch [self .dx , self .dy ]
800800 libtcodpy .console_put_char (sample_console , self .dx , self .dy , "+" , libtcodpy .BKGND_NONE )
801801 if SAMPLE_MAP [self .dx , self .dy ] == " " :
802802 self .recalculate = True
803803 elif event .sym == tcod .event .KeySym .l and self .dx < SAMPLE_SCREEN_WIDTH - 1 :
804804 # destination move east
805- libtcodpy .console_put_char (sample_console , self .dx , self .dy , self .oldchar , libtcodpy .BKGND_NONE )
805+ libtcodpy .console_put_char (sample_console , self .dx , self .dy , self .old_char , libtcodpy .BKGND_NONE )
806806 self .dx += 1
807- self .oldchar = sample_console .ch [self .dx , self .dy ]
807+ self .old_char = sample_console .ch [self .dx , self .dy ]
808808 libtcodpy .console_put_char (sample_console , self .dx , self .dy , "+" , libtcodpy .BKGND_NONE )
809809 if SAMPLE_MAP [self .dx , self .dy ] == " " :
810810 self .recalculate = True
@@ -822,10 +822,10 @@ def ev_mousemotion(self, event: tcod.event.MouseMotion) -> None:
822822 mx = event .tile .x - SAMPLE_SCREEN_X
823823 my = event .tile .y - SAMPLE_SCREEN_Y
824824 if 0 <= mx < SAMPLE_SCREEN_WIDTH and 0 <= my < SAMPLE_SCREEN_HEIGHT and (self .dx != mx or self .dy != my ):
825- libtcodpy .console_put_char (sample_console , self .dx , self .dy , self .oldchar , libtcodpy .BKGND_NONE )
825+ libtcodpy .console_put_char (sample_console , self .dx , self .dy , self .old_char , libtcodpy .BKGND_NONE )
826826 self .dx = mx
827827 self .dy = my
828- self .oldchar = sample_console .ch [self .dx , self .dy ]
828+ self .old_char = sample_console .ch [self .dx , self .dy ]
829829 libtcodpy .console_put_char (sample_console , self .dx , self .dy , "+" , libtcodpy .BKGND_NONE )
830830 if SAMPLE_MAP [self .dx , self .dy ] == " " :
831831 self .recalculate = True
@@ -1139,7 +1139,7 @@ class NameGeneratorSample(Sample):
11391139 def __init__ (self ) -> None :
11401140 self .name = "Name generator"
11411141
1142- self .curset = 0
1142+ self .current_set = 0
11431143 self .delay = 0.0
11441144 self .names : list [str ] = []
11451145 self .sets : list [str ] = []
@@ -1159,7 +1159,7 @@ def on_draw(self) -> None:
11591159 sample_console .print (
11601160 1 ,
11611161 1 ,
1162- "%s\n \n + : next generator\n - : prev generator" % self .sets [self .curset ],
1162+ "%s\n \n + : next generator\n - : prev generator" % self .sets [self .current_set ],
11631163 fg = WHITE ,
11641164 bg = None ,
11651165 )
@@ -1175,18 +1175,18 @@ def on_draw(self) -> None:
11751175 self .delay += frame_length [- 1 ]
11761176 if self .delay > 0.5 :
11771177 self .delay -= 0.5
1178- self .names .append (libtcodpy .namegen_generate (self .sets [self .curset ]))
1178+ self .names .append (libtcodpy .namegen_generate (self .sets [self .current_set ]))
11791179
11801180 def ev_keydown (self , event : tcod .event .KeyDown ) -> None :
11811181 if event .sym == tcod .event .KeySym .EQUALS :
1182- self .curset += 1
1182+ self .current_set += 1
11831183 self .names .append ("======" )
11841184 elif event .sym == tcod .event .KeySym .MINUS :
1185- self .curset -= 1
1185+ self .current_set -= 1
11861186 self .names .append ("======" )
11871187 else :
11881188 super ().ev_keydown (event )
1189- self .curset %= len (self .sets )
1189+ self .current_set %= len (self .sets )
11901190
11911191
11921192#############################################
@@ -1294,9 +1294,9 @@ def on_draw(self) -> None:
12941294 for v in range (RES_V - int_t , RES_V ):
12951295 for u in range (RES_U ):
12961296 tex_v = (v + int_abs_t ) / float (RES_V )
1297- texture [u , v ] = tcod . noise_get_fbm ( noise2d , [ u / float ( RES_U ), tex_v ], 32.0 ) + tcod .noise_get_fbm (
1298- noise2d , [1 - u / float (RES_U ), tex_v ], 32.0
1299- )
1297+ texture [u , v ] = libtcodpy .noise_get_fbm (
1298+ noise2d , [u / float (RES_U ), tex_v ], 32.0
1299+ ) + libtcodpy . noise_get_fbm ( noise2d , [ 1 - u / float ( RES_U ), tex_v ], 32.0 )
13001300
13011301 # squared distance from center,
13021302 # clipped to sensible minimum and maximum values
@@ -1324,9 +1324,9 @@ def on_draw(self) -> None:
13241324 y = random .uniform (- 0.5 , 0.5 )
13251325 strength = random .uniform (MIN_LIGHT_STRENGTH , 1.0 )
13261326
1327- color = tcod .Color (0 , 0 , 0 ) # create bright colors with random hue
1327+ color = libtcodpy .Color (0 , 0 , 0 ) # create bright colors with random hue
13281328 hue = random .uniform (0 , 360 )
1329- tcod .color_set_hsv (color , hue , 0.5 , strength )
1329+ libtcodpy .color_set_hsv (color , hue , 0.5 , strength )
13301330 self .lights .append (Light (x , y , TEX_STRETCH , color .r , color .g , color .b , strength ))
13311331
13321332 # eliminate lights that are going to be out of view
0 commit comments