|
@@ 943-969 (lines=27) @@
|
| 940 |
|
return lib.TCOD_console_get_fade() |
| 941 |
|
|
| 942 |
|
def console_get_fading_color(): |
| 943 |
|
return Color._new_from_cdata(lib.TCOD_console_get_fading_color()) |
| 944 |
|
|
| 945 |
|
# handling keyboard input |
| 946 |
|
def console_wait_for_keypress(flush): |
| 947 |
|
"""Block until the user presses a key, then returns a new Key. |
| 948 |
|
|
| 949 |
|
Args: |
| 950 |
|
flush bool: If True then the event queue is cleared before waiting |
| 951 |
|
for the next event. |
| 952 |
|
|
| 953 |
|
Returns: |
| 954 |
|
Key: A new Key instance. |
| 955 |
|
""" |
| 956 |
|
k=Key() |
| 957 |
|
lib.TCOD_console_wait_for_keypress_wrapper(k.cdata, flush) |
| 958 |
|
return k |
| 959 |
|
|
| 960 |
|
def console_check_for_keypress(flags=KEY_RELEASED): |
| 961 |
|
k=Key() |
| 962 |
|
lib.TCOD_console_check_for_keypress_wrapper(k.cdata, flags) |
| 963 |
|
return k |
| 964 |
|
|
| 965 |
|
def console_is_key_pressed(key): |
| 966 |
|
return lib.TCOD_console_is_key_pressed(key) |
| 967 |
|
|
| 968 |
|
# using offscreen consoles |
| 969 |
|
def console_new(w, h): |
| 970 |
|
"""Return an offscreen console of size: w,h.""" |
| 971 |
|
return tcod.console.Console(w, h) |
| 972 |
|
|
|
@@ 915-941 (lines=27) @@
|
| 912 |
|
def console_get_default_background(con): |
| 913 |
|
"""Return this consoles default background color.""" |
| 914 |
|
return Color._new_from_cdata( |
| 915 |
|
lib.TCOD_console_get_default_background(_cdata(con))) |
| 916 |
|
|
| 917 |
|
def console_get_default_foreground(con): |
| 918 |
|
"""Return this consoles default foreground color.""" |
| 919 |
|
return Color._new_from_cdata( |
| 920 |
|
lib.TCOD_console_get_default_foreground(_cdata(con))) |
| 921 |
|
|
| 922 |
|
def console_get_char_background(con, x, y): |
| 923 |
|
"""Return the background color at the x,y of this console.""" |
| 924 |
|
return Color._new_from_cdata( |
| 925 |
|
lib.TCOD_console_get_char_background(_cdata(con), x, y)) |
| 926 |
|
|
| 927 |
|
def console_get_char_foreground(con, x, y): |
| 928 |
|
"""Return the foreground color at the x,y of this console.""" |
| 929 |
|
return Color._new_from_cdata( |
| 930 |
|
lib.TCOD_console_get_char_foreground(_cdata(con), x, y)) |
| 931 |
|
|
| 932 |
|
def console_get_char(con, x, y): |
| 933 |
|
"""Return the character at the x,y of this console.""" |
| 934 |
|
return lib.TCOD_console_get_char(_cdata(con), x, y) |
| 935 |
|
|
| 936 |
|
def console_set_fade(fade, fadingColor): |
| 937 |
|
lib.TCOD_console_set_fade(fade, fadingColor) |
| 938 |
|
|
| 939 |
|
def console_get_fade(): |
| 940 |
|
return lib.TCOD_console_get_fade() |
| 941 |
|
|
| 942 |
|
def console_get_fading_color(): |
| 943 |
|
return Color._new_from_cdata(lib.TCOD_console_get_fading_color()) |
| 944 |
|
|