Skip to content

Instantly share code, notes, and snippets.

@C4Code
C4Code / gist:5ba9f368418bd91d3284
Created Dec 9, 2014
Rough Isometric Line code, Swift C4
View gist:5ba9f368418bd91d3284
class Rule {
var a: IsometricPoint
var b: IsometricPoint
lazy var targets = [[IsometricPoint]]()
init(_ a: IsometricPoint, _ b: IsometricPoint) {
self.a = a
self.b = b
}
@C4Code
C4Code / MenuButton.swift
Created Apr 14, 2015
Button - C4Swift style
View MenuButton.swift
//
// ViewController.swift
// C4Swift
//
// Created by travis on 2014-10-28.
// Copyright (c) 2014 C4. All rights reserved.
//
import UIKit
import C4UI
@C4Code
C4Code / C4IsometricLogo.Swift
Created Apr 14, 2015
Isometric Logo Experiment
View C4IsometricLogo.Swift
//
// C4Logo.swift
// C4Swift
//
// Created by travis on 2014-11-24.
// Copyright (c) 2014 C4. All rights reserved.
//
import Foundation
import C4Core
View FirstWorkSpace.m
//
// FirstWorkSpace.m
// tabbed
//
// Created by moi on 12-10-15.
// Copyright (c) 2012 moi. All rights reserved.
//
#import "FirstWorkSpace.h"
@C4Code
C4Code / GrabSaveImageUIButton
Last active Aug 29, 2015
How to grab and save an image from a default UIButton
View GrabSaveImageUIButton
override func viewDidLoad() {
let fileName = "infoLight.png"
let b = UIButton.buttonWithType(UIButtonType.InfoLight) as! UIButton
let img = b.imageForState(.Normal)
let paths = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)
let dir = (paths[0] as! String)+"/"+fileName
UIImagePNGRepresentation(img).writeToFile(dir, atomically: true)
@C4Code
C4Code / C4WorkSpace.m
Created May 12, 2012
daisy chaining animations with timers
View C4WorkSpace.m
//
// C4WorkSpace.m
// daisyChaining
//
// Created by Travis Kirton on 12-04-04.
// Copyright (c) 2012 POSTFL. All rights reserved.
//
#import "C4WorkSpace.h"
@C4Code
C4Code / C4WorkSpace.m
Created May 12, 2012
how to make a C4Image animate to black and white
View C4WorkSpace.m
#import "C4WorkSpace.h"
C4Image *myImage;
@implementation C4WorkSpace
-(void)setup {
myImage = [C4Image imageNamed:@"C4Sky.png"];
myImage.center = CGPointMake(384, 512);
[self.canvas addImage:myImage];
@C4Code
C4Code / C4WorkSpace.m
Created May 12, 2012
how to structure the init method of a custom shape class
View C4WorkSpace.m
//
// C4WorkSpace.m
// customShapeInit
//
// Created by Travis Kirton on 12-04-30.
// Copyright (c) 2012 POSTFL. All rights reserved.
//
#import "C4WorkSpace.h"
#import "MyShape.h"
@C4Code
C4Code / C4WorkSpace.m
Created May 12, 2012
how to rotate shapes using the shape.transform property (uses CGAffineTransform)
View C4WorkSpace.m
//
// C4WorkSpace.m
// rotate
//
// Created by Travis Kirton on 12-04-04.
// Copyright (c) 2012 POSTFL. All rights reserved.
//
#import "C4WorkSpace.h"
@C4Code
C4Code / C4WorkSpace.m
Created May 12, 2012
How to make a C4 object glow, using shadows
View C4WorkSpace.m
//
// C4WorkSpace.m
// glow
//
// Created by Travis Kirton on 12-04-04.
// Copyright (c) 2012 POSTFL. All rights reserved.
//
#import "C4WorkSpace.h"