<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>GuShH&#039;s DevBlog</title>
	<atom:link href="http://gushh.net/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://gushh.net/blog</link>
	<description>This blog is about software, electronics engineering and game development.</description>
	<lastBuildDate>Sat, 14 Apr 2012 04:17:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>DIY Homelite / Ryobi Carburetor adjustment pac-man tool</title>
		<link>http://gushh.net/blog/diy-homelite-tool/</link>
		<comments>http://gushh.net/blog/diy-homelite-tool/#comments</comments>
		<pubDate>Sat, 14 Apr 2012 04:17:37 +0000</pubDate>
		<dc:creator>GuShH</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[carb adjust tool]]></category>
		<category><![CDATA[diy homelite adjust tool]]></category>
		<category><![CDATA[Homelite]]></category>
		<category><![CDATA[leaf blower adjust tool]]></category>
		<category><![CDATA[pac-man tool]]></category>
		<category><![CDATA[ryobi adjust tool]]></category>
		<category><![CDATA[weed wacker carb adjust]]></category>

		<guid isPermaLink="false">http://gushh.net/blog/?p=1312</guid>
		<description><![CDATA[I recently purchased a Homelite leaf blower, it seems to work fine except for the carburetor requiring some tuneup, so I decided to take a look at the needle screws just to find out they used a proprietary screw everyone calls &#8220;pac-man&#8221;, the tool costs $20 usd shipped from eBay and similar sources, the fun [...]]]></description>
			<content:encoded><![CDATA[<p>I recently purchased a Homelite leaf blower, it seems to work fine except for the carburetor requiring some tuneup, so I decided to take a look at the needle screws just to find out they used a proprietary screw everyone calls &#8220;pac-man&#8221;, the tool costs $20 usd shipped from eBay and similar sources, the fun (or sad) thing is that the whole unit cost me about $100 usd &#8212; It&#8217;s not really an option to get the tool unless you do this for a living.</p>
<p><a href="http://gushh.net/blog/wp-content/uploads/2012/04/carby3.jpg"><img class="aligncenter size-full wp-image-1313" title="carby3" src="http://gushh.net/blog/wp-content/uploads/2012/04/carby3.jpg" alt="" width="656" height="732" /></a></p>
<p>So I decided to make my own, first I tried to make a mould of the carb using oil and hotglue (the oil prevents the plastic from sticking to the metal) &#8212; The cast was fine, but it wasn&#8217;t deep enough, on hindsight I should&#8217;ve pre-heated the carburetor so the plastic would&#8217;ve run hot for a longer period of time, thus filling up the cavities of the adjustment section. The idea was to cast the tool out of 2 part epoxy, it may have worked if only I could&#8217;ve got a proper cast&#8230;</p>
<p>&nbsp;</p>
<p style="text-align: center;"><a href="http://gushh.net/blog/wp-content/uploads/2012/04/carby4.jpg"><img class="aligncenter  wp-image-1314" title="carby4" src="http://gushh.net/blog/wp-content/uploads/2012/04/carby4.jpg" alt="" width="700" height="525" /></a></p>
<p>Since that was a complete failure, I went for plan b: I got a random piece of brass tubing. I filed it down to size and then I used a phillips screwdriver on a vise as the template for the pac-man groove, then I whacked it with an old chisel to leave the imprint. To further strengthen the groove I decided to use regular leaded solder (60/40) to cover up the groove from the outside. I also covered up the bottom portion of the tube (capped it) and I added a handle made out of wooden dowel.</p>
<p>&nbsp;</p>
<p style="text-align: center;"><a href="http://gushh.net/blog/wp-content/uploads/2012/04/carby6.jpg"><img class="aligncenter  wp-image-1315" title="carby6" src="http://gushh.net/blog/wp-content/uploads/2012/04/carby6.jpg" alt="" width="700" height="525" /></a></p>
<p>What can I say, it simply works for what it is. I may not get tons of cycles out of it but as long as I can adjust the carb a few times, I&#8217;ll be happy.</p>
<p>Certainly worth the half an hour I spent doing this. Too bad it looks like crap!</p>
<p>&nbsp;</p>
<p><a href="http://gushh.net/blog/wp-content/uploads/2012/04/carby7.jpg"><img class="aligncenter size-full wp-image-1318" title="carby7" src="http://gushh.net/blog/wp-content/uploads/2012/04/carby7.jpg" alt="" width="768" height="467" /></a></p>
<div><span style="color: #0000ee;"><span style="text-decoration: underline;"><br />
</span></span>In case you don&#8217;t like the idea of making your own tool, the other option is to simply grab the Dremel tool with a cutoff disk and just cut the slits on each screw, this will damage the carb as well though, I&#8217;m not too crazy about this option and certainly not crazy enough to spend 20 bucks on the real tool (which by the way I think its too long for this particular homelite product)</p>
<p>&nbsp;</p>
<p>Either way, you don&#8217;t really have to bend over to Homelite! &#8212; Take that corporations and governments!</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</div>
<g:plusone href='http://gushh.net/blog/diy-homelite-tool/'></g:plusone>]]></content:encoded>
			<wfw:commentRss>http://gushh.net/blog/diy-homelite-tool/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MSP430 Launchpad: Controlling a Servo with hardware PWM</title>
		<link>http://gushh.net/blog/msp430-servo/</link>
		<comments>http://gushh.net/blog/msp430-servo/#comments</comments>
		<pubDate>Wed, 07 Mar 2012 11:00:33 +0000</pubDate>
		<dc:creator>GuShH</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[MSP430 Launchpad]]></category>
		<category><![CDATA[43oh servo]]></category>
		<category><![CDATA[diy launchpad servo]]></category>
		<category><![CDATA[interfacing servo with msp430]]></category>
		<category><![CDATA[launchpad servo]]></category>
		<category><![CDATA[msp430 servo]]></category>
		<category><![CDATA[rc servo]]></category>
		<category><![CDATA[tower pro servo]]></category>

		<guid isPermaLink="false">http://gushh.net/blog/?p=1298</guid>
		<description><![CDATA[RC Servos are pretty useful devices, they allow us to move things in a mechanical manner. They are cheap and readily available, so it only makes sense to use them! A quick intro: Servos are actually rather simple to interface with, they merely require a pulse of a certain width to determine the next position. [...]]]></description>
			<content:encoded><![CDATA[<p>RC Servos are pretty useful devices, they allow us to move things in a mechanical manner. They are cheap and readily available, so it only makes sense to use them!</p>
<h3>A quick intro:</h3>
<p>Servos are actually rather simple to interface with, they merely require a pulse of a certain width to determine the next position.</p>
<p>Because of this, we can use hardware PWM to generate these pulses. The frequency is typically 50Hz, which means we&#8217;ll be able to obtain a great deal of granularity with regard to the duty cycle, given our clock speed of 1MHz. Which is required since we&#8217;ll be dealing with pulses ranging ~1mS to ~2mS (typically)</p>
<blockquote><p>Different servos will require a different minimum and maximum duty cycle, however in general the given code should just-work, in case your servo goes off range simply find the best minimum and maximum values for it.</p></blockquote>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #339900;">#include &quot;msp430g2553.h&quot; // make sure you change the header to suit your particular device.</span>
&nbsp;
<span style="color: #666666;">// Connect the servo SIGNAL wire to P1.2 through a 1K resistor.</span>
&nbsp;
<span style="color: #339900;">#define MCU_CLOCK			1000000</span>
<span style="color: #339900;">#define PWM_FREQUENCY		46		// In Hertz, ideally 50Hz.</span>
&nbsp;
<span style="color: #339900;">#define SERVO_STEPS			180		// Maximum amount of steps in degrees (180 is common)</span>
<span style="color: #339900;">#define SERVO_MIN			650		// The minimum duty cycle for this servo</span>
<span style="color: #339900;">#define SERVO_MAX			2700	// The maximum duty cycle</span>
&nbsp;
<span style="color: #0000ff;">unsigned</span> <span style="color: #0000ff;">int</span> PWM_Period		<span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span>MCU_CLOCK <span style="color: #000040;">/</span> PWM_FREQUENCY<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>	<span style="color: #666666;">// PWM Period</span>
<span style="color: #0000ff;">unsigned</span> <span style="color: #0000ff;">int</span> PWM_Duty		<span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>							<span style="color: #666666;">// %</span>
&nbsp;
<span style="color: #0000ff;">void</span> main <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">void</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#123;</span>
&nbsp;
	<span style="color: #0000ff;">unsigned</span> <span style="color: #0000ff;">int</span> servo_stepval, servo_stepnow<span style="color: #008080;">;</span>
	<span style="color: #0000ff;">unsigned</span> <span style="color: #0000ff;">int</span> servo_lut<span style="color: #008000;">&#91;</span> SERVO_STEPS<span style="color: #000040;">+</span><span style="color: #0000dd;">1</span> <span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">unsigned</span> <span style="color: #0000ff;">int</span> i<span style="color: #008080;">;</span>
&nbsp;
	<span style="color: #666666;">// Calculate the step value and define the current step, defaults to minimum.</span>
	servo_stepval 	<span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#40;</span>SERVO_MAX <span style="color: #000040;">-</span> SERVO_MIN<span style="color: #008000;">&#41;</span> <span style="color: #000040;">/</span> SERVO_STEPS <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
	servo_stepnow	<span style="color: #000080;">=</span> SERVO_MIN<span style="color: #008080;">;</span>
&nbsp;
	<span style="color: #666666;">// Fill up the LUT</span>
	<span style="color: #0000ff;">for</span> <span style="color: #008000;">&#40;</span>i <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> i <span style="color: #000040;">&amp;</span>lt<span style="color: #008080;">;</span> SERVO_STEPS<span style="color: #008080;">;</span> i<span style="color: #000040;">++</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
		servo_stepnow <span style="color: #000040;">+</span><span style="color: #000080;">=</span> servo_stepval<span style="color: #008080;">;</span>
		servo_lut<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span> <span style="color: #000080;">=</span> servo_stepnow<span style="color: #008080;">;</span>
	<span style="color: #008000;">&#125;</span>
&nbsp;
	<span style="color: #666666;">// Setup the PWM, etc.</span>
	WDTCTL	<span style="color: #000080;">=</span> WDTPW <span style="color: #000040;">+</span> WDTHOLD<span style="color: #008080;">;</span>     <span style="color: #666666;">// Kill watchdog timer</span>
	TACCTL1	<span style="color: #000080;">=</span> OUTMOD_7<span style="color: #008080;">;</span>            <span style="color: #666666;">// TACCR1 reset/set</span>
	TACTL	<span style="color: #000080;">=</span> TASSEL_2 <span style="color: #000040;">+</span> MC_1<span style="color: #008080;">;</span>     <span style="color: #666666;">// SMCLK, upmode</span>
	TACCR0	<span style="color: #000080;">=</span> PWM_Period<span style="color: #000040;">-</span><span style="color: #0000dd;">1</span><span style="color: #008080;">;</span>        <span style="color: #666666;">// PWM Period</span>
	TACCR1	<span style="color: #000080;">=</span> PWM_Duty<span style="color: #008080;">;</span>            <span style="color: #666666;">// TACCR1 PWM Duty Cycle</span>
	P1DIR	<span style="color: #000040;">|</span><span style="color: #000080;">=</span> BIT2<span style="color: #008080;">;</span>               <span style="color: #666666;">// P1.2 = output</span>
	P1SEL	<span style="color: #000040;">|</span><span style="color: #000080;">=</span> BIT2<span style="color: #008080;">;</span>               <span style="color: #666666;">// P1.2 = TA1 output</span>
&nbsp;
	<span style="color: #666666;">// Main loop</span>
	<span style="color: #0000ff;">while</span> <span style="color: #008000;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#123;</span>
&nbsp;
		<span style="color: #666666;">// Go to 0°</span>
		TACCR1 <span style="color: #000080;">=</span> servo_lut<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
		__delay_cycles<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">1000000</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
		<span style="color: #666666;">// Go to 45°</span>
		TACCR1 <span style="color: #000080;">=</span> servo_lut<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">45</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
		__delay_cycles<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">1000000</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
		<span style="color: #666666;">// Go to 90°</span>
		TACCR1 <span style="color: #000080;">=</span> servo_lut<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">90</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
		__delay_cycles<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">1000000</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
		<span style="color: #666666;">// Go to 180°</span>
		TACCR1 <span style="color: #000080;">=</span> servo_lut<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">179</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
		__delay_cycles<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">1000000</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
		<span style="color: #666666;">// Move forward toward the maximum step value</span>
		<span style="color: #0000ff;">for</span> <span style="color: #008000;">&#40;</span>i <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> i <span style="color: #000040;">&amp;</span>lt<span style="color: #008080;">;</span> SERVO_STEPS<span style="color: #008080;">;</span> i<span style="color: #000040;">++</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span> 			TACCR1 <span style="color: #000080;">=</span> servo_lut<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span> 			__delay_cycles<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">20000</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> 		<span style="color: #008000;">&#125;</span> 		 		<span style="color: #666666;">// Move backward toward the minimum step value 		for (i = SERVO_STEPS; i &amp;gt; 0; i--) {</span>
			TACCR1 <span style="color: #000080;">=</span> servo_lut<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
			__delay_cycles<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">20000</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
		<span style="color: #008000;">&#125;</span>
&nbsp;
   <span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>The actual code was written for a quick and dirty servo testing unit I put together, however it could easily be expanded to other uses.</p>
<p>By using a LUT (Look-Up Table) we are able to position the servo on a per-degree basis, which makes the code a lot more intuitive and readable.</p>
<h3>A bunch of notes and tips:</h3>
<ol>
<li>Filter your servo power supply properly; servos are electrically noisy!</li>
<li>Make sure your micro-controller is protected from external devices, such as the servos. For instance never connect the signal wire directly to the GPIO pins. Instead, use a buffer or at least a resistor. For this example we used a 1k Resistor, but since the &#8220;signal&#8221; interface is relatively high impedance, we could even use 4k7 or higher without much hassle.</li>
<li>As long as you keep sending a signal to the servo, the servo will keep it&#8217;s position due to it&#8217;s internal feedback. However this consumes power so if you&#8217;ve got a very lightweight load or no load at all, you can always stop the PWM output for the periods of inactivity to save power.</li>
<li>If you aren&#8217;t sure about your servo connections, <a href="http://www.coastalplanes.com/articles/servopin.gif" target="_blank">here&#8217;s a small diagram</a> to help you find the pinouts. In my case I had a couple cheap &#8220;Tower Pro&#8221; blue servos that use the JR pinout &#8212; These work fine at both 5v and 3.3v, however do not power them from the Launchpad power supply pins! &#8212; Servos consume a lot of current, always use an external PSU.</li>
<li>Only one connection is required to interface the servo with the launchpad, find the pin P1.2 and connect it to the SIGNAL wire from your servo.</li>
</ol>
<p>&nbsp;</p>
<p>That&#8217;s it for now, enjoy!</p>
<g:plusone href='http://gushh.net/blog/msp430-servo/'></g:plusone>]]></content:encoded>
			<wfw:commentRss>http://gushh.net/blog/msp430-servo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>(PB) Loading Assets, the simple way.</title>
		<link>http://gushh.net/blog/loading-assets-simple-way/</link>
		<comments>http://gushh.net/blog/loading-assets-simple-way/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 00:29:27 +0000</pubDate>
		<dc:creator>GuShH</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[PureBasic]]></category>
		<category><![CDATA[asset]]></category>
		<category><![CDATA[Game Development]]></category>
		<category><![CDATA[loading files]]></category>
		<category><![CDATA[purebasic]]></category>

		<guid isPermaLink="false">http://gushh.net/blog/?p=1284</guid>
		<description><![CDATA[Intro Assets are an essential part of most games, how you manage them determines whether you spend more time working on them than dealing with them. For small to medium games, loading an entire directory and having it referenced to a Map is the ideal solution. It&#8217;s both flexible and simple. The following code allows [...]]]></description>
			<content:encoded><![CDATA[<h2>Intro</h2>
<p>Assets are an essential part of most games, how you manage them determines whether you spend more time working on them than dealing with them.</p>
<p>For small to medium games, loading an entire directory and having it referenced to a Map is the ideal solution. It&#8217;s both flexible and simple.</p>
<h4>The following code allows you to do just this:</h4>

<div class="wp_syntax"><div class="code"><pre class="purebasic" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">Prototype</span>.i LOAD_DIRECTORY_CALLBACK<span style="color: #000066;">&#40;</span> Map Assets.i<span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span>, directory.s, extension.s, name.s, userDefined.i <span style="color: #000066;">=</span> #Null <span style="color: #000066;">&#41;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">Procedure</span>.i LoadDirectory<span style="color: #000066;">&#40;</span> Map assets.i<span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span>, directory.s, extension.s, <span style="color: #000066;">*</span>callback.LOAD_DIRECTORY_CALLBACK, userDefined.i <span style="color: #000066;">=</span> #Null <span style="color: #000066;">&#41;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">Define</span>.i dir <span style="color: #000066;">=</span> <span style="color: #0000ff;">ExamineDirectory</span><span style="color: #000066;">&#40;</span> #PB_Any, directory, <span style="color: #009900;">&quot;*&quot;</span> <span style="color: #000066;">+</span> extension <span style="color: #000066;">&#41;</span>
	<span style="color: #000066; font-weight: bold;">If</span> <span style="color: #0000ff;">IsDirectory</span><span style="color: #000066;">&#40;</span> dir <span style="color: #000066;">&#41;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">Define</span>.i count <span style="color: #000066;">=</span> <span style="color: #CC0000;">0</span>
		<span style="color: #000066; font-weight: bold;">Define</span>.s name <span style="color: #000066;">=</span> <span style="color: #009900;">&quot;&quot;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">While</span> <span style="color: #0000ff;">NextDirectoryEntry</span><span style="color: #000066;">&#40;</span> dir <span style="color: #000066;">&#41;</span>
			<span style="color: #000066; font-weight: bold;">If</span> <span style="color: #0000ff;">DirectoryEntryType</span><span style="color: #000066;">&#40;</span> dir <span style="color: #000066;">&#41;</span> <span style="color: #000066;">=</span> #PB_DirectoryEntry_File
				name <span style="color: #000066;">=</span> <span style="color: #0000ff;">DirectoryEntryName</span><span style="color: #000066;">&#40;</span> dir <span style="color: #000066;">&#41;</span><span style="color: #ff0000; font-style: italic;">;</span>
				assets<span style="color: #000066;">&#40;</span> <span style="color: #0000ff;">ReplaceString</span><span style="color: #000066;">&#40;</span> name, extension, <span style="color: #009900;">&quot;&quot;</span> <span style="color: #000066;">&#41;</span> <span style="color: #000066;">&#41;</span> <span style="color: #000066;">=</span> <span style="color: #000066;">*</span>callback<span style="color: #000066;">&#40;</span> assets<span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span>, directory, extension, name, userDefined <span style="color: #000066;">&#41;</span><span style="color: #ff0000; font-style: italic;">;LoadSound( #PB_Any, directory + &quot;\&quot; + name )</span>
				count <span style="color: #000066;">+</span> <span style="color: #CC0000;">1</span>
			<span style="color: #000066; font-weight: bold;">EndIf</span>
		<span style="color: #000066; font-weight: bold;">Wend</span>
&nbsp;
		<span style="color: #0000ff;">FinishDirectory</span><span style="color: #000066;">&#40;</span> dir <span style="color: #000066;">&#41;</span>
	<span style="color: #000066; font-weight: bold;">EndIf</span>
	<span style="color: #000066; font-weight: bold;">ProcedureReturn</span> count
&nbsp;
<span style="color: #000066; font-weight: bold;">EndProcedure</span></pre></div></div>

<p>To use this code you must define a procedure of your own, this procedure is going to be called on each file to be loaded; you&#8217;ll have to load and process the file in this function.</p>
<h4>Example use:</h4>

<div class="wp_syntax"><div class="code"><pre class="purebasic" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">Global</span> NewMap sprite.i<span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span>
<span style="color: #000066; font-weight: bold;">Procedure</span>.i callback_loadsprites<span style="color: #000066;">&#40;</span> Map Assets.i<span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span>, directory.s, extension.s, name.s, userDefined.i <span style="color: #000066;">=</span> #Null <span style="color: #000066;">&#41;</span>
	<span style="color: #000066; font-weight: bold;">ProcedureReturn</span> <span style="color: #0000ff;">LoadSprite</span><span style="color: #000066;">&#40;</span> #PB_Any, directory <span style="color: #000066;">+</span> <span style="color: #009900;">&quot;\&quot;</span> <span style="color: #000066;">+</span> name, userDefined <span style="color: #000066;">&#41;</span>
<span style="color: #000066; font-weight: bold;">EndProcedure</span>
&nbsp;
LoadDirectory<span style="color: #000066;">&#40;</span> sprite<span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span>, <span style="color: #009900;">&quot;sprites&quot;</span>, <span style="color: #009900;">&quot;.png&quot;</span>, @callback_loadsprites<span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span> <span style="color: #000066;">&#41;</span></pre></div></div>

<p>The example will attempt to scan through the directory &#8220;sprites&#8221;, it will execute your callback on each png file it finds inside the aforementioned directory, furthermore it&#8217;ll reference the filename (without extension) to the sprite() Map, so when you need a handle for the sprite called &#8220;fire.png&#8221; you&#8217;d just use sprite(&#8220;fire&#8221;) to obtain it.</p>
<p>Since the files are referenced to a Map by their actual name, you could easily implement a scripting system or any other dynamic management solution for your assets without much hassle.</p>
<blockquote><p>An interesting part of the code is the return value, it&#8217;s actually the number of assets found (not the ones loaded, since your callback could choose not to load a certain file, for instance).</p></blockquote>
<p>There are several limitations to this simple implementation, which is why I mentioned &#8220;small games&#8221; &#8211; There is no directory recursion, no advanced filtering options, no way to parallel the process on a separate thread and there&#8217;s no error handling at the moment.</p>
<p>However, it&#8217;s still very useful and I highly recommend you try it out, while it&#8217;s not a novel aproach, it&#8217;s always been the method I used to load my assets and it just works.</p>
<p>Have fun!</p>
<g:plusone href='http://gushh.net/blog/loading-assets-simple-way/'></g:plusone>]]></content:encoded>
			<wfw:commentRss>http://gushh.net/blog/loading-assets-simple-way/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Well, This sucks.</title>
		<link>http://gushh.net/blog/this-sucks/</link>
		<comments>http://gushh.net/blog/this-sucks/#comments</comments>
		<pubDate>Wed, 21 Dec 2011 17:23:54 +0000</pubDate>
		<dc:creator>GuShH</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://gushh.net/blog/?p=1278</guid>
		<description><![CDATA[Technically homeless, in a hotel waiting to meet with the realtors in regard with the property I was going to acquire&#8230; They keep BSing me about this and that with stupid constraints and whatnot, so I really need to get some lawyers down there first. What also sucks is that they have to make sure [...]]]></description>
			<content:encoded><![CDATA[<p>Technically homeless, in a hotel waiting to meet with the realtors in regard with the property I was going to acquire&#8230; </p>
<p>They keep BSing me about this and that with stupid constraints and whatnot, so I really need to get some lawyers down there first.</p>
<p>What also sucks is that they have to make sure the owner is available for the meeting otherwise it&#8217;ll be a futile exercise.</p>
<p>I&#8217;m trying to get this over with ASAP but it seems to be out of reach.</p>
<p>The biggest issues right now are having my pets living in a friggin&#8217; vet store, which by the way they won&#8217;t be able to keep &#8216;em for longer than a few days, borderline Saturday. In fact, it took half a day of calls and walking half the damn town to find a place that would keep them in such a short notice (met with a clerk at night, they were closed but the guy opened anyway and told me to come back at the morning.</p>
<p>I had to get to downtown to seal the deal at 11AM, woke up at 7 or 8AM if I recall after going to sleep at 3-4AM &#8212; slept on the floor, wasn&#8217;t comfy but hey it helps with the back pain at least! &#8212; and I still had things to do at &#8220;home&#8221; before I left for good, however the pain from moving everything the day before was just too much to bare so I had to leave a few untied knots here and there; which I&#8217;ll have to deal with today or tomorrow.</p>
<p>Right now I&#8217;m using the shitty hotel&#8217;s WIFI, which is also shitty &#8212; obviously. The password is bosh780 by the way.</p>
<p>What really, really bothers me aside from all this crap is the price, they charge premium for an &#8220;apart hotel&#8221; room that I would never ever take if it wasn&#8217;t for the fact that every other place was fully booked.</p>
<p>I mean seriously, there are no facilities at all, the breakfast was a-ok but if I had to choose, I&#8217;d rather sleep in a car; which by the way is at the shop right now so yeah&#8230;</p>
<p>Anyway, f*** real estate agencies, in the arse with a machinegun.</p>
<p>See ya.</p>
<g:plusone href='http://gushh.net/blog/this-sucks/'></g:plusone>]]></content:encoded>
			<wfw:commentRss>http://gushh.net/blog/this-sucks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Off for a while&#8230;</title>
		<link>http://gushh.net/blog/moving-out/</link>
		<comments>http://gushh.net/blog/moving-out/#comments</comments>
		<pubDate>Wed, 14 Dec 2011 00:13:46 +0000</pubDate>
		<dc:creator>GuShH</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[moving out]]></category>

		<guid isPermaLink="false">http://gushh.net/blog/?p=1270</guid>
		<description><![CDATA[Well, it&#8217;s no secret to some &#8212; I&#8217;m moving out &#8212; And this means I&#8217;ll be away for a while. I&#8217;ll try to get online as soon as possible (not that any of you care!) and start posting some of my drafts right away; I have quite some interesting notes to share. However I&#8217;m not [...]]]></description>
			<content:encoded><![CDATA[<p>Well, it&#8217;s no secret to some &#8212; I&#8217;m moving out &#8212; And this means I&#8217;ll be away for a while. I&#8217;ll try to get online as soon as possible (not that any of you care!) and start posting some of my drafts right away; I have quite some interesting notes to share. However I&#8217;m not sure about the Internet providers and the quality of service at the new place, I may even have to resort to &#8220;stealing&#8221; WIFI while I figure out the ISPs.</p>
<p>It&#8217;s worth noting that right now the site has a low priority as well, I need to figure out how to get the massive amount of stuff I own moved from point A to point B without getting stuff damaged or stolen in the process. I also need to deal with a lot of paperwork and this requires a lot of time and dedication, so that&#8217;s where I&#8217;ll be focusing for the moment.</p>
<p>Hopefully I&#8217;ll be able to start with some nice weekly video entries as well once I&#8217;m half settled down.</p>
<p>There are lots of things that need to be done in the new house and I would like to share the process with everyone. Not everything is going to be electronics related, but I reckon some of it will be <img src='http://gushh.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Either way, have a good one!</p>
<p>Gus</p>
<p>PS: Shit this whole thing is stressful. But if it were easy it wouldn&#8217;t be worth it.</p>
<g:plusone href='http://gushh.net/blog/moving-out/'></g:plusone>]]></content:encoded>
			<wfw:commentRss>http://gushh.net/blog/moving-out/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Served from: gushh.net @ 2012-05-20 19:33:15 by W3 Total Cache -->
