Skip to content

Instantly share code, notes, and snippets.

View johnfredcee's full-sized avatar
🚀
On an intergalactic cruise

John Connors johnfredcee

🚀
On an intergalactic cruise
View GitHub Profile
@johnfredcee
johnfredcee / nanovg_fb.cpp
Created February 2, 2017 10:38
Nanovg - render to framebuffer
nvgImageSize(vg, fb->image, &fboWidth, &fboHeight);
winWidth = (int)(fboWidth / pxRatio);
winHeight = (int)(fboHeight / pxRatio);
// Draw some stuff to an FBO as a test
nvgluBindFramebuffer(fb);
glViewport(0, 0, fboWidth, fboHeight);
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
nvgBeginFrame(vg, winWidth, winHeight, pxRatio);
@johnfredcee
johnfredcee / opticl-cl-vectors.lisp
Last active November 26, 2015 15:01
Using cl-vectors with opticl
(let ((state (aa:make-state))) ; create the state
;; the 1st triangle
(aa:line-f state 200 50 250 150) ; describe the 3 sides
(aa:line-f state 250 150 50 100) ; of the first triangle
(aa:line-f state 50 100 200 50)
;; the 2nd triangle
(aa:line-f state 75 25 10 75) ; describe the 3 sides
(aa:line-f state 10 75 175 100) ; of the second triangle
(aa:line-f state 175 100 75 25)
(let* ((image (opticl:make-8-bit-rgba-image 200 300 :initial-element 255)))
;;; The following lines added by ql:add-to-init-file:
#-quicklisp
(let ((quicklisp-init #P"/wsr/lisp/quicklisp/setup.lisp"))
(when (probe-file quicklisp-init)
(load quicklisp-init)))
(defun start-swank-server (&key (port 4006))
"Starts a swank-server on the localhost interface."
/* Copyright 2010 Nurullah Akkaya */
/* lisp.c is free software: you can redistribute it and/or modify it */
/* under the terms of the GNU General Public License as published by the */
/* Free Software Foundation, either version 3 of the License, or (at your */
/* option) any later version. */
/* lisp.c is distributed in the hope that it will be useful, but WITHOUT */
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
@johnfredcee
johnfredcee / use-tinyscheme.c
Created July 21, 2014 18:22
TinyScheme Integration Example
/**
* hello-scheme for illustration how to embed
* the tiny scheme interpreter in a C program
*
* 2012, OL
*/
#include <stdio.h>
#include <string.h>
#include "scheme.h"
@johnfredcee
johnfredcee / dot.emacs
Created July 13, 2014 14:35
Dot emacs with el-get
;; Ensure unix binaries on path
(setenv "PATH" (concat "C:\\wsr\\apps\\Git\\bin" path-separator "C:\\wsr\\apps\\emacs-24.3\\bin" path-separator (getenv "PATH")))
;;; basic load-path setup
;;; ------------------------------------------------------------------
(defun add-subdirs-to-load-path (dir)
@johnfredcee
johnfredcee / object.c
Created July 13, 2014 13:51
Another c based object system sketch - decouple code from data
enum eClass
{
MODEL,
RENDERABLE,
ATTACHMENT,
LOCATION
};
@johnfredcee
johnfredcee / tagwank.py
Created January 21, 2014 16:13
New tag - generating utility. Portable.
import sys
import getopt
import os
import os.path
import subprocess
import ConfigParser
# Example config
# [Global]
(defpackage #:trivial-gui
(:use #:cl))
(in-package #:trivial-gui)
(defmethod glop:on-key (window pressed keycode keysym text)
(format t "Key ~:[released~;pressed~]: ~D (~S ~S)~%" pressed keycode keysym text)
(format t "Key pressed: ~S~%" (glop:key-pressed keycode))
(when (and (not pressed) (eq keysym :escape))
@johnfredcee
johnfredcee / world.lisp
Last active January 2, 2016 03:19
Stub for CL-TCOD
(defparameter *x* 45)
(defparameter *y* 20)
(defparameter *running* t)
(defun main ()
(tcod:console-init-root 80 50 :title "Libtcod Lisp Tutorial" :fullscreen? nil :renderer :renderer-sdl)
(loop
while *running*
do