source: libcaca/trunk/src/io.c @ 192

Last change on this file since 192 was 192, checked in by Sam Hocevar, 19 years ago
  • Changed copyleft to LGPL.
  • Property svn:keywords set to Id
File size: 1.4 KB
Line 
1/*
2 *   libcaca       ASCII-Art library
3 *   Copyright (c) 2002, 2003 Sam Hocevar <sam@zoy.org>
4 *                 All Rights Reserved
5 *
6 *   $Id: io.c 192 2003-11-16 12:28:29Z sam $
7 *
8 *   This library is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU Lesser General Public
10 *   License as published by the Free Software Foundation; either
11 *   version 2 of the License, or (at your option) any later version.
12 *
13 *   This library is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 *   Lesser General Public License for more details.
17 *
18 *   You should have received a copy of the GNU Lesser General Public
19 *   License along with this library; if not, write to the Free Software
20 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 *   02111-1307  USA
22 */
23
24#include "config.h"
25
26#if defined(USE_SLANG)
27#   include <slang.h>
28#elif defined(USE_NCURSES)
29#   include <curses.h>
30#elif defined(USE_CONIO)
31#   include <conio.h>
32#else
33#   error "no graphics library detected"
34#endif
35
36#include "caca.h"
37#include "caca_internals.h"
38
39char caca_get_key(void)
40{
41#if defined(USE_SLANG)
42    return SLang_input_pending(0) ? SLang_getkey() : 0;
43
44#elif defined(USE_NCURSES)
45    char key = getch();
46    return key != ERR ? key : 0;
47
48#elif defined(USE_CONIO)
49    return _conio_kbhit() ? getch() : 0;
50
51#endif
52}
53
Note: See TracBrowser for help on using the repository browser.