C ++ на iOS — ошибка EXC_BAD_ACCESS для доступа к переменной области класса

Я не могу получить доступ к переменной curWaitTime в методе draw (…), она вылетает с ошибкой EXC_BAD_ACCESS. Он даже не выделяется динамически!

#include <string>
#include "ofMain.h"#include "Colour.h"#include "ColourScheme.h"
#define NOTIFICATION_TEXT_SIZE          60
#define NOTIFICATION_FADE_OUT_TIME      2

class Notification {
private:
char *text;
float curWaitTime;

void setGlColour( Colour *colourScheme, int colourType, float alphaPercentage ) {
glColor4f( colourScheme[colourType].r,
colourScheme[colourType].g,
colourScheme[colourType].b,
colourScheme[colourType].a * alphaPercentage );
}

public:
float screenWidth, screenHeight;

Notification( const char *_text, float width, float height  ) {
text = new char[255];
strcpy(text, _text);
screenWidth = width;
screenHeight = height;
curWaitTime = NOTIFICATION_FADE_OUT_TIME;
NSLog(@"Notification created!");
}

~Notification() {
delete text;
}

bool draw( Colour *colourScheme, ofTrueTypeFont *font, float deltaTime ) {
// update timer
curWaitTime -= deltaTime;
if( curWaitTime <= 0.f ) {
return false;
}

//draw
setGlColour( colourScheme, COLOUR_BACKGROUND_COL3, curWaitTime / NOTIFICATION_FADE_OUT_TIME );
font->drawString(text, screenWidth/2 - (font->stringWidth(text)/2), screenHeight/2);

return true;
}
};

Это действительно смущает меня, это нормально работает. Есть идеи? Я использую XCode и кодирование для iOS с OpenFrameworks

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector