~~NOTOC~~ ====== JTLine ====== ---- dataentry extension ---- author_mail : matan.eilat@joytunes.com Matan Eilat description : A simple customisable line. lastupdate_dt : 2014-10-06 compatible : v2.x tags : line homepage_url : https://gist.github.com/4745f7b707f0659b9fc6 download_url : https://gist.github.com/4745f7b707f0659b9fc6/download ---- ===== Description ===== JTLine is a Sparrow 2.x compatible, [[http://wiki.sparrow-framework.org/users/shilo/extensions/shline|SHLine]]-isomorphic implementation of a simple line. ===== Example ===== Taken from [[http://wiki.sparrow-framework.org/users/shilo/extensions/shline|SHLine]]. //initialize a line with a length of 100 pixels and thickness of 5 pixels JTLine *line = [SHLine lineWithLength:100 andThickness:5]; //set the start color to red line.startColor = 0xff0000; //set the end color to blue line.endColor = 0x0000ff; //set the start opacity to 75% line.startAlpha = 0.75f; //set the end opacity to 25% line.endAlpha = 0.25f; //set the end destination to the bottom right corner of the screen line.x2 = 320; line.y2 = 480; //add the line to the stage [self addChild:line]; //initialize another line with the coords (x, y, width, height) JTLine *line2 = [JTLine lineWithCoords:0:480:320:-480]; //set the line thickness to 5 pixels line2.thickness = 5; //add line2 to the stage to create a 'cross' pattern [self addChild:line2]; ===== Instructions ===== Taken from [[http://wiki.sparrow-framework.org/users/shilo/extensions/shline|SHLine]]. ==== To add into your Sparrow project ==== - Download the source files here: [[https://gist.github.com/4745f7b707f0659b9fc6/download]] - Open your desired Sparrow project - Drag and drop the files into the "Groups & Files" pane - Open "Game.h" - Include the extension: #include "JTLine.h" - Save "Game.h" ==== To add directly into Sparrow source ==== - Download the source files here: [[https://gist.github.com/4745f7b707f0659b9fc6/download]] - Save the files into Sparrow's "/Classes/" directory * Example: "/sparrow/src/Classes/" - Navigate back one directory and open "Sparrow.xcodeproj" * Example: "/sparrow/src/Sparrow.xcodeproj" - Inside the "Groups & Files" pane, locate the "Display" group folder * Example: "Sparrow -> Classes -> Display" - Right click the "Display" group folder and click "Add -> Existing Files.." - Navigate into the "/Classes/" directory and select "JTLine.h" and "JTLine.m", then click "add" - On the next window, leave all options as default and click "add" - In the "Groups & Files" pane, Open "Sparrow.h" * Example "Sparrow -> Classes -> Sparrow.h" - At the bottom of the file, add: #import "JTLine.h" - Save "Sparrow.h" - Close "Sparrow.xcodeproj" ===== Changelog ===== * //2014/10/06 17:42//: First public version ===== Source Code ===== %gist(4745f7b707f0659b9fc6)%