add movement fn
This commit is contained in:
parent
a1e5ef7ec8
commit
3d3ea8ccdf
2 changed files with 32 additions and 0 deletions
|
@ -3,10 +3,27 @@
|
||||||
|
|
||||||
#include <GL4D/gl4duw_SDL2.h>
|
#include <GL4D/gl4duw_SDL2.h>
|
||||||
|
|
||||||
|
enum Movement { TETE, CORPS, JAMBE_G, JAMBE_D, BRAS_G, BRAS_D };
|
||||||
|
|
||||||
// Récupère un delta-temps
|
// Récupère un delta-temps
|
||||||
double get_dt(double *, GLboolean);
|
double get_dt(double *, GLboolean);
|
||||||
|
|
||||||
// Bind and load a matrix
|
// Bind and load a matrix
|
||||||
void bindAndLoadf(const char *name);
|
void bindAndLoadf(const char *name);
|
||||||
|
|
||||||
|
/* Move something in space
|
||||||
|
*
|
||||||
|
* +x = movement to right
|
||||||
|
*
|
||||||
|
* -x = movement to left
|
||||||
|
*
|
||||||
|
* +y = movement to top
|
||||||
|
*
|
||||||
|
* -y = movement to bottom
|
||||||
|
*
|
||||||
|
* +z = move closer
|
||||||
|
*
|
||||||
|
* -z = move away */
|
||||||
|
void move(GLfloat x, GLfloat y, GLfloat z, int type);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
15
src/utils.c
15
src/utils.c
|
@ -13,3 +13,18 @@ void bindAndLoadf(const char *name) {
|
||||||
gl4duBindMatrix(name);
|
gl4duBindMatrix(name);
|
||||||
gl4duLoadIdentityf();
|
gl4duLoadIdentityf();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void move(GLfloat x, GLfloat y, GLfloat z, int type) {
|
||||||
|
switch (type) {
|
||||||
|
case CORPS:
|
||||||
|
x *= 10;
|
||||||
|
z *= 5;
|
||||||
|
break;
|
||||||
|
case TETE:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printf("Undefined yet\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
gl4duTranslatef(x, y, z);
|
||||||
|
}
|
||||||
|
|
Reference in a new issue