mirror of https://github.com/bjornbytes/lovr.git
Animator:seek; Animator:tell;
This commit is contained in:
parent
23b4750e9c
commit
748c467b1c
|
@ -42,6 +42,22 @@ int l_lovrAnimatorResume(lua_State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int l_lovrAnimatorSeek(lua_State* L) {
|
||||
Animator* animator = luax_checktype(L, 1, Animator);
|
||||
const char* animation = luaL_checkstring(L, 2);
|
||||
float time = luaL_checknumber(L, 3);
|
||||
lovrAnimatorSeek(animator, animation, time);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int l_lovrAnimatorTell(lua_State* L) {
|
||||
Animator* animator = luax_checktype(L, 1, Animator);
|
||||
const char* animation = luaL_checkstring(L, 2);
|
||||
float time = lovrAnimatorTell(animator, animation);
|
||||
lua_pushnumber(L, time);
|
||||
return 1;
|
||||
}
|
||||
|
||||
const luaL_Reg lovrAnimator[] = {
|
||||
{ "getAnimationCount", l_lovrAnimatorGetAnimationCount },
|
||||
{ "update", l_lovrAnimatorUpdate },
|
||||
|
@ -49,5 +65,7 @@ const luaL_Reg lovrAnimator[] = {
|
|||
{ "stop", l_lovrAnimatorStop },
|
||||
{ "pause", l_lovrAnimatorPause },
|
||||
{ "resume", l_lovrAnimatorResume },
|
||||
{ "seek", l_lovrAnimatorSeek },
|
||||
{ "tell", l_lovrAnimatorTell },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
|
|
@ -68,3 +68,13 @@ void lovrAnimatorResume(Animator* animator, const char* animation) {
|
|||
Track* track = lovrAnimatorEnsureTrack(animator, animation);
|
||||
track->playing = true;
|
||||
}
|
||||
|
||||
void lovrAnimatorSeek(Animator* animator, const char* animation, float time) {
|
||||
Track* track = lovrAnimatorEnsureTrack(animator, animation);
|
||||
track->time = time;
|
||||
}
|
||||
|
||||
float lovrAnimatorTell(Animator* animator, const char* animation) {
|
||||
Track* track = lovrAnimatorEnsureTrack(animator, animation);
|
||||
return track->time;
|
||||
}
|
||||
|
|
|
@ -29,3 +29,5 @@ void lovrAnimatorPlay(Animator* animator, const char* animation);
|
|||
void lovrAnimatorStop(Animator* animator, const char* animation);
|
||||
void lovrAnimatorPause(Animator* animator, const char* animation);
|
||||
void lovrAnimatorResume(Animator* animator, const char* animation);
|
||||
void lovrAnimatorSeek(Animator* animator, const char* animation, float time);
|
||||
float lovrAnimatorTell(Animator* animator, const char* animation);
|
||||
|
|
Loading…
Reference in New Issue