Skip to content

Instantly share code, notes, and snippets.

@gazliddon
gazliddon / cPosVelComponent.h
Created July 6, 2012 16:19
cPosVelComponent.cpp
//
// cPosVelComponent.h
// GLFullScreen
//
// Created by Gaz Liddon on 19/04/2012.
// Copyright (c) 2012 Ruffian Games. All rights reserved.
//
#ifndef GLFullScreen_cPosVelComponent_h
#define GLFullScreen_cPosVelComponent_h
@gazliddon
gazliddon / cOffScreenBuffer.cpp
Created July 12, 2012 11:22
Offscreen buffer stuff
/*
* offscrbuffer.cpp
* gazotron
*
* Created by Gary Liddon on 23/08/2006.
* Copyright 2006 __MyCompanyName__. All rights reserved.
*
*/
#include "cOffScreenBuffer.h"
@gazliddon
gazliddon / gist:3551368
Created August 31, 2012 10:44
SL Compatible fullscreen code
- (void)toggleFullscreen
{
// lol statics - should be in the class
// fulll screen status should be saved as well
static bool fullScreen = false;
static NSRect nonFullScreenRect;
static NSInteger oldStyleMask;
static NSInteger oldLevel;
auto w = [self window];
@gazliddon
gazliddon / game.clj
Last active December 17, 2015 00:19
Functional game loop
(def fps 60)
(def delta (1.0 / fps))
(defn game-loop [time input world enemies player]
(let [
new_world (create-world world time)
new_player (create-player player input time new_world)
new_enemies (create-enemies enemies new_player new_world)
final_player (collide-player new_player new_enemies)
(ns pacgaz.mapdata
(:require clojure.pprint)
(:use [clojure.string :only (join)]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Different map element types
(def map-bit-types
{
@gazliddon
gazliddon / test.html
Created January 11, 2014 15:13
Mouseover w/out javascript
<!DOCTYPE html>
<html>
<head>
<title>Mouseover</title>
<meta charset="utf-8" />
</head>
<body>
<header>
</header>
@gazliddon
gazliddon / lua stuff
Created November 1, 2014 14:07
Is This Bad Lua Form?
-- Creating a object and I have a load of action functions that all return self
-- which means I can chain the functions
-- and also chain after initialisation
-- I like the brevity but I'm no Lua expert. Any thoughts? :)
function CippyGame:titleScreen()
local keepGoing = true
local components = {
set autoupdategist
set nosmoothscroll
let scrollstep=100
site '*://feedly.com/*' {
unmap j
unmap k
unmap ;
}
@gazliddon
gazliddon / gist:298480b62c80f42593e3
Created December 15, 2014 16:45
Man, clojure is terse
(def get-event-action [table event current-state]
(let [identity (fn [o _] o)]
(get-in table [current-state event] identity)))
(def player-state-table
{:spawning {:timeout go-running }
:running {:button go-jump
:fall-off go-fall }
@gazliddon
gazliddon / Main.hs
Created July 10, 2015 18:03
RLE in Haskell
--------------------------------------------------------------------------------
-- Run length encode
encode :: Eq a => [a] -> [(Int, a)]
encode xs = map (\x -> (length x , head x)) (group xs)