Skip to content

Instantly share code, notes, and snippets.

View osolovyoff's full-sized avatar

Oleg Solovyoff osolovyoff

  • Belarus/Minsk
View GitHub Profile
@OmarShehata
OmarShehata / RebindAction.cpp
Created June 1, 2017 21:42
Rebinding Keys at runtime in Unreal Engine 4.
void RebindAction(FName ActionName, FKey NewKey) {
// Adapted from Rama's VictoryBPFunctionLibrary (https://wiki.unrealengine.com/Rebinding_Keys_At_Runtime_in_Packaged_Game)
UInputSettings* Settings = const_cast<UInputSettings*>(GetDefault<UInputSettings>());
if (Settings) {
TArray<FInputActionKeyMapping>& Actions = Settings->ActionMappings;
for (FInputActionKeyMapping& Each : Actions)
{
if (Each.ActionName == ActionName) {
Each.Key = NewKey;
UE_LOG(LogTemp, Warning, TEXT("%s is triggered by %s"), *Each.ActionName.ToString(), *Each.Key.ToString());
@latentflip
latentflip / Instrumentor.coffee
Created October 27, 2012 12:21
Instrumentor
#depends on underscore
_.isConstructor = (thing) ->
if thing.name && thing.name[0].toUpperCase() == thing.name[0]
true
else
false
class Instrumentor
constructor: (namespace) ->
@yoggy
yoggy / SerialPort.cpp
Created August 11, 2012 10:58
SerialPort class sample using boost::asio::serial_port
#include "StdAfx.h"
#include <Setupapi.h>
#pragma comment(lib, "Setupapi.lib")
#include "SerialPort.h"
SerialPort::SerialPort(void) : end_of_line_char_('\n')
{
}