Screen and Window

BlitzMax Forums/BlitzMax Beginners Area/Screen and Window

In the good old days of BlitzBasic on the Amiga i had a simple game that used a screen and a window.
The screen was bigger than the window.
As i held the right mouse button down i scrolled the window so i could see different parts of the screen.
Actually i think i was scrolling the screen behind the stationary window...

The screen is like a chess board and the window is smaller so i can only see part of the board at any one time.

I can't seem to find the right keywords in the help system to achieve this.

Any help appreciated,
Regards
Glenn

setviewport?
You can either scroll the viewport (image remains stationary) or change the drawimage offset (viewport remains stationary). If you have multiple images you can use setorigin to change them all.
Bit clunky...
Graphics 800 , 600
Local bg:TImage = LoadImage("skyatnightold_800_600.png")
Local x:Int = 100
Local y:Int = 100
Local tomove:Int=1
While Not KeyHit(KEY_ESCAPE)
	Cls
	If KeyHit(KEY_SPACE) tomove = - tomove
	If tomove = 1
		If KeyDown(KEY_DOWN) y:+ 1
		If KeyDown(KEY_UP) y:- 1
		If KeyDown(KEY_RIGHT) X:+ 1
		If KeyDown(KEY_LEFT) x:- 1
		SetViewport x , y , 200,200
		DrawImage bg , 0 , 0
	Else
		If KeyDown(KEY_DOWN) imagey:+ 1
		If KeyDown(KEY_UP) imagey:- 1
		If KeyDown(KEY_RIGHT) imageX:+ 1
		If KeyDown(KEY_LEFT) imagex:- 1
		SetViewport x,y,200,200
		SetOrigin imagex , imagey
		DrawImage bg,0,0
	EndIf   
	Flip
Wend


Cheers. Will have a try and read the docs about it.
Regards
Glenn

I might be asking the wrong questions.
I want a screen (800,600) where a big section is the scrollable map, a smaller section is the mini map, a small section is the statistics view and finally there is a status bar on the bottom.
All this is surrounded by a static border.
From all the stuff above i have got a viewport working for the main scrollable area but still having problems with the other parts. The mini map will change as a character moves. The statistics will update with steps left for this turn. The status bar will change once a turn.

Is there a sample program in the archives that does something similar? I don't know what to start searching for...

I thought all i needed was multiple viewports but i guess i am doing something wrong in the code as the graphics keep overwriting each other.

Regards
Glenn

perhaps you're drawing them in the wrong order?
a suggestion is first to draw the backgound and the stuff on it for the big section..
after that, you draw the minimap, the statistics view and the status bar..

I added a HUGE response with answers, code etc last night but it must have been zapped by the forum problems.
You might have solved your movemouse stuff but this should help.
Second, try (pseudo)...
   while
      cls
      setviewport 0,0,graphicswidth(),graphicsheight()
      Draw border image
      setviewport x,y,200,200
      draw viewport image
      flip
   wend


Tony - Any chance you can post the huge reply again?
I seem to be doing ok for the moment but it would be useful for any other beginners too.

Cheers
Glenn

Sorry Glenn, didn't save them. I *could* do it all again but it'd be quicker for you to post your code.
I do know I got some flickering with Flip 0 but it was OK with flip -1 and 1. I had not timing code though.

Ok.
When i get the basics of the game done i will post the source so people can advise what i should do differently.
Cheers
Glenn