quakeforge/ruamoko/cl_menu/CrosshairView.r
Bill Currie 4898a44263 [console] Hook up new input system
This has smashed the keydest handling for many things, and bindings, but
seems to be a good start with the new input system: the console in
qw-client-x11 is usable (keyboard-only).

The button and axis values have been removed from the knum_t enum as
mouse events are separate from key events, and other button and axis
inputs will be handled separately.

keys.c has been disabled in the build as it is obsolute (thus much of
the breakage).
2021-11-08 11:20:04 +09:00

42 lines
674 B
R

#include "draw.h"
#include "key.h"
#include "sound.h"
#include "CrosshairView.h"
@implementation CrosshairView
{
CrosshairCvar *crosshair;
}
-(id)initWithBounds:(Rect)aRect :(CrosshairCvar*)_crosshair
{
self = [self initWithBounds:aRect];
crosshair = _crosshair;
return self;
}
-(void) next
{
[crosshair next];
S_LocalSound ("misc/menu2.wav");
}
-(void) draw
{
Draw_Fill (xabs, yabs, xlen, ylen, 0);
Draw_Crosshair ([crosshair crosshair], xabs + xlen / 2, yabs + ylen / 2);
}
- (int) keyEvent:(int)key unicode:(int)unicode down:(int)down
{
switch (key) {
case QFK_RETURN:
//case QFM_BUTTON1:
[self next];
return 1;
default:
return 0;
}
}
@end