I have a Code Problems - see code

BlitzMax Forums/BlitzMax Beginners Area/I have a Code Problems - see code

Newbie(Posted 2007) [#1]
I have a problem with this code
i want to scroll only PART of the screen XYWH as in 100,100,200,200 so I set the SetViewPort to those specs; then my updates are within that field OK! it works ... or so i thought! except i noticed that after the viewport has been set, I cant animate elsewhere on the screen. so i thought the soilution was to add another / a second setviewport after my "drawing", a setviewport() that "normalised" the viewport to 0,0,640,480, but it doesnt seem to work; here is my code:

While Not KeyHit(KEY_ESCAPE)
Cls
Do-something()
Do-something()


SetViewport(100,100,200,200) ‘only do something is specific area!
..

Flip 0;
Wend

I tried putting a SetViewPort(0,0,640,480) just before flip 0; but it did not seem to work! all "future" drawings are only done is the tiny area??


tonyg(Posted 2007) [#2]
Don't want to appear too negative but couldn't you post a simplified but runnable version of the code you're having trouble with.
<edit> Maybe this :
Graphics 640 , 480
Local image1:TImage=LoadImage("max.png")
While Not KeyHit(KEY_ESCAPE)
	Cls
		SetViewport x1 , 100 , 200,200
		DrawImage image1 , x2 , 0
		x1 = (x1 + 4) Mod 640
		'x2=x1   'uncomment to see a different effect.
		SetViewport(0 , 0 , 640 , 480) 
		DrawImage image1,200,0
	Flip
Wend

?
You might also want to check the setorigin command.


H&K(Posted 2007) [#3]
Well I would say that its because all your drawing commands are after you set the veiwpoint back to the small one