Actually I wasn't planning on releasing it, but I already have one, lol. In its current state, it just manages 2 stl vector objects. One for the console messages, and another that store a user defined "type" integer that you can use to set or determine what kind of console message it should be.
With that being said, that version was intended to be separate from a graphical console. I did however make a small sample which uses my console library as well as the Dark GDK version of Cloggy's d3dfunc. I'll take a look and see if I can find it real quick then I'll post it.
Edit: Alright, here it is. As I said before, you'll need Cloggy's d3dfunc for Dark GDK for my example but I'd recommend taking the console.h by itself if you plan on using it. That way you can design your own graphic interface to it. One thing i never got around to is creating a console dump function but that could be easily added by just about anyone with a little C knowledge.
main.cpp
// Dark GDK - The Game Creators - www.thegamecreators.com
// the wizard has created a very simple project that uses Dark GDK
// it contains the basic code for a GDK application
// whenever using Dark GDK you must ensure you include the header file
#include "DarkGDK.h"
#include "d3dfunc.h"
#include "console.h"
#include "gconsole.h"
// the main entry point for the application is this function
void DarkGDK ( void )
{
dbSetDisplayMode(800,600,32);
dbSync();
dbSyncOn();
dbSyncRate(0);
dbAutoCamOff();
dbBackdropOn();
d3dInit();
GConsole::Init();
Console::AddMessage("Hello",0);
Console::AddMessage("These messages are being sent to the text console",1);
Console::AddMessage("After that, I use the GConsole namespace to draw it using Cloggy's d3dfunc Library",2);
dbLoadImage("./media/_256.png",1); // change to whatever texture you want to use
dbMakeObjectCube(1,1.0);
dbTextureObject(1,1);
dbMoveCamera(0,-2);
float Rot = 0.0;
// our main loop
while ( LoopGDK ( ) )
{
dbRotateObject(1,Rot,Rot,0.0);
Rot += 1.0;
GConsole::Draw();
dbSync ( );
}
Console::Destroy();
// return back to windows
return;
}
console.h
namespace Console
{
using namespace std;
vector<char*> MessageString;
vector<int> MessageType;
void AddMessage(char* text,int type)
{
MessageString.insert(MessageString.end(),text);
MessageType.insert(MessageType.end(),type);
}
int MessageQuantity()
{
return MessageString.size();
}
char* GetMessageString(int index)
{
return MessageString.at(index);
}
int GetMessageType(int index)
{
return MessageType.at(index);
}
void ClearMessages()
{
MessageString.empty();
MessageType.empty();
}
void Destroy()
{
MessageString.empty();
MessageType.empty();
}
};
gconsole.h, my graphical console
namespace GConsole
{
int ScrollPosition = 0;
char* Font = "Arial";
int FontSize = 12;
int HorizontalTextOffset = 2;
int VerticalTextOffset = 0;
DWORD BGColor = d3dRGBA(255,255,255,127);
void Init()
{
d3dFont(1,Font,FontSize,0,0,0);
}
void Draw()
{
d3dBox(0,0,dbScreenWidth(),ScrollPosition,BGColor);
int NumStrings = ScrollPosition / FontSize;
int YOffset = ScrollPosition - FontSize;
DWORD TextColor;
int StringOffset = 0;
int VerticalOffset = ScrollPosition - d3dGetTextHeight(1,Console::GetMessageString(Console::MessageQuantity()-1)) - VerticalTextOffset;
if(dbControlKey() && dbDownKey())
{
GConsole::ScrollPosition += 10;
}
if(dbControlKey() && dbUpKey())
{
GConsole::ScrollPosition -= 10;
}
if(GConsole::ScrollPosition > dbScreenHeight())
{
GConsole::ScrollPosition = dbScreenHeight();
}
if(GConsole::ScrollPosition <= 0)
{
GConsole::ScrollPosition = 0;
}
for(int CurrentIndex = Console::MessageQuantity()-1; CurrentIndex>=0; CurrentIndex--)
{
if(VerticalOffset > 0 - (FontSize*2))
{
switch(Console::GetMessageType(CurrentIndex))
{
case 0:
TextColor = d3dRGBA(0,0,0,255);
break;
case 1:
TextColor = d3dRGBA(255,0,0,255);
break;
case 2:
TextColor = d3dRGBA(0,255,0,255);
break;
default:
TextColor = d3dRGBA(0,0,0,255);
break;
}
d3dStartText();
d3dText(1,HorizontalTextOffset,VerticalOffset,0,
Console::GetMessageString(Console::MessageQuantity()-1-StringOffset),TextColor);
d3dEndText();
StringOffset++;
VerticalOffset -= (d3dGetTextHeight(1,Console::GetMessageString(CurrentIndex)) + VerticalTextOffset);
}
}
}
}
To use the sample, create a new Dark GDK project and add d3dfunc library. Replace the projects "main.cpp" with the one above and also create and copy over the other two headers.
My GConsole namespace was never meant to be actually used and as such I have some hard coded input functions inside the draw function. The controls to pull down/push up the console are CTRL+Down Arrow, and CTRL+Up Key respectively.
I've also attached a EXE in case anyone doesn't want to bother with compiling.
@RedEye: As for misspelling my name, I have no good excuse for that, lol. I've been terrible with typing lately. Thats what I get for mixing programming with beer and/or vodka, lol.
Note to Moderators: If possible, please change the tag of topic from [DBP] to [DBP][DGDK]. I wasn't originally planning on it being for both