difficultés avec un objet timer
bonjour bonjour,
aujourd'hui, pb de timer :
j'ai le code suivant :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
class timer{
#include <allegro.h>
#include <time.h>
// Member Variables
private:
protected:
static timer* m_ptimer;
int m_iTarget_Cycle;
int m_iLast_fps;
int m_iFrame_Counter;
int m_iActual_Cycle;
void m_vtarget_incrementor();
void m_vCount_Frames();
public:
timer();
virtual ~timer();
} |
et :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| #include "timer.h"
timer *timer::m_ptimer = NULL;
timer::timer(){
install_timer();
LOCK_VARIABLE(m_iTarget_Cycle);
LOCK_VARIABLE(m_iLast_fps);
LOCK_VARIABLE(m_iFrame_Counter);
LOCK_FUNCTION(m_vtarget_incrementor);
LOCK_FUNCTION(m_vCount_Frames);
install_int_ex(m_vtarget_incrementor, BPS_TO_TIMER(60));
install_int_ex(m_vCount_Frames, BPS_TO_TIMER(1));
m_iActual_Cycle = 0;
m_iTarget_Cycle = 0;
}
timer::~timer(){
}
void timer::m_vtarget_incrementor()
{
m_iTarget_Cycle++;
};
void timer::m_vCount_Frames()
{
m_iLast_fps = m_iFrame_Counter;
m_iFrame_Counter = 0;
}; |
a la compile, le pb est le suivant :
Code:
1 2 3
| timer.cpp||In constructor `timer::timer()':|
\timer.cpp|25|error: argument of type `void (timer::)()' does not match `void (*)()'|
timer.cpp|26|error: argument of type `void (timer::)()' does not match `void (*)()'| |
je piges pas comment utiliser install_int_ex()
ou plutôt, comment lui renvoyer le bon type de variable
qq a t'il une idée sur la question?
merci d'avance