Noise and Heat This is my brain on truffles.

29Jan/102

sh-zenburnish: SyntaxHighlighter Evolved, zenburn stylee

Ok, more real coding avoidance*. I hacked together a little SyntaxHighlighter Evolved colour scheme so that my eyes aren't offended when I post code in this blog. Here's an example with lines 5-7 highlighted:

package dt.particles
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Sprite;
	import flash.geom.Point;
	import flash.geom.Rectangle;

	/**
	 * Particle manager.
	 *
	 * @author David Wagner
	 *
	 */
	public class PMan extends Sprite
	{
		private var _emitters :Array;
		private var _bd :BitmapData;
		private var _b :Bitmap;
		private var _r :Rectangle;
		private var _zeroPoint :Point;

		/**
		 * Constructor.
		 *
		 * @param p_width Width of the particle area.
		 * @param p_height Height of the particle area.
		 *
		 */
		public function PMan( p_width :int, p_height :int )
		{
			super();

			_zeroPoint = new Point();

			_r = new Rectangle( 0, 0, p_width, p_height );
			_bd = new BitmapData(_r.width, _r.height, true, 0x000000);
			_b = new Bitmap(_bd, "never", false);

			addChild(_b);

			_emitters = [];
		}

		/**
		 * Adds a new particle emitter.
		 *
		 * @param p_particleCount Number of particles
		 * @param p_x Emitter X
		 * @param p_y Emitter Y
		 * @param p_colours Array of colours the particles are randomly chosen from
		 * @param p_bouncy Indicates if the particles should bouncy at the edge of the area, or die.
		 * @param p_boundingArea Indicates a constraining box the particles must appear in. If null, the full size of the area is used.
		 *
		 */
		public function addEmitter( p_particleCount :Number, p_x :Number, p_y :Number, p_colours :Array, p_bouncy :Boolean, p_boundingArea :Rectangle = null ) :void
		{
			if( p_boundingArea == null )
			{
				p_boundingArea = _r;
			}
			_emitters.push( new PEmitter( p_particleCount, p_x, p_y, _bd, p_boundingArea, p_colours, p_bouncy ) );
		}

		/**
		 * Updates each emitter.
		 *
		 * @param p_emitter
		 * @param p_index
		 * @param p_array
		 *
		 */
		private function forEach_updateEmitter( p_emitter :PEmitter, p_index :int, p_array :Array ) :void
		{
			p_emitter.update();
		}

		/**
		 * Updates all the emitters.
		 *
		 */
		public function update() :void
		{
			_bd.lock();
			_bd.fillRect(_r, 0x00ffffff);
			_emitters.forEach( forEach_updateEmitter );
			_bd.unlock();
		}
	}
}

You can grab the theme from, along with installation instructions:

Assuming I don't break anything when I move flat tomorrow, I may actually get around to finishing off the post on ActionScript bytecode that I've been fiddling with.

  • Good work, I thought I had my editor open when I surfed to this page :)
    PS. The link to Inconsolata font is a gem. Thanks!
  • Thanks for creating the scheme in the first place :) It's made my coding life far more pleasant.
blog comments powered by Disqus