I created a moveable text window. It works fine till text is added and the game lags out for a split second. With alot of text coming across, my game lags so much it is unplayable
This code adds text to the window.
void graphWindowScreenDisplay()
{
if (graphWindowShow)
{
graphWindowChange = false;
int ImageNumber = 5;
if (Dire3DTextures[ImageNumber] != 0) dbDeleteImage(ImageNumber);
Dire3DTextures[ImageNumber] = -1;
dbSetTextSize(graphWindowTextSize);
dbSetImageColorKey(255, 0, 255);
DWORD dWindow = dbRGB(graphWindowColor1, graphWindowColor2, graphWindowColor3);
DWORD dWindowTextA = dbRGB(graphWindowColorTextA1, graphWindowColorTextA2, graphWindowColorTextA3);
DWORD dWindowTextB = dbRGB(graphWindowColorTextB1, graphWindowColorTextB2, graphWindowColorTextB3);
DWORD dWindowTextC = dbRGB(graphWindowColorTextC1, graphWindowColorTextC2, graphWindowColorTextC3);
dbCreateBitmap(1, graphWindowWidth, graphWindowHeight);
dbSetCurrentBitmap(1);
dbInk(dWindow, dWindow);
dbBox(0, 0, graphWindowWidth, graphWindowHeight);
int b = 0;
string sInfo = "";
char * cInfo;
for (int a = 0; a < graphMaxWindowTextLines; a++)
{
sInfo = graphWindowTexts[a];
if (sInfo[0] == 'A' && graphChatSystemToggle)
{
sInfo[0] = ' ';
dbInk(dWindowTextA, dWindow); // Server
cInfo = &sInfo[0];
dbText(1, 1 + (b * graphWindowLineSpacing), cInfo);
b++;
}
if (sInfo[0] == 'B' && graphChatRPToggle)
{
sInfo[0] = ' ';
dbInk(dWindowTextB, dWindow); // Chat Channel 1
cInfo = &sInfo[0];
dbText(1, 1 + (b * graphWindowLineSpacing), cInfo);
b++;
}
if (sInfo[0] == 'C' && graphChatOOCToggle)
{
sInfo[0] = ' ';
dbInk(dWindowTextC, dWindow); // Chat Channel 2
sInfo = " 2:" + sInfo;
cInfo = &sInfo[0];
dbText(1, 1 + (b * graphWindowLineSpacing), cInfo);
b++;
}
}
dbGetImage(ImageNumber, 0, 0, graphWindowWidth, graphWindowHeight);
dbSetCurrentBitmap(0);
dbPasteImage(ImageNumber, graphWindowX, graphWindowY, 1);
dbSetTextSize(graphTextSize);
}
}
Anyone recommend a different approach to this?