Here is a function that demonstrates how efficient sprites can be when used for text
// 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"
// the main entry point for the application is this function
void TextToSprite(int SpID, int FontSize, char* sChar, int Xp, int Yp);
char* mytext= "Hello";
int MyTimer=0, i;
void DarkGDK ( void )
{
// turn on sync rate and set maximum rate to 60 fps
dbSyncOn ( );
dbSyncRate (60);
dbInk(
for (i=1;i<100;i++){
TextToSprite(i, dbRnd(64),mytext, dbRnd(800), dbRnd(600));
}
// our main loop
while ( LoopGDK ( ) )
{
for (i=1;i<100;i++){
dbSprite(i, dbSpriteX(i)+dbRnd(2)-1, dbSpriteY(i)+dbRnd(2)-1, i);
}
dbText(1,1,dbStr(dbScreenFPS()));
dbSync ( );
}
// return back to windows
return;
}
void TextToSprite(int SpID, int FontSize, char* sChar, int Xp, int Yp){
if (dbBitmapExist(2)){
dbDeleteBitmap(2);
}
dbCreateBitmap(2,800,600);
dbSetCurrentBitmap(2);
dbSetTextSize(FontSize);
dbText(0,0,sChar);
dbGetImage(SpID,0,0,dbTextWidth(sChar),dbTextHeight(sChar));
dbSprite(SpID,Xp,Yp,SpID);
dbSetCurrentBitmap(0);
}
Codger
System
PIV 2.8 MZ 512 Mem
FX 5600 256 mem