byte _keys_down[256];
// returns nonzero when the given key was hit since the last call
function key_hit(var num)
{
if (num <= 0 || num >= 256) return 0;
if(!_keys_down[num] && key_pressed(num))
{
_keys_down[num] = 1;
return 1;
}
_keys_down[num] = key_pressed(num);
return 0;
}
// returns nonzero when the key with the given name was hit
function key_hit(STRING* keystr)
{
return key_hit(key_for_str(keystr));
}
As you can see there a two key_hit() functions.
Windows XP SP3 Intel Dual Core CPU: E5200 @ 2.5GHz 4.00GB DDR3 Ram ASUS P5G41T-M LX PCIE x16 GeForce GTS 450 1Gb SB Audigy 4 Spyware Doctor with AntiVirus
Re: typo in keys.c template
[Re: Nidhogg]
#333528 07/16/1022:3007/16/1022:30
Technically, there is no problem with that, that's called overloading functions. If you use a var as parameter, the first one is used and if you use a string as parameter, the second one is used. I guess they are meant to have the same name, as they are documented with the same name: http://www.conitec.net/beta/keys_c.htm