Skip to content

Instantly share code, notes, and snippets.

View jeremyabel's full-sized avatar

Jeremy Abel jeremyabel

View GitHub Profile
@jeremyabel
jeremyabel / KeyboardKeyIcons.csv
Last active March 27, 2024 18:05
Unreal Common Input Keyboard Action Icon Generator
Key Label Icon XOffset YOffset
BackSpace
Tab
Enter
Pause
CapsLock CapsLk -5
Escape Esc
SpaceBar
PageUp PgUp -5
PageDown PgDn -5
#pragma once
#include <stdlib.h>
#define NAME_NONE "NONE"
#define U8_MAX 0xFF
typedef signed char S8;
typedef unsigned char U8;
typedef signed short S16;
@jeremyabel
jeremyabel / index.html
Created July 22, 2020 18:40
Line derivatives?
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<p>There's an interaction in our game that looks like this:</p>
<br/>
<img src="https://i.imgur.com/gIixK0p.png" />
<br/>
<p>You move a slider and the landscape changes with a nice noisy kind of movement until you get the plant in the right position.</p>
<br/>
<img src="https://i.imgur.com/8dRCevu.png">
@jeremyabel
jeremyabel / index.html
Last active July 22, 2020 18:38
Line derivatives?
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<p>There's an interaction in our game that looks like this:</p>
<img src="https://i.imgur.com/gIixK0p.png" />
<p>You move a slider and the landscape changes with a nice noisy kind of movement until you get the plant in the right position.</p>
<img src="https://i.imgur.com/8dRCevu.png">
<p>

Our game has two input modes when using the controller. One is called Virtual Cursor, where it just mimics a mouse cursor directly. Moving the analog stick moves a cursor on screen. Pressing the gamepad bottom face button registers as EKeys::LeftMouseButton as far as the input system is concerned. This is done using a IInputProcessor.

The other is called Character Pilot, which is your typical 3rd-person controller movement setup. Analog stick moves the character, pressing the gamepad bottom face button registers as EKeys::Gamepad_FaceButton_Bottom. This also uses a IInputProcessor, but it's more of just a dummy one, it doesn't actually process inputs. It's mostly used to help figure out when the player has switched from mouse to controller at any given time.

Whenever the player stops piloting the character, we remove the Virtual Cursor processor and add the Character Pilot processor. Doing this changes what the gamepad bottom face button registers as:

With Virtual Cursor: EKeys::Gamepad_FaceButton_Botto
// Fill out your copyright notice in the Description page of Project Settings.
#include "GNNode_RegisterTweakableVariable.h"
#include "GNBaseHUD.h"
#include "Framework/Commands/UIAction.h"
#include "Framework/MultiBox/MultiBoxBuilder.h"
#include "EdGraphSchema_K2.h"
#include "EdGraph/EdGraphNodeUtils.h"
#include "K2Node_InputKeyEvent.h"
#include "K2Node_CallFunction.h"
var endian = true;
var byte = 0;
var magic = view.getUint32(byte, endian);
var objectCount = view.getUint32(byte += 4, endian);
var vertexCount = view.getUint32(byte += 8, endian);
var indexCount = view.getSome8ByteValue(byte += 8, endian);
@jeremyabel
jeremyabel / ue-delaunator.h
Last active October 27, 2018 02:49
UE Delaunator
// Represents the area outside of the triangulation.
// Halfedges on the convex hull (which don't have an adjacent halfedge)
// will have this value.
#define DELAUNATOR_INVALID_INDEX TNumericLimits<int32>::Max()
bool Orient(const FVector2D A, const FVector2D Q, const FVector2D R)
{
return (Q.Y - A.Y) * (R.X - Q.X) - (Q.X - A.X) * (R.Y - Q.Y) < 0.f
}
/**
* Class which handles the display of various palette-based move fx animations.
*
* These effects operate on a bitmap which stores a capture of the state of the screen,
* and then modifies the 4-color palettes used to draw specific areas of the screen.
*
* There are a number of palette effects available:
*
* INVERT: Inverts the palette's order.
* LIGHTEN1, 2, 3, 4: Lightens the palette, by 1, 2, 3, or 4 steps.