Skip to content

Instantly share code, notes, and snippets.

View petrocket's full-sized avatar
💥
Trying not to cross the streams

Alex Peterson petrocket

💥
Trying not to cross the streams
View GitHub Profile
@petrocket
petrocket / GameAudio.mm
Last active August 29, 2015 13:57
Game Audio Implementation
@implementation GameAudio
void playBackgroundMusic(std::string filename)
{
[SimpleAudioEngine sharedEngine].backgroundMusicVolume = 0.25;
[[SimpleAudioEngine sharedEngine] playBackgroundMusic:[NSString stringWithCString:filename.c_str() encoding:[NSString defaultCStringEncoding]]];
}
void stopBackgroundMusic()
{
@petrocket
petrocket / GameAudioInterface.h
Created April 2, 2014 00:17
Game Audio Interface Header
void playBackgroundMusic(std::string filename);
void stopBackgroundMusic();
unsigned int playEffect(std::string filename);
unsigned int playEffect(std::string filename,float pitch, float pan, float gain);
@petrocket
petrocket / GameKeyboard.h
Last active August 29, 2015 13:57
Game Keyboard Header
@interface GameKeyboard : NSObject<UITextFieldDelegate>
@property (nonatomic, strong) UITextField *textField;
+ (GameKeyboard *)sharedInstance;
@end
@petrocket
petrocket / GameKeyboard.mm
Last active August 29, 2015 13:57
Game Keyboard Implementation
using namespace std;
map <char, OIS::KeyCode> createKeyMap() {
map<char, OIS::KeyCode> m;
m['a'] = OIS::KC_A;
m['b'] = OIS::KC_B;
m['c'] = OIS::KC_C;
m['d'] = OIS::KC_D;
m['e'] = OIS::KC_E;
m['f'] = OIS::KC_F;
@petrocket
petrocket / GameKeyboardInterface.h
Created April 2, 2014 00:21
Game Keyboard Interface
void setKeyboardVisible(bool visible);
void setKeyboardVisible(bool visible, const std::string& text);
@petrocket
petrocket / tri-planar-sphere.fx
Created April 2, 2014 01:25
NVidia FX Composer Tri-Planer Sphere
/************* UN-TWEAKABLES **************/
float4x4 WorldITXf : WorldInverseTranspose < string UIWidget="None"; >;
float4x4 WvpXf : WorldViewProjection < string UIWidget="None"; >;
float4x4 WorldXf : World < string UIWidget="None"; >;
float4x4 ViewIXf : ViewInverse < string UIWidget="None"; >;
float3 Lamp0Pos : Position <
string Object = "PointLight0";
string UIName = "Lamp 0 Position";
string Space = "World";
@petrocket
petrocket / nodejs_sequential.js
Last active August 9, 2020 21:59
NodeJs Sequential Promises
// a list of sequential tasks (promises)
var sequentialTask1 = []
sequentialTask1.push((result)=>{
return new Promise( (resolve,reject) => {
console.log('sequential task 1 a with 2 seconds delay ...');
setTimeout(resolve, 2000);
});
});
sequentialTask1.push((result)=>{
return new Promise( (resolve,reject) => {
@petrocket
petrocket / lfs-lambda-function.py
Created August 9, 2020 23:08
Single file AWS Lambda serverless LFS service using S3 for object store and SecretsManager for credentials
import json
import boto3
from botocore.exceptions import ClientError
from botocore.client import Config
import json
from base64 import b64decode
import logging
import os
@petrocket
petrocket / deploy-lfs-service.yml
Last active August 11, 2020 02:31
AWS CloudFormation template to stand up a serverless LFS service using API Gateway, Lambda, S3 and SecretsManager
AWSTemplateFormatVersion: 2010-09-09
#
# This AWS CloudFormation template will set up a serverless LFS service using
# API Gateway, S3 for storage, Lambda and SecretsManager for credentials.
# It will also create a few IAM roles.
# When deployed you will be able to use your git lfs endpoint using
# the API Gateway endpoint which will look like this
#
# https://example.execute-api.us-west-2.amazonaws.com/lfs
#
@petrocket
petrocket / O3DEGameJamSetup.md
Last active June 26, 2022 05:00
O3DE GameJam Solo Setup

Setup

  1. get latest o3de
  2. create project using script scripts\o3de.bat create-project -pp path/to/project
  3. cd into project folder
  4. (optional)edit IMGUI cmake so IMGUI is availabe in release build - change IMGUI_DISABLED to IMGUI_ENABLED
  5. configure and build project-centric so all binaries are in project build folder
  6. run editor and create a game level e.g. game.prefab
  7. edit autoexec.cfg with something that loads the level, turns off debug text and enters fullscreen
loadlevel game