Gw Temp


Tutorial - 'C++ Scrolling background' by Xfactor

An item about Programming Languages posted on


How to create a scrolling background in C++


Edit by Hiretsukan: This is not a real C++ tutorial, so anyone who wants to learn anything whatsoever about C++ had best go elsewhere. Sorry.

Have you ever wondered how the programmers, made the screen slides with your character in C++. Then wonder no more, these codes below are the key to create your game scrooling background.

In this tutorial, when you see"//", they are comments in order to eplain what the line of codes does.

if it's not clear enough email me at:

I am just trying to help out the newbies out there, especially those who are going to be game programmers, i would suggest, you tackle C++ as soon as possible, trust me.

// Project : slide

// Copyright (c) 2003 by Xfactor


// Slider example

// Create Static Display control

myStatic=New StaticText(CurWindow,"",10,10,200,20,StaticText.NOBORDER);


myStatic2=New StaticText(CurWindow,"",10,30,200,20,StaticText.NOBORDER);


// Create Slider

mySlider=New Slider(CurWindow,10,60,220,30,Slider.AUTOTICKS,Slider.HORZ,Slider.TOOLTIPS,Slider.ENABLESELRANGE,Slider.NOBORDER);




// Wait for user Input



// Function CallBack


Function SliderPosChanged(sliderObj, pos)


myStatic.SetText("New Position : "+pos);

myStatic2.SetText("Selection : From "+mySlider.GetSelectionStart()+" To "+mySlider.GetSelectionEnd());


Do you see how very simple it is.