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?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.