void ComponentGraphics::UpdateBackground(GLFWwindow* window, Shader shader, ComponentCamera* camera, glm::vec3 difference) { if (camera->getlockParallax() == false) { if (difference[0] > 0.0001f) //right { posX -= backgroundSpeed; } if (difference[0] < -0.0001f) //left { posX += backgroundSpeed; } } //96.0f / 50.0f, 84.0f / 50.0f float CurrentCameraX = camera->getCameraPosition().x; UpdateGraphics(0.0001, window, shader, camera, ConvertTo4x4Affine(AffineScaleMatrix(96.0f / 50.0f, 84.0f / 50.0f) * AffineTranslationMatrix(posX, posY)), "NoCamX"); } void ComponentGraphics::setBackgroundSpeedFromFile(Stream stream) { backgroundSpeed = StreamReadFloat(stream); } void ComponentGraphics::setBackgroundSpeed(float speed) { backgroundSpeed = speed; } void ComponentGraphics::setPosFromFile(Stream stream) { posX = StreamReadFloat(stream); posY = StreamReadFloat(stream); }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter