Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: Need help with 2D Map and how to Scroll with it...  (Read 1717 times)
Magnum357jhp
Community Member
*
Posts: 128


« on: August 14, 2009, 03:20:47 AM »

Hello, I got two questions that I hope someone could answer. 

I'm working on a project (well, this problem really relates to quite a few different projects of mine) that requires the user to work with a large map but must be able to scroll the map around in order to see the whole 2D feild (the map is just too large for the screen to show all of it).  Also, there are quite a few different objects that must be located on this map and must move around on the map, so if you scroll the map around the objects should stay where they are located on the map, even if the scrolling moves to a whole other part of the map (hope this makes sense). 

So can someone give me a simple example on how to accomplish this?  I tried setting up a simple Picture Box and scroll bars, but I have no idea how to connect the two objects in order to do this.  And even if I can connect these two objects, how do I make objects on the map "flow" with the scrolling?  I'm using VB6 to program this.

Any info on this would be most appreciated.
« Last Edit: August 14, 2009, 03:23:21 AM by Magnum357jhp » Logged

"There is no such thing as the ultimate programming language.  Every language has its weaknesses."
jviper
Community Member
*
Posts: 2130

Discipline in training


« Reply #1 on: August 16, 2009, 10:53:33 AM »

What you want to do is draw a portion of the map rather then the whole thing. This can be done with TVScreen2DImmediate.Draw_Texture(...). This function has several overloads, one of which has tu1, tv1, tu2 and tv2 arguments. These arguments are for the retangular region you which to be drawn from your texture. These values are to be between 0 and 1. Also if you are using a render surface, you can use the TVRenderSurface.GetTexture() as the TextureID argument for the function.

You could also use a second viewport. What you would do is render your normal scene view to your regular viewport, and render your map view to your second viewport. Be sure to look up how to use TVViewport first though.
Logged

JAbstract.....Don't just imagine, make it happen!
Magnum357jhp
Community Member
*
Posts: 128


« Reply #2 on: August 17, 2009, 04:42:26 PM »

Jviper, thanks for the info, but what I was hoping to do is create a map with just Visual Basic 6 (no truevison at all) to show only portions of it on a Form or Picture box, but use scroll bars to move the veiw to other portions of the map.  I have a few programming books but they don't really tell you how to do this with Visual Basic 6. 

I'll keep your suggestions if I ever need this for Truevision, but this is just a simple VB6 2D map question.
Logged

"There is no such thing as the ultimate programming language.  Every language has its weaknesses."
jviper
Community Member
*
Posts: 2130

Discipline in training


« Reply #3 on: August 17, 2009, 05:40:24 PM »

What you would actually have to do is use a picturebox inside of a panel. Then you would put scroll bars on the inside of your panel, then move the picturebox as you move the scrollbars. You'd also have to make alot of calculations to keep the scrollbar sizes right.
Logged

JAbstract.....Don't just imagine, make it happen!
Magnum357jhp
Community Member
*
Posts: 128


« Reply #4 on: August 18, 2009, 03:21:57 AM »

Ok, can you tell me what you mean by "Panel"?  I'm not aware of that type of VB6 object.  And how would I put a PictureBox inside this Panel?  Is it hard to add scroll controls to a Panel?  Sorry, I just never heard of a "Panel" object before.
Logged

"There is no such thing as the ultimate programming language.  Every language has its weaknesses."
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks