Thought this would help other new at darkgdk like me. Requires CodeGeneration:RuntimeLibrary set to /MT since I used "include<string>".
#include "DarkGDK.h"
#include <string>
using namespace std;
void TagAvatar(string sName, string sNation, int iPlayStyle, int iImageNumber)
{
int iNameLen = sName.length();
int iNationLen = sNation.length();
if (iNameLen < 22)
{
while(iNameLen < 22)
{
sName = " " + sName + " ";
iNameLen = sName.length();
}
}
if (iNameLen < iNationLen)
{
while(iNameLen < iNationLen)
{
sName = " " + sName + " ";
iNameLen = sName.length();
}
}
else if (iNameLen > iNationLen)
{
while(iNameLen > iNationLen)
{
sNation = " " + sNation + " ";
iNationLen = sNation.length();
}
}
DWORD dStyle = dbRGB(250, 250, 0);
if (iPlayStyle == 1) dStyle = dbRGB(250, 0, 0); // Red
if (iPlayStyle == 2) dStyle = dbRGB(250, 250, 0); // Yellow
if (iPlayStyle == 3) dStyle = dbRGB(0, 250, 250); // Blue
if (iPlayStyle == 4) dStyle = dbRGB(150, 250, 150); // Green
char *Message;
Message = &sName[0];
char *Message1;
Message1 = &sNation[0];
dbCreateBitmap(1, 275, 30);
dbSetCurrentBitmap(1);
dbInk(dbRGB(255, 0, 255), dbRGB(255, 0, 255));
dbBox(0, 0, 275, 30);
dbSetImageColorKey(255, 0, 255);
dbInk(dStyle, dbRGB(255, 0, 255));
dbText(50, 2, Message);
dbText(50, 13, Message1);
dbGetImage(iImageNumber, 0, 0, 275, 30);
dbDeleteMemblock(1);
dbSetCurrentBitmap(0);
return;
}
void DarkGDK(void)
{
dbColorBackdrop(dbRGB(0, 0, 0));
TagAvatar("John Doe", "(101st Airborne)", 4, 5);
float x = 1;
float y = 1;
float z = 1;
dbMakeObjectPlain(1, 10, 3);
dbTextureObject(1, 5);
dbSetObjectTransparency(1, 2);
dbPositionObject(1, x, y, z);
dbSyncOn();
dbSyncRate(60);
while ( LoopGDK ( ) )
{
if(dbKeyState(17)) dbMoveCamera(0, 1); // move camera with WASD
if(dbKeyState(31)) dbMoveCamera(0, -1);
if(dbKeyState(30)) dbMoveCameraLeft(0, 1);
if(dbKeyState(32)) dbMoveCameraRight(0, 1);
dbSync();
}
return;
}