Log In  

Cart #rceach-0 | 2022-03-30 | Code ▽ | Embed ▽ | Forks ▽ | No License

Feature Overview

RCEACH() performs a two-dimensional loop in a single function.

  • The rectangle value arguments correspond to [table] {x,y,w,h} and [string] "x y w h".
  • You can refer to the current x and y values in the specified function.
  • This function consumes 50 Token.
rceach({16,16,32,32},function(x,y,r)
 local c=(x+y)%8+8
 pset(x,y,c)
end)

One of KNUTIL's functions, the object generated by EXRECT(), has a rectangle value format to be used for the RCEACH() argument.
may want to Use DMP() if check the converted table.
This function is included in the KNUTIL library.

P#72450 2022-03-30 10:32 ( Edited 2022-06-30 04:10)

interesting construct but per-pixel operations are super costly on Pico.
usually better to find ‘block’ alternative.

P#109406 2022-03-30 11:57

@freds72
Ah, yes! You are right.
My post is simple in the look of the code and something that can be tried quickly. (I'm not considering cpu cost)

BTW, what does the 'block' you are referring to indicate?

P#109415 2022-03-30 14:02

block = operation on many pixels at once (spr, map, memcpy…)

P#109428 2022-03-30 16:28

I understand!
Thanks!

P#109464 2022-03-31 13:15

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2022-10-01 18:31:00 | 0.017s | Q:16