Skip to content

Instantly share code, notes, and snippets.

@feuery
feuery / registry.clj
Created July 15, 2016 14:50
Example of memapper-registry
{:G__24782
{:y 1,
:map-x 1,
:rotation 0,
:map-y 3,
:type :tile,
:id :G__24782,
:parent-id :LAYER__24773,
:x 1,
:tileset :TILESET__24710},
(and (= (rem (width *png-image*) 50) 0)
(= (rem (height *png-image*) 50) 0))
{:G__31964
{:y 150,
:name "New sprite",
:type :sprite,
:angle 327.7682228088379,
:id :G__31964,
:parent-id :MAP__30960,
:order 1,
:x 205,
:subtype :static},
PUSH 'iszero
LAMBDA
PUSH 0
PEQ
RET
PUSH 'waszero
LAMBDA
MULTIPLY CX
RET
(def rooms [{:x 0 :y 0 :w 3 :h 3}
{:x 2 :y 2 :w 2 :h 1}
{:x 5 :y 2 :w 10 :h 1}])
(for [[x y w h :as a] (map (juxt :x :y :w :h) rooms)
[x2 y2 w2 h2 :as b] (map (juxt :x :y :w :h) rooms)
:when (not= a b)]
(square-collision? a b))
(defun rpn->infix (expr)
"Outputs expr in infix form. For example\n(rpn->infix '(< x1 (+ x2 w2))) => x1 < x2 + w2\n\nI'm not going to write an interactive version cause I don't remember how to command emacs' interactive-fn :D"
(let* ((symbol (car expr))
(param1 (cadr expr))
(param2 (caddr expr)))
(insert (prin1-to-string param1) " "
(prin1-to-string symbol) " ")
(if (atom param2)
(insert (prin1-to-string param2))
(rpn->infix param2))))
bool square_collision_p (int x1, int y1, int w1, int h1,
int x2, int y2, int w2, int h2) {
return x1 < x2 + w2 &&
x1 + w1 > x2 &&
y1 < y2 + h2 &&
(y1 + h1) > y2;
}
bool collisions_p (int maxI) {
(assoc-in {} [:this 0 :is] :test) ;;=> {:this {0 {:is :test}}}
(what-implements-this? {} [:this 0 :is] :test) ;; => {:this [{:is :test}]}
void immutable_obj::setup_texture(QOpenGLFunctions_4_3_Core *f, const char* filename)
{
if(strcmp(filename, "") == 0) {
qDebug() << "Not loading texture's from an empty string";
return;
}
if(!shader_loaded) { qDebug()<<"Shader isn't loaded?"; return; }
f->glGenTextures(1, &texture);
@feuery
feuery / wat
Created September 13, 2017 16:21
roland:/home/feuer2/Dropbox/qt-test % sbcl
fatal error encountered in SBCL pid 4105(tid 0x7ffff7fbbfc0):
can't find core file at NIL/sbcl.core