Skip to content

Instantly share code, notes, and snippets.

View eonarheim's full-sized avatar
🕹️
Fixin' bugs

Erik Onarheim eonarheim

🕹️
Fixin' bugs
View GitHub Profile
@eonarheim
eonarheim / elastic-camera.ts
Last active August 29, 2015 14:24
Elastic camera code
var cameraVel = new ex.Vector(0, 0);
engine.on('update', function(){
// Calculate the center of mass between the players on screen
// this is sort of a naive way to do co-op camera but works for now
var playerAvg = players.reduce(function(last, current, i){
return new ex.Vector(last.x + current.x, last.y + current.y);
}, ex.Vector.Zero.clone()).scale(1/players.length);
// Grab the current focus of the camper
@eonarheim
eonarheim / screenshot.ps1
Last active December 6, 2018 19:03
Screen Shot with powershell
## Simple screen shot powershell script
[Reflection.Assembly]::LoadWithPartialName("System.Drawing")
# Base path to save screen shots
$basePath = "$env:USERPROFILE\Desktop\ld41-screenshots\"
# Bounding rectangle of the 1st screen (can be found in the windows display properties)
# The primary screen always starts at (0, 0), then other screens have bounds relative to the primary screen
$bounds1 = [Drawing.Rectangle]::FromLTRB(0, 0, 3240, 2160)
@eonarheim
eonarheim / ExcaliburGraphicsAPI.md
Last active May 12, 2020 14:03
New Graphics API documentation

Excalibur Graphics API

Excalibur has a new graphics system that has been developed to hide the underyling implementation. This allows optimizations like webgl batch rendering and shader programs to increase the speed and power of our drawings. This new system does a great deal to reduce the complexity of the drawing stack for both developers using Excalibur and the maintainers.

This implementation is being tracked here

Folder: https://github.com/excaliburjs/Excalibur/tree/feature/drawing-graphics-redo/src/engine/Graphics

@eonarheim
eonarheim / patched-excalibur-v0.24.5.js
Created July 19, 2021 19:24
Collision Resolution Patch v0.24.5
This file has been truncated, but you can view the full file.
/*!
* excalibur - 0.24.5 - Collision Resolution Patch - 2020-9-8
* https://github.com/excaliburjs/Excalibur
* Copyright (c) 2020 Excalibur.js <https://github.com/excaliburjs/Excalibur/graphs/contributors>
* Licensed BSD-2-Clause
* @preserve
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
@eonarheim
eonarheim / AdminRestApi.ps1
Last active August 12, 2022 21:08
PowerShell DSC Configuration for the new Microsoft IIS.Administration Rest API
configuration AdminRestAp {
Import-DscResource -ModuleName xPSDesiredStateConfiguration
Import-DscResource -ModuleName xNetworking
Node "webserver" {
<#
Install windows features
#>
WindowsFeature InstallIIS {
@eonarheim
eonarheim / CRTPostProcessor.ts
Created June 25, 2023 22:42
CRT Style PostProcessor For Excalibur
import { Shader, VertexLayout, PostProcessor, ScreenShader } from "excalibur";
import crtFragmentSource from './crt-fragment.glsl';
export class CRTPostProcessors implements PostProcessor {
private _shader: ScreenShader;
constructor() {}
initialize(gl: WebGL2RenderingContext): void {
this._shader = new ScreenShader(gl, crtFragmentSource);
}