add movement fn

This commit is contained in:
Mylloon 2023-05-12 13:49:33 +02:00
parent a1e5ef7ec8
commit 3d3ea8ccdf
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 32 additions and 0 deletions

View file

@ -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

View file

@ -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);
}