Skip to content

Instantly share code, notes, and snippets.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="https://raw.github.com/tuupola/jquery_lazyload/master/jquery.lazyload.min.js"></script>
<script type="text/javascript">
$(function() {
var images = $('[data-original]');
images.lazyload({
effect: 'fadeIn'
});
});
</script>
# Loop through the whole tileset and create rectangles
# for each tile position.
tileIndex = 0
for y in [0..@tilesHigh]
for x in [0..@tilesWide]
@tileRectangles[tileIndex] = new Rectangle(
x * @tileWidth,
y * @tileHeight,
@tileWidth,
@tileHeight
#
# Choro - Tileset
# Copyright (c) 2012 Nico Hämäläinen <nico@bender.fi>
# MIT Licensed
#
#
# Events:
# - tilesetImageLoaded
# This event is emitted when the initial tileset graphic is loaded
#
# Choro - Map Layer
# Copyright (c) 2012 Nico Hämäläinen <nico@bender.fi>
# MIT Licensed
#
# Inspired by node-validator
#
net = require 'net'
# Regular expressions
#
# Choro - Tileset
# Copyright (c) 2012 Nico Hämäläinen <nico@bender.fi>
# MIT Licensed
#
#
# Events:
# - tilesetImageLoaded
# This event is emitted when the initial tileset graphic is loaded
#ifndef ENGINE_H
#define ENGINE_H
#include "SDL.h"
/** The base engine class **/
class CEngine {
private:
/** Last iteration's tick value **/
#include "Engine.h"
/* #include <windows.h> // For the WaitMessage() function. */
/** Default constructor. **/
CEngine::Cengine()
{
m_lLastTick = 0;
m_iWidth = 800;
m_iHeight = 600;
m_czTitle = 0;
#include <stdlib.h>
#include <GL/glew.h>
#ifdef __APPLE__
# include <GLUT/glut.h>
#else
# include <GL/glut.h>
#endif
#include <math.h>
#include <stdio.h>
#include "util.h"
EventEmitter = () ->
EventEmitter.prototype =
# Add a new listener for an event
bind: (event, func) ->
this._events = this._events or {}
this._events[event] = this._events[event] or []
this._events[event].push(func)
# Remove a listener for an event
unbind: (event, func) ->
splitArray = (array, chunkSize) ->
result = []
while (array.length)
result.push(array.splice(0, chunkSize))
result