Skip to content

Instantly share code, notes, and snippets.

View alanedwardes's full-sized avatar
👋

Alan Edwardes alanedwardes

👋
View GitHub Profile
@alanedwardes
alanedwardes / EstScreenshotTaker.cpp
Created December 20, 2017 00:11
Unreal Engine 4 class to take and compress screenshots to a JPEG image, then raise an event with the compressed data.
// Estranged is a trade mark of Alan Edwardes.
#include "EstScreenshotTaker.h"
#include "IImageWrapper.h"
#include "IImageWrapperModule.h"
void UEstScreenshotTaker::RequestScreenshot()
{
if (GEngine == nullptr || GEngine->GameViewport == nullptr || bIsScreenshotRequested)
{
@alanedwardes
alanedwardes / rays.js
Created December 24, 2011 20:53
Generates animated sun rays using HTML canvas
var rays = new Object({
canvas: false,
context: false,
interval: false,
offset: 0,
init: function(id, colour1, colour2){
this.canvas = document.getElementById(id);
this.context = this.canvas.getContext('2d');
this.canvas.style.background = colour1;
this.context.fillStyle = colour2;
@alanedwardes
alanedwardes / EstPlayer.cpp
Last active March 27, 2022 02:09
A client-side smooth crouching implementation for Unreal Engine 4.
void AEstPlayer::Tick(float DeltaSeconds)
{
Super::Tick(DeltaSeconds);
UpdateCamera(DeltaSeconds);
}
void AEstPlayer::UpdateCamera(float DeltaSeconds)
{
FVector EyeLocation;
@alanedwardes
alanedwardes / collector.py
Last active May 25, 2021 21:35
Uses the Pimoroni enviroplus board to capture statistics every second, update the screen and send them to a Graphite installation
#!/usr/bin/env python3
import graphyte
import time
import colorsys
import sys
import ST7735
try:
# Transitional fix for breaking change in LTR559
from ltr559 import LTR559
@alanedwardes
alanedwardes / Program.cs
Last active January 26, 2020 14:06
Parse the UE4 Vault API to catalogue it in a spreadsheet (exports the JSON -> CSV)
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace UnrealVaultParser
{
class Program
{
// Checkout and store away result
def checkoutResult = scm checkout
// Build a human readable build label
def buildLabel = [env.EstPlatform, checkoutResult.GIT_COMMIT.substring(0, 6), env.JOB_NAME, env.BUILD_NUMBER].join('-')
// Stamp the build config header file
def configFile = 'Depot/Source/EstCore/EstBuildConfig.h'
def buildConfig = readFile file: configFile
buildConfig += '\n#undef BUILD_COMMIT'
@alanedwardes
alanedwardes / logic_submerge.cpp
Created July 28, 2013 14:31
A Source Engine entity that fires an output when it's submerged.
//=============================================================================
//
// Purpose: Logic submerge - fires output when submerged in water.
//
//=============================================================================
#include "cbase.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
@alanedwardes
alanedwardes / estranged_materialsystem.cpp
Created June 11, 2013 21:59
A passthru material system for the source engine. Doesn't work very well.
#include "cbase.h"
#include "estranged_materialsystem.h"
#include "materialsystem\itexture.h"
#include "materialsystem/imaterialvar.h"
static void AppendShaderParams(const char* shader, IMaterial *pMat, KeyValues *newParams)
{
int nParams = pMat->ShaderParamCount();
IMaterialVar **pParams = pMat->GetShaderParams();
//=============================================================================//
//
// Purpose: Implementation of IMaterialSystem interface which "passes tru" all
// function calls to the real interface. Can be used to override
// IMaterialSystem function calls (combined with engine->Mat_Stub).
//
//=============================================================================//
#ifndef MATERIALSYSTEM_PASSTHRU_H
#define MATERIALSYSTEM_PASSTHRU_H
@alanedwardes
alanedwardes / GetTimestamp.cpp
Created November 24, 2012 01:02
Get the Timestamp as a Char Array
char* GetTimestamp()
{
time_t rawtime;
struct tm* timeinfo;
time(&rawtime);
timeinfo = localtime(&rawtime);
char* time = asctime(timeinfo);
char* newLine = strstr(time, "\n");