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 March 21, 2020 23:49
Updated 3D Asset Viewer
-----------------------------------------
-- Models
-- Written by John Millard
-----------------------------------------
-- Description:
-- Domonstrates model loading in Craft.
-----------------------------------------
Tag = class()
@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 / 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 / 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 / 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
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)
//
// KeyboardLayout.swift
// Codea
//
// Created by Simeon on 24/7/17.
// Copyright © 2017 Two Lives Left. All rights reserved.
//
import UIKit
@simsaens
simsaens / main.lua
Created January 4, 2018 03:44
Hello <Your Name Here> Codea Example
-- Use this function to perform your initial setup
function setup()
parameter.text("name", "Tiff")
end
-- This function gets called once every frame
function draw()
-- This sets a dark background color
background(40, 40, 50)
@simsaens
simsaens / Lightsaber.lua
Created December 19, 2015 14:00
Codea Lightsaber Effect
--# Main
-- Lightsaber
function setup()
touches = {}
lightsaber = Saber(300, 15)
lightsaber:setTransform(matrix():translate(WIDTH/2, HEIGHT/2, 0), false)
@simsaens
simsaens / BoxScene.lua
Created June 3, 2013 17:35
Simple Scene Switching - Put the tabs in the following order: Main, Scene, BoxScene, CircleScene, Button
BoxScene = class(Scene)
function BoxScene:init()
-- We have to initialize our
-- super class
Scene.init(self)
end
function BoxScene:draw()
background(78, 99, 51, 255)