I have removed all that math stuff cose nobody wants to read it.
So the question:
Is there a more faster way to do
for example direct copying bitmap bits or memory segment that belonges to the bitmap, streight to the screen.This is becouse i dont want all image to be displayed, just area that intersects with a sprite. See example below it gives about +2.5 fps to the sample Blit project on my Toshiba e740 when it should give about 2.5*FPS
So the question:
Is there a more faster way to do
- Code:
display->Blit(pos.left,pos.top,m_background,&Rect;(pos.left,pos.top,pos.right,pos.bottom));
for example direct copying bitmap bits or memory segment that belonges to the bitmap, streight to the screen.This is becouse i dont want all image to be displayed, just area that intersects with a sprite. See example below it gives about +2.5 fps to the sample Blit project on my Toshiba e740 when it should give about 2.5*FPS
- Code:
void BlitSample::GameLoop()
{
DisplayDevice* display = GetDisplay();
#if defined(FROG_HPC)
display->Blit( 320, 0, m_background );
#endif
for (int i = 0; i < 4; ++i)
{
Rect& pos = m_position[i];
display->Blit( pos.left, pos.top, m_images[i] );
}
// Update FPS
m_FPSTicks[ m_FPSCounter & 15 ] = PocketPC::GetTickCount();
if (m_FPSCounter > 15)
{
uint32_t totalTime = m_FPSTicks[ m_FPSCounter & 15 ] - m_FPSTicks[ (m_FPSCounter+1) & 15 ];
if (totalTime == 0) totalTime = 1;
uint32_t fps = 16000 / totalTime;
uint32_t n100 = fps / 100; fps -= n100 * 100;
uint32_t n10 = fps / 10; fps -= n10 * 10;
uint32_t n1 = fps;
if (n100 > 9) { n100 = 9; n10 = 9; n1 = 9; }
// Display fps
display->Blit( 0, 0, m_numbers, &Rect;( n100 * 8, 0, (n100+1)*8, 11 ) );
display->Blit( 8, 0, m_numbers, &Rect;( n10 * 8, 0, (n10+1)*8, 11 ) );
display->Blit( 16, 0, m_numbers, &Rect;( n1 * 8, 0, (n1+1)*8, 11 ) );
}
display->Update();
for (i = 0; i < 4; ++i)
{
Rect& pos = m_position[i];
display->Blit(pos.left,pos.top,m_background,&Rect;(pos.left,pos.top,pos.right,pos.bottom));
if (i != m_dragImage)
{
switch (rand() % 3)
{
case 0: break; // Don't move
case 1: if (pos.left > 0) pos.Translate( -1, 0 ); break;
case 2: if (pos.right < display->GetWidth()) pos.Translate( 1, 0 ); break;
}
// Move image (vertical)
switch (rand() % 3)
{
case 0: break; // Don't move
case 1: if (pos.top > 0) pos.Translate( 0, -1 ); break;
case 2: if (pos.bottom < display->GetHeight()) pos.Translate( 0, 1 ); break;
}
}
}
++m_FPSCounter;
}