Skip to content

Instantly share code, notes, and snippets.

View pluckyporcupine's full-sized avatar

Plucky Porcupine pluckyporcupine

  • USA
View GitHub Profile
@pluckyporcupine
pluckyporcupine / basic_window.5.lm
Last active March 28, 2020 21:24
WIP attempt to bind raylib to Lumi
module basic-window
native include "raylib.h"
native type Color "Color"
native var Color raywhite "RAYWHITE"
native var Color lightgray "LIGHTGRAY"
native func init-window(copy Int w, copy Int h, copy cdef.Pointer{cdef.Char} text)->() "InitWindow"
switch operating-system
case 'windows
load-library "libraylib.dll"
case 'linux
load-library "libraylib.so"
case 'macos
load-library "libraylib.dylib"
default
error "Unsupported OS"
run-stage;
@pluckyporcupine
pluckyporcupine / core_2d_camera.carp
Last active March 19, 2020 19:29
core_2d_camera Carp
(use Array)
(use String)
(load "raylib.carp")
(use rlcore)
(use KeyboardKey)
(use Colors)
(use Shapes)
(use Text)
@pluckyporcupine
pluckyporcupine / basic_window.carp
Created March 17, 2020 21:50
WIP Carp raylib test
(use Int)
(use String)
(load "raylib.carp")
(use rlcore)
(Project.config "title" "basic_window")
(def screen-width 800)
(def screen-height 450)
@pluckyporcupine
pluckyporcupine / gist:b743831cf9d006598c9c1eb59e57416e
Created March 17, 2020 21:39
Carp compiler output warnings
In file included from out\main.c:21:
D:\Code\GitHub\Carp/core\carp_double.h(43,5): warning: 'memcpy' will always overflow; destination buffer has size 4, but size argument is 8 [-Wfortify-source]
memcpy(&y, &x, sizeof(double));
^
In file included from out\main.c:24:
D:\Code\GitHub\Carp/core\carp_string.h(19,5): warning: format specifies type 'long' but the argument has type 'ssize_t' (aka 'long long')
[-Wformat]
CHK_INDEX(i, strlen(*s));
^~~~~~~~~~~~~~~~~~~~~~~~
D:\Code\GitHub\Carp/core\core.h(39,64): note: expanded from macro 'CHK_INDEX'
@pluckyporcupine
pluckyporcupine / core_2d_camera_c-mera.lisp
Last active February 8, 2020 23:46
raylib core_2d_camera example in C-Mera
;; This is more or less a direct translation, so there are no fancy Lisp macros or anything in this code.
(include <raylib.h>)
(defvar MAX_BUILDINGS 100)
(function main () -> int
(decl ((const int screenWidth = 800)
(const int screenHeight = 450)))
@pluckyporcupine
pluckyporcupine / minimaltic80entitysystem.wren
Last active February 22, 2018 21:24
The beginnings of an entity system in Wren in TIC-80
var Entities = [ ]
class Entity {
construct new(tx, ty, st, ss, sm, sp, spm) {
_t = 0
_x = tx
_y = ty
_flipped = 0
_vx = 0
@pluckyporcupine
pluckyporcupine / project_euler6.nim
Created January 26, 2018 18:58
A solution to Project Euler Problem 6 in Nim
import math
var s, sq = 0
for i in 1..100:
s += math.`^`(i, 2)
sq += i
sq = math.`^`(sq, 2)
@pluckyporcupine
pluckyporcupine / project_euler5.nim
Created January 26, 2018 04:31
A solution to Project Euler Problem 5 in Nim
var n: int = 20
var found: bool = false
while (not found):
for i in countdown(20, 1):
if (n mod i == 0):
if (i == 1):
found = true;
else:
break
@pluckyporcupine
pluckyporcupine / project_euler2.nim
Created January 26, 2018 02:10
A solution to Project Euler Problem 2 in Nim
var n: int = 1
var prev: array[0..1, int] = [1, 1]
var sum: int = 0
while (n < 4000000):
if (n mod 2 == 0):
sum += n
prev[0] = prev[1]
prev[1] = n
n = prev[0] + prev[1]