Trouble creating pointer to abstract class

58 views Asked by At

I coded some smiley faces into my app recently, but I'm having trouble calling it in my option interface. The reason I'm wanting to call it from optioninterface is I want to add 2 sets of emojis, and if the value of Setting.nEmoji is 0 or 1 call a different set. The function loademojis() gets called when the application starts (it's technically coded in the interface solution). I can call it from a function that handles user input, but it generated horrible lag, I assume because each time a letter was typed, it cleared the array and loaded the emojis in again. So long story short, I was wondering if there's any way at all to create a pointer to a abstract class so I could call this from my option menu. Everytime I create a pointer and call it from theoption menu it crashes. Here's how I'm creating the pointer

MDrawContext* pDC

void MDrawContext::LoadEmojis()
{
    if (Z_VIDEO_EMOJIS == 1)
    {
        m_Emoji[";)"] = "wink.png";
        m_Emoji[":)"] = "smile.png";
        m_Emoji[":D"] = "biggrin.png";
        m_Emoji[":("] = "frown.png";
        m_Emoji[":O"] = "eek.png";
        m_Emoji[":P"] = "tongue.png";
        m_Emoji[":?"] = "confused.png";
        m_Emoji[":4"] = "cool.png";
        m_Emoji[":3"] = "redface.png";
        m_Emoji[":@"] = "mad.png";
        m_Emoji[":I"] = "rolleyes.png";
        m_Emoji[":K"] = "kappa.png";
    }
    else
    {
        m_Emoji[";)"] = "wink2.png";
        m_Emoji[":)"] = "smile2.png";
        m_Emoji[":D"] = "biggrin2.png";
        m_Emoji[":("] = "frown2.png";
        m_Emoji[":O"] = "eek2.png";
        m_Emoji[":P"] = "tongue2.png";
    }
}
//custom: reloademojis allows players to choose between ios/forum emojis
void MDrawContext::ReloadEmojis()
{
    m_Emoji[";)"].clear();
    m_Emoji[":)"].clear();
    m_Emoji[":D"].clear();
    m_Emoji[":("].clear();
    m_Emoji[":O"].clear();
    m_Emoji[":P"].clear();
    m_Emoji[":?"].clear();
    m_Emoji[":4"].clear();
    m_Emoji[":3"].clear();
    m_Emoji[":@"].clear();
    m_Emoji[":I"].clear();
    m_Emoji[":K"].clear();
    LoadEmojis();
}
//Calling the pointer (different cpp)
    int nEmojiType = 0;
if(nEmojiType != Z_VIDEO_EMOJI)
{
  pDC->ReloadEmojis();
  nEmojiType = Z_VIDEO_EMOJI;
}
0

There are 0 answers