Here is Timidon's Gui
this is the "include" file
// Varibles
#define nGuiMaxMessages 40 // Max Gui Messages
#define gMaxButtons 3000 // Max Buttons on Screen at one time
struct button
{
int nButtonID; // This is the "Active" if 0 then it's empty
int nButtonChar; // ASCII
int nButtonType; // Refrence for Button - IE What will be returned and proccessed
int nPosX1;
int nPosY1;
int nPosX2;
int nPosY2;
int nOverLayXAdjust; // This is for fixing the "slide" on the buttons with overlay icons
int nOverLayYAdjust; // This is for fixing the "slide" on the buttons with overlay icons
int nBaseImage; // My buttons will use a base bottem graphic and another placed ontop
int nOverlayImage;
int nHoverImage;
int nParm1; // Additional Paramaters added "AFTER" the button has been created
int nParm2; // should hold addtional infromation such as what ship player extra..
int nParm3;
int nParm4;
char sToolTip[256]; // no more than 256 chars for a tool tip
} oButton[gMaxButtons];
struct GuiInput
{
int nCapLocks;
int nLastKeyHit;
} oGuiInput;
//
struct GuiGlobal
{
int nMouseX;
int nMouseXStored;
int nMouseY;
int nMouseYStored;
int nButtonType;
int nMouseButtonsUsed;
int nButtonClicked;
int nMouseButtonClicked;
int nButtonLastTime;
int nButtonHover; // What Button is the system currently hovering over?
int nMenuSpecial1;
int nMenuSpecial2;
int nMenuSpecial3;
int nMenuSpecial4;
int nMouseImageAttatch;
char sText[256];
int nTextEntryExitCommand;
int nMessageWindow[40];
int nMessageListIndex;
int nMessageListMax;
int nDebugButtonID;
int nTextEnteryMode;
int nKBTimerNextEvent;
int nTouchScreen; // For those with Touch Screens
int nStartUp; // for Startup Flag does something special for Text Feed back, you can code what you want for this
int nGuiExit;
} oGuiGlobal;
struct GuiMessageSystem
{
char sMessage[256];
} oGuiMessageSystem[nGuiMaxMessages];
struct StartUpText
{
char sText[256];
} oGuiStartUpText[25];
void gui_GuiLoadGui_Elements(char sBaseName[256],int nStartImage);
void gui_GuiLoadGui_AudioWave(char sBaseName[256],int nStartSoundID);
void gui_GuiLoadGui_3dSound(char sBaseName[256],int nStartSoundID);
void gui_GuiLoadGui_AudioMP3(char sBaseName[256],int nStartSoundID);
void gui_OverLay();
// Gui Elements
int gui2_Window(int nStartX,int nStartY, int nModX, int nModY, int nLengthX, int nLengthY, int nParm1, int nParm2, int nParm3,int nParm4, char sName[256]);
//
void gui_RegisterButton(int fnButtonID,int fnButtonChar, int fnButtonType, int fnPosX1, int fnPosY1,int fnPosX2, int fnPosY2, int fnBaseImage, int fnOverlayImage, int fnHoverImage, char fsToolTip[256]);
int gui_AddNewButton(int fnButtonChar, int fnButtonType, int fnPosX1, int fnPosY1,int fnPosX2, int fnPosY2, int fnBaseImage, int fnOverlayImage, int fnHoverImage, char fsToolTip[256]);
void gui_UnregisterButton(int fnButtonID);
void gui_DisplayToolTip(int fnButtonID);
void gui_SetButtonParm(int fnButtonID, int fnParm, int fnVarible);
int gui_GetButtonParm(int fnButtonID, int fnParm);
void gui_PlaceButton(int fnBaseImage, int fnOverlayImage, int fnPosX, int fnPosY, int fnAdjustX, int fnAdjustY);
void gui_UpdateButtons(void);
void gui_MouseTagImage(int nMouseImage);
void gui_EnterText(int nPosX, int nPosY,int nMaxField);
void gui_TextField(int fnLength, int fnPosX, int fnPosY);
void gui_TextFieldwText(int fnLength, int fnPosX, int fnPosY, char fsText[256]);
void gui_FlushButtons(void);
int gui_GetButtonX1Corner(int fnButtonID); // returns "X" of upper left corner
int gui_GetButtonY1Corner(int fnButtonID); // returns "Y" of upper left corner
//
void gui_MessageWindow(char sText[256]);
//
void gui_DebugMouse();
void gui_DebugWindow(char sText[256]);
// Specail Loading Window
void gui_StartUpScroll(char sText[256]);
//
void gui_SetInkColor(int nColor);
// ---------------------------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------------------------
void gui_GuiLoadGui_Elements(char sBaseName[256],int nStartImage)
{
// -----------------------------------------------------------------------------------------
int nBreak = 0;
int nImage_ID = nStartImage;
int nCount = nStartImage;
// Get Varibles Needed to Load Files
static char mmpSCFileName[MAX_PATH];
static char sText[256];
// -----------------------------------------------------------------------------------------
while (nBreak==0)
{
strcpy(mmpSCFileName,"");
// Set Directory
strcat(mmpSCFileName, dbGetDir()); //sBaseName
strcat(mmpSCFileName,"\hak\gui\");
strcat(mmpSCFileName,sBaseName);
// Set New File
strcat(mmpSCFileName,dbStr(nCount));
strcat(mmpSCFileName,".png");
// debug dbText(32,200+(nCount*10),mmpSCFileName);
// Search the "Hak" directory first
if (dbFileExist(mmpSCFileName)==1)
{
dbLoadImage(mmpSCFileName,nImage_ID,1);
nImage_ID++;
}
else
{
// if the "hak" file is not there then look for it in the regular dir
strcpy(mmpSCFileName,"");
// Set Directory
strcat(mmpSCFileName, dbGetDir()); //sBaseName
strcat(mmpSCFileName,"\media\gui\");
strcat(mmpSCFileName,sBaseName);
// Set New File
strcat(mmpSCFileName,dbStr(nCount));
strcat(mmpSCFileName,".png");
if (dbFileExist(mmpSCFileName)==1)
{
dbLoadImage(mmpSCFileName,nImage_ID,1);
nImage_ID++;
}
else
{
nBreak = 1; // exit Loop
}
// This is Specific for the game
}
if (oGuiGlobal.nStartUp==1)
{
strcpy(sText,sBaseName);
strcat(sText," ");
strcat(sText,dbStr(nCount));
gui_StartUpScroll(sText);
}
nCount++;
}
// -----------------------------------------------------------------------------------------
}
void gui_GuiLoadGui_AudioWave(char sBaseName[256],int nStartSoundID)
{
// -----------------------------------------------------------------------------------------
int nBreak = 0;
int nSound_ID = nStartSoundID;
int nCount = nStartSoundID;
// Get Varibles Needed to Load Files
static char mmpSCFileName[MAX_PATH];
static char sText[256];
// -----------------------------------------------------------------------------------------
while (nBreak==0)
{
strcpy(mmpSCFileName,"");
// Set Directory
strcat(mmpSCFileName, dbGetDir()); //sBaseName
strcat(mmpSCFileName,"\hak\audio\");
strcat(mmpSCFileName,sBaseName);
// Set New File
strcat(mmpSCFileName,dbStr(nCount));
strcat(mmpSCFileName,".wav");
// Search the "Hak" directory first
if (dbFileExist(mmpSCFileName)==1)
{
dbLoadSound (mmpSCFileName,nSound_ID);
nSound_ID++;
}
else
{
// if the "hak" file is not there then look for it in the regular dir
strcpy(mmpSCFileName,"");
// Set Directory
strcat(mmpSCFileName, dbGetDir()); //sBaseName
strcat(mmpSCFileName,"\media\audio\");
strcat(mmpSCFileName,sBaseName);
// Set New File
strcat(mmpSCFileName,dbStr(nCount));
strcat(mmpSCFileName,".wav");
if (dbFileExist(mmpSCFileName)==1)
{
dbLoadSound (mmpSCFileName,nSound_ID);
nSound_ID++;
}
else
{
nBreak = 1; // exit Loop
}
}
if (oGuiGlobal.nStartUp==1)
{
strcpy(sText,sBaseName);
strcat(sText," ");
strcat(sText,dbStr(nCount));
gui_StartUpScroll(sText);
}
nCount++;
}
// -----------------------------------------------------------------------------------------
}
void gui_GuiLoadGui_3dSound(char sBaseName[256],int nStartSoundID)
{
// -----------------------------------------------------------------------------------------
int nBreak = 0;
int nSound_ID = nStartSoundID;
int nCount = nStartSoundID;
// Get Varibles Needed to Load Files
static char mmpSCFileName[MAX_PATH];
static char sText[256];
// -----------------------------------------------------------------------------------------
while (nBreak==0)
{
strcpy(mmpSCFileName,"");
// Set Directory
strcat(mmpSCFileName, dbGetDir()); //sBaseName
strcat(mmpSCFileName,"\hak\audio\");
strcat(mmpSCFileName,sBaseName);
// Set New File
strcat(mmpSCFileName,dbStr(nCount));
strcat(mmpSCFileName,".wav");
// Search the "Hak" directory first
if (dbFileExist(mmpSCFileName)==1)
{
dbLoad3DSound (mmpSCFileName,nSound_ID);
nSound_ID++;
}
else
{
// if the "hak" file is not there then look for it in the regular dir
strcpy(mmpSCFileName,"");
// Set Directory
strcat(mmpSCFileName, dbGetDir()); //sBaseName
strcat(mmpSCFileName,"\media\audio\");
strcat(mmpSCFileName,sBaseName);
// Set New File
strcat(mmpSCFileName,dbStr(nCount));
strcat(mmpSCFileName,".wav");
if (dbFileExist(mmpSCFileName)==1)
{
dbLoad3DSound (mmpSCFileName,nSound_ID);
nSound_ID++;
}
else
{
nBreak = 1; // exit Loop
}
}
if (oGuiGlobal.nStartUp==1)
{
strcpy(sText,sBaseName);
strcat(sText," ");
strcat(sText,dbStr(nCount));
gui_StartUpScroll(sText);
}
nCount++;
}
// -----------------------------------------------------------------------------------------
}
void gui_GuiLoadGui_AudioMP3(char sBaseName[256],int nStartSoundID)
{
// -----------------------------------------------------------------------------------------
int nBreak = 0;
int nSound_ID = nStartSoundID;
int nCount = nStartSoundID;
// Get Varibles Needed to Load Files
static char mmpSCFileName[MAX_PATH];
static char sText[256];
// -----------------------------------------------------------------------------------------
while (nBreak==0)
{
strcpy(mmpSCFileName,"");
// Set Directory
strcat(mmpSCFileName, dbGetDir()); //sBaseName
strcat(mmpSCFileName,"\hak\audio\");
strcat(mmpSCFileName,sBaseName);
// Set New File
strcat(mmpSCFileName,dbStr(nCount));
strcat(mmpSCFileName,".mp3");
// Search the "Hak" directory first
if (dbFileExist(mmpSCFileName)==1)
{
dbLoadMusic (mmpSCFileName,nSound_ID);
nSound_ID++;
}
else
{
// if the "hak" file is not there then look for it in the regular dir
strcpy(mmpSCFileName,"");
// Set Directory
strcat(mmpSCFileName, dbGetDir()); //sBaseName
strcat(mmpSCFileName,"\media\audio\");
strcat(mmpSCFileName,sBaseName);
// Set New File
strcat(mmpSCFileName,dbStr(nCount));
strcat(mmpSCFileName,".mp3");
if (dbFileExist(mmpSCFileName)==1)
{
dbLoadMusic (mmpSCFileName,nSound_ID);
nSound_ID++;
}
else
{
nBreak = 1; // exit Loop
}
}
if (oGuiGlobal.nStartUp==1)
{
strcpy(sText,sBaseName);
strcat(sText," ");
strcat(sText,dbStr(nCount));
gui_StartUpScroll(sText);
}
nCount++;
}
// -----------------------------------------------------------------------------------------
}
// Place Buttomn
//
//
void gui_ButtonOverlayAdjust(int fnButtonID, int fnXadjust, int fnYadjust)
{
oButton[fnButtonID].nOverLayXAdjust = fnXadjust;
oButton[fnButtonID].nOverLayYAdjust = fnYadjust;
}
// Adds a new Button as a Specific one
void gui_RegisterButton(int fnButtonID,int fnButtonChar, int fnButtonType, int fnPosX1, int fnPosY1,int fnPosX2, int fnPosY2, int fnBaseImage, int fnOverlayImage, int fnHoverImage, char fsToolTip[256])
{
oButton[fnButtonID].nButtonID = 1;
oButton[fnButtonID].nBaseImage = fnBaseImage;
oButton[fnButtonID].nButtonChar = fnButtonChar;
oButton[fnButtonID].nButtonType = fnButtonType;
oButton[fnButtonID].nHoverImage = fnHoverImage;
oButton[fnButtonID].nOverlayImage = fnOverlayImage;
oButton[fnButtonID].nPosX1 = fnPosX1;
oButton[fnButtonID].nPosX2 = fnPosX2;
oButton[fnButtonID].nPosY1 = fnPosY1;
oButton[fnButtonID].nPosY2 = fnPosY2;
oButton[fnButtonID].nOverLayXAdjust = 0;
oButton[fnButtonID].nOverLayYAdjust = 0;
oButton[fnButtonID].nParm1 = 0;
oButton[fnButtonID].nParm2 = 0;
oButton[fnButtonID].nParm3 = 0;
oButton[fnButtonID].nParm4 = 0;
// clean out string before use
strcpy(oButton[fnButtonID].sToolTip,"");
strcpy(oButton[fnButtonID].sToolTip,fsToolTip);
}
// Adds a new button to the Index
int gui_AddNewButton(int fnButtonChar, int fnButtonType, int fnPosX1, int fnPosY1,int fnPosX2, int fnPosY2, int fnBaseImage, int fnOverlayImage, int fnHoverImage, char fsToolTip[256])
{
int nResult = -1; // if there is a error then return "-1"
int fnButtonID = 999; // prime input
int nCounter = 0;
// Get Button ID - look for 1st avaible button
oGuiGlobal.nMouseButtonsUsed ++;
nCounter = oGuiGlobal.nMouseButtonsUsed;
fnButtonID = nCounter;
if (nCounter>gMaxButtons) return nResult; // The buttons are full! return -1;
//
// Run Button ID and Set up Button
//
nResult = fnButtonID;
gui_RegisterButton(fnButtonID, fnButtonChar, fnButtonType, fnPosX1, fnPosY1, fnPosX2, fnPosY2, fnBaseImage, fnOverlayImage, fnHoverImage, fsToolTip);
return nResult;
}
// Removes a Button
void gui_UnregisterButton(int fnButtonID)
{
oButton[fnButtonID].nBaseImage = 0;
oButton[fnButtonID].nButtonChar = 0;
oButton[fnButtonID].nButtonID = 0; // set above 0 for active
oButton[fnButtonID].nButtonType = 0;
oButton[fnButtonID].nHoverImage = 0;
oButton[fnButtonID].nOverlayImage = 0;
oButton[fnButtonID].nPosX1 = 0;
oButton[fnButtonID].nPosX2 = 0;
oButton[fnButtonID].nPosY1 = 0;
oButton[fnButtonID].nPosY2 = 0;
oButton[fnButtonID].nOverLayXAdjust = 0;
oButton[fnButtonID].nOverLayYAdjust = 0;
oButton[fnButtonID].nParm1 = 0;
oButton[fnButtonID].nParm2 = 0;
oButton[fnButtonID].nParm3 = 0;
oButton[fnButtonID].nParm4 = 0;
strcpy(oButton[fnButtonID].sToolTip, "");
}
// Flush Buttons
void gui_FlushButtons(void)
{
int nCounter;
oGuiGlobal.nMouseButtonsUsed = 0;
oGuiGlobal.nButtonType = 0; // Clear Command Buttons
for (nCounter = 0 ; nCounter<= gMaxButtons; nCounter++)
{
gui_UnregisterButton(nCounter);
}
}
// Check for ToolTip
// This only runs on a mouse check (over)
void gui_DisplayToolTip(int fnButtonID)
{
// Added temp Font Size will restore after used
int nFontSize = dbTextSize();
dbSetTextSize (12);
// need to set color here (want to use a light green)
int nX = dbMouseX()-32;
int nY = dbMouseY()-16;
dbText(nX,nY,oButton[fnButtonID].sToolTip);
// Restore Old Font Size
dbSetTextSize(nFontSize);
}
// Display Button "A" button to the screen
void gui_PlaceButton(int fnBaseImage, int fnOverlayImage, int fnPosX, int fnPosY, int fnAdjustX, int fnAdjustY)
{
if (dbImageExist(fnBaseImage))
{
dbPasteImage(fnBaseImage,fnPosX,fnPosY,1);
}
if (dbImageExist(fnOverlayImage))
{
dbPasteImage(fnOverlayImage,fnPosX+fnAdjustX,fnPosY+fnAdjustY,1);
}
}
// Set a Extra Paramater to a Button
void gui_SetButtonParm(int fnButtonID, int fnParm, int fnVarible)
{
switch(fnParm)
{
case(1): oButton[fnButtonID].nParm1 = fnVarible; break;
case(2): oButton[fnButtonID].nParm2 = fnVarible; break;
case(3): oButton[fnButtonID].nParm3 = fnVarible; break;
case(4): oButton[fnButtonID].nParm4 = fnVarible; break;
}
}
// Get a Paramater from a Button
int gui_GetButtonParm(int fnButtonID, int fnParm)
{
int nReturn = 0;
switch(fnParm)
{
case(1): nReturn = oButton[fnButtonID].nParm1; break;
case(2): nReturn = oButton[fnButtonID].nParm2; break;
case(3): nReturn = oButton[fnButtonID].nParm3; break;
case(4): nReturn = oButton[fnButtonID].nParm4; break;
}
return nReturn;
}
// Update Buttons on Screen
void gui_UpdateButtons(void)
{
int nCounter = 0;
int nButtonBaseImage = 0;
int nButtonOverlay = 0;
int nButtonHover = 0;
int nPosX1 = 0;
int nPosY1 = 0;
int nPosX2 = 0;
int nPosY2 = 0;
int nAdjustX = 0;
int nAdjustY = 0;
int nMouseX = dbMouseX();
int nMouseY = dbMouseY();
int nToolTipCheck = -1;
int nMouseClick = 0;
int nMenuCalled = 0;
int nTimeCur = 0;
int nTimeDelay = 500;
//
//
//
//
oGuiGlobal.nButtonHover = -1;
for (nCounter = 0; nCounter<=gMaxButtons; nCounter++)
{
// Found a Button!
if (oButton[nCounter].nButtonID>=1)
{
// Clear Varibles
// Get Button info
nButtonBaseImage = oButton[nCounter].nBaseImage;
nButtonOverlay = oButton[nCounter].nOverlayImage;
nButtonHover = oButton[nCounter].nHoverImage;
nPosX1 = oButton[nCounter].nPosX1;
nPosX2 = oButton[nCounter].nPosX2;
nPosY1 = oButton[nCounter].nPosY1;
nPosY2 = oButton[nCounter].nPosY2;
// Check for Button Hover, then replace for Overlay && Tool Tip Call
// Get the Highlighter & Mouse Clicker
if (nMouseX>nPosX1 && nMouseX<nPosX2)
{
if (nMouseY>nPosY1 && nMouseY<nPosY2)
{
if (nButtonHover >=1)
{
nButtonBaseImage = nButtonHover;
oGuiGlobal.nButtonHover = nCounter;
}
if (oButton[nCounter].sToolTip!="") nToolTipCheck = nCounter;
nMouseClick = dbMouseClick();
// Updated for Touch Screen
if (oGuiGlobal.nTouchScreen == 1)
{
if (oGuiGlobal.nMouseXStored != nMouseX && oGuiGlobal.nMouseYStored != nMouseY)
{
nMouseClick = 1;
oGuiGlobal.nMouseXStored = nMouseX;
oGuiGlobal.nMouseYStored = nMouseY;
}
}
if (nMouseClick>=1)
{
nMenuCalled = nCounter;
}
oGuiGlobal.nDebugButtonID = oButton[nCounter].nButtonType;
}
}
// adjust Button Overlay
if (nButtonOverlay >= 1)
{
nAdjustX = oButton[nCounter].nOverLayXAdjust;
nAdjustY = oButton[nCounter].nOverLayYAdjust;
}
// put button to screen
gui_PlaceButton(nButtonBaseImage, nButtonOverlay, nPosX1, nPosY1, nAdjustX, nAdjustY);
// check to display tool tip
}
}
//
// Tool Tip Over Buttons
//
if (nToolTipCheck >= 0) gui_DisplayToolTip(nToolTipCheck);
//
// Check for Mouse info
//
if (nMouseClick>=1)
{
// tell system that a legitame Mouse Click has been hit
nTimeCur = dbTimer();
if (oGuiGlobal.nButtonLastTime <= nTimeCur)
{
if (nMouseClick==1) // Left Click
{
oGuiGlobal.nButtonClicked = nMenuCalled ;
oGuiGlobal.nMouseButtonClicked = nMouseClick;
oGuiGlobal.nButtonType = oButton[nMenuCalled].nButtonType;
if (oGuiGlobal.nButtonType >=6 && oGuiGlobal.nButtonType<=9) nTimeDelay = 50;
oGuiGlobal.nButtonLastTime = nTimeCur + nTimeDelay; // Set Timer to Prevent Double Clicking
// dbText(dbMouseX(),dbMouseY(),dbStr(oButton[nMenuCalled].nButtonType));
}
}
}
//
// Check for KeyBoard;
// Check for Mouse Attach
if (oGuiGlobal.nMouseImageAttatch>0) gui_MouseTagImage(oGuiGlobal.nMouseImageAttatch);
//
}
// Place Overlay - This is the "Screen Overlay"
//
//
void gui_OverLay()
{
dbPasteImage(7,0,0,1);
}
//
// Mouse Debug
//
void gui_DebugMouse()
{
int nX = dbMouseX();
int nY = dbMouseY();
int nYpos = 8;
int nMaxX = dbScreenWidth();
int nMinX = nMaxX-(16*13);
char sText[256];
int nXpos = nMinX;
gui2_Window(0,0, nXpos, 8,11, 14, 0, 0, 0, 0,"Mouse Debug");
// X Pos
dbText(nMinX+16,16 * 2,"Mouse X:");
dbText(nMinX+16+(16*3.5),16 *2,dbStr(nX));
// Y Pos
dbText(nMinX+16,16 *3,"Mouse Y:");
dbText(nMinX+16+(16*3.5),16*3,dbStr(nY));
strcpy(sText,"Mouse Move X: ");
strcat(sText,dbStr(dbMouseMoveX()));
dbText(nMinX+16+(16*3.5),16*4,sText);
strcpy(sText,"Mouse Move Y: ");
strcat(sText,dbStr(dbMouseMoveY()));
dbText(nMinX+16+(16*3.5),16*5,sText);
strcpy(sText,"Mouse Move Z: ");
strcat(sText,dbStr(dbMouseMoveZ()));
dbText(nMinX+16+(16*3.5),16*6,sText);
/*
strcat(sText,", ");
strcat(sText,dbStr(nY));
strcat(sText,", Menu 1 Speical: ");
strcat(sText,dbStr(oGuiGlobal.nMenuSpecial1));
strcat(sText,", Button: ");
strcat(sText,dbStr(oGuiGlobal.nButtonClicked));
strcat(sText,", Buttons Used: ");
strcat(sText,dbStr(oGuiGlobal.nMouseButtonsUsed));
*/
}
void gui_MouseTagImage(int nMouseImage)
{
if (nMouseImage >= 1)
{
if (dbImageExist(nMouseImage))
{
dbPasteImage(nMouseImage,dbMouseX(),dbMouseY(),1);
}
}
}
void gui_EnterText(int nPosX, int nPosY,int nMaxField)
{
/* ** On 10/27/2007 ran into a error that caused the system to crash. The cause was that
I tried to copy the dbEntry() code into the oConfig.Text string before any character had
been entered into the system. Started after I on ODE text enter command #2.
*/
if (nMaxField<1) nMaxField = 40;
int nTimeCur = dbTimer();
int ch = dbScanCode();
int nShift = dbShiftKey();
char sKey[8];
int nPass = 0;
char sText[256];
dbSetTextSize (14);
// Clear sKey
strcpy(sKey,"");
if (nTimeCur >= oGuiGlobal.nButtonLastTime && ch>=1)
{
if (ch==14)
{
strcpy(oGuiGlobal.sText,"");
}
if (ch == 58)
{
oGuiInput.nCapLocks ++; if (oGuiInput.nCapLocks>1) oGuiInput.nCapLocks = 0;
}
{
if (dbShiftKey()==1) oGuiInput.nCapLocks ++; if (oGuiInput.nCapLocks>1) oGuiInput.nCapLocks = 0;
switch(ch)
{
case(2): strcpy(sKey,"1"); nPass=1;break;
case(3): strcpy(sKey,"2"); nPass=1;break;
case(4): strcpy(sKey,"3"); nPass=1;break;
case(5): strcpy(sKey,"4"); nPass=1;break;
case(6): strcpy(sKey,"5"); nPass=1;break;
case(7): strcpy(sKey,"6"); nPass=1;break;
case(8): strcpy(sKey,"7"); nPass=1;break;
case(9): strcpy(sKey,"8"); nPass=1;break;
case(10): strcpy(sKey,"9"); nPass=1;break;
case(11): strcpy(sKey,"0"); nPass=1;break;
case(12):
{
if (oGuiInput.nCapLocks==1) strcpy(sKey,"_");
else strcpy(sKey,"-");
nPass=1;
}
break; // Check for Shift Key for Under Score
case(13): strcpy(sKey,"+"); nPass=1; break;
case(16):
{
nPass=1;
if (oGuiInput.nCapLocks==1) strcpy(sKey,"Q");
else strcpy(sKey,"q");
}break;
case(17):
{
nPass=1;
if (oGuiInput.nCapLocks==1) strcpy(sKey,"W");
else strcpy(sKey,"w");
}break;
case(18):
{
nPass=1;
if (oGuiInput.nCapLocks==1) strcpy(sKey,"E");
else strcpy(sKey,"e");
}break;
case(19):
{
nPass=1;
if (oGuiInput.nCapLocks==1) strcpy(sKey,"R");
else strcpy(sKey,"r");
}break;
case(20):
{
nPass=1;
if (oGuiInput.nCapLocks==1) strcpy(sKey,"T");
else strcpy(sKey,"t");
}break;
case(21):
{
nPass=1;
if (oGuiInput.nCapLocks==1) strcpy(sKey,"Y");
else strcpy(sKey,"y");
}break;
case(22):
{
nPass=1;
if (oGuiInput.nCapLocks==1) strcpy(sKey,"U");
else strcpy(sKey,"u");
}break;
case(23):
{
nPass=1;
if (oGuiInput.nCapLocks==1) strcpy(sKey,"I");
else strcpy(sKey,"i");
}break;
case(24):
{
nPass=1;
if (oGuiInput.nCapLocks==1) strcpy(sKey,"O");
else strcpy(sKey,"o");
}break;
case(25):
{
nPass=1;
if (oGuiInput.nCapLocks==1) strcpy(sKey,"P");
else strcpy(sKey,"p");
}break;
case(26):
{
nPass=1;
if (oGuiInput.nCapLocks==1) strcpy(sKey,"{");
else strcpy(sKey,"[");
}break;
case(27):
{
nPass=1;
if (oGuiInput.nCapLocks==1) strcpy(sKey,"}");
else strcpy(sKey,"]");
}break;
case(30):
{
nPass=1;
if (oGuiInput.nCapLocks==1) strcpy(sKey,"A");
else strcpy(sKey,"a");
}break;
case(31):
{
nPass=1;
if (oGuiInput.nCapLocks==1) strcpy(sKey,"S");
else strcpy(sKey,"s");
}break;
case(32):
{
nPass=1;
if (oGuiInput.nCapLocks==1) strcpy(sKey,"D");
else strcpy(sKey,"d");
}break;
case(33):
{
nPass=1;
if (oGuiInput.nCapLocks==1) strcpy(sKey,"F");
else strcpy(sKey,"f");
}break;
case(34):
{
nPass=1;
if (oGuiInput.nCapLocks==1) strcpy(sKey,"G");
else strcpy(sKey,"g");
}break;
case(35):
{
nPass=1;
if (oGuiInput.nCapLocks==1) strcpy(sKey,"H");
else strcpy(sKey,"h");
}break;
case(36):
{
nPass=1;
if (oGuiInput.nCapLocks==1) strcpy(sKey,"J");
else strcpy(sKey,"j");
}break;
case(37):
{
nPass=1;
if (oGuiInput.nCapLocks==1) strcpy(sKey,"K");
else strcpy(sKey,"k");
}break;
case(38):
{
nPass=1;
if (oGuiInput.nCapLocks==1) strcpy(sKey,"L");
else strcpy(sKey,"l");
}break;
case(39):
{
nPass=1;
if (oGuiInput.nCapLocks==1) strcpy(sKey,":");
else strcpy(sKey,";");
}break;
case(40):
{
nPass=1;
if (oGuiInput.nCapLocks==1) strcpy(sKey,"'");
else strcpy(sKey,"'");
}break;
case(44):
{
nPass=1;
if (oGuiInput.nCapLocks==1) strcpy(sKey,"Z");
else strcpy(sKey,"z");
}break;
case(45):
{
nPass=1;
if (oGuiInput.nCapLocks==1) strcpy(sKey,"X");
else strcpy(sKey,"x");
}break;
case(46):
{
nPass=1;
if (oGuiInput.nCapLocks==1) strcpy(sKey,"C");
else strcpy(sKey,"c");
}break;
case(47):
{
nPass=1;
if (oGuiInput.nCapLocks==1) strcpy(sKey,"V");
else strcpy(sKey,"v");
}break;
case(48):
{
nPass=1;
if (oGuiInput.nCapLocks==1) strcpy(sKey,"B");
else strcpy(sKey,"b");
}break;
case(49):
{
nPass=1;
if (oGuiInput.nCapLocks==1) strcpy(sKey,"N");
else strcpy(sKey,"n");
}break;
case(50):
{
nPass=1;
if (oGuiInput.nCapLocks==1) strcpy(sKey,"M");
else strcpy(sKey,"m");
}break;
case(51):
{
nPass=1;
if (oGuiInput.nCapLocks==1) strcpy(sKey,"<");
else strcpy(sKey,",");
}break;
case(52):
{
nPass=1;
if (oGuiInput.nCapLocks==1) strcpy(sKey,">");
else strcpy(sKey,".");
}break;
case(57):
{
nPass=1; strcpy(sKey," ");
} break;
default: strcpy(sKey,"?");
}
}
if (nPass==1) // Acceptable Key Found
{
if (dbLen(oGuiGlobal.sText)<nMaxField)
{
strcat(oGuiGlobal.sText,sKey);
}
else
{
strcpy(oGuiGlobal.sText,"");
}
}
if (ch==28) // Enter Key hit
{
if (dbLen(dbEntry())<nMaxField)
{
dbClearEntryBuffer () ;
oGuiGlobal.nButtonType = oGuiGlobal.nTextEntryExitCommand;
dbText(nPosX, nPosY + 16, dbStr(oGuiGlobal.nButtonType));
}
else
{
dbClearEntryBuffer ();
}
}
oGuiGlobal.nButtonLastTime = nTimeCur + 100;
}
// Display to Screen
if (dbLen(oGuiGlobal.sText)<nMaxField)
{
strcpy(sText,oGuiGlobal.sText);
strcat(sText,"#");
dbText(nPosX, nPosY,sText);
}
else
{
strcpy(oGuiGlobal.sText,"");
}
}
void gui_TextField(int fnLength, int fnPosX, int fnPosY)
{
int nK;
int nLen = 0;
int nX = 0;
int nY = 0;
int nStartX = fnPosX;
int nStartY = fnPosY;
nLen = fnLength / 2;
nX = nStartX+8;
nY = nStartY-4;
dbPasteImage(10,nX,nY);
for (nK = 1; nK<=nLen-1; nK++)
{
nX = (nK * 16) + 8 + nStartX;
dbPasteImage(11,nX,nY);
}
nX = nStartX + (nLen*16) + 8;
dbPasteImage(12,nX,nY);
}
void gui_TextFieldwText(int fnLength, int fnPosX, int fnPosY, char fsText[256])
{
gui_TextField(fnLength, fnPosX, fnPosY);
dbText(fnPosX+17,fnPosY+7,fsText);
}
void gui_DebugWindow(char sText[256])
{
dbSetCurrentBitmap(0);
gui2_Window(0,45, 0, 0, 63, 4, 0, 0, 0,0,"Messages");
int nPosX = 2;
int nPosY = 46;
nPosY = (46 + 2) * 16;
nPosX = 2 * 16;
dbText(nPosX, nPosY, sText);
// dbPlaySound(3);
dbSync();
dbSetCurrentBitmap(1);
}
void gui_MessageWindow(char sText[256])
{
// dbSetCurrentBitmap(0);
int nPosX = 2;
int nPosY = 46;
//
gui2_Window(0,0, 0, 0, 10, 4, 0, 0, 0,0,"Messages");
nPosY = (1 * 16);
nPosX = (2 * 16);
dbText(nPosX, nPosY, sText);
dbSync();
// dbSetCurrentBitmap(1);
}
// --------------------------------------------------------------------------------------
// gui2_Window
//
int gui2_Window(int nStartX,int nStartY, int nModX, int nModY, int nLengthX, int nLengthY, int nParm1, int nParm2, int nParm3,int nParm4, char sName[256])
{
// nParm 1 - (0) clear under the square where it is printed, or Tile with a image
// nParm 2 - Specific image in the "center"
// nParm 3 -
// nParm 4 - (0) No Split End
int nWindow = -1;
int nK, nN;
int nX, nY;
int nLen;
nStartX = (nStartX * 16) + nModX;
nStartY = (nStartY * 16) + nModY;
// Place Coners
// Corner (UL)
nX = nStartX;
nY = nStartY;
if (nParm1 == 0) dbPasteImage(9,nX,nY); // Erase if Not Requested
else
{
dbPasteImage(nParm1,nX,nY);
}
dbPasteImage(1,nX,nY,1);
// Corner (UR)
nX = nStartX + (nLengthX * 16) + 16;
nY = nStartY;
if (nParm1 == 0) dbPasteImage(9,nX,nY); // Erase if Not Requested
else
{
dbPasteImage(nParm1,nX,nY);
}
dbPasteImage(2,nX,nY,1);
// Corner (LR)
nX = nStartX + (nLengthX * 16) + 16;
nY = nStartY + (nLengthY * 16) + 16;
if (nParm1 == 0) dbPasteImage(9,nX,nY); // Erase if Not Requested
else
{
dbPasteImage(nParm1,nX,nY);
}
dbPasteImage(3,nX,nY,1);
// Corner (LL)
nX = nStartX;
nY = nStartY +(nLengthY * 16) + 16;
if (nParm1 == 0) dbPasteImage(9,nX,nY); // Erase if Not Requested
dbPasteImage(4,nX,nY,1);
// the 4 bars
for (nK=1;nK<=nLengthX;nK++)
{
nX = nStartX + (nK * 16);
nY = nStartY;
if (nParm1 == 0) dbPasteImage(9,nX,nY); // Erase if Not Requested
else
{
dbPasteImage(nParm1,nX,nY);
}
dbPasteImage(5,nX,nY,1);
nY = nStartY + (nLengthY * 16) + 16;
if (nParm1 == 0) dbPasteImage(9,nX,nY); // Erase if Not Requested
else
{
dbPasteImage(nParm1,nX,nY);
}
dbPasteImage(6,nX,nY,1);
}
for (nK=1;nK<=nLengthY;nK++)
{
nX = nStartX;
nY = nStartY + (nK * 16);
if (nParm1 == 0) dbPasteImage(9,nX,nY); // Erase if Not Requested
else
{
dbPasteImage(nParm1,nX,nY);
}
dbPasteImage(8,nX,nY,1);
nX = nStartX + (nLengthX * 16) + 16;
if (nParm1 == 0) dbPasteImage(9,nX,nY); // Erase if Not Requested
else
{
dbPasteImage(nParm1,nX,nY);
}
dbPasteImage(7,nX,nY,1);
}
// Draw Center -----------------------------------------------
if (nParm2 !=0) // Specific Image Found Place
{
nX = nStartX + 9;
nY = nStartY + 6;
dbPasteImage(nParm2,nX,nY,1);
} else
{
for (nK=1;nK<=nLengthX;nK++)
{
for (nN=1;nN<=nLengthY;nN++)
{
nX = nStartX + (nK * 16);
nY = nStartY + (nN * 16);
if (nParm1 == 0) // Clear with Default Image
{
dbPasteImage(9,nX,nY);
}
else
{
dbPasteImage(nParm1,nX,nY);
}
}
}
}
// Place Menu Name
if (sName!="")
{
nLen = dbLen(sName) / 2;
nX = nStartX+8;
nY = nStartY-4;
dbPasteImage(10,nX,nY);
for (nK = 1; nK<=nLen-1; nK++)
{
nX = (nK * 16) + 8 + nStartX;
dbPasteImage(11,nX,nY);
}
nX = nStartX + (nLen*16) + 8;
dbPasteImage(12,nX,nY);
nX = nStartX+10;
dbText(nX,nY,sName);
}
return nWindow;
}
// For the Start Up
void gui_StartUpScroll(char sText[256])
{
// This is a specail Scrolling Type Effect, this will scroll up the message 1 notch
// Scroll Up Messages
// New Function added 5/31/08
int nK;
int nXWidth = dbScreenWidth();
int nXCenter = nXWidth/2;
int nXAdjust = nXCenter - 384/2;// Slides things over
int nYAdjust = 20;
int nX,nY,nSize,nPos;
int nFontSize = dbTextSize();
nSize = 16; nPos = 0;
strcpy(oGuiStartUpText[25].sText,sText);
for (nK=1;nK<=25;nK++)
{
strcpy(oGuiStartUpText[nK-1].sText,"");
strcpy(oGuiStartUpText[nK-1].sText,oGuiStartUpText[nK].sText);
strcpy(oGuiStartUpText[nK].sText,"");
}
strcpy(oGuiStartUpText[25].sText,sText);
// Update The List
if (oGuiGlobal.nStartUp==1)
{
// StartUp Special
dbPasteImage(10001,nXAdjust-120,40);
}
dbSetTextSize(16);
for (nK=0;nK<=24;nK++)
{
nPos = nK * nSize + nYAdjust+79;
dbText(nXAdjust-120+26, nPos, oGuiStartUpText[nK].sText);
}
//
dbSync();
// End Update
}
// returns "X" of upper left corner
int gui_GetButtonX1Corner(int fnButtonID)
{
int nReturn = -1;
if (fnButtonID>=0 && fnButtonID<=gMaxButtons) nReturn = oButton[fnButtonID].nPosX1;
return nReturn;
}
// returns "Y" of upper left corner
int gui_GetButtonY1Corner(int fnButtonID)
{
int nReturn = -1;
if (fnButtonID>=0 && fnButtonID<=gMaxButtons) nReturn = oButton[fnButtonID].nPosY1;
return nReturn;
}
// Set Ink Color
void gui_SetInkColor(int nColor)
{
int nColorRed, nColorGreen, nColorBlue;
switch(nColor)
{
case(1): // (black) Omegan
{
nColorRed = 44; nColorGreen = 44; nColorBlue = 44;
} break;
case(2): // (red) Terran
{
nColorRed = 255; nColorGreen = 0; nColorBlue = 0;
} break;
case(3): // (yellow)
{
nColorRed = 255; nColorGreen = 255; nColorBlue = 0;
} break;
case(4): // (green)
{
nColorRed = 0; nColorGreen = 255; nColorBlue = 0;
} break;
case(5): // (blue)
{
nColorRed = 130; nColorGreen = 130; nColorBlue = 255;
} break;
case(6): // (purple)
{
nColorRed = 170; nColorGreen = 0; nColorBlue = 121;
} break;
case(7): // (cyan)
{
nColorRed = 0; nColorGreen = 255; nColorBlue = 255;
} break;
case(8): // (white)
{
nColorRed = 255; nColorGreen = 255; nColorBlue = 255;
} break;
case(9): // (dark yellow) non aligned
{
nColorRed = 128; nColorGreen = 128; nColorBlue = 44;
} break;
case(10): // (Gray)
{
nColorRed = 128; nColorGreen = 128; nColorBlue = 128;
} break;
default:
nColorRed = 192; nColorGreen = 192; nColorBlue = 192;
}
// Set RGB
dbInk(dbRGB(nColorRed, nColorGreen, nColorBlue),0);
}
Here is for Code Example (this is the main.cpp)
// Dark GDK - The Game Creators - www.thegamecreators.com
/*
You want to set up a specific directory to hold your Images. I recommed the tree like this
for images: > media > gui
for sound : > media > audio
*/
#include "DarkGDK.h"
#include "timidons_gui.h"
void Menu_Test()
{
// Place Background Screen
dbPasteImage(300,0,0);
// **************************************************************************************************
// Adding a Button
// **************************************************************************************************
// int gui_AddNewButton(int fnButtonChar, int fnButtonType, int fnPosX1, int fnPosY1,int fnPosX2, int fnPosY2, int fnBaseImage, int fnOverlayImage, int fnHoverImage, char fsToolTip[256])
/*
When you add a new button. The Gui will keep track of it. You can get the ButtonID number so that you can
do other things with it, such as offset images and assign additional paramaters to it.
int fnButtonChar - This is suppose to reprent a ASCII character - this function is UNTESTED at this time.
int fnButtonType - This is the "Command" that will help you figure out what button has been pressed
int fnPosX1 - X1,Y1 Upper Left Hand Corner of the Clickalble area
int fnPosY1 -
int fnPosX2 - X2, Y2 Lower Right Hand Corner of a Clickable area
int fnPosY2 -
int fnBaseImage - This image is placed on the bottom layer
int fnHoverImage - This image that comes up over the base image when the mouse moves over the button
int fnOverlayImage - This is another image that can be placed on the button. often requires to be offset
char fsToolTip[256] - This is a bit of text that you can enter into this field. Pops up like a Tool Tip
*/
// Command: 1000 - Exit Game Command
int nButID= 0; // Used to Store the Button ID
nButID = gui_AddNewButton(0, 1000,(11*64) ,(0*64)+16 ,(11*64)+64, (0*64)+80, 101, 200, 100, "Quit Demo");
// gui_ButtonOverlayAdjust(int fnButtonID, int fnXadjust, int fnYadjust)
/*
This allows you to adjust the "Image Overlay"
int fnButtonID - You need to know your ButtonID, This is the button on the index that will be changed
int fnXadjust - "X" adjust
int fnYadjust - "Y" adjust
*/
gui_ButtonOverlayAdjust(nButID, 10, 7);
// **************************************************************************************************
// Add a Window
// **************************************************************************************************
// This just pops up a box that uses images
// gui2_Window(int nStartX,int nStartY, int nModX, int nModY, int nLengthX, int nLengthY, int nParm1, int nParm2, int nParm3,int nParm4, char sName[256]);
/*
The Window Box, it's not much of a window box. It's based on a 16x16 grid size.
int nStartX - Start Point "X" on Grid
int nStartY - Start Point "Y" on Grid
int nModX - adjust the "X" "Grid" point.
int nModY - adjust the "Y" "Grid" point.
int nLengthX - "X" length x16
int nLengthY - "Y" length x16
int nParm 1 - (0) clear under the square where it is printed, or Tile with a image
int nParm 2 - Specific image in the "center"
int nParm 3-4 : I think I was planing something for these but never got around to.
char sName[256] - If you place text here it will pop up just above the window.
*/
// place some text in that window. It's not really a window just something to fill the screen
gui2_Window(24,1, 0, 0, 15, 2, 0, 0, 0,0,"You Entered");
dbText(25*16,40,oGuiGlobal.sText);
// **************************************************************************************************
// Entering Text
// **************************************************************************************************
// Entering Text is a little more difficult but i can be done. requires coding in a switch of sorts
if (oGuiGlobal.nTextEnteryMode == 0)
{
// Command: 1001 - Enter Text
nButID = gui_AddNewButton(0, 1001,(0*64)+10 ,(0*64)+16 ,(0*64)+74, (0*64)+80, 101, 201, 100, "Enter Text");
gui_ButtonOverlayAdjust(nButID, 10, 7);
// When you Hit "Enter" signaling you have "ended" your text. You will need to have a Command ready.
gui2_Window(5,1, 0, 0, 15, 2, 0, 0, 0,0,"What goes here?");
}
else
{
// Put together Text Window
gui2_Window(5,1, 0, 0, 15, 2, 0, 0, 0,0,"Enter Text");
// This is the space when the Commands Go into
gui_EnterText(96, 40, 29);
}
// **************************************************************************************************
// Attacthing Something to the Mouse
// **************************************************************************************************
if (oGuiGlobal.nMouseImageAttatch == 0)
{
gui2_Window(1,10, 0, 0, 4, 4, 0, 0, 0,0,"!Ball!");
// Command: 1003 - The Ball, attach image to the mouse
nButID = gui_AddNewButton(0, 1003, (2*16) ,(11*16),(2*16)+64, (11*16)+64, 202, 0, 0, "Take Ball, Place in Trash");
// Paramater Example
// gui_SetButtonParm(int fnButtonID, int fnParm, int fnVarible)
/*
int fnButtonID - You need to know your ButtonID, This is the button on the index that will be changed
int fnParm - You can have up to 4 paramaters stored on a single button (1,2,3,4)
` int fnVarible)
*/
// I am placing the Image that will be draged across the screen, in the Paramator options
gui_SetButtonParm(nButID, 1, 202);
}
else
{
gui2_Window(1,10, 0, 0, 4, 4, 0, 0, 0,0,"");
}
// **************************************************************************************************
// Trash Can - remove image from mouse
// **************************************************************************************************
nButID = gui_AddNewButton(0, 1004, (40*16) ,(28*16),(40*16)+128, (28*16)+127, 203, 0, 0, "Trash Can");
}
/*
*/
void Command_1000()
{
int nGuiCommand = oGuiGlobal.nButtonType;
int nButtonID = oGuiGlobal.nButtonClicked;
int nParm1 = gui_GetButtonParm(nButtonID,1);
int nParm2 = gui_GetButtonParm(nButtonID,2);
int nParm3 = gui_GetButtonParm(nButtonID,3);
int nParm4 = gui_GetButtonParm(nButtonID,4);
}
// Command: 1001 - Start Text Entery
void Command_1001()
{
int nGuiCommand = oGuiGlobal.nButtonType;
int nButtonID = oGuiGlobal.nButtonClicked;
int nParm1 = gui_GetButtonParm(nButtonID,1);
int nParm2 = gui_GetButtonParm(nButtonID,2);
int nParm3 = gui_GetButtonParm(nButtonID,3);
int nParm4 = gui_GetButtonParm(nButtonID,4);
oGuiGlobal.nTextEnteryMode = 1;
oGuiGlobal.nTextEntryExitCommand = 1002;
// Remember to Clear the Text before starting to type.
strcpy(oGuiGlobal.sText,"");
//
dbPlaySound(1);
}
// Command: 1002 - End Text Entery
void Command_1002()
{
oGuiGlobal.nTextEnteryMode = 0;
// The information gathered from the "Text" is stored in the varible "oGuiGlobal.sText"
// do with as you wish.
dbPlaySound(1);
}
// Command: 1003 - Pick Up the Ball
void Command_1003()
{
int nGuiCommand = oGuiGlobal.nButtonType;
int nButtonID = oGuiGlobal.nButtonClicked;
int nParm1 = gui_GetButtonParm(nButtonID,1);
int nParm2 = gui_GetButtonParm(nButtonID,2);
int nParm3 = gui_GetButtonParm(nButtonID,3);
int nParm4 = gui_GetButtonParm(nButtonID,4);
int nImage = nParm1;
oGuiGlobal.nMouseImageAttatch = nImage;
dbPlaySound(1);
}
// Command: 1004 - Trash Can
void Command_1004()
{
int nGuiCommand = oGuiGlobal.nButtonType;
int nButtonID = oGuiGlobal.nButtonClicked;
int nParm1 = gui_GetButtonParm(nButtonID,1);
int nParm2 = gui_GetButtonParm(nButtonID,2);
int nParm3 = gui_GetButtonParm(nButtonID,3);
int nParm4 = gui_GetButtonParm(nButtonID,4);
oGuiGlobal.nMouseImageAttatch = 0;
dbPlaySound(1);
}
void Command_Index()
{
/*
int nGuiCommand = oGuiGlobal.nButtonType;
int nButtonID = oGuiGlobal.nButtonClicked;
int nParm1 = gui_GetButtonParm(nButtonID,1);
int nParm2 = gui_GetButtonParm(nButtonID,2);
int nParm3 = gui_GetButtonParm(nButtonID,3);
int nParm4 = gui_GetButtonParm(nButtonID,4);
*/
// This is just another place holder that calls other commands
int nGuiCommand = oGuiGlobal.nButtonType;
if (nGuiCommand == 0) return;
switch(nGuiCommand)
{
case(1000): oGuiGlobal.nGuiExit = 1; break; // Exit Demo
case(1001): Command_1001(); break; // Text Entery
case(1002): Command_1002(); break; // Exit Text Entery
case(1003): Command_1003(); break; // Attach Something to the Mouse
case(1004): Command_1004(); break; // Trash Can Take the object off the mouse.
default:;
}
}
void DarkGDK ( void )
{
// turn on sync rate and set maximum rate to 60 fps
//
dbSetDisplayMode ( 800, 600, 32 );
//
dbSyncOn ( );
dbSyncRate ( 60 );
// Load Up the Splash Screen
dbLoadImage("SplashScreen.png",10001);
// for starting screen only - starts load scrolling
oGuiGlobal.nStartUp = 1;
// Load up basic images (specific 1) The first 10 slots are used specificly by Timidon's Gui
gui_GuiLoadGui_Elements("gui2_",1);
// Load Specific Buttons. I usualy start at Image ID 100.
gui_GuiLoadGui_Elements("button_",100);
// These are other "Images and Backgrounds"
gui_GuiLoadGui_Elements("gui_",200);
// Load up background screen
gui_GuiLoadGui_Elements("screen_",300);
// Load Audio Sounds (Wave format)
gui_GuiLoadGui_AudioWave("sound_",1);
// Load MP3. I did not include any in the demo
gui_GuiLoadGui_AudioMP3("mp3_",1);
// End Loading Gui Elements, Turn off Scrolling text
gui_StartUpScroll("Press any key to continue.");
oGuiGlobal.nStartUp =0;
dbWaitKey();
//
while ( LoopGDK ( ) && oGuiGlobal.nGuiExit != 1)
{
// Clean Up and Reset Gui Buttons.
gui_FlushButtons();
// Add Menu's and Buttons
Menu_Test();
// Update Buttons
gui_SetInkColor(7);
gui_UpdateButtons();
//
// Check Buttons
Command_Index();
dbSync ( );
}
// return back to windows
return;
}
You will need to upload Media for the demo. I will work up some more docs on better on how to use this. This is a bare bones demo, that shows the basics.
There are many answers but just one question" ~ Jerilith the Mad