To jest funkcja licząca FPS:
char FPS(int iklatek, int time)
{
stringstream ss(FPS);
string FPString = ss.str();
char * board = new char[FPString.length()];
for(int i = 0; i < FPString.length(); i++) {
board[i] = FPString[i];
if(Time(time) == 1) DrawString(100, 100, board);
}
Jednak gdy próbuje skompilować kod to mam następujące błędy.
main.cpp(13): warning C4018: '<' : signed/unsigned mismatch
main.cpp(15): error C2664: 'DrawString' : cannot convert parameter 3 from 'char' to 'char *' // <-jak to zrobić
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
error C2601: 'Display' : local function definitions are illegal
main.cpp(9): this line contains a '{' which has not yet been matched // cala masa błędów z klamrami nie wiem czemu
C2601: 'Reshape' : local function definitions are illegal
main.cpp(9): this line contains a '{' which has not yet been matched
error C2601: 'Keyboard' : local function definitions are illegal
main.cpp(9): this line contains a '{' which has not yet been matched
error C2601: 'SpecialKeys' : local function definitions are illegal
main.cpp(9): this line contains a '{' which has not yet been matched
error C2601: 'Menu' : local function definitions are illegal
main.cpp(9): this line contains a '{' which has not yet been matched
error C2601: 'main' : local function definitions are illegal
main.cpp(9): this line contains a '{' which has not yet been matched
fatal error C1075: end of file found before the left brace '{' at main.cpp(9)' was matched
A jeśli chodzi o ten twój sposób to go zaraz wypróbuje.
Na początku/końcu pętli
- to miałbym kod umieścić w głównej funkcji czy funkcji rysującej scenę 3D ???
fFPSTime = 0.0f;
Dlaczego zmienna fFPSTime ma wartość 0.0f ???