Last-Modified: Sat, 21 Sep 2024 08:26:27 GMT
Expires: Tue, 19 Sep 2034 08:26:27 GMT

<!DOCTYPE html>
<html lang='en'>
<head>
<title>thoughts - mixed-content personal blog</title>
<meta name='generator' content='cgit 1.4.1'/>
<meta name='robots' content='index, nofollow'/>
<link rel='stylesheet' type='text/css' href='/cgit.css'/>
<link rel='shortcut icon' href='/favicon.ico'/>
<link rel='alternate' title='Atom feed' href='https://code.fourisland.com/thoughts/atom/app/views/admin/blogs/index.html.haml?h=master' type='application/atom+xml'/>
<link rel='vcs-git' href='https://git.fourisland.com/thoughts' title='thoughts Git repository'/>
</head>
<body>
<div id='cgit'><table id='header'>
<tr>
<td class='logo' rowspan='2'><a href='/'><img src='/cgit.png' alt='cgit logo'/></a></td>
<td class='main'><a href='/'>index</a> : <a href='/thoughts/'>thoughts</a></td><td class='form'><form method='get'>
<input type='hidden' name='id' value='db803440022103bb6d4f7015d87db3b52610223a'/><input type='hidden' name='showmsg' value='1'/><select name='h' onchange='this.form.submit();'>
<option value='17c72a9bd8a624a2bc0aa4c806199ba8648ce4cc'>this commit</option>
<optgroup label='branches'><option value='dependabot/bundler/globalid-1.0.1'>dependabot/bundler/globalid-1.0.1</option>
<option value='dependabot/bundler/loofah-2.19.1'>dependabot/bundler/loofah-2.19.1</option>
<option value='dependabot/bundler/rack-2.2.6.3'>dependabot/bundler/rack-2.2.6.3</option>
<option value='dependabot/bundler/rails-html-sanitizer-1.4.4'>dependabot/bundler/rails-html-sanitizer-1.4.4</option>
<option value='master' selected='selected'>master</option>
</optgroup></select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>mixed-content personal blog</td><td class='sub right'></td></tr></table>
<table class='tabs'><tr><td>
<a href='/thoughts/about/'>about</a> <a href='/thoughts/'>summary</a> <a href='/thoughts/refs/?id=db803440022103bb6d4f7015d87db3b52610223a'>refs</a> <a class='active' href='/thoughts/log/app/views/admin/blogs/index.html.haml?showmsg=1'>log</a> <a href='/thoughts/tree/app/views/admin/blogs/index.html.haml?id=db803440022103bb6d4f7015d87db3b52610223a'>tree</a> <a href='/thoughts/commit/app/views/admin/blogs/index.html.haml?id=db803440022103bb6d4f7015d87db3b52610223a'>commit</a> <a href='/thoughts/diff/app/views/admin/blogs/index.html.haml?id=db803440022103bb6d4f7015d87db3b52610223a'>diff</a> <a href='/thoughts/stats/app/views/admin/blogs/index.html.haml'>stats</a></td><td class='form'><form class='right' method='get' action='/thoughts/log/app/views/admin/blogs/index.html.haml'>
<input type='hidden' name='id' value='db803440022103bb6d4f7015d87db3b52610223a'/><input type='hidden' name='showmsg' value='1'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/thoughts/log/?id=db803440022103bb6d4f7015d87db3b52610223a&amp;showmsg=1'>root</a>/<a href='/thoughts/log/app?id=db803440022103bb6d4f7015d87db3b52610223a&amp;showmsg=1'>app</a>/<a href='/thoughts/log/app/views?id=db803440022103bb6d4f7015d87db3b52610223a&amp;showmsg=1'>views</a>/<a href='/thoughts/log/app/views/admin?id=db803440022103bb6d4f7015d87db3b52610223a&amp;showmsg=1'>admin</a>/<a href='/thoughts/log/app/views/admin/blogs?id=db803440022103bb6d4f7015d87db3b52610223a&amp;showmsg=1'>blogs</a>/<a href='/thoughts/log/app/views/admin/blogs/index.html.haml?id=db803440022103bb6d4f7015d87db3b52610223a&amp;showmsg=1'>index.html.haml</a></div><div class='content'><table class='list nowrap'><tr class='nohover'><th></th><th class='left'>Commit message (<a href='/thoughts/log/app/views/admin/blogs/index.html.haml?id=db803440022103bb6d4f7015d87db3b52610223a'>Collapse</a>)</th><th class='left'>Author</th><th class='left'>Age</th><th class='left'>Files</th><th class='left'>Lines</th></tr>
<tr class='logheader'><td class='commitgraph'>* </td><td class='logsubject'><a href='/thoughts/commit/app/views/admin/blogs/index.html.haml?id=292c2e4a031360e5b58385f4b6b7f3e47a8ca988'>Fixed broken blog post urls</a></td><td>Star Rauchenberger</td><td><span title='2023-10-11 16:39:45 -0400'>2023-10-11</span></td><td>1</td><td><span class='deletions'>-1</span>/<span class='insertions'>+1</span></td></tr>
<tr class='nohover-highlight'><td class='commitgraph'><span class='column1'>|</span> </td>
<td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td class='commitgraph'>* </td><td class='logsubject'><a href='/thoughts/commit/app/views/admin/blogs/index.html.haml?id=5f860c66d300654934848aee1abe8e5c0d41836e'>Added blog archive</a></td><td>Star Rauchenberger</td><td><span title='2023-10-11 16:25:37 -0400'>2023-10-11</span></td><td>1</td><td><span class='deletions'>-1</span>/<span class='insertions'>+1</span></td></tr>
<tr class='nohover-highlight'><td class='commitgraph'><span class='column1'>|</span> 
<span class='column1'>|</span> 
<span class='column1'>|</span> 
<span class='column1'>|</span> </td>
<td colspan='5' class='logmsg'>
The path to blog posts is now "blog" instead of "says", btw.


</td></tr>
<tr class='logheader'><td class='commitgraph'>* </td><td class='logsubject'><a href='/thoughts/commit/app/views/admin/blogs/index.html.haml?id=e21a783bc2646522bc02750f292b732a470a747f'>Fixed blog editing url</a></td><td>Star Rauchenberger</td><td><span title='2023-10-11 13:27:29 -0400'>2023-10-11</span></td><td>1</td><td><span class='deletions'>-1</span>/<span class='insertions'>+1</span></td></tr>
<tr class='nohover-highlight'><td class='commitgraph'><span class='column1'>|</span> </td>
<td colspan='5' class='logmsg'>
</td></tr>
<tr class='logheader'><td class='commitgraph'>* </td><td class='logsubject'><a href='/thoughts/commit/app/views/admin/blogs/index.html.haml?id=dd231a335758873dcd9024db7618837094fcc0a5'>Added page titles</a></td><td>Kelly Rauchenberger</td><td><span title='2018-07-06 16:52:48 -0400'>2018-07-06</span></td><td>1</td><td><span class='deletions'>-0</span>/<span class='insertions'>+1</span></td></tr>
<tr class='nohover-highlight'><td class='commitgraph'><span class='column1'>|</span> 
<span class='column1'>|</span> 
<span class='column1'>|</span> 
<span class='column1'>|</span> </td>
<td colspan='5' class='logmsg'>
refs #4


</td></tr>
<tr class='logheader'><td class='commitgraph'>* </td><td class='logsubject'><a href='/thoughts/commit/app/views/admin/blogs/index.html.haml?id=e11dedec034c4180985adf4a9f176b07121f0a41'>Blog drafts no longer require slugs</a></td><td>Kelly Rauchenberger</td><td><span title='2018-07-04 11:46:13 -0400'>2018-07-04</span></td><td>1</td><td><span class='deletions'>-1</span>/<span class='insertions'>+4</span></td></tr>
<tr class='nohover-highlight'><td class='commitgraph'><span class='column1'>|</span> 
<span class='column1'>|</span> 
<span class='column1'>|</span> 
<span class='column1'>|</span> 
<span class='column1'>|</span> 
<span class='column1'>|</span> </td>
<td colspan='5' class='logmsg'>
They do still technically require titles, but the engine will fill in "Untitled draft" if it is left blank. Unpublished posts can be viewed at a different URL than published posts would be. Quick links to view published and unpublished posts have been added to the admin panel.

