a other box one help me out bro
Author |
Message |
mac
|
Posted: Thu Nov 14, 2002 4:13 pm Post subject: a other box one help me out bro |
|
|
Write a program to output a box which is tilted in the window so that its top and bottom follow diagonal lines and fill in the box a color different from the background? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Dan
|
Posted: Thu Nov 14, 2002 9:15 pm Post subject: (No subject) |
|
|
i am not shure what you mean but here is the code for what i think you whont.
code: |
Draw.FillBox (maxx, 0, maxx div 2, maxy div 2, red)
Draw.FillBox (0, maxy, maxx div 2, maxy div 2, green)
Draw.FillBox (0, 0, maxx div 2, maxy div 2, blue)
Draw.FillBox (maxx, maxy, maxx div 2, maxy div 2, yellow)
|
P.S. i think this is school wrok and you realy shode be doing it your slef or at least aske question that are more genreal like "how do i draw a box" or "how whode i center a box".
any way i hope that helped |
Computer Science Canada
Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more! |
|
|
|
|
FizixMan
|
Posted: Thu Nov 21, 2002 11:41 pm Post subject: (No subject) |
|
|
I think it was more along the lines of drawing a diamond on the screen. Now I'm pretty sure there is no "drawfilldiamond" function, but there is drawfillpolygon.
For the polygon:
drawfillpolygon(X,Y:array of int, numPoints:int, colour:int)
With this, the "X" and "Y" are integer arrays containing all your points of your polygon.
code: |
const numPoints:int:=4
var X,Y:array 1..numPoints of int
|
Then from there you have to put in each point. Now, each corresponding array position works together with this. So X(1) and Y(1) make up a point, and X(2) and Y(2) make up a point and so forth.
So then you have to put the values in:
code: |
X(1):=200
Y(1):=200
...
...
X(numPoints):=Xpoint
Y(numPoints):=Ypoint
|
then all you need to do is put in the drawfillpolygon (it could be drawpolygon, but then it wouldn't be filled in)
drawfillpolygon(X,Y,numPoints, 3)
I just chose "3" for the colour, you can choose anyone really so long as it's not the background, right? And what it does is go through each index of that array to pick out a point. Then it fills in the polygon. It's like connect the dots from 1..numPoints.
Hope this helps.
(course, if all else fails... you could just draw a bunch of lines and emulate a diamond...*shudders*) |
|
|
|
|
|
|
|