Original Post
Hello.
My problem is c++ related on my lack of knowlage.
I have a fT whic i use for Timed Movment. In function Main::ActionHandle() i call the calculation where problem ocures.
when i blit HeroCropF(float) and Position(float) should be same right? i use same calculations and values. But "Position" changes while "HeroCropF" stay 0.
il post whole code if this isent enought but i got just bacis SDL Event/Render only.
Edit: Btw Position changes for 4 Pixels per second, so should the HeroCropF but it dosent... Ani value with Position works perfect.
Edit2: I changed this:
TO THIS!!!:
And now it works. So the error is Passed "fT" value ? wtf can som1 explain the error there
My problem is c++ related on my lack of knowlage.
I have a fT whic i use for Timed Movment. In function Main::ActionHandle() i call the calculation where problem ocures.
when i blit HeroCropF(float) and Position(float) should be same right? i use same calculations and values. But "Position" changes while "HeroCropF" stay 0.
il post whole code if this isent enought but i got just bacis SDL Event/Render only.
int Main::MainStart()
{
if(Init() == false || Load() == false)
{
Exit();
return -1;
}
SDL_Event ImpEvent;
while(Running)
{
oT = cT;
cT = SDL_GetTicks();
fT = (cT - oT) / 1000.0f;
FpsTimer = SDL_GetTicks();
while(SDL_PollEvent(&ImpEvent))
{
EventHandle(&ImpEvent);
}
ActionHandle();
RenderHandle();
if(1000.0f / Screen_FPS > (SDL_GetTicks() - FpsTimer))
SDL_Delay(1000.0f / Screen_FPS - (SDL_GetTicks()- FpsTimer));
}
Exit();
return 0;
}
float Main::ReturnfT()
{
return fT;
}
void Main::ActionHandle(
{
Hero::HeroControl.AnimateHero();
Position += 4.0f * fT;
}
void Hero::AnimateHero()
{
HeroCropF += 4.0f * Main::MainControl.ReturnfT();
}
Edit: Btw Position changes for 4 Pixels per second, so should the HeroCropF but it dosent... Ani value with Position works perfect.
Edit2: I changed this:
void Main::ActionHandle(
{
Hero::HeroControl.AnimateHero();
Position += 4.0f * fT;
}
TO THIS!!!:
void Main::ActionHandle(
{
Hero::HeroControl.HeroPosF += 4.0f * fT;
Position += 4.0f * fT;
}
And now it works. So the error is Passed "fT" value ? wtf can som1 explain the error there