Original Post
hey all i've developed a wrapper for the dibits api function thingo and...well i feel its 2 slow i've programmed the interface in visual basic and the main code in c++ vb sends pointers to the coordinates to 500 Objects and to the screen (byte array) and the image to be drawn (byte array) it calls the api 15 times a second and that takes 1204 ms to complete 1000ms coming from c++ and 204 from vb (so virtually 6229 objects per second) the size of the object being drawn is 80 by 80 @ 24 bit am i asking to much? or can c++ do this faster? Here is my main c++ code also i've noticed getting VB to make api calls that have lots of variables in them increases the time it takes to make the call but i feel it shouldn't be this great (note when i get it finished ill be changing it into just 1 call - an array of pointers =D)
long __declspec(dllexport) CALLBACK GetNumberEX(long x,long y,char *TheScreen,long SoWidth,long SoHeight,char *TheObject,long OoWidth,long OoHeight,long *TheXPosition,long *TheYPosition,long XYS)
//LPSAFEARRAY FAR *data)
{
long bufx;
long bufy;
long mx;
long my;
long num;
long index=0;
long mxy;
long x2=x;// = 100;//x;
long y2=y;// = 100;//y;
long x3 = x2;
long y3 = y2;
long output1;
long output2;
long maxx;
long maxy;
maxx = (x2+OoWidth)-1;
maxy = (y2+OoHeight)-1;
for (long mass=1 - 1;mass <= XYS - 1;mass++)
{
for (long tempx=x3;tempx<=maxx;tempx++)
{
for (long tempy=y3;tempy<=maxy;tempy++)
{
x2=tempx+TheXPosition[mass];
y2=tempy+TheYPosition[mass];
bufx = x2;
bufy = y2 +1;
mx = SoWidth;
my = bufy * SoHeight;
mxy = (SoWidth * SoHeight) * 3;
bufx = bufx * 3;
num = bufy * mx;
num = num * 3;
num = (mxy - num) + bufx;
num = num + 1;
output1 = num;
bufx = (x2-(x+TheXPosition[mass]));
bufy = (y2-(y+TheYPosition[mass]))+1;
mx = OoWidth;
my = bufy * OoHeight;
mxy = (OoWidth * OoHeight) * 3;
bufx = bufx * 3;
num = bufy * mx;
num = num * 3;
num = (mxy - num) + bufx;
num = num + 1;
output2 = num;
if (TheObject[output2-1] != 0) { TheScreen[output1-1] = TheObject[output2-1]; }
if (TheObject[output2] != 0) { TheScreen[output1] = TheObject[output2]; }
if (TheObject[output2+1] != 0) { TheScreen[output1+1] = TheObject[output2+1]; }
}
}
}
return(0);
}