Skip to content

Instantly share code, notes, and snippets.

View leeprobert's full-sized avatar

Lee Probert leeprobert

View GitHub Profile
@leeprobert
leeprobert / BlockWorker.h
Last active December 16, 2015 04:29
Blocks explorer. Demonstrates Block creation and usage in Objective C. Includes creation of Class methods with blocks as arguments, and creating type definitions for block signatures.
//
// BlockWorker.h
// BlocksExplorer
//
// Created by Lee Probert on 13/04/2013.
// Copyright (c) 2013 Lee Probert. All rights reserved.
//
#import <Foundation/Foundation.h>
@leeprobert
leeprobert / AGNSimpleButton.m
Created March 15, 2013 13:10
Simple UIButton subclass that has a nice embossed grey background drawn on to it. No bitmaps required.
//
// AGNSimpleButton.m
// iP2
//
// Created by Lee Probert on 07/03/2013.
//
//
#import "AGNSimpleButton.h"
@leeprobert
leeprobert / HorizontalDivide.m
Created March 15, 2013 13:08
Simple UIView for drawing an embossed style horizontal line.
//
// HorizontalDivide.m
// iP2
//
// Created by Lee Probert on 25/01/2013.
//
//
#import "HorizontalDivide.h"
@leeprobert
leeprobert / CollectionViewCalendarFlowLayout.m
Created March 15, 2013 12:22
UICollectionViewFlowLayout class that positions the CollectionView Header and Footer views horizontally to the section items. This was used to create a Calendar Week view with one cell per section (representing the day of the week) and the Section header to the left of it and a footer to the right. The other sections were the other days of the w…
//
// CollectionViewCalendarFlowLayout.m
#import "CollectionViewCalendarFlowLayout.h"
#define HEADER_WIDTH 200.0f
#define FOOTER_WIDTH 20.0f
#define SECTION_MARGIN_X 0.0f
#define PADDING_X 0.0f
@leeprobert
leeprobert / CollectionViewOrientingFlowLayout.m
Created March 15, 2013 12:17
UIcollectionViewFlowLayout class for changing the scroll direction based on device orientation.
//
// CollectionViewOrientingFlowLayout.m
// iP2
//
// Created by Lee Probert on 08/03/2013.
//
//
#define ITEM_SIZE 150.0f
#define PADDING 20
@leeprobert
leeprobert / CollectionViewCircleFlowLayout.m
Created March 15, 2013 11:13
UICollectionViewFlowLayout sub-class for layout attributes of all the items in a circle.
//
// CollectionViewCarouselFlowLayout.m
// iP2
//
// Created by Lee Probert on 07/03/2013.
//
//
#import "CollectionViewCircleFlowLayout.h"
@leeprobert
leeprobert / CollectionViewCarouselFlowLayout.m
Created March 15, 2013 11:11
UICollectionViewFlowLayout sub-class that creates layout attributes for items so they render like a carousel. The point of view is from the center of the carousel so is suited for lots of items. It also changes its behaviour based on orientation.
//
// CollectionViewCarouselFlowLayout.m
// iP2
//
// Created by Lee Probert on 07/03/2013.
//
//
#import "CollectionViewCarouselFlowLayout.h"
@leeprobert
leeprobert / Angle.as
Created April 23, 2012 14:40
A class for drawing a block of text and then drawing an extrusion path from the bounds of the rectangle
package com.cc.math
{
/**
* Full details: http://gamedev.michaeljameswilliams.com/2009/04/24/angles-in-flash/
* Hungarian notation idea: http://www.joelonsoftware.com/articles/Wrong.html
* Optimisation credit: http://www.nbilyk.com/optimizing-actionscript-3
*
* Usage: import com.michaeljameswilliams.gamedev.angles.Angle
* var degAngle:Number = Angle.degFromRad( radAngle );
<?xml version="1.0" encoding="utf-8"?>
<s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
minWidth="955"
minHeight="600"
@leeprobert
leeprobert / PVPixelPrecision.as
Created March 23, 2012 10:17
The code required to make an object look pixel perfect in a 3D Papervision environment
Object.z = Math.round((camera.zoom * camera.focus) -Math.abs(camera.z))
+ Object.depth/2; // take or add 0.5 if it's still blurred