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?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Storing variable coordinates in a matrix
by davidrw (Prior) on Mar 15, 2007 at 16:46 UTC | |
Re: Storing variable coordinates in a matrix
by Fletch (Bishop) on Mar 15, 2007 at 16:37 UTC | |
Re: Storing variable coordinates in a matrix
by andye (Curate) on Mar 15, 2007 at 16:42 UTC | |
Re: Storing variable coordinates in a matrix
by Moron (Curate) on Mar 15, 2007 at 17:18 UTC | |
by robot_tourist (Hermit) on Mar 16, 2007 at 12:41 UTC | |
Re: Storing variable coordinates in a matrix
by jettero (Monsignor) on Mar 16, 2007 at 19:29 UTC |
Back to
Seekers of Perl Wisdom