Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
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?

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*)
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 3 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: