Advertisement

Moving the background map right and left. How ?

Started by January 10, 2000 03:13 AM
0 comments, last by yoni 24 years, 11 months ago
Does anyone have a code segment that shows how to shift the background image in directx ?
Hi,
all newer graphics-cards support surfaces bigger than the screen, so you could simply have a screen-res of 640x480 and put a 800x600-bitmap into an offscreen-surface. Now you can just blit from where you want, just be sure you don''t blit anything beside the offscreen-surface.

// You already created your primary surface & backbufferZeroMemory(&ddsd, sizeof(ddsd));ddsd.dwSize = sizeof(ddsd);ddsd.dwFlags = DDSD_CAPS / DDSD_WIDTH / DDSD_HEIGHT;ddsd.dwHeight = 600;ddsd.dwWidth = 800;ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;lpDD->CreateSurface(&ddsd, &lpDDSOffscreen, NULL);DDReLoadBitmap(lpDDSOffscreen, "myBigMap.bmp");RECT rect;rect.top = y;rect.bottom = y + 480;rect.left = x;rect.right = x + 640;lpDDSBack->BltFast(0, 0, lpDDSOffscreen, ▭, NULL);lpDDSPrimary->Flip(lpDDSBack, NULL); 


You could simply increase x when hitting ''->'', decrease it when hitting ''<-'', etc.

CU

Graphix Coding @
Skullpture Entertainment
Graphix Coding @Skullpture Entertainmenthttp://www.skullpture.de

This topic is closed to new replies.

Advertisement