forked from libretro/jumpnbump-libretro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
interrpt.c
59 lines (53 loc) · 1.49 KB
/
interrpt.c
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
* interrpt.c
* Copyright (C) 1998 Brainchild Design - http://brainchilddesign.com/
*
* Copyright (C) 2001 Chuck Mason <[email protected]>
*
* Copyright (C) 2002 Florian Schulze <[email protected]>
*
* Copyright (C) 2015 Côme Chilliet <[email protected]>
*
* This file is part of Jump 'n Bump.
*
* Jump 'n Bump is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Jump 'n Bump is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#ifdef _WIN32
#include <direct.h>
#else
#include <unistd.h>
#endif
#include "globals.h"
char keyb[256];
char last_keys[50];
int addkey(unsigned int key)
{
int c1;
if (!(key & 0x8000)) {
keyb[key & 0x7fff] = 1;
for (c1 = 48; c1 > 0; c1--)
last_keys[c1] = last_keys[c1 - 1];
last_keys[0] = key & 0x7fff;
} else
keyb[key & 0x7fff] = 0;
return 0;
}
int key_pressed(int key)
{
return keyb[(unsigned char) key];
}