Skip to content

Instantly share code, notes, and snippets.

Alan Edwardes alanedwardes

Block or report user

Report or block alanedwardes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@alanedwardes
alanedwardes / EstScreenshotTaker.cpp
Created Dec 20, 2017
Unreal Engine 4 class to take and compress screenshots to a JPEG image, then raise an event with the compressed data.
View EstScreenshotTaker.cpp
// 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)
{
View estranged-jenkinsfile-build-stamp.groovy
// 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 / rays.js
Created Dec 24, 2011
Generates animated sun rays using HTML canvas
View rays.js
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 Dec 19, 2017
A client-side smooth crouching implementation for Unreal Engine 4.
View EstPlayer.cpp
void AEstPlayer::Tick(float DeltaSeconds)
{
Super::Tick(DeltaSeconds);
UpdateCamera(DeltaSeconds);
}
void AEstPlayer::UpdateCamera(float DeltaSeconds)
{
FVector EyeLocation;
@alanedwardes
alanedwardes / logic_submerge.cpp
Created Jul 28, 2013
A Source Engine entity that fires an output when it's submerged.
View logic_submerge.cpp
//=============================================================================
//
// 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 Jun 11, 2013
A passthru material system for the source engine. Doesn't work very well.
View estranged_materialsystem.cpp
#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();
View passthru_materialsystem.hpp
//=============================================================================//
//
// 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 Nov 24, 2012
Get the Timestamp as a Char Array
View GetTimestamp.cpp
char* GetTimestamp()
{
time_t rawtime;
struct tm* timeinfo;
time(&rawtime);
timeinfo = localtime(&rawtime);
char* time = asctime(timeinfo);
char* newLine = strstr(time, "\n");
@alanedwardes
alanedwardes / statistics_collector.cpp
Created Oct 6, 2012
Simple entity for the Source Engine to log and send gameplay statistics.
View statistics_collector.cpp
//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ========
//
// Purpose: Simple entity to log and send gameplay statistics
//
//=============================================================================
#include "cbase.h"
#include "vstdlib/jobthread.h"
#include "curl/curl.h"
#include "steam\steam_api.h"
@alanedwardes
alanedwardes / Encoder.js
Created Jun 24, 2012
Simple JS object to encode text to its unicode character references for URLs and HTML. Makes displaying text and passing data to a server super safe.
View Encoder.js
/////////////////
// HTML EXAMPLES
/////////////////
// Encoder.html_entities("常用國字標準字體表"); "常用國字標準字體表"
// Encoder.html_entities("%"); "%"
// Encoder.html_entities("Pig: €3.99 (£6.77)"); "Pig: €3.99 (£6.77)"
/////////////////
// URL EXAMPLES
/////////////////
// Encoder.url_encode("常用國字標準字體表"); "%u5E38%u7528%u570B%u5B57%u6A19%u6E96%u5B57%u9AD4%u8868"
You can’t perform that action at this time.