mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-11 23:54:18 +00:00
BLOCKS SDK: New and updated version of juce_blocks_basics, adding functionality and compatibility with latest Dashboard-compatible firmware
This commit is contained in:
parent
beab10fca7
commit
f207ebb6d8
19 changed files with 1302 additions and 566 deletions
|
|
@ -29,7 +29,7 @@
|
|||
*/
|
||||
|
||||
|
||||
BitmapLEDProgram::BitmapLEDProgram (LEDGrid& lg) : Program (lg) {}
|
||||
BitmapLEDProgram::BitmapLEDProgram (Block& b) : Program (b) {}
|
||||
|
||||
/*
|
||||
The heap format for this program is just an array of 15x15 5:6:5 colours,
|
||||
|
|
@ -38,27 +38,31 @@ BitmapLEDProgram::BitmapLEDProgram (LEDGrid& lg) : Program (lg) {}
|
|||
|
||||
void BitmapLEDProgram::setLED (uint32 x, uint32 y, LEDColour colour)
|
||||
{
|
||||
auto w = (uint32) ledGrid.getNumColumns();
|
||||
auto h = (uint32) ledGrid.getNumRows();
|
||||
|
||||
if (x < w && y < h)
|
||||
if (auto ledGrid = block.getLEDGrid())
|
||||
{
|
||||
auto bit = (x + y * w) * 16;
|
||||
auto w = (uint32) ledGrid->getNumColumns();
|
||||
auto h = (uint32) ledGrid->getNumRows();
|
||||
|
||||
ledGrid.setDataBits (bit, 5, colour.getRed() >> 3);
|
||||
ledGrid.setDataBits (bit + 5, 6, colour.getGreen() >> 2);
|
||||
ledGrid.setDataBits (bit + 11, 5, colour.getBlue() >> 3);
|
||||
if (x < w && y < h)
|
||||
{
|
||||
auto bit = (x + y * w) * 16;
|
||||
|
||||
block.setDataBits (bit, 5, colour.getRed() >> 3);
|
||||
block.setDataBits (bit + 5, 6, colour.getGreen() >> 2);
|
||||
block.setDataBits (bit + 11, 5, colour.getBlue() >> 3);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jassertfalse;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 BitmapLEDProgram::getHeapSize()
|
||||
{
|
||||
return 15 * 15 * 16;
|
||||
}
|
||||
|
||||
juce::String BitmapLEDProgram::getLittleFootProgram()
|
||||
{
|
||||
auto program = R"littlefoot(
|
||||
String program (R"littlefoot(
|
||||
|
||||
#heapsize: 15 * 15 * 2
|
||||
|
||||
void repaint()
|
||||
{
|
||||
|
|
@ -76,9 +80,12 @@ juce::String BitmapLEDProgram::getLittleFootProgram()
|
|||
}
|
||||
}
|
||||
|
||||
)littlefoot";
|
||||
)littlefoot");
|
||||
|
||||
return juce::String (program)
|
||||
.replace ("NUM_COLUMNS", juce::String (ledGrid.getNumColumns()))
|
||||
.replace ("NUM_ROWS", juce::String (ledGrid.getNumRows()));
|
||||
if (auto ledGrid = block.getLEDGrid())
|
||||
return program.replace ("NUM_COLUMNS", juce::String (ledGrid->getNumColumns()))
|
||||
.replace ("NUM_ROWS", juce::String (ledGrid->getNumRows()));
|
||||
|
||||
jassertfalse;
|
||||
return {};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue