Skip to content

Instantly share code, notes, and snippets.

View simsaens's full-sized avatar

Sim Saëns simsaens

  • Two Lives Left
  • Adelaide, Australia
View GitHub Profile
@simsaens
simsaens / main.lua
Created January 25, 2019 11:09
Render one frame in setup
function setup()
background(0)
-- Render once into an image the size of the screen
img = image(WIDTH,HEIGHT)
setContext(img)
stroke(255)
strokeWidth(5)
@simsaens
simsaens / main.lua
Last active January 25, 2019 11:28
Render once with early bail-out
function setup()
didDraw = false
background(0)
backingMode(RETAINED)
end
function draw()
-- Just draw one frame and bail out early if we have drawn
@simsaens
simsaens / main.lua
Last active January 25, 2019 14:17
backingMode(RETAINED)
function setup()
background(0)
stroke(255)
strokeWidth(5)
fill(227, 106, 106, 255)
ellipse(WIDTH/2, HEIGHT/2, 500)
end
@simsaens
simsaens / Header.swift
Created February 15, 2019 08:42
Add these two overrides to class Header
override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
guard let menu = menuView else {
return super.point(inside: point, with: event)
}
let menuPoint = convert(point, to: menu)
if menu.point(inside: menuPoint, with: event) {
return true
}
@simsaens
simsaens / CodeEditor.m
Created August 30, 2019 04:13
Responding to copy and paste
- (BOOL) canPerformAction:(SEL)action withSender:(id)sender
{
switch ( menuState )
{
case JAMCodeEditorMenuStateHidden:
{
if( self.selectedRange.length == 0 )
{
if( action == @selector(select:) ||
action == @selector(selectAll:) ||
@simsaens
simsaens / Main.lua
Created March 21, 2020 23:49
Updated 3D Asset Viewer
-----------------------------------------
-- Models
-- Written by John Millard
-----------------------------------------
-- Description:
-- Domonstrates model loading in Craft.
-----------------------------------------
Tag = class()
@simsaens
simsaens / Main.lua
Last active March 22, 2020 00:08
Updated 3D Asset Viewer #2
-----------------------------------------
-- Models
-- Written by John Millard
-----------------------------------------
-- Description:
-- Domonstrates model loading in Craft.
-----------------------------------------
Tag = class()
@simsaens
simsaens / InstancedSnow.lua
Created April 28, 2021 06:04
Codea project which uses mesh instancing to draw snow
--# Main
-- 3D Snow
function setup()
viewer.mode = FULLSCREEN
parameter.watch("FPS")
parameter.boolean("camOrtho", false)
parameter.number("timeSpeed", 0, 8, 1)
parameter.number("hspread", 0, 50, 50)
@simsaens
simsaens / SKPayment+Async.swift
Created December 20, 2021 05:39
These three files extend the default StoreKit API to use async in Swift 5.5. Based on the PromiseKit StoreKit extensions
//
// SKPayment+Async.swift
//
// Created by Sim Saens on 15/12/21.
//
import Foundation
import StoreKit
//Adds an async extension to SKPayment to purchase products
-- Dungeon variables
local dungeonWidth = 16 -- The width of the dungeon in tiles
local dungeonHeight = 16 -- The height of the dungeon in tiles
local tileSize = 40 -- The size of each tile in pixels
local dungeon = {} -- The dungeon map
local rooms = {} -- The list of rooms in the dungeon
local doors = {} -- The list of doors in the dungeon
local traps = {} -- The list of traps in the dungeon
-- Colors