This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local ffi = require("ffi") | |
local C = ffi.C | |
-- We need to actually load the dynamo dylib first because, dynamo.lua depends on glmath.lua, but glmath is compiled | |
-- into libdynamo^^; | |
ffi.load("./libdynamo.dylib", true) | |
local sdl = require("sdl") | |
local glfw = require("glfw") | |
local glm = require("glmath") | |
local dynamo = require("dynamo") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <assert.h> | |
#include <math.h> | |
#include <stdbool.h> | |
#define MAX(x,m) ((x)>(m) ? (x) : (m)) | |
int bin2dec(char *str, int len) { | |
int ret = 0, i; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*- | |
* Copyright (c) 1990, 1993 | |
* The Regents of the University of California. All rights reserved. | |
* | |
* This code is derived from software contributed to Berkeley by | |
* Mike Hibler and Chris Torek. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions | |
* are met: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (c) 2005 Apple Computer, Inc. All rights reserved. | |
* | |
* @APPLE_LICENSE_HEADER_START@ | |
* | |
* This file contains Original Code and/or Modifications of Original Code | |
* as defined in and that are subject to the Apple Public Source License | |
* Version 2.0 (the 'License'). You may not use this file except in | |
* compliance with the License. Please obtain a copy of the License at | |
* http://www.opensource.apple.com/apsl/ and read it before using this |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "dictionary.h" | |
#include <string.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
static DictionaryNode_t *_dict_createNode(void *value); | |
static void dict_destroy(Dictionary_t *aDict); | |
static DictionaryNode_t *_dict_searchFromNode(DictionaryNode_t *aNode, const char *key, bool createPath); | |
Class_t Class_Dictionary = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "json.h" | |
#include "util.h" | |
#include <yajl/yajl_parse.h> | |
#include <yajl/yajl_gen.h> | |
#include <assert.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#pragma mark - Parsing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2011, Fjölnir Ásgeirsson | |
// | |
// Permission to use, copy, modify, and/or distribute this software for any | |
// purpose with or without fee is hereby granted, provided that the above | |
// copyright notice and this permission notice appear in all copies. | |
// | |
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local box = dynamo.createEntity(dynamo.world, nil, 1, dynamo.world.momentForBox(1, vec2(200,100)), { | |
dynamo.createBoxShape(vec2(200,100)) | |
}) | |
box.location = vec2(110, 700) | |
local circle = dynamo.createEntity(dynamo.world, nil, 1, dynamo.world.momentForCircle(1, 0, 70, vec2_zero), { | |
dynamo.createCircleShape(vec2(0, 0), 70) | |
}) | |
circle.elasticity = 1 | |
circle.location = vec2(200, 500) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local box = dynamo.createEntity(dynamo.world, nil, 1, dynamo.world.momentForBox(1, vec2(32*sprite.scale,32*sprite.scale)), { | |
dynamo.createBoxShape(vec2(32*sprite.scale,32*sprite.scale)) | |
}) | |
box.location = vec2(110, 700) | |
function box:updateHandler() | |
sprite.angle = self:angle() | |
sprite.location.xy = self:location() | |
end | |
local circle = dynamo.createEntity(dynamo.world, nil, 1, dynamo.world.momentForCircle(1, 0, 70, vec2_zero), { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ffi = require("ffi") | |
local dispatch = {} | |
ffi.cdef[[ | |
// base.h | |
typedef union { | |
struct dispatch_object_s *_do; | |
struct dispatch_continuation_s *_dc; | |
struct dispatch_queue_s *_dq; | |
struct dispatch_queue_attr_s *_dqa; |