# Scrolling background?

**URL:** <https://discourse.libsdl.org/t/scrolling-background/9246>\
**Category:** SDL Development\
**Created:** [August 30, 2003, 12:28am UTC](https://discourse.libsdl.org/t/scrolling-background/9246 "2003-08-30T00:28:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Freeman](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/f/ec9cab/32.png) [@Freeman](https://discourse.libsdl.org/u/Freeman)\
**Post date:** [August 30, 2003, 12:28am UTC](https://discourse.libsdl.org/t/scrolling-background/9246/1 "2003-08-30T00:28:01Z")

</div>

Hello everyone !!!

I was wondering if there was a standard way of creating  
a scrolling background ,… I mean ,… I’ve heard of bliting  
the hardware memory to the hardware memory with a little offset  
and then filling the “blank” area with the new background piece …  
it looks nice, and hardware-to-hardware blit is fast ,(I think ),…  
but I still have some quetions … :  
1- How do I access hardware memory ?, is setting SDL\_HWSURFACE enough ?  
if I use SDL\_HWSURFACE, can I combine it with SDL\_DOUBLEBUF and still  
have access to hardware-memory(directly ,I mean).

2- Is this means that I can’t count on a sollution based on SDL\_SWSURFACE ?  
because if I use SDL\_SWSURFACE, and I offset the background, I need to  
redraw  
a huge area of the screen in sofware memory and then update it,which is  
quite  
expensive in terms of CPU power …  
But if I can’t use SDL\_SWSURFACE, I’ll oblige the user of my games to  
have  
(correctly-configured) hardware acceleration, even if I’m going only to  
do 2D stuffs !!  
and that’s not good …

Thanks in advence.\*\*\*\*  
“Stand for something, or you will fall for nothing” – Richard M.  
Stallman.  
Then ,we’ll stand for the free-software !!!..

* * *

---

<div class="post-metadata">

**Author:** ![Evgeny\_Bronnikov](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/e/ed655f/32.png) [@Evgeny\_Bronnikov](https://discourse.libsdl.org/u/Evgeny_Bronnikov)\
**Post date:** [May 11, 2004, 5:23pm UTC](https://discourse.libsdl.org/t/scrolling-background/9246/2 "2004-05-11T17:23:33Z")

</div>

Hi!  
I’ve tried to get any question on this subject but it’s very hard to  
do… So, I use same algorythm that you wrote. I pass SDL\_HWSURFACE |  
SDL\_DOUBLEBUFFER at first. But is you have real hardware acceleration  
under X Window you need set up evironment variable SDL\_VIDEODRIVER =  
dga. If you a win32 coder, you need launch your program in fuulscreen  
mode with DirectX support (you must build SDL with DX support)

Best regards,  
Evgeny Bronnikov
