void ThingType::draw(const Point& dest, float scaleFactor, int layer, int xPattern, int yPattern, int zPattern, int animationPhase, LightView *lightView) { if(m_null) return; if(animationPhase >= m_animationPhases) return; const TexturePtr& texture = getTexture(animationPhase); // texture might not exists, neither its rects. if(!texture) return; uint frameIndex = getTextureIndex(layer, xPattern, yPattern, zPattern); if(frameIndex >= m_texturesFramesRects[animationPhase].size()) return; Point textureOffset; Rect textureRect; if(scaleFactor != 1.0f) { textureRect = m_texturesFramesOriginRects[animationPhase][frameIndex]; } else { textureOffset = m_texturesFramesOffsets[animationPhase][frameIndex]; textureRect = m_texturesFramesRects[animationPhase][frameIndex]; } Rect screenRect(dest + (textureOffset - m_displacement - (m_size.toPoint() - Point(1, 1)) * 32) * scaleFactor, textureRect.size() * scaleFactor); bool useOpacity = m_opacity < 1.0f; if(useOpacity) g_painter->setColor(Color(1.0f,1.0f,1.0f,m_opacity)); g_painter->drawTexturedRect(screenRect, texture, textureRect); if(useOpacity) g_painter->setColor(Color::white); if(lightView && hasLight()) { Light light = getLight(); if(light.intensity > 0) lightView->addLightSource(screenRect.center(), scaleFactor, light); } }
int main(void) { double cpuTemp = getCpuTemp(); printf("cpu temp: %.2f\n", cpuTemp); if (initGpio() == -1) { exit(1); } setLedFlash(0, 3); while (1) { int light = hasLight(7); int sound = hasSound(1); printf("has light: %d, has sound: %d\n", light, sound); delay(100); } return 0; }