Image Wrapping

BlitzMax Forums/BlitzMax Programming/Image Wrapping

If I've got an image that I want to scroll constantly from left to right, how do I wrap it so it looks like, one long image?

Thanks

try this with an image that is wider than the screen
Strict 

Framework BRL.GlMax2D

Import BRL.System
Import BRL.Basic
Import BRL.pngloader
Import BRL.Retro

?Win32
SetGraphicsDriver(GLMax2DDriver())
?

Graphics 640,480

Global x:Int=0

Global image:TImage = LoadImage("test.png")


While KeyDown(KEY_ESCAPE)=False
        cls
	DrawImage image,x,0
	x:-3
	If x<0 Then DrawImage image,(x+ImageWidth(image)),0
	If x<=-ImageWidth(image) Then x=0
	DebugLog x
	Flip
	flushmem
Wend


TileImage with the x and y parameters would avoid having to do two DrawImage's.

Thanks Scott :)

JazzieB - That is a good idea but TileImage fills the entire current viewport. So I guess you would need to set the viewport before each TileImage call.

Yes you would need to set a viewport if you don't want the entire screen drawn to, but wouldn't you be using one anyway if that were the case - in order to ensure that sprites and other graphics are clipped to the active game play area? Depends on the game though, I suppose.