formating + switch off overview withh 1-9 keybindings

This commit is contained in:
Volodymyr Patuta 2021-01-01 15:13:09 +01:00
parent 57726d85d1
commit cf7b27ef0c
1 changed files with 48 additions and 31 deletions

View File

@ -445,11 +445,11 @@ void key(int keycode) {
switch(keycode) { switch(keycode) {
case GL4DK_UP: case GL4DK_UP:
if (_movement) if (_movement)
_cam.y += 5; _cam.y += step;
break; break;
case GL4DK_DOWN: case GL4DK_DOWN:
if (_movement) if (_movement)
_cam.y -= 5; _cam.y -= step;
break; break;
case GL4DK_RIGHT: case GL4DK_RIGHT:
if (!_pause) if (!_pause)
@ -519,6 +519,7 @@ void key(int keycode) {
_p = -1; _p = -1;
_pause = 0; _pause = 0;
_movement = 1; _movement = 1;
_overview = 0;
break; break;
case GL4DK_q: case GL4DK_q:
exit(0); exit(0);
@ -527,6 +528,7 @@ void key(int keycode) {
_p = 0; _p = 0;
/*_pause = 1;*/ /*_pause = 1;*/
_movement = 0; _movement = 0;
_overview = 0;
_cam.x = (int)_cam.x; _cam.x = (int)_cam.x;
_cam.y = (int)_cam.y; _cam.y = (int)_cam.y;
_cam.z = (int)_cam.z; _cam.z = (int)_cam.z;
@ -535,6 +537,7 @@ void key(int keycode) {
_p = 1; _p = 1;
/*_pause = 1;*/ /*_pause = 1;*/
_movement = 0; _movement = 0;
_overview = 0;
_cam.x = (int)_cam.x; _cam.x = (int)_cam.x;
_cam.y = (int)_cam.y; _cam.y = (int)_cam.y;
_cam.z = (int)_cam.z; _cam.z = (int)_cam.z;
@ -543,6 +546,7 @@ void key(int keycode) {
_p = 2; _p = 2;
/*_pause = 1;*/ /*_pause = 1;*/
_movement = 0; _movement = 0;
_overview = 0;
_cam.x = (int)_cam.x; _cam.x = (int)_cam.x;
_cam.y = (int)_cam.y; _cam.y = (int)_cam.y;
_cam.z = (int)_cam.z; _cam.z = (int)_cam.z;
@ -551,6 +555,7 @@ void key(int keycode) {
_p = 3; _p = 3;
/*_pause = 1;*/ /*_pause = 1;*/
_movement = 0; _movement = 0;
_overview = 0;
_cam.x = (int)_cam.x; _cam.x = (int)_cam.x;
_cam.y = (int)_cam.y; _cam.y = (int)_cam.y;
_cam.z = (int)_cam.z; _cam.z = (int)_cam.z;
@ -559,6 +564,7 @@ void key(int keycode) {
_p = 4; _p = 4;
/*_pause = 1;*/ /*_pause = 1;*/
_movement = 0; _movement = 0;
_overview = 0;
_cam.x = (int)_cam.x; _cam.x = (int)_cam.x;
_cam.y = (int)_cam.y; _cam.y = (int)_cam.y;
_cam.z = (int)_cam.z; _cam.z = (int)_cam.z;
@ -567,6 +573,7 @@ void key(int keycode) {
_p = 5; _p = 5;
/*_pause = 1;*/ /*_pause = 1;*/
_movement = 0; _movement = 0;
_overview = 0;
_cam.x = (int)_cam.x; _cam.x = (int)_cam.x;
_cam.y = (int)_cam.y; _cam.y = (int)_cam.y;
_cam.z = (int)_cam.z; _cam.z = (int)_cam.z;
@ -575,6 +582,7 @@ void key(int keycode) {
_p = 6; _p = 6;
/*_pause = 1;*/ /*_pause = 1;*/
_movement = 0; _movement = 0;
_overview = 0;
_cam.x = (int)_cam.x; _cam.x = (int)_cam.x;
_cam.y = (int)_cam.y; _cam.y = (int)_cam.y;
_cam.z = (int)_cam.z; _cam.z = (int)_cam.z;
@ -583,6 +591,7 @@ void key(int keycode) {
_p = 7; _p = 7;
/*_pause = 1;*/ /*_pause = 1;*/
_movement = 0; _movement = 0;
_overview = 0;
_cam.x = (int)_cam.x; _cam.x = (int)_cam.x;
_cam.y = (int)_cam.y; _cam.y = (int)_cam.y;
_cam.z = (int)_cam.z; _cam.z = (int)_cam.z;
@ -591,6 +600,7 @@ void key(int keycode) {
_p = 8; _p = 8;
/*_pause = 1;*/ /*_pause = 1;*/
_movement = 0; _movement = 0;
_overview = 0;
_cam.x = (int)_cam.x; _cam.x = (int)_cam.x;
_cam.y = (int)_cam.y; _cam.y = (int)_cam.y;
_cam.z = (int)_cam.z; _cam.z = (int)_cam.z;
@ -599,6 +609,7 @@ void key(int keycode) {
_p = 9; _p = 9;
/*_pause = 1;*/ /*_pause = 1;*/
_movement = 0; _movement = 0;
_overview = 0;
_cam.x = (int)_cam.x; _cam.x = (int)_cam.x;
_cam.y = (int)_cam.y; _cam.y = (int)_cam.y;
_cam.z = (int)_cam.z; _cam.z = (int)_cam.z;
@ -607,49 +618,55 @@ void key(int keycode) {
_use_tex = !_use_tex; _use_tex = !_use_tex;
if(_use_tex) { if(_use_tex) {
enableSurfaceOption(_sun, SO_USE_TEXTURE); enableSurfaceOption(_sun, SO_USE_TEXTURE);
for(i = 0; i < 18; ++i) for (i = 0; i < 18; ++i) {
enableSurfaceOption(_moon[i], SO_USE_TEXTURE); enableSurfaceOption(_moon[i], SO_USE_TEXTURE);
for(i = 0; i < 9; ++i) if (i < 9)
enableSurfaceOption(_planet[i], SO_USE_TEXTURE); enableSurfaceOption(_planet[i], SO_USE_TEXTURE);
}
} else { } else {
disableSurfaceOption(_sun, SO_USE_TEXTURE); disableSurfaceOption(_sun, SO_USE_TEXTURE);
for(i = 0; i < 18; ++i) for (i = 0; i < 18; ++i) {
disableSurfaceOption(_moon[i], SO_USE_TEXTURE); disableSurfaceOption(_moon[i], SO_USE_TEXTURE);
for(i = 0; i < 9; ++i) if (i < 9)
disableSurfaceOption(_planet[i], SO_USE_TEXTURE); disableSurfaceOption(_planet[i], SO_USE_TEXTURE);
} }
}
break; break;
case GL4DK_c: /* 'c' utiliser la couleur */ case GL4DK_c: /* 'c' utiliser la couleur */
_use_color = !_use_color; _use_color = !_use_color;
if(_use_color) { if(_use_color) {
enableSurfaceOption(_sun, SO_USE_COLOR); enableSurfaceOption(_sun, SO_USE_COLOR);
for(i = 0; i < 18; ++i) for (i = 0; i < 18; ++i) {
enableSurfaceOption(_moon[i], SO_USE_COLOR); enableSurfaceOption(_moon[i], SO_USE_COLOR);
for(i = 0; i < 9; ++i) if (i < 9)
enableSurfaceOption(_planet[i], SO_USE_COLOR); enableSurfaceOption(_planet[i], SO_USE_COLOR);
}
} else { } else {
disableSurfaceOption(_sun, SO_USE_COLOR); disableSurfaceOption(_sun, SO_USE_COLOR);
for(i = 0; i < 18; ++i) for (i = 0; i < 18; ++i) {
disableSurfaceOption(_moon[i], SO_USE_COLOR); disableSurfaceOption(_moon[i], SO_USE_COLOR);
for(i = 0; i < 9; ++i) if (i < 9)
disableSurfaceOption(_planet[i], SO_USE_COLOR); disableSurfaceOption(_planet[i], SO_USE_COLOR);
} }
}
break; break;
case GL4DK_l: /* 'l' utiliser l'ombrage par la méthode Gouraud */ case GL4DK_l: /* 'l' utiliser l'ombrage par la méthode Gouraud */
_use_lighting = !_use_lighting; _use_lighting = !_use_lighting;
if(_use_lighting) { if(_use_lighting) {
enableSurfaceOption(_sun, SO_USE_LIGHTING); enableSurfaceOption(_sun, SO_USE_LIGHTING);
for(i = 0; i < 18; ++i) for (i = 0; i < 18; ++i) {
enableSurfaceOption(_moon[i], SO_USE_LIGHTING); enableSurfaceOption(_moon[i], SO_USE_LIGHTING);
for(i = 0; i < 9; ++i) if (i < 9)
enableSurfaceOption(_planet[i], SO_USE_LIGHTING); enableSurfaceOption(_planet[i], SO_USE_LIGHTING);
}
} else { } else {
disableSurfaceOption(_sun, SO_USE_LIGHTING); disableSurfaceOption(_sun, SO_USE_LIGHTING);
for(i = 0; i < 18; ++i) for (i = 0; i < 18; ++i) {
disableSurfaceOption(_moon[i], SO_USE_LIGHTING); disableSurfaceOption(_moon[i], SO_USE_LIGHTING);
for(i = 0; i < 9; ++i) if (i < 9)
disableSurfaceOption(_planet[i], SO_USE_LIGHTING); disableSurfaceOption(_planet[i], SO_USE_LIGHTING);
} }
}
break; break;
default: break; default: break;
} }