Skip to content

Instantly share code, notes, and snippets.

#include "FastLED.h"
#include <CapacitiveSensor.h>
#include <Servo.h>
// WS2812B definitions
#define NUM_LEDS 17
#define DATA_PIN 7
CRGB leds[NUM_LEDS];
int bright = 3;
@grisevg
grisevg / AnimatedImage.cpp
Last active August 30, 2023 02:49
UMG Animated Image.
#include "AnimatedImage.h"
void UAnimatedImage::SetCurrentFrame(int32 Frame)
{
CurrentFrame = Frame;
if (CurrentFrame < 0) CurrentFrame = 0;
if (CurrentFrame > TotalFrames - 1) CurrentFrame = TotalFrames - 1;
SynchronizeProperties();
}
@grisevg
grisevg / FAsyncQueue.h
Last active October 20, 2023 03:39
Utility class for asynchronous/coroutine style programming in UE4 C++
#pragma once
/**
* FAsyncQueue can be used to run asynchronous delegates in sequence, parallel and combinations of the above
*
* Use Add() to enqueue delegates matching FAsyncDelegate signature:
* a void function that accepts a single argument of another void function with no arguments.
*
* Static factories MakeSync, MakeSequence and MakeParallel can be used to wrap different type of delegates and
* delegate collections into a single FAsyncDelegate which can be enqueued with Add().