Panel użytkownika
Nazwa użytkownika:
Hasło:
Nie masz jeszcze konta?

Expression have must class type

Ostatnio zmodyfikowano 2012-08-17 09:15
Autor Wiadomość
yoogi
Temat założony przez niniejszego użytkownika
Expression have must class type
» 2012-08-17 09:15:23
C/C++
#ifndef FramePerSecond_h
#define FramePerSecond_h

#include <time.h>

class FramePerSecond {
public:
    FramePerSecond();
    void Add();
    int GetIntValue();
private:
    clock_t starttime;
    int fpsValue;
    int temp;
};

#endif

C/C++
#include "FramePerSecond.h"

FramePerSecond::FramePerSecond()
{
    starttime = clock() + 1.00 * CLOCKS_PER_SEC;
    fpsValue = 0;
    temp = 0;
}

void FramePerSecond::Add()
{
    if( clock() < starttime )
         temp++;
    else
    {
        fpsValue = temp;
        temp = 0;
        starttime = clock() + 1.00 * CLOCKS_PER_SEC;
    }
}

int FramePerSecond::GetIntValue()
{
    return fpsValue;
}

Help! :)



#edit
durny błąd, zamiast
FramePerSecond fps;
 pisałem
FramePerSecond fps();
P-62721
« 1 »
  Strona 1 z 1