Skip to content

Instantly share code, notes, and snippets.

Avatar

Simeon Saëns TwoLivesLeft

View GitHub Profile
@TwoLivesLeft
TwoLivesLeft / Main.lua
Last active Mar 22, 2020
Updated 3D Asset Viewer #2
View Main.lua
-----------------------------------------
-- Models
-- Written by John Millard
-----------------------------------------
-- Description:
-- Domonstrates model loading in Craft.
-----------------------------------------
Tag = class()
@TwoLivesLeft
TwoLivesLeft / Main.lua
Created Mar 21, 2020
Updated 3D Asset Viewer
View Main.lua
-----------------------------------------
-- Models
-- Written by John Millard
-----------------------------------------
-- Description:
-- Domonstrates model loading in Craft.
-----------------------------------------
Tag = class()
@TwoLivesLeft
TwoLivesLeft / CodeEditor.m
Created Aug 30, 2019
Responding to copy and paste
View CodeEditor.m
- (BOOL) canPerformAction:(SEL)action withSender:(id)sender
{
switch ( menuState )
{
case JAMCodeEditorMenuStateHidden:
{
if( self.selectedRange.length == 0 )
{
if( action == @selector(select:) ||
action == @selector(selectAll:) ||
@TwoLivesLeft
TwoLivesLeft / Header.swift
Created Feb 15, 2019
Add these two overrides to class Header
View Header.swift
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
}
View main.lua
backingMode(RETAINED)
function setup()
background(0)
stroke(255)
strokeWidth(5)
fill(227, 106, 106, 255)
ellipse(WIDTH/2, HEIGHT/2, 500)
end
@TwoLivesLeft
TwoLivesLeft / main.lua
Last active Jan 25, 2019
Render once with early bail-out
View main.lua
function setup()
didDraw = false
background(0)
backingMode(RETAINED)
end
function draw()
-- Just draw one frame and bail out early if we have drawn
@TwoLivesLeft
TwoLivesLeft / main.lua
Created Jan 25, 2019
Render one frame in setup
View main.lua
function setup()
background(0)
-- Render once into an image the size of the screen
img = image(WIDTH,HEIGHT)
setContext(img)
stroke(255)
strokeWidth(5)
View KeyboardLayout.swift
//
// KeyboardLayout.swift
// Codea
//
// Created by Simeon on 24/7/17.
// Copyright © 2017 Two Lives Left. All rights reserved.
//
import UIKit
@TwoLivesLeft
TwoLivesLeft / main.lua
Created Jan 4, 2018
Hello <Your Name Here> Codea Example
View main.lua
-- 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)
@TwoLivesLeft
TwoLivesLeft / Lightsaber.lua
Created Dec 19, 2015
Codea Lightsaber Effect
View Lightsaber.lua
--# Main
-- Lightsaber
function setup()
touches = {}
lightsaber = Saber(300, 15)
lightsaber:setTransform(matrix():translate(WIDTH/2, HEIGHT/2, 0), false)
You can’t perform that action at this time.