Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / question about the scrolling tut?

Author
Message
sinkler20
21
Years of Service
User Offline
Joined: 12th Mar 2003
Location: United States
Posted: 18th Jun 2003 05:42
hello and thanks for any help you can provide.
I'm working on the screen scrolling tut, and have a question on (I don't know if I can ask it right),the x1,y1,x2,y2 coord.
It say's that we are scrolling a 432x368 section and x1=352 y1 =16 x2=784 and y2=384.
How do I know why to put in those numbers? how did they come up with them? if I wanted a 800X300 how do I figure those numbers?
thanks and if I need to clarify the question let me know.
David
philippians 4:13
sinkler20
21
Years of Service
User Offline
Joined: 12th Mar 2003
Location: United States
Posted: 19th Jun 2003 04:23
Hello, out there,
what i'm trying to ask is.... how do I figure out, say
: x1 = 352 is on the screen without running program.

I know that the x1y1 is top left and x2y2 bottom right, but what is 352.
help

philippians 4:13
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 19th Jun 2003 06:00 Edited at: 19th Jun 2003 06:07
Not sure if this is the answer to what you're asking, but...

X1, Y1, X2 and Y2 are simply the variables which are being used to store the screen pixel positions of the rectangle on the screen.

If a rectangle's right edge lies at pixel 784 on the screen it has to start at 352 or it wouldn't be 432 pixels wide!

If your routine/tutorial (which I haven't seen) needs to scroll just a section of the screen rather than the full screen, then you need to supply these four values to define the four corners of the region to scroll, (remember, top left and bottom right co-ords define a rectangle).

You can alter these values to scroll a larger or smaller region or a different area of the screen.

Just remember that the top left corner pixel is X1=0, Y1=0 increasing in value moving across and down the screen respectively.

Scrolling an 800x300 region, you would use X1=0, Y1=0, X2=799 and Y2=299.

TDK_Man
sinkler20
21
Years of Service
User Offline
Joined: 12th Mar 2003
Location: United States
Posted: 19th Jun 2003 07:06
o.k thanks I think I get it, so a 800x600 would be x1=0 y1 = 0
x2 = 799 and y2 599.. cool that is good thanks .Now if I can ask another question. how would I know say 800x300 where is 300 located without running the program... is there a chart that I can get that shows that or maybe just create my own based on what you told me in the last post.

thanks TDK for your help and I was visiting your site earliar. It looks great!!

philippians 4:13
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 19th Jun 2003 21:53
not sure what your problem is there? it`s simple enough, 300 is half of 600 so that is halfway down the screen, the first number (800) is the width (the x value...x is a-cross...geddit ) and the second number is the y value (the height down the screen), 0,0 is the top left, 800,600 is the bottom right and 400,300 would be the middle on a 800x600 screen, position 800,300 is 800 across from the left (full width) and 300 is half way down the screen, if you set the screen to 1024,720 then halfway down the screen is 360 (half of 720) just divide the screen size to find the positions you want to place your sprites or scroll or whatever, cheers.

Mentor.

Login to post a reply

Server time is: 2024-11-24 18:50:59
Your offset time is: 2024-11-24 18:50:59