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
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)
@simsaens
simsaens / FPS.lua
Created June 2, 2013 00:47
Codea Project Gist Created with AutoGist
--FPS = class(juice.text)
FPS = class()
function FPS:init()
--juice.text.init(self, "FPS", 0,0)
self.pos = vec2(0,0)
self.fps = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
self.idx = 0
end
@simsaens
simsaens / Main.lua
Created June 1, 2013 14:20
Juice AutoInstall
--Juice Single Install
--Installer created by @acp edited by @Briarfox
--- This will pull the Juice project into Codea for you
-- Instructions:
-- * Create a new project in Codea named Juice If you chose another name please change the variable Below
--This is case sensitive
ProjectName = "Juice"
-- * Paste this into the Main (not from the raw view, as iSafari will escape special characters)
-- * Run, run again,
@simsaens
simsaens / Main.lua
Created June 1, 2013 14:19
Juice Library - Codea Project Gist Created with AutoGist
-- Juice
-- Use this function to perform your initial setup
function setup()
r = juice.rect(WIDTH/2,HEIGHT/2,70)
parameter.integer( "ObjType", 1, 4, 1, objChanged )
parameter.action( "Spin", function() r:spin(2) end )