void MaxMatrix::writeSprite(int X, int Y, const byte* Sprite) { int SpriteWidth = Sprite[ASCII_TABLE_SPRITE_WIDTH]; int SpriteHeight = Sprite[ASCII_TABLE_SPRITE_HEIGHT]; if(SpriteHeight == MAXMATRIX_ROW_NUMBER_OF_MODULE && Y == 0) { for(int i = 0; i < SpriteWidth; i++) { int Column = X + i; if(Column >= 0 && Column < MAXMATRIX_NUMBER_OF_COLUMNS) setColumn(Column, Sprite[i + ASCII_TABLE_SPRITE_COLUMN1]); } } else { for(int i = 0; i < SpriteWidth; i++) { for(int j = 0; j < SpriteHeight; j++) { int Column = X + i; int Row = Y + j; if(Column >= 0 && Column < MAXMATRIX_NUMBER_OF_COLUMNS && Row >= 0 && Row < MAXMATRIX_ROW_NUMBER_OF_MODULE) setDot(Column, Row, bitRead(Sprite[i + ASCII_TABLE_SPRITE_COLUMN1], j)); } } } }
int GASignalMatrix::set( int addr, int port, int value, int delay ) { int col = addr - startAddr; int row = port + 2; setDot( col, row, value ); return ( 200 ); }
void core::DotMatrix::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { GraphicObject::mouseReleaseEvent(event); // if(continuousDotWritting) return; //Check if object hasn't moved if(objectPosAtPress == pos()){ setDot(curRowIndex, curColIndex, !enableEraser); update(); } }
void FretDiagram::init(StringData* stringData, Chord* chord) { if (!stringData) setStrings(6); else setStrings(stringData->strings()); if (stringData) { for (int string = 0; string < _strings; ++string) _marker[string] = 'X'; foreach(const Note* note, chord->notes()) { int string; int fret; if (stringData->convertPitch(note->pitch(), chord->staff(), chord->segment()->tick(), &string, &fret)) setDot(string, fret); } _maxFrets = stringData->frets(); } else
void FretDiagram::init(Tablature* tab, Chord* chord) { if (tab == 0) setStrings(6); else setStrings(tab->strings()); if (tab) { for (int string = 0; string < _strings; ++string) _marker[string] = 'X'; foreach(const Note* note, chord->notes()) { int string; int fret; if (tab->convertPitch(note->ppitch(), &string, &fret)) setDot(string, fret); } _maxFrets = tab->frets(); } else
void core::DotMatrix::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { GraphicObject::mouseMoveEvent(event); if(flags() & GraphicObject::ItemIsMovable) return; //Taken only when continuous drawing //See the mouseReleaseEvent for clicking a determined dot. if(event->buttons() & Qt::LeftButton && enableContinuousDrawing){ QPointF pointerPos = event->pos(); updateCurRowAndColIndexes(pointerPos); // qDebug() << "Row: " + QString::number(curRowIndex) + "Col: " + QString::number(curColIndex); setDot(curRowIndex, curColIndex, !enableEraser); updateMouseRectangle(pointerPos); update(); } }
void GMMaxMatrix::writeSprite(int x, int y, const byte* sprite) { //Serial.println("in writeSprite"); int w = sprite[0]; int h = sprite[1]; if (h == 8 && y == 0) for (int i = 0; i<w; i++) { int c = x + i; if (c >= 0 && c<BITMAP_BUFFER_LEN) setColumn(c, sprite[i + 2]); } else for (int i = 0; i<w; i++) for (int j = 0; j<h; j++) { int c = x + i; int r = y + j; if (c >= 0 && c<BITMAP_BUFFER_LEN && r >= 0 && r<8) setDot(c, r, bitRead(sprite[i + 2], j)); } //Serial.println("exiting writeSprite"); }
void Timer::update() { //För att få fram vilken bild som skall visas mDec = (mTimeSave + mClock.getElapsedTime().asMilliseconds() / 100) % 10; mSek = (mTimeSave / 1000) + mClock.getElapsedTime().asSeconds(); //mMin = (mTimeSave /1000) + mClock.getElapsedTime().asSeconds() / 60; //mHour = (mTimeSave / 1000) + mClock.getElapsedTime().asSeconds() / 3600; mMin = mSek / 60; mHour = mSek / 3600; m1Sek = mSek % 10; m10Sek = (mSek / 10) % 6; m1Min = mMin % 10; m10Min = (mMin / 10) % 6; m1Hour = mHour % 10; m10Hour = (mHour / 10) % 10; timerPos = sf::Vector2f(1200, 20); if(mShow) { Window::getWindow().draw(mFrame.getSprite()); if(mRun) { mFrame.setCurrentFrame(4); //tiondels sekunder updateNumbers(mDec); setDot(); //ental sekunder updateNumbers(m1Sek); //tiotal sekunder updateNumbers(m10Sek); if(m1Min >= 1) { mFrame.setCurrentFrame(3); setColon(); //ental minuter updateNumbers(m1Min); if(m10Min >= 1) { mFrame.setCurrentFrame(2); //tiotal minuter updateNumbers(m10Min); if(m1Hour >= 1) { mFrame.setCurrentFrame(1); setColon(); //ental timmar updateNumbers(m1Hour); if(m10Hour >=1) { mFrame.setCurrentFrame(0); //tiotal timmar updateNumbers(m10Hour); } } } } } else { mFrame.setCurrentFrame(4); updateNumbers(0); setDot(); updateNumbers(0); updateNumbers(0); } mFrame.update(); } }
void DotDisplay::updateDisplay(char textMessage[]){ /* CONSTANTS */ int DISPLAY_SIZE = 15; //=== F O N T === // Font code taken from // http://www.instructables.com/files/orig/FQC/A1CY/H5EW79JK/FQCA1CYH5EW79JK.txt // The @ will display as space character. byte alphabet[][5] = { {0,0,0,0,0}, {0,56,125,56,0},// ! {80,96,0,80,96},//" {20,127,20,127,20},//# {18,42,127,42,36},//$ {98,100,8,19,35},//% {54,73,85,34,5},//& {0,80,96,0,0},//'(7) {0,28,34,65,0},//( {0,65,34,28,0},//) {20,8,62,8,20},//* {8,8,62,8,8},//+ {0,5,6,0,0},//,(12) {8,8,8,8,8},//- {0,3,3,0,0},//.(14) {2,4,8,16,32},// / {62,69,73,81,62},//0 {17,33,127,1,1},//1 {33,67,69,73,49},//2 {34,65,73,73,54},//3 {12,20,36,127,4},//4 {114,81,81,81,78},//5 {62,73,73,73,38},//6 {64,71,72,80,96},//7 {54,73,73,73,54},//8 {50,73,73,73,62},//9 {0,54,54,0,0},//:(26) {0,53,54,0,0},//;(27) {8,20,34,65,0},//< {20,20,20,20,20},//= {0,65,34,20,8},//> {32,64,69,72,48},//? {62,73,87,85,62},//@ {31, 36, 68, 36, 31}, //A {127, 73, 73, 73, 54}, //B {62, 65, 65, 65, 34}, //C {127, 65, 65, 34, 28}, //D {127, 73, 73, 65, 65}, //E {127, 72, 72, 72, 64}, //F {62, 65, 65, 69, 38}, //G {127, 8, 8, 8, 127}, //H {0, 65, 127, 65, 0}, //I {2, 1, 1, 1, 126}, //J {127, 8, 20, 34, 65}, //K {127, 1, 1, 1, 1}, //L {127, 32, 16, 32, 127}, //M {127, 32, 16, 8, 127}, //N {62, 65, 65, 65, 62}, //O {127, 72, 72, 72, 48}, //P {62, 65, 69, 66, 61}, //Q {127, 72, 76, 74, 49}, //R {50, 73, 73, 73, 38}, //S {64, 64, 127, 64, 64}, //T {126, 1, 1, 1, 126}, //U {124, 2, 1, 2, 124}, //V {126, 1, 6, 1, 126}, //W {99, 20, 8, 20, 99}, //X {96, 16, 15, 16, 96}, //Y {67, 69, 73, 81, 97}, //Z {0,127,65,65,0},//[ {32,16,8,4,2},// {0,65,65,127,0}, {16,32,64,32,16},//^ {1,1,1,1,1},//_ {0,64,32,16,0},//` {2,21,21,14,1},//a {64,126,9,17,14},//b {14,17,17,17,10},//c {14,17,74,127,1},//d {14,21,21,21,9},//e {1,9,63,72,32},//f {9,21,21,21,30},//g {127,8,8,8,7},//h {0,0,46,1,1},//i {2,1,1,1,94},//j {1,127,4,10,17},//k {0,65,127,1,0},//l {31,16,14,16,31},//m {31,8,16,16,15},//n {14,17,17,17,14},//o {127,20,20,20,8},//p {8,20,20,31,1},//q {31,8,16,16,8},//r {9,21,21,21,18},//s {16,16,126,17,18},//t {30,1,1,30,1},//u {28,2,1,2,28},//v {30,1,6,1,30},//w {17,10,4,10,17},//x {16,9,6,8,16},//y {17,19,21,25,17},//z {8,54,65,65,0},//{ {0,0,127,0,0},//|(92) {0,65,65,54,8},//} {32,64,32,16,32},//~ }; //Serial.print("FROM WITHIN THE FUNCTION("); //Serial.print(textMessage); //Serial.print(")"); int currentColumn = 0; //goes through all characters for (int ch = 0; ch < (DISPLAY_SIZE);ch++){ //get a character from the message int alphabetIndex = textMessage[ch] - ' '; //Subtract '@' so we get a number //Serial.println(alphabetIndex); if (alphabetIndex < 0) alphabetIndex=0; //set all the bits in the next 5 columns on the display for(byte col = currentColumn; col<(currentColumn+5); col++){ byte calculatedColumn = (col)%5; for(byte row = 0; row < 7; row++){ bool isOn = bitRead(alphabet[alphabetIndex][calculatedColumn],6-row);//this index is needed as we are going from back to front setDot(col, row, isOn); } } currentColumn = currentColumn+5; } }
int CKLBUIScore::commandUI(CLuaState& lua, int argc, int cmd) { int ret = 0; switch(cmd) { case UI_SCORE_RESET: setValue(0); m_bScoreUpdate = true; break; case UI_SCORE_SET: { if(argc != 3) { lua.retNil(); ret = 1; break; } int value = lua.getInt(3); if(m_bCountClip && value >= m_maxvalue) value = m_maxvalue - 1; setValue(value); } break; case UI_SCORE_SETFLOAT: { if(argc != 4) { lua.retNil(); ret = 1; break; } float value = lua.getFloat(3); int pos = lua.getInt(4); if(m_bCountClip && value >= m_maxvalue) value = m_maxvalue - 1; setValueFloat(value, pos); } break; case UI_SCORE_SETDOT: { if(argc != 5) { lua.retNil(); ret = 1; break; } setDot(lua.getString(3), lua.getInt(4), lua.getInt(5)); } break; case UI_SCORE_GET: { int value = getValue(); lua.retInt(value); ret = 1; } break; case UI_SCORE_ENTERANIM: { if(argc != 8) { lua.retBoolean(false); ret = 1; break; } s32 mspt = lua.getInt(3); s32 tshift = lua.getInt(4); bool onlychg = lua.getBool(5); int type = lua.getInt(6); u32 affected = lua.getInt(7); float mat[8]; klb_assert(type > 0, "UI_Score: UI_SCORE_ENTERANIM type == 0"); // 配列を読む lua.retValue(8); lua.retNil(); while(lua.tableNext()) { lua.retValue(-2); int idx = lua.getInt(-1) - 1; klb_assert((idx >= 0 && idx < 8), "%s(%d): bad array index. UI_SCORE_ENTERANIM", lua.getScriptName(), lua.getNumLine()); mat[idx] = lua.getFloat(-2); lua.pop(2); } lua.pop(1); klb_assert(type != 0, "Custom animation is not authorized (type 0)"); m_pScoreNode->setEnterAnimation(mspt, tshift, onlychg, type, affected, mat); } break; case UI_SCORE_EXITANIM: { if(argc != 8) { lua.retBoolean(false); ret = 1; break; } s32 mspt = lua.getInt(3); s32 tshift = lua.getInt(4); bool onlychg = lua.getBool(5); int type = lua.getInt(6); u32 affected = lua.getInt(7); float mat[4]; klb_assert(type > 0, "UI_Score: UI_SCORE_ENTERANIM type == 0"); // 配列を読む lua.retValue(8); lua.retNil(); while(lua.tableNext()) { lua.retValue(-2); int idx = lua.getInt(-1) - 1; mat[idx] = lua.getFloat(-2); lua.pop(2); } lua.pop(1); klb_assert(type != 0, "Custom animation is not authorized (type 0)"); m_pScoreNode->setExitAnimation(mspt, tshift, onlychg, type, affected, mat); } break; case UI_SCORE_ALIGN: { bool bResult = false; if(argc == 3) { int align = lua.getInt(3); setAlign(align); bResult = true; } lua.retBool(bResult); ret = 1; } break; } return ret; }