Having a constructor such as the following:
Text::Text(std::string textImage)
{
image = agk::LoadImage((char*)textImage.c_str());
agkText = agk::CreateText("Hello World!");
agk::SetTextFontImage(agkText, image);
agk::SetTextSize(agkText, 24);
}
That causes the app to crash with the following error:
Quote: "Unhandled exception at 0x010FFC04 in Template.exe: 0xC0000005: Access violation reading location 0x00000004."
But making the following function:
void Text::Setup(std::string textImage)
{
image = agk::LoadImage((char*)textImage.c_str());
agkText = agk::CreateText("Hello World!");
agk::SetTextFontImage(agkText, image);
agk::SetTextSize(agkText, 24);
}
Works if I create the object and THEN call the Setup function. It crashes if I try to call Setup through the constructor.
Is there any reason for this?