void FigureRender () { static float nn; if (moveit) nn += 0.03f; fig2.RotateBone (BONE_SPINE1, glVector (0.0f, 0.0f, sin (nn * 3) * 25.0f)); fig2.RotateBone (BONE_RFINGERS1, glVector (0.0f, -abs (sin (nn * 1)) * -80.0f, 0.0f)); //fig2.RotateBone (BONE_RELBOW, glVector (abs (cos (nn * 1)) * 45.0f, 0.0f, 0.0f)); //fig2.RotateBone (BONE_LSHOULDER, glVector (0.0f, abs (sin (nn * 3)) * 80.0f, 0.0f)); //fig2.RotateBone (BONE_LELBOW, glVector (0.0f, 0.0f, abs (cos (nn * 2)) * 90.0f)); fig2.RotateBone (BONE_LWRIST, glVector (0.0f, abs (cos (nn * 2)) * 90.0f, 0.0f)); //fig2.RotateBone (BONE_RHIP, glVector (sin (nn) * 25.0f, 0.0f, 0.0f)); //fig2.RotateBone (BONE_RKNEE, glVector (-abs (cos (nn * 2) * 45.0f), 0.0f, 0.0f)); /* for (unsigned i = 0; i < anim._frame[frame].joint.size (); i++) { //if (anim._frame[frame].joint[i].id > BONE_PELVIS) fig.RotateBone (anim._frame[frame].joint[i].id, anim._frame[frame].joint[i].rotation); } */ if (stand) { //fig.Animate (&anim_stand, nn); //fig2.Animate (&anim_stand, nn); } else { //fig.Animate (&anim, nn); //fig2.Animate (&anim, nn); } frame++; //frame %= anim._frame.size (); //fig.Update (); //fig2.Update (); if (InputKeyPressed (SDLK_f)) { fig.PositionSet (AvatarPosition () + glVector (0.0f, -2.0f, 0.0f)); fig2.PositionSet (AvatarPosition () + glVector (0.0f, 2.0f, 0.0f)); } if (InputKeyPressed (SDLK_g)) moveit = !moveit; if (InputKeyPressed (SDLK_h)) stand = !stand; glBindTexture (GL_TEXTURE_2D, 0); //glDisable (GL_LIGHTING); //fig.Render (); //fig2.Render (); //glEnable (GL_LIGHTING); }
int SFKeyPressed(lua_State* l) { int key = lua_tonumber(Scripts.vm, 1); if (InputKeyPressed(key)) { lua_pushboolean(Scripts.vm, 1); } else { lua_pushboolean(Scripts.vm, 0); } return 1; }
SQInteger SFKeyPressed(HSQUIRRELVM v) { int key; sq_getinteger(Scripts.vm, 2, &key); if (InputKeyPressed(key)) { sq_pushbool(Scripts.vm, SQTrue); } else { sq_pushbool(Scripts.vm, SQFalse); } return 1; }