![]() |
|
#1
|
|||
|
|||
FLTK - Can't fill in my star . . .I am writing a program to draw a star to the screen. I have done this successfully, and can run my code which produces a red star. As per my lab instructions (this is a school assignment) I am supposed to fill the star in. I figured, as my teacher informed me, that I could simply stick the code in a loop altering the size of the star until I get a completely filled star.
Below is my working star code, please bare in mind that many of the header files included where provided by my teacher for "simplicity" and I am required to use them. I don't believe the problem is here, but rather occurs when I try and reuse the same "Points" and "Lines": CPP / C++ / C Code:
Any ideas as to why simply placing this code in a loop doesnt work? When out of a loop it produces a star, when inside the loop it produces a small scribble in the top left corner. Any help would be greatly appreciated! |
|||
|
#2
|
||||
|
||||
Re: FLTK - Can't fill in my star . . .Is it possible for you to post the included files here? Without them, you can't really expect to get any useful help with the FLTK code.
I'll venture a guess that you will want to explore the drawing functions that can be found in the documentation under, oddly enough, Function Reference - Drawing Functions. Also, take a look at the arc example in the test dir for complex drawing. Mark __________________
"Opportunity is missed by most people because it comes dressed in overalls and looks like work." --Thomas Alva Edison "Those who would give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety." --Benjamin Franklin "A happy person is not a person in a certain set of circumstances, but rather a person with a certain set of attitudes." --Hugh Downs |
|
#3
|
|||
|
|||
Re: FLTK - Can't fill in my star . . .All of the included files can be found at: courses.cs.tamu.edu/daugher/cpsc121/07fall/
Under the "Code" section on the right hand side of the page. Sorry I tried to post direct links to the source but the ending directories got stripped off. All except Samle_main3.cpp are needed. There are quite a few. And several (the .cpp files) must be compiled along with star.cpp (the first posted source code) My problem doesn't reside in any of those files. I am assuming it has to do with the scope of the loop the encompasses the actual code that produces the star. Basically what I want to do is draw a small star, then a larger one, then a larger . . . until I have a star of desired size that is filled in (by all the smaller stars). I assumed that once I got the code working to draw the star I could simply throw it in a for loop and change the "radius" variable (this is the radius of my unit circle . . . ) and it would produce a smaller star. But, as soon as the previously posted code is placed in a loop it goes crazy producing a tiny scribble in the top left corner. Even when I set the loop to go through only once, or just set it in an if statement that's set to true it does the same thing. |
|
#4
|
||||
|
||||
Re: FLTK - Can't fill in my star . . .If I can make some time I'll try this out later.
For anyone else, http://courses.cs.tamu.edu/daugher/cpsc121/07fall/ Louis, your links will eventually show up when you get enough posts. Mark __________________
"Opportunity is missed by most people because it comes dressed in overalls and looks like work." --Thomas Alva Edison "Those who would give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety." --Benjamin Franklin "A happy person is not a person in a certain set of circumstances, but rather a person with a certain set of attitudes." --Hugh Downs |
|
#5
|
|||
|
|||
Re: FLTK - Can't fill in my star . . .try
Fl::redraw(); within the loop to fill star you must be decrease a radius and draw |
|
#6
|
|||
|
|||
Re: FLTK - Can't fill in my star . . .Quote:
I have tried implementing the redraw on the line(s). But unfortunately this is not supported by Graph.h (the header file provided by my professor . . .). Is there any way to call it anyway? Or is there another way to correct my problem? Here is what happens when the program is run. The top window shown in the image is the code outside of a for loop, the bottom is the code inside of a for loop: CPP / C++ / C Code:
![]() Just produces crazy lines. Regardless of the loop, it does the same thing. Thanks |
|
#7
|
|||
|
|||
Re: FLTK - Can't fill in my star . . .Figured it out. It was a scope problem :-) Thanks for the help!
|
Recent GIDBlog
Problems with the Navy (Officers) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [Tutorial] GUI programming with FLTK | dsmith | FLTK Forum | 10 | 03-Oct-2005 15:41 |
| Re: Derived FLTK Classes | cable_guy_67 | FLTK Forum | 0 | 26-Jun-2005 20:07 |
| FLTK with GLUT | usmsci | FLTK Forum | 4 | 26-Nov-2004 16:21 |
| fltk and ncurses | podarok | FLTK Forum | 2 | 08-Nov-2004 07:45 |
| Welcome to the FLTK Forums | dsmith | FLTK Forum | 0 | 08-Sep-2004 06:58 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The