-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrender_functions.py
More file actions
32 lines (23 loc) · 849 Bytes
/
render_functions.py
File metadata and controls
32 lines (23 loc) · 849 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Eric Janusson
# Python 3.9
'''⌬
Description: render_functions.py
⌬'''
import tcod as libtcod
def render_all(con, entities, screen_width, screen_height):
# Draw all entities in the list
for entity in entities:
draw_entity(con, entity)
libtcod.console_blit(con, 0, 0, screen_width, screen_height, 0, 0, 0)
def clear_all(con, entities):
for entity in entities:
clear_entity(con, entity)
def draw_entity(con, entity):
libtcod.console_set_default_foreground(con, entity.color)
libtcod.console_put_char(con, entity.x, entity.y, entity.char,
libtcod.BKGND_NONE)
def clear_entity(con, entity):
# erase the character that represents this object
libtcod.console_put_char(con, entity.x, entity.y, ' ', libtcod.BKGND_NONE)