mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-06-01 17:12:15 +00:00
Get the keyboard controls working.
This commit is contained in:
parent
27fdf21120
commit
6be1f516f6
2 changed files with 28 additions and 41 deletions
|
@ -894,19 +894,13 @@ keyDown
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define KEY_RIGHTARROW 0xae
|
|
||||||
#define KEY_LEFTARROW 0xac
|
|
||||||
#define KEY_UPARROW 0xad
|
|
||||||
#define KEY_DOWNARROW 0xaf
|
|
||||||
|
|
||||||
|
|
||||||
-_keyDown:(NSEvent *)theEvent
|
-_keyDown:(NSEvent *)theEvent
|
||||||
{
|
{
|
||||||
int ch;
|
NSString *chars = [theEvent characters];
|
||||||
|
unichar c = [chars length] == 1 ? [chars characterAtIndex: 0] : '\0';
|
||||||
|
|
||||||
ch = tolower ([[theEvent characters] characterAtIndex: 0]);
|
switch (c) {
|
||||||
|
|
||||||
switch (ch) {
|
|
||||||
case 13:
|
case 13:
|
||||||
return self;
|
return self;
|
||||||
|
|
||||||
|
@ -924,25 +918,25 @@ keyDown
|
||||||
[quakeed_i updateCamera];
|
[quakeed_i updateCamera];
|
||||||
return self;
|
return self;
|
||||||
|
|
||||||
case KEY_RIGHTARROW:
|
case NSRightArrowFunctionKey:
|
||||||
ya -= M_PI * move / (64 * 2);
|
ya -= M_PI * move / (64 * 2);
|
||||||
[self matrixFromAngles];
|
[self matrixFromAngles];
|
||||||
[quakeed_i updateCamera];
|
[quakeed_i updateCamera];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_LEFTARROW:
|
case NSLeftArrowFunctionKey:
|
||||||
ya += M_PI * move / (64 * 2);
|
ya += M_PI * move / (64 * 2);
|
||||||
[self matrixFromAngles];
|
[self matrixFromAngles];
|
||||||
[quakeed_i updateCamera];
|
[quakeed_i updateCamera];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_UPARROW:
|
case NSUpArrowFunctionKey:
|
||||||
origin[0] += move * cos (ya);
|
origin[0] += move * cos (ya);
|
||||||
origin[1] += move * sin (ya);
|
origin[1] += move * sin (ya);
|
||||||
[quakeed_i updateCamera];
|
[quakeed_i updateCamera];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_DOWNARROW:
|
case NSDownArrowFunctionKey:
|
||||||
origin[0] -= move * cos (ya);
|
origin[0] -= move * cos (ya);
|
||||||
origin[1] -= move * sin (ya);
|
origin[1] -= move * sin (ya);
|
||||||
[quakeed_i updateCamera];
|
[quakeed_i updateCamera];
|
||||||
|
|
|
@ -880,73 +880,66 @@ keyDown
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define KEY_RIGHTARROW 0xae
|
|
||||||
#define KEY_LEFTARROW 0xac
|
|
||||||
#define KEY_UPARROW 0xad
|
|
||||||
#define KEY_DOWNARROW 0xaf
|
|
||||||
|
|
||||||
-keyDown:(NSEvent *) theEvent
|
-keyDown:(NSEvent *) theEvent
|
||||||
{
|
{
|
||||||
int ch;
|
NSString *chars = [theEvent characters];
|
||||||
const char *chars;
|
unichar c = [chars length] == 1 ? [chars characterAtIndex: 0] : '\0';
|
||||||
|
|
||||||
// function keys
|
// function keys
|
||||||
switch ([theEvent keyCode]) {
|
switch (c) {
|
||||||
case 60: // F2
|
case NSF2FunctionKey:
|
||||||
[cameraview_i setDrawMode:dr_wire];
|
[cameraview_i setDrawMode:dr_wire];
|
||||||
Sys_Printf ("wire draw mode\n");
|
Sys_Printf ("wire draw mode\n");
|
||||||
return self;
|
return self;
|
||||||
case 61: // F3
|
case NSF3FunctionKey:
|
||||||
[cameraview_i setDrawMode:dr_flat];
|
[cameraview_i setDrawMode:dr_flat];
|
||||||
Sys_Printf ("flat draw mode\n");
|
Sys_Printf ("flat draw mode\n");
|
||||||
return self;
|
return self;
|
||||||
case 62: // F4
|
case NSF4FunctionKey:
|
||||||
[cameraview_i setDrawMode:dr_texture];
|
[cameraview_i setDrawMode:dr_texture];
|
||||||
Sys_Printf ("texture draw mode\n");
|
Sys_Printf ("texture draw mode\n");
|
||||||
return self;
|
return self;
|
||||||
|
|
||||||
case 63: // F5
|
case NSF5FunctionKey:
|
||||||
[xyview_i setDrawMode:dr_wire];
|
[xyview_i setDrawMode:dr_wire];
|
||||||
Sys_Printf ("wire draw mode\n");
|
Sys_Printf ("wire draw mode\n");
|
||||||
return self;
|
return self;
|
||||||
case 64: // F6
|
case NSF6FunctionKey:
|
||||||
Sys_Printf ("texture draw mode\n");
|
Sys_Printf ("texture draw mode\n");
|
||||||
return self;
|
return self;
|
||||||
|
|
||||||
case 66: // F8
|
case NSF8FunctionKey:
|
||||||
[cameraview_i homeView:self];
|
[cameraview_i homeView:self];
|
||||||
return self;
|
return self;
|
||||||
|
|
||||||
case 88: // F12
|
case NSF12FunctionKey:
|
||||||
[map_i subtractSelection:self];
|
[map_i subtractSelection:self];
|
||||||
return self;
|
return self;
|
||||||
|
|
||||||
case 106: // page up
|
case NSPageUpFunctionKey:
|
||||||
[cameraview_i upFloor:self];
|
[cameraview_i upFloor:self];
|
||||||
return self;
|
return self;
|
||||||
|
|
||||||
case 107: // page down
|
case NSPageDownFunctionKey:
|
||||||
[cameraview_i downFloor:self];
|
[cameraview_i downFloor:self];
|
||||||
return self;
|
return self;
|
||||||
|
|
||||||
case 109: // end
|
case NSEndFunctionKey:
|
||||||
[self deselect:self];
|
[self deselect:self];
|
||||||
return self;
|
return self;
|
||||||
}
|
|
||||||
|
|
||||||
// portable things
|
case NSRightArrowFunctionKey:
|
||||||
chars = [[theEvent characters] cString];
|
case NSLeftArrowFunctionKey:
|
||||||
ch = chars ? tolower (chars[0]) : 0;
|
case NSUpArrowFunctionKey:
|
||||||
|
case NSDownArrowFunctionKey:
|
||||||
switch (ch) {
|
|
||||||
case KEY_RIGHTARROW:
|
|
||||||
case KEY_LEFTARROW:
|
|
||||||
case KEY_UPARROW:
|
|
||||||
case KEY_DOWNARROW:
|
|
||||||
case 'a':
|
case 'a':
|
||||||
|
case 'A':
|
||||||
case 'z':
|
case 'z':
|
||||||
|
case 'Z':
|
||||||
case 'd':
|
case 'd':
|
||||||
|
case 'D':
|
||||||
case 'c':
|
case 'c':
|
||||||
|
case 'C':
|
||||||
case '.':
|
case '.':
|
||||||
case ',':
|
case ',':
|
||||||
[cameraview_i _keyDown:theEvent];
|
[cameraview_i _keyDown:theEvent];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue