trying to mimic a controllable dot matrix grid

Hi,
I'm trying to create a 16x16 grid of 256 rounded rectangles that can individually have their color and alpha changed by other functions.

My initial approach was to create them all in the main function with display.newRoundedRect(...)
but I reached the 200 limit.

I then created 128 in one function and 128 in another but could no longer access them from other functions.

Anybody have a solution to my problem?
Thanks!!!

Alex

@Alex,

http://iphone.oz-apps.com/create-a-dot-matrix-display

perhaps this is what you are after?

How many distinct colors do you need?
If this is a connect-4 style thing, and there are only (say) 20 color variations, you should use sprites instead.
Each color is a frame from your spritesheet.
Each sprite can have individual alpha set.

I dont have an answer if the rects must be tweakable in a 24bit colorspace.

Wasnt aware of this 200 limit, noted.

If you can create 2 batches of 128, you might want to create them in the _G table.

_G.arrayFirst128[1] = display.newRoundRect ...

_G.arraySecond128[1] = display.newRoundRect ...

@JayantV

Congrats - that looks amazing as an effect, however I'm looking to make a 16x16 grid of pads that can be turned on/off for a music sequencer like the Monome: http://monome.org/image/256_01c.jpg

the use of the term "dot matrix" was misleading - sorry

@Jeff

I wasn't familiar with _G table. - this could be exactly what I need!!!!

If I understand correctly - it's an array/table of shapes? AWESOME. I must research this
I can settle for 4 or 5 colors and 4 levels of alpha ( can store them in tables)

Thanks all!

views:1659 update:2012/1/13 9:04:04
corona forums © 2003-2011