refs #1


</td></tr>
<tr class='logheader'><td class='commitgraph'>* </td><td class='logsubject'><a href='/thoughts/commit/app/views/admin/blogs/index.html.haml?id=d48adb741c5c30ba3f2d3c039a7e342b43add352'>Added blog drafts</a></td><td>Kelly Rauchenberger</td><td><span title='2018-07-04 10:42:21 -0400'>2018-07-04</span></td><td>1</td><td><span class='deletions'>-2</span>/<span class='insertions'>+2</span></td></tr>
<tr class='nohover-highlight'><td class='commitgraph'><span class='column1'>|</span> 
<span class='column1'>|</span> 
<span class='column1'>|</span> 
<span class='column1'>|</span> 
<span class='column1'>|</span> 
<span class='column1'>|</span> 
<span class='column1'>|</span> 
<span class='column1'>|</span> </td>
<td colspan='5' class='logmsg'>
An unpublished post is not viewable unless you are logged in. The "Create record" field is disabled for unpublished posts, though this is only in JavaScript and the backend will not disallow creating records for unpublished posts if forced to. Unpublishing a post does not destroy records for that post.

This only applies to blog posts, currently; streams and stream updates cannot be drafted. Unpublished posts still require titles and slugs. There is no autosaving functionality yet.

refs #1


</td></tr>
<tr class='logheader'><td class='commitgraph'>* </td><td class='logsubject'><a href='/thoughts/commit/app/views/admin/blogs/index.html.haml?id=e47e83cf6bded3d1924b4d500193e7876833ef83'>Created admin panel</a></td><td>Kelly Rauchenberger</td><td><span title='2017-07-02 13:03:43 -0400'>2017-07-02</span></td><td>1</td><td><span class='deletions'>-0</span>/<span class='insertions'>+10</span></td></tr>
<tr class='nohover-highlight'><td class='commitgraph'>  
  
  
  
  
  
  </td>
<td colspan='5' class='logmsg'>
Currently allows you to create and edit blogs, including associated
records. Uses a WYSIWYG editor that allows uploading images.

