Computer Science Canada Maxx and Maxy trouble... |
Author: | lapo3399 [ Fri Jul 14, 2006 1:58 pm ] | ||||
Post subject: | Maxx and Maxy trouble... | ||||
Hi, I am attempting to draw circles (Draw.FillOval) in one of my programs, and, unfortunately, when I use an in-class function to assign "maxx div 2" and "maxy div 2" to an array with an enumerated type in that class, and then use the two values inside of Draw.FillOval as the x and y locations. Seeing nothing on the screen, I put in a put command to output the values that the program had recorded for the positions in the array, and got approximately 9000 and 16000 for x and y. These are much too large, and I am wondering whether maxx/maxy are dependent solely on the size of the area defined in View.Set, or whether calculations can increase the size of them based on range or domain of output. The following is my assignment of maxx and maxy to the array:
And the following is my Draw.FillOval
Any help would be appreciated, lapo3399 |
Author: | lapo3399 [ Fri Jul 14, 2006 2:00 pm ] | ||
Post subject: | |||
I should probably show the way the values are assigned to array using init_pos too:
Thanks! |
Author: | Delos [ Fri Jul 14, 2006 2:01 pm ] |
Post subject: | |
Can't say for sure if indeed you are using the enum type, but as a work-around for this, you could declare two MAXX and MAXY constants in your parent class that would be referencable (word?) later on. This would ensure that you wouldn't be getting the wrong values... Though you might want to make them variables instead and initialize them in an 'initialize' function, thus ways you can have screens of different size and not only (eg.) 800x600. |
Author: | lapo3399 [ Fri Jul 14, 2006 2:06 pm ] |
Post subject: | |
That make sense. Thanks a lot for your help ![]() |
Author: | Delos [ Fri Jul 14, 2006 4:33 pm ] |
Post subject: | |
Nevertheless, this still is an intriguing problem. I'd like to explore it a little further - just to figure out what the hell Turing's doing this time ![]() You could also post it here, but not everyone likes to release code-in-progress, your choice really! |
Author: | lapo3399 [ Fri Jul 14, 2006 7:19 pm ] |
Post subject: | |
Oh... it's not Turing's fault, I figured out that it was mine ![]() Your method works better anyway than fixing what was wrong, but it isn't necessary for you to look at it... Turing is working.... this time.... ![]() |
Author: | [Gandalf] [ Fri Jul 14, 2006 8:28 pm ] |
Post subject: | |
Ok, you pass init_pos() two values, maxx div 2 and maxy div 2. Those numbers would be default (on the 640x480 screen) be 320 and 240. When you multiply them by 50 in the init_pos() procedure, why don't you expect them to be in the thousands? 320*50 is 16000, as you output said, and as the drawing suggested (ie. 16000 way way off a 1024x800 monitor). |
Author: | Slaivis [ Fri Jul 14, 2006 9:53 pm ] |
Post subject: | |
Hm... I think what he wanted to do was "A * 50 := x" In order to do that, he would have to write it as "A := x / 50". I know I've made similar mistakes before. |