Add debug key
This commit is contained in:
parent
bbb8995e99
commit
a74cec10c2
1 changed files with 17 additions and 6 deletions
23
window.c
23
window.c
|
@ -33,6 +33,9 @@ static float _cubeSize = 4.f;
|
||||||
/* Variable d'état pour activer/désactiver la synchronisation verticale */
|
/* Variable d'état pour activer/désactiver la synchronisation verticale */
|
||||||
static int _use_vsync = 1;
|
static int _use_vsync = 1;
|
||||||
|
|
||||||
|
/* Variable d'état pour activer/désactiver le debug */
|
||||||
|
static int _debug = 0;
|
||||||
|
|
||||||
/* Grille de positions où il y aura des cubes
|
/* Grille de positions où il y aura des cubes
|
||||||
* 0 -> Vide
|
* 0 -> Vide
|
||||||
* 1 -> Mur
|
* 1 -> Mur
|
||||||
|
@ -190,9 +193,11 @@ void idle(void) {
|
||||||
_herosA.z += vitesse * dt;
|
_herosA.z += vitesse * dt;
|
||||||
|
|
||||||
/* Affichage Debug */
|
/* Affichage Debug */
|
||||||
printf("\n==== Héros A ====\n li = %d, col = %d, pos = %d\n", (int)(zA + .5f), (int)(xA + .5f), _herosA.position);
|
if(_debug) {
|
||||||
printf("zA=%f xA=%f\n", zA, xA);
|
printf("\n==== Héros A ====\n li = %d, col = %d, pos = %d\n", (int)(zA + .5f), (int)(xA + .5f), _herosA.position);
|
||||||
printf("d=%d h=%d g=%d b=%d\n", coorDroiteA, coorHautA, coorGaucheA, coorBasA);
|
printf("zA=%f xA=%f\n", zA, xA);
|
||||||
|
printf("d=%d h=%d g=%d b=%d\n", coorDroiteA, coorHautA, coorGaucheA, coorBasA);
|
||||||
|
}
|
||||||
|
|
||||||
/* Anti-collision entre joueurs */
|
/* Anti-collision entre joueurs */
|
||||||
if(_herosA.position != coorJoueurA) {
|
if(_herosA.position != coorJoueurA) {
|
||||||
|
@ -234,9 +239,11 @@ void idle(void) {
|
||||||
_herosB.z += vitesse * dt;
|
_herosB.z += vitesse * dt;
|
||||||
|
|
||||||
/* Affichage Debug */
|
/* Affichage Debug */
|
||||||
printf("==== Héros B ====\n li = %d, col = %d, pos = %d\n=================\n", (int)(zB + .5f), (int)(xB + .5f), _herosB.position);
|
if(_debug) {
|
||||||
printf("zA=%f xA=%f\n", zB, xB);
|
printf("==== Héros B ====\n li = %d, col = %d, pos = %d\n=================\n", (int)(zB + .5f), (int)(xB + .5f), _herosB.position);
|
||||||
printf("d=%d h=%d g=%d b=%d\n", coorDroiteB, coorHautB, coorGaucheB, coorBasB);
|
printf("zA=%f xA=%f\n", zB, xB);
|
||||||
|
printf("d=%d h=%d g=%d b=%d\n", coorDroiteB, coorHautB, coorGaucheB, coorBasB);
|
||||||
|
}
|
||||||
|
|
||||||
/* Anti-collision entre joueurs */
|
/* Anti-collision entre joueurs */
|
||||||
if(_herosB.position != coorJoueurB) {
|
if(_herosB.position != coorJoueurB) {
|
||||||
|
@ -321,6 +328,10 @@ void keyd(int keycode) {
|
||||||
SDL_GL_SetSwapInterval(0);
|
SDL_GL_SetSwapInterval(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GL4DK_h:
|
||||||
|
_debug = !_debug;
|
||||||
|
break;
|
||||||
|
|
||||||
/* Héros A */
|
/* Héros A */
|
||||||
case GL4DK_RIGHT:
|
case GL4DK_RIGHT:
|
||||||
_vkeyboard[VK_RIGHT] = 1;
|
_vkeyboard[VK_RIGHT] = 1;
|
||||||
|
|
Reference in a new issue