🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Moving the background map right and left. How ?

Started by
0 comments, last by yoni 24 years, 5 months ago
Does anyone have a code segment that shows how to shift the background image in directx ?
Advertisement
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