Skip to content

Instantly share code, notes, and snippets.

View reefwing's full-sized avatar

David Such reefwing

View GitHub Profile
@reefwing
reefwing / Button.lua
Last active September 2, 2015 23:39
Lunar Lander HD
Button = class()
function Button: init(displayName)
-- displayName: Is the text displayed on your button. The button will scale up and down to fit the
-- text.
-- pos: Defines the x and y - coordinates of the button using a vector.
-- size: Is a vector which contains the width and height of the button, which is set by the
-- display name text, and is used to determine if a button has been hit.
-- action: Is the function that you want called when the button is tapped.
@reefwing
reefwing / Dial.lua
Created July 30, 2012 11:05
Tutorial 10 - A Simple Dial Class
--# Dial
Dial = class()
-- A Dial Class
-- Reefwing Software (www.reefwing.com.au)
--
-- 26 July 2012
-- Version 1.0
function Dial:init(x, y, angle)
@reefwing
reefwing / Main.lua
Created July 31, 2012 11:05
Tutorial 11 - Physics 101
supportedOrientations(ANY)
function setup()
-- Physics Demo Metadata
version = 1.0
saveProjectInfo("Description", "Physics v"..version)
saveProjectInfo("Author", "Reefwing Software")
@reefwing
reefwing / Codea_Class_Template.lua
Created August 18, 2012 00:31
Interlude 11 - Classes in Lua and Codea
MyClass = class()
function MyClass:init(x)
-- you can accept and set parameters here
self.x = x
end
function MyClass:draw()
-- Codea does not automatically call this method
end
@reefwing
reefwing / Colors.lua
Created August 25, 2012 05:52
Tutorial 14 - An Extended Ship Class
--# Colors
-- Make available the predefined colors from UIColor
--
-- Version 1.1
blackColor = color(0, 0, 0)
darkGrayColor = color(85, 85, 85)
lightGrayColor = color(170, 170, 170)
whiteColor = color(255, 255, 255)
grayColor = color(128, 128, 128)
@reefwing
reefwing / ToString.lua
Created September 8, 2012 12:39
Tutorial 16 - Table to String & String to Table
--# ToString
--
-- Converts an arbitrary data type into a string. Will recursively convert
-- tables.
--
-- () param data The data to convert.
-- () param indent (optional) The number of times to indent the line. Default is 0.
--
-- () return A string representation of a data, will be one or more full lines.
--
@reefwing
reefwing / FileManager.lua
Created September 20, 2012 11:00
Tutorial 17 - A Simple File Manager for Codea
-- Define Directory Types
ProjectInfo = 1
ProjectData = 2
LocalData = 3
GlobalData = 4
-- Class version
version = 1.1
@reefwing
reefwing / Button.lua
Created September 30, 2012 00:44
Tutorial 18 - Saving and Loading Complicated Tables
--# Button
Button = class()
function Button:init(x, y, pressed, text)
-- Initialise Button
self.x = x or 0
self.y = y or 0
self.pressed = pressed or false
@reefwing
reefwing / MenuBar.lua
Created September 30, 2012 00:54
Tutorial 18 - Saving and Loading Complicated Tables (Part 2)
--# MenuBar
-- MenuBar Class
--
-- Developed by @dave1707
-- 16th September 2012
--
-- Version 1.1
--
-- Modified by: Reefwing Software
--
@reefwing
reefwing / aGameCenter_Codea.h
Created October 14, 2012 04:19 — forked from juaxix/aGameCenter_Codea.h
Tutorial 21 - Game Center for Codea (multiple Leaderboards and Achievements)
//
// aGameCenter_Codea.h
//
// Created by Juan Belón on 28/05/12
// Games -> http://www.xixgames.com
// LGPL - @juaxix - Codea connection!
//
// Modified by Reefwing Software on 14/10/12
// http://www.reefwing.com.au
// @reefwing on the Codea Forums