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