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
- (vec4_t)mapToSphere:(vec2_t)aWindowCoord // http://www.tommyhinks.com/docs/shoemake92_arcball.pdf | |
{ | |
// normalize window coordinates | |
vec4_t viewport; | |
glGetFloatv(GL_VIEWPORT, viewport.f); | |
vec3_t p = { 2.0*aWindowCoord.x/viewport.z - 1.0, 2.0*aWindowCoord.y/viewport.w - 1.0, 0 }; | |
// Map to sphere | |
float mag = p.x*p.x + p.y*p.y; | |
if(mag > 1.0) { |
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
//////////////////////////////////////////////////////////////////////////////////////////// | |
// | |
// PSClock | |
// | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
// | |
// Copyright (c) 2010, Fjölnir Ásgeirsson | |
// | |
// All rights reserved. | |
// |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<Module> | |
<ModulePrefs title="hello world example" /> | |
<Content type="html"><![CDATA[ | |
Hello, world! | |
]]></Content> | |
</Module> |
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
The bridge is now located at https://github.com/fjolnir/TLC |
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
objc = require("objc") | |
ffi = require("ffi") | |
setmetatable(_G, {__index=objc}) | |
objc.debug=false | |
ffi.cdef("IMP class_replaceMethod(Class cls, SEL name, IMP imp, const char *types);") | |
local C = ffi.C | |
function observeMethod(class, sel, lambda) | |
local method = C.class_getInstanceMethod(class, SEL(sel)) | |
if method == nil then |
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 _docTable = {} | |
function document(docStr) | |
return function(thingToDocument) | |
_docTable[thingToDocument] = docStr | |
end | |
end | |
document[[Adds documentation for a function]](document) | |
function help(thingToLookup) |
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
scene:clear() | |
count = 8000 | |
scene.clearColor = rgb(0,0,0) | |
p1=buildParticles(count) | |
local x,y,Ax,wx,px,As,ws,ps,Ay,wy,py | |
Ax = 300.4 | |
wx = 390.4 | |
px = 123.9 | |
Ay = 390.9 |
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
objc.class_setMetaTable({objc.NSDictionary, objc.__NSCFDictionary, objc.NSMutableDictionary, objc.__NSCFMutableDictionary }, { | |
__tostring = objc.objToStr, | |
__index = function(self, key) | |
local val = objc.getInstanceMethodCaller(self, "objectForKey_")(self, Obj(key)) | |
if val ~= nil then | |
return val | |
end | |
return objc.getInstanceMethodCaller(self, key) | |
end, | |
__newindex = function(self, key, val) |
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 <stdlib.h> | |
#include <unistd.h> | |
#include <string.h> | |
#include <sys/types.h> | |
#include <sys/socket.h> | |
#include <netinet/in.h> | |
#include <netdb.h> | |
#include <dispatch/dispatch.h> | |
#include <readline/readline.h> |
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 <objc/objc.h> | |
#include <objc/runtime.h> | |
#include <objc/objc-exception.h> | |
#include <stdlib.h> | |
#include <limits.h> | |
@class FString; | |
void uncaughtExceptionHandler(id e) |