… | |
… | |
282 | } |
282 | } |
283 | } |
283 | } |
284 | |
284 | |
285 | } |
285 | } |
286 | |
286 | |
287 | void overlay::set (int x, int y, SV *str, SV *rend) |
287 | void overlay::set (int x, int y, SV *text, SV *rend) |
288 | { |
288 | { |
289 | x += border; |
289 | x += border; |
290 | y += border; |
290 | y += border; |
291 | |
291 | |
292 | if (!IN_RANGE_EXC (y, 0, h - border)) |
292 | if (!IN_RANGE_EXC (y, 0, h - border)) |
293 | return; |
293 | return; |
294 | |
294 | |
295 | wchar_t *wstr = sv2wcs (str); |
295 | wchar_t *wtext = sv2wcs (text); |
296 | |
296 | |
297 | for (int col = min (wcslen (wstr), w - x - border); col--; ) |
297 | for (int col = min (wcslen (wtext), w - x - border); col--; ) |
298 | text [y][x + col] = wstr [col]; |
298 | this->text [y][x + col] = wtext [col]; |
299 | |
299 | |
300 | free (wstr); |
300 | free (wtext); |
|
|
301 | |
|
|
302 | if (rend) |
|
|
303 | { |
|
|
304 | if (!SvROK (rend) || SvTYPE (SvRV (rend)) != SVt_PVAV) |
|
|
305 | croak ("rend must be arrayref"); |
|
|
306 | |
|
|
307 | AV *av = (AV *)SvRV (rend); |
|
|
308 | |
|
|
309 | for (int col = min (av_len (av) + 1, w - x - border); col--; ) |
|
|
310 | this->rend [y][x + col] = SvIV (*av_fetch (av, col, 1)); |
|
|
311 | } |
301 | |
312 | |
302 | THIS->want_refresh = 1; |
313 | THIS->want_refresh = 1; |
303 | } |
314 | } |
304 | |
315 | |
305 | |
316 | |