Skip to content

Instantly share code, notes, and snippets.

View MGDSStudio's full-sized avatar

Alexander Gorodilov MGDSStudio

View GitHub Profile
@MGDSStudio
MGDSStudio / blur_grayscale_variable.frag
Created June 25, 2024 07:27
This shader is enabled when the player in my game is dead
// Copyright © 2024 MGDS Studio. All rights reserved.
/** Used to create a visual effect when the player in my game is dead.
* Values must be passed:
shaderProgram.setUniformf( "time", deltaTime );
shaderProgram.setUniformf( "u_imageSize", new Vector2(textureRegion.getWidth(), textureRegion.getHeight()) );
*/
#ifdef GL_FRAGMENT_PRECISION_HIGH
@MGDSStudio
MGDSStudio / Fragment_shader_for_sprite_in_portal_dissolving.fs
Created June 24, 2024 13:37
This shader is used to create an effect of a sprite dissolving in a portal (when the protagonist visits a portal) in my game. The sprite should have the same size as the source image file.
// Copyright © 2024 MGDS Studio. All rights reserved.
#ifdef GL_ES
#define LOWP lowp
precision mediump float;
#else
#define LOWP
#endif
const float VISIBLE_LINES_COUNT = 7.0; // Visible areas pieces
@MGDSStudio
MGDSStudio / LedStripController.cpp
Created April 21, 2023 13:25
Controller for LED-strips with chips ws2811. The code doesn't use SPI and I2C.
#include <iostream>
#include <chrono>
#include <thread>
void switchOnLeds(int firstLed, int lastLed);
void digitalWrite(int pin, bool statement);
int main()
{
switchOnLeds(0, 4);
@MGDSStudio
MGDSStudio / LedChainManager.java
Created April 21, 2023 09:11
Code to control a LED-strip based on chips ws2811. It switches on a line of LEDs white (parameter 2>parameter1) or switches all the LEDs off (parameter 1 = 0; parameter 2 = 0)
public class LedChainManager extends Manager{
private LinuxRaspberryPiGpioManager linuxRaspberryPiGpioManager;
private int parameter1, parameter2;
private static LedStrip ledStrip;
private final int leds = 10;
public LedChainManager(LinuxRaspberryPiGpioManager linuxRaspberryPiGpioManager) {
this.linuxRaspberryPiGpioManager = linuxRaspberryPiGpioManager;
init();