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 / BOX Graphic Comman Explination Please

Author
Message
Bubblz
15
Years of Service
User Offline
Joined: 30th Dec 2008
Location:
Posted: 30th Dec 2008 23:21
Hi All,

I just got DBP and have been reading up as much as possible. Im enjoying the language so far, but getting very stuck very quickly. I've got programming experience, but not masses</LifeStory>

I would kindly ask someone to please explain the BOX command. Let me explain where I am confused. In most languages from my experience, BOXes are made up of 3 things, a starting point, a width and a height. The following example function call is what I would have expected.
e.g. CreateBox(x-coord, y-coord, width, height)

Im confused how "BOX Left, Top, Right, Bottom" relate to the screen. Im able to draw some boxes but others do not!

For example if I put in this code :


and I get a nice little rectangle. However this code does not work:



Please help! Im going insane!

Is it going off the drawing surface? I understand the default resolution is 640, 480?

Many thanks for this simple problem.
//Bubblz
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 30th Dec 2008 23:26
No, it's not going off the drawing surface. The coordinates are inclusive/exclusive, ie they include the starting coordinates, but exclude the end coordinates.

If you specify a bottom y coordinate of 101 instead of 100, you'll get a 1 pixel line.

While I'm at it, I may as well tell you that the GET IMAGE and LINE commands work in the same way, and possibly the COPY BITMAP command does too.

Bubblz
15
Years of Service
User Offline
Joined: 30th Dec 2008
Location:
Posted: 30th Dec 2008 23:41
Thank you very much for the fast approval and response. I've now been playing with it after you have explained it. Many thanks. I think its a little strange, just means ill be doing more maths I suppose! hehe

Ta again

Login to post a reply

Server time is: 2024-11-24 17:04:07
Your offset time is: 2024-11-24 17:04:07