Changeset 2824 for libcaca/trunk/python
- Timestamp:
- Sep 27, 2008, 4:29:11 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/python/snake.py
r2060 r2824 79 79 def draw(self): 80 80 global cv 81 lcaca.c ucul_set_color_ansi(cv, 0x05, 0x00)81 lcaca.caca_set_color_ansi(cv, 0x05, 0x00) 82 82 83 83 for p in self.body: 84 lcaca.c ucul_put_char(cv, p[0], p[1], ord('o'))85 lcaca.c ucul_set_color_ansi(cv, 0x02, 0x00)86 lcaca.c ucul_put_char(cv, self.head[0], self.head[1], ord('@'))84 lcaca.caca_put_char(cv, p[0], p[1], ord('o')) 85 lcaca.caca_set_color_ansi(cv, 0x02, 0x00) 86 lcaca.caca_put_char(cv, self.head[0], self.head[1], ord('@')) 87 87 lcaca.caca_refresh_display(dp) 88 88 … … 102 102 def draw(self): 103 103 global cv 104 lcaca.c ucul_set_color_ansi(cv, 0x03, 0x00)105 lcaca.c ucul_put_char(cv, self.x, self.y, ord(str(self.value)))104 lcaca.caca_set_color_ansi(cv, 0x03, 0x00) 105 lcaca.caca_put_char(cv, self.x, self.y, ord(str(self.value))) 106 106 lcaca.caca_refresh_display(dp) 107 107 108 108 def draw_border(): 109 lcaca.c ucul_set_color_ansi(cv, 0x04, 0x00)110 lcaca.c ucul_draw_box(cv,109 lcaca.caca_set_color_ansi(cv, 0x04, 0x00) 110 lcaca.caca_draw_box(cv, 111 111 0, 112 112 0, … … 117 117 event = ev() 118 118 lcaca = C.cdll.LoadLibrary('libcaca.so.0') 119 cv = lcaca.c ucul_create_canvas(CANVAS_WIDTH, CANVAS_HEIGHT)119 cv = lcaca.caca_create_canvas(CANVAS_WIDTH, CANVAS_HEIGHT) 120 120 dp = lcaca.caca_create_display(cv) 121 121 lcaca.caca_set_display_title(dp, "snake.py - playing with ctypes and libcaca") … … 161 161 s.grow() 162 162 163 lcaca.c ucul_clear_canvas(cv)163 lcaca.caca_clear_canvas(cv) 164 164 draw_border() 165 165 s.draw()
Note: See TracChangeset
for help on using the changeset viewer.