shandor has asked for the wisdom of the Perl Monks concerning the following question:
I'm just starting to play around with Curses and I want to draw a (n,n) box of X's to the screen. Then I want to move that box and draw it again. I'm trying to figure out how modify the coordinate variables stored in the matrix.
Currently, I'm storing my coordinates in a matrix. I create my matrix like this...
my ($x, $y) = qw(5 10); my @A = ( [ ([$x, $y ]), ([$x+1, $y ]), ([$x+2, $y ]), ([$x+3, $y ]) ], [ ([$x, $y+1]), ([$x+1, $y+1]), ([$x+2, $y+1]), ([$x+3, $y+1]) ], [ ([$x, $y+2]), ([$x+1, $y+2]), ([$x+2, $y+2]), ([$x+3, $y+2]) ], [ ([$x, $y+3]), ([$x+1, $y+3]), ([$x+2, $y+3]), ([$x+3, $y+3]) ], );
After drawing my matrix, I try to move and redraw the matrix, but when I change $x and $y, it doesn't change the elements in the already created matrix. I've looked at a couple of the Matrix modules, but they all seem to want my matrix elements to be a single value, not an array.
Is there a way to get ($x,$y) to update without cycling through the entire matrix again?
Back to
Seekers of Perl Wisdom