source: libcaca/trunk/libcaca/io.c @ 185

Last change on this file since 185 was 185, checked in by Sam Hocevar, 19 years ago
  • Renamed libee to libcaca. Far less collisions.
  • 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 185 2003-11-16 00:33:35Z sam $
7 *
8 *   This program is free software; you can redistribute it and/or modify
9 *   it under the terms of the GNU General Public License as published by
10 *   the Free Software Foundation; either version 2 of the License, or
11 *   (at your option) any later version.
12 *
13 *   This program 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
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23#include "config.h"
24
25#if defined(USE_SLANG)
26#   include <slang.h>
27#elif defined(USE_NCURSES)
28#   include <curses.h>
29#elif defined(USE_CONIO)
30#   include <conio.h>
31#else
32#   error "no graphics library detected"
33#endif
34
35#include "caca.h"
36#include "caca_internals.h"
37
38char caca_get_key(void)
39{
40#if defined(USE_SLANG)
41    return SLang_input_pending(0) ? SLang_getkey() : 0;
42
43#elif defined(USE_NCURSES)
44    char key = getch();
45    return key != ERR ? key : 0;
46
47#elif defined(USE_CONIO)
48    return _conio_kbhit() ? getch() : 0;
49
50#endif
51}
52
Note: See TracBrowser for help on using the repository browser.