Also included jQuery :(


</td></tr>
</table><ul class='pager'></ul></div> <!-- class=content -->
<div class='footer'>generated by <a href='https://git.causal.agency/cgit-pink/about/'>cgit-pink 1.4.1</a> (<a href='https://git-scm.com/'>git 2.36.1</a>) at 2024-09-21 08:26:27 +0000</div>
</div> <!-- id=cgit -->
</body>
</html>
ef='#n189'>189</a>
<a id='n190' href='#n190'>190</a>
<a id='n191' href='#n191'>191</a>
<a id='n192' href='#n192'>192</a>
<a id='n193' href='#n193'>193</a>
<a id='n194' href='#n194'>194</a>
<a id='n195' href='#n195'>195</a>
<a id='n196' href='#n196'>196</a>
<a id='n197' href='#n197'>197</a>
<a id='n198' href='#n198'>198</a>
<a id='n199' href='#n199'>199</a>
<a id='n200' href='#n200'>200</a>
<a id='n201' href='#n201'>201</a>
<a id='n202' href='#n202'>202</a>
<a id='n203' href='#n203'>203</a>
<a id='n204' href='#n204'>204</a>
<a id='n205' href='#n205'>205</a>
<a id='n206' href='#n206'>206</a>
<a id='n207' href='#n207'>207</a>
<a id='n208' href='#n208'>208</a>
<a id='n209' href='#n209'>209</a>
<a id='n210' href='#n210'>210</a>
<a id='n211' href='#n211'>211</a>
<a id='n212' href='#n212'>212</a>
</pre></td>
<td class='lines'><pre><code><style>.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */</style><div class="highlight"><pre><span></span><span class="c1">//</span>
<span class="c1">//  Cart_CollectAppDelegate.m</span>
<span class="c1">//  Cart Collect</span>
<span class="c1">//</span>
<span class="c1">//  Created by iD Student Account on 7/18/11.</span>
<span class="c1">//  Copyright __MyCompanyName__ 2011. All rights reserved.</span>
<span class="c1">//</span>

<span class="cp">#import &quot;cocos2d.h&quot;</span>

<span class="cp">#import &quot;Cart_CollectAppDelegate.h&quot;</span>
<span class="cp">#import &quot;GameConfig.h&quot;</span>
<span class="cp">#import &quot;GameLayer.h&quot;</span>
<span class="cp">#import &quot;RootViewController.h&quot;</span>
<span class="cp">#import &quot;MainMenuLayer.h&quot;</span>

<span class="k">@implementation</span> <span class="nc">Cart_CollectAppDelegate</span>

<span class="k">@synthesize</span> <span class="n">window</span><span class="p">,</span> <span class="n">viewController</span><span class="p">;</span>

<span class="p">-</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span> <span class="nf">removeStartupFlicker</span>
<span class="p">{</span>
	<span class="c1">//</span>
	<span class="c1">// THIS CODE REMOVES THE STARTUP FLICKER</span>
	<span class="c1">//</span>
	<span class="c1">// Uncomment the following code if you Application only supports landscape mode</span>
	<span class="c1">//</span>
<span class="cp">#if GAME_AUTOROTATION == kGameAutorotationUIViewController</span>
	
	<span class="c1">//	CC_ENABLE_DEFAULT_GL_STATES();</span>
	<span class="c1">//	CCDirector *director = [CCDirector sharedDirector];</span>
	<span class="c1">//	CGSize size = [director winSize];</span>
	<span class="c1">//	CCSprite *sprite = [CCSprite spriteWithFile:@&quot;Default.png&quot;];</span>
	<span class="c1">//	sprite.position = ccp(size.width/2, size.height/2);</span>
	<span class="c1">//	sprite.rotation = -90;</span>
	<span class="c1">//	[sprite visit];</span>
	<span class="c1">//	[[director openGLView] swapBuffers];</span>
	<span class="c1">//	CC_ENABLE_DEFAULT_GL_STATES();</span>
	
<span class="cp">#endif </span><span class="c1">// GAME_AUTOROTATION == kGameAutorotationUIViewController	</span>
<span class="p">}</span>

<span class="p">-</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span> <span class="nf">applicationDidFinishLaunching:</span><span class="p">(</span><span class="bp">UIApplication</span><span class="o">*</span><span class="p">)</span><span class="nv">application</span>
<span class="p">{</span>
	<span class="p">[[</span><span class="bp">UIApplication</span> <span class="n">sharedApplication</span><span class="p">]</span> <span class="nl">setIdleTimerDisabled</span><span class="p">:</span><span class="nb">YES</span><span class="p">];</span>
	
	<span class="bp">NSMutableDictionary</span><span class="o">*</span> <span class="n">registerDefaults</span> <span class="o">=</span> <span class="p">[</span><span class="bp">NSMutableDictionary</span> <span class="nl">dictionaryWithObjectsAndKeys</span><span class="p">:</span>
                                             <span class="s">@&quot;&quot;</span><span class="p">,</span> <span class="s">@&quot;username&quot;</span><span class="p">,</span>
                                             <span class="p">[</span><span class="bp">NSNumber</span> <span class="nl">numberWithBool</span><span class="p">:</span><span class="nb">YES</span><span class="p">],</span> <span class="s">@&quot;submitScore&quot;</span><span class="p">,</span>
                                             <span class="nb">nil</span><span class="p">];</span>
	<span class="p">[[</span><span class="bp">NSUserDefaults</span> <span class="n">standardUserDefaults</span><span class="p">]</span> <span class="nl">registerDefaults</span><span class="p">:</span><span class="n">registerDefaults</span><span class="p">];</span>
	
	<span class="c1">// Init the window</span>
	<span class="n">window</span> <span class="o">=</span> <span class="p">[[</span><span class="bp">UIWindow</span> <span class="n">alloc</span><span class="p">]</span> <span class="nl">initWithFrame</span><span class="p">:[[</span><span class="bp">UIScreen</span> <span class="n">mainScreen</span><span class="p">]</span> <span class="n">bounds</span><span class="p">]];</span>
	
	<span class="c1">// Try to use CADisplayLink director</span>
	<span class="c1">// if it fails (SDK &lt; 3.1) use the default director</span>
	<span class="k">if</span><span class="p">(</span> <span class="o">!</span> <span class="p">[</span><span class="n">CCDirector</span> <span class="nl">setDirectorType</span><span class="p">:</span><span class="n">kCCDirectorTypeDisplayLink</span><span class="p">]</span> <span class="p">)</span>
		<span class="p">[</span><span class="n">CCDirector</span> <span class="nl">setDirectorType</span><span class="p">:</span><span class="n">kCCDirectorTypeDefault</span><span class="p">];</span>
	
	
	<span class="n">CCDirector</span> <span class="o">*</span><span class="n">director</span> <span class="o">=</span> <span class="p">[</span><span class="n">CCDirector</span> <span class="n">sharedDirector</span><span class="p">];</span>
	
	<span class="c1">// Init the View Controller</span>
	<span class="n">viewController</span> <span class="o">=</span> <span class="p">[[</span><span class="n">RootViewController</span> <span class="n">alloc</span><span class="p">]</span> <span class="nl">initWithNibName</span><span class="p">:</span><span class="nb">nil</span> <span class="nl">bundle</span><span class="p">:</span><span class="nb">nil</span><span class="p">];</span>
	<span class="n">viewController</span><span class="p">.</span><span class="n">wantsFullScreenLayout</span> <span class="o">=</span> <span class="nb">YES</span><span class="p">;</span>
	
	<span class="c1">//</span>
	<span class="c1">// Create the EAGLView manually</span>
	<span class="c1">//  1. Create a RGB565 format. Alternative: RGBA8</span>
	<span class="c1">//	2. depth format of 0 bit. Use 16 or 24 bit for 3d effects, like CCPageTurnTransition</span>
	<span class="c1">//</span>
	<span class="c1">//</span>
	<span class="n">EAGLView</span> <span class="o">*</span><span class="n">glView</span> <span class="o">=</span> <span class="p">[</span><span class="n">EAGLView</span> <span class="nl">viewWithFrame</span><span class="p">:[</span><span class="n">window</span> <span class="n">bounds</span><span class="p">]</span>
								   <span class="nl">pixelFormat</span><span class="p">:</span><span class="n">kEAGLColorFormatRGB565</span>	<span class="c1">// kEAGLColorFormatRGBA8</span>
								   <span class="nl">depthFormat</span><span class="p">:</span><span class="mi">0</span>						<span class="c1">// GL_DEPTH_COMPONENT16_OES</span>
						<span class="p">];</span>
	
	<span class="c1">// attach the openglView to the director</span>
	<span class="p">[</span><span class="n">director</span> <span class="nl">setOpenGLView</span><span class="p">:</span><span class="n">glView</span><span class="p">];</span>
	
<span class="c1">//	// Enables High Res mode (Retina Display) on iPhone 4 and maintains low res on all other devices</span>
	<span class="c1">//if( ! [director enableRetinaDisplay:YES] )</span>
	<span class="c1">//	CCLOG(@&quot;Retina Display Not supported&quot;);</span>
	
	<span class="c1">//</span>
	<span class="c1">// VERY IMPORTANT:</span>
	<span class="c1">// If the rotation is going to be controlled by a UIViewController</span>
	<span class="c1">// then the device orientation should be &quot;Portrait&quot;.</span>
	<span class="c1">//</span>
	<span class="c1">// IMPORTANT:</span>
	<span class="c1">// By default, this template only supports Landscape orientations.</span>
	<span class="c1">// Edit the RootViewController.m file to edit the supported orientations.</span>
	<span class="c1">//</span>
<span class="cp">#if GAME_AUTOROTATION == kGameAutorotationUIViewController</span>
	<span class="p">[</span><span class="n">director</span> <span class="nl">setDeviceOrientation</span><span class="p">:</span><span class="n">kCCDeviceOrientationPortrait</span><span class="p">];</span>
<span class="cp">#else</span>
	<span class="p">[</span><span class="n">director</span> <span class="nl">setDeviceOrientation</span><span class="p">:</span><span class="n">kCCDeviceOrientationPortrait</span><span class="p">];</span>
<span class="cp">#endif</span>
	
	<span class="p">[</span><span class="n">director</span> <span class="nl">setAnimationInterval</span><span class="p">:</span><span class="mf">1.0</span><span class="o">/</span><span class="mi">60</span><span class="p">];</span>
	<span class="c1">//[director setDisplayFPS:YES];</span>
	
	
	<span class="c1">// make the OpenGLView a child of the view controller</span>
	<span class="p">[</span><span class="n">viewController</span> <span class="nl">setView</span><span class="p">:</span><span class="n">glView</span><span class="p">];</span>
	
	<span class="c1">// make the View Controller a child of the main window</span>
	<span class="p">[</span><span class="n">window</span> <span class="nl">addSubview</span><span class="p">:</span> <span class="n">viewController</span><span class="p">.</span><span class="n">view</span><span class="p">];</span>
	
	<span class="p">[</span><span class="n">window</span> <span class="n">makeKeyAndVisible</span><span class="p">];</span>
	
	<span class="c1">// Default texture format for PNG/BMP/TIFF/JPEG/GIF images</span>
	<span class="c1">// It can be RGBA8888, RGBA4444, RGB5_A1, RGB565</span>
	<span class="c1">// You can change anytime.</span>
	<span class="p">[</span><span class="n">CCTexture2D</span> <span class="nl">setDefaultAlphaPixelFormat</span><span class="p">:</span><span class="n">kCCTexture2DPixelFormat_RGBA8888</span><span class="p">];</span>

	
	<span class="c1">// Removes the startup flicker</span>
	<span class="p">[</span><span class="nb">self</span> <span class="n">removeStartupFlicker</span><span class="p">];</span>
	
	<span class="c1">// Run the intro Scene</span>
	<span class="p">[[</span><span class="n">CCDirector</span> <span class="n">sharedDirector</span><span class="p">]</span> <span class="nl">runWithScene</span><span class="p">:</span> <span class="p">[</span><span class="n">MainMenuLayer</span> <span class="n">scene</span><span class="p">]];</span>
<span class="p">}</span>


<span class="p">-</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="nf">applicationWillResignActive:</span><span class="p">(</span><span class="bp">UIApplication</span> <span class="o">*</span><span class="p">)</span><span class="nv">application</span> <span class="p">{</span>
	<span class="p">[[</span><span class="n">CCDirector</span> <span class="n">sharedDirector</span><span class="p">]</span> <span class="n">pause</span><span class="p">];</span>
<span class="p">}</span>

<span class="p">-</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="nf">applicationDidBecomeActive:</span><span class="p">(</span><span class="bp">UIApplication</span> <span class="o">*</span><span class="p">)</span><span class="nv">application</span> <span class="p">{</span>
	<span class="p">[[</span><span class="n">CCDirector</span> <span class="n">sharedDirector</span><span class="p">]</span> <span class="n">resume</span><span class="p">];</span>
<span class="p">}</span>

<span class="p">-</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="nf">applicationDidReceiveMemoryWarning:</span><span class="p">(</span><span class="bp">UIApplication</span> <span class="o">*</span><span class="p">)</span><span class="nv">application</span> <span class="p">{</span>
	<span class="p">[[</span><span class="n">CCDirector</span> <span class="n">sharedDirector</span><span class="p">]</span> <span class="n">purgeCachedData</span><span class="p">];</span>
<span class="p">}</span>

<span class="p">-(</span><span class="kt">void</span><span class="p">)</span> <span class="nf">applicationDidEnterBackground:</span><span class="p">(</span><span class="bp">UIApplication</span><span class="o">*</span><span class="p">)</span><span class="nv">application</span> <span class="p">{</span>
	<span class="p">[[</span><span class="n">CCDirector</span> <span class="n">sharedDirector</span><span class="p">]</span> <span class="n">stopAnimation</span><span class="p">];</span>
	
	<span class="k">if</span> <span class="p">([[</span><span class="n">CCDirector</span> <span class="n">sharedDirector</span><span class="p">]</span> <span class="n">runningScene</span><span class="p">].</span><span class="n">tag</span> <span class="o">==</span> <span class="mi">436</span><span class="p">)</span>
	<span class="p">{</span>
		<span class="p">[[</span><span class="n">CCDirector</span> <span class="n">sharedDirector</span><span class="p">]</span> <span class="nl">replaceScene</span><span class="p">:[</span><span class="n">PauseLayer</span> <span class="nl">sceneWithScene</span><span class="p">:[[</span><span class="n">CCDirector</span> <span class="n">sharedDirector</span><span class="p">]</span> <span class="n">runningScene</span><span class="p">]]];</span>
	<span class="p">}</span>
<span class="p">}</span>

<span class="p">-(</span><span class="kt">void</span><span class="p">)</span> <span class="nf">applicationWillEnterForeground:</span><span class="p">(</span><span class="bp">UIApplication</span><span class="o">*</span><span class="p">)</span><span class="nv">application</span> <span class="p">{</span>
	<span class="p">[[</span><span class="n">CCDirector</span> <span class="n">sharedDirector</span><span class="p">]</span> <span class="n">startAnimation</span><span class="p">];</span>
<span class="p">}</span>

<span class="p">-</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="nf">applicationWillTerminate:</span><span class="p">(</span><span class="bp">UIApplication</span> <span class="o">*</span><span class="p">)</span><span class="nv">application</span> <span class="p">{</span>
	<span class="n">CCDirector</span> <span class="o">*</span><span class="n">director</span> <span class="o">=</span> <span class="p">[</span><span class="n">CCDirector</span> <span class="n">sharedDirector</span><span class="p">];</span>
	
	<span class="n">sqlite3_close</span><span class="p">([</span><span class="n">Cart_CollectAppDelegate</span> <span class="n">database</span><span class="p">]);</span>
	
	<span class="p">[[</span><span class="n">director</span> <span class="n">openGLView</span><span class="p">]</span> <span class="n">removeFromSuperview</span><span class="p">];</span>
	
	<span class="p">[</span><span class="n">viewController</span> <span class="k">release</span><span class="p">];</span>
	
	<span class="p">[</span><span class="n">window</span> <span class="k">release</span><span class="p">];</span>
	
	<span class="p">[</span><span class="n">director</span> <span class="n">end</span><span class="p">];</span>	
<span class="p">}</span>

<span class="p">-</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="nf">applicationSignificantTimeChange:</span><span class="p">(</span><span class="bp">UIApplication</span> <span class="o">*</span><span class="p">)</span><span class="nv">application</span> <span class="p">{</span>
	<span class="p">[[</span><span class="n">CCDirector</span> <span class="n">sharedDirector</span><span class="p">]</span> <span class="nl">setNextDeltaTimeZero</span><span class="p">:</span><span class="nb">YES</span><span class="p">];</span>
<span class="p">}</span>

<span class="p">-</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="nf">dealloc</span> <span class="p">{</span>
	<span class="c1">//[[CCDirector sharedDirector] release];</span>
	<span class="p">[</span><span class="n">window</span> <span class="k">release</span><span class="p">];</span>
	<span class="p">[</span><span class="nb">super</span> <span class="n">dealloc</span><span class="p">];</span>
<span class="p">}</span>

<span class="p">+</span> <span class="p">(</span><span class="n">sqlite3</span><span class="o">*</span><span class="p">)</span><span class="nf">database</span>
<span class="p">{</span>
	<span class="k">static</span> <span class="n">sqlite3</span><span class="o">*</span> <span class="n">database</span> <span class="o">=</span> <span class="nb">nil</span><span class="p">;</span>
	
	<span class="k">if</span> <span class="p">(</span><span class="n">database</span> <span class="o">==</span> <span class="nb">nil</span><span class="p">)</span>
	<span class="p">{</span>
		<span class="bp">NSString</span><span class="o">*</span> <span class="n">databaseName</span> <span class="o">=</span> <span class="s">@&quot;cartdata.sqlite3&quot;</span><span class="p">;</span>
		<span class="bp">NSArray</span><span class="o">*</span> <span class="n">documentPaths</span> <span class="o">=</span> <span class="n">NSSearchPathForDirectoriesInDomains</span><span class="p">(</span><span class="n">NSDocumentDirectory</span><span class="p">,</span> <span class="n">NSUserDomainMask</span><span class="p">,</span> <span class="nb">YES</span><span class="p">);</span>
		<span class="bp">NSString</span><span class="o">*</span> <span class="n">documentsDir</span> <span class="o">=</span> <span class="p">[</span><span class="n">documentPaths</span> <span class="nl">objectAtIndex</span><span class="p">:</span><span class="mi">0</span><span class="p">];</span>
		<span class="bp">NSString</span><span class="o">*</span> <span class="n">databasePath</span> <span class="o">=</span> <span class="p">[</span><span class="n">documentsDir</span> <span class="nl">stringByAppendingPathComponent</span><span class="p">:</span><span class="n">databaseName</span><span class="p">];</span>
		<span class="bp">NSFileManager</span><span class="o">*</span> <span class="n">fileManager</span> <span class="o">=</span> <span class="p">[</span><span class="bp">NSFileManager</span> <span class="n">defaultManager</span><span class="p">];</span>
        <span class="bp">NSUserDefaults</span><span class="o">*</span> <span class="n">userDefaults</span> <span class="o">=</span> <span class="p">[</span><span class="bp">NSUserDefaults</span> <span class="n">standardUserDefaults</span><span class="p">];</span>
		
		<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="p">[</span><span class="n">fileManager</span> <span class="nl">fileExistsAtPath</span><span class="p">:</span><span class="n">databasePath</span><span class="p">])</span>
		<span class="p">{</span>
			<span class="bp">NSString</span><span class="o">*</span> <span class="n">databasePathFromApp</span> <span class="o">=</span> <span class="p">[[[</span><span class="bp">NSBundle</span> <span class="n">mainBundle</span><span class="p">]</span> <span class="n">resourcePath</span><span class="p">]</span> <span class="nl">stringByAppendingPathComponent</span><span class="p">:</span><span class="n">databaseName</span><span class="p">];</span>
			<span class="p">[</span><span class="n">fileManager</span> <span class="nl">copyItemAtPath</span><span class="p">:</span><span class="n">databasePathFromApp</span> <span class="nl">toPath</span><span class="p">:</span><span class="n">databasePath</span> <span class="nl">error</span><span class="p">:</span><span class="nb">nil</span><span class="p">];</span>
			<span class="c1">//[fileManager release];</span>
			
			<span class="p">[</span><span class="n">userDefaults</span> <span class="nl">setInteger</span><span class="p">:</span><span class="mi">1</span> <span class="nl">forKey</span><span class="p">:</span><span class="s">@&quot;databaseVersion&quot;</span><span class="p">];</span>
		<span class="p">}</span>
		
		<span class="k">if</span> <span class="p">([</span><span class="n">userDefaults</span> <span class="nl">integerForKey</span><span class="p">:</span><span class="s">@&quot;databaseVersion&quot;</span><span class="p">]</span> <span class="o">&lt;</span> <span class="mi">1</span><span class="p">)</span>
		<span class="p">{</span>
			<span class="c1">// Upgrade the database to version 1, which is completely unnecessary as no prior version exists</span>
		<span class="p">}</span>
		
		<span class="k">if</span> <span class="p">(</span><span class="n">sqlite3_open</span><span class="p">([</span><span class="n">databasePath</span> <span class="n">UTF8String</span><span class="p">],</span> <span class="o">&amp;</span><span class="n">database</span><span class="p">)</span> <span class="o">!=</span> <span class="n">SQLITE_OK</span><span class="p">)</span>
		<span class="p">{</span>
			<span class="n">NSLog</span><span class="p">(</span><span class="s">@&quot;Failed to open database&quot;</span><span class="p">);</span>
		<span class="p">}</span>
	<span class="p">}</span>
	
	<span class="k">return</span> <span class="n">database</span><span class="p">;</span>
<span class="p">}</span>

<span class="k">@end</span>
</pre></div>
</code></pre></td></tr></table>
</div> <!-- class=content -->
<div class='footer'>generated by <a href='https://git.causal.agency/cgit-pink/about/'>cgit-pink 1.4.1</a> (<a href='https://git-scm.com/'>git 2.36.1</a>) at 2024-09-21 08:26:27 +0000</div>
</div> <!-- id=cgit -->
</body>
</html>
