injection of custom code in SDL for iPhone in order to implement our frontend
authorkoda
Thu, 07 Jan 2010 05:23:23 +0000
changeset 2678 334016e8d895
parent 2677 83ad68ceef72
child 2679 b61d25fa6c53
injection of custom code in SDL for iPhone in order to implement our frontend initial support for (real) multitouch events
cocoaTouch/MainWindow.xib
cocoaTouch/SDL_uikitappdelegate.h
cocoaTouch/SDL_uikitappdelegate.m
cocoaTouch/SDL_uikitview.h
cocoaTouch/SDL_uikitview.m
cocoaTouch/otherSrc/CGPointUtils.c
cocoaTouch/otherSrc/CGPointUtils.h
cocoaTouch/otherSrc/PascalImports.h
cocoaTouch/resources/Default.png
cocoaTouch/resources/Icon.png
hedgewars/hwengine.pas
hedgewars/uKeys.pas
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cocoaTouch/MainWindow.xib	Thu Jan 07 05:23:23 2010 +0000
@@ -0,0 +1,686 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
+	<data>
+		<int key="IBDocument.SystemTarget">784</int>
+		<string key="IBDocument.SystemVersion">10C540</string>
+		<string key="IBDocument.InterfaceBuilderVersion">740</string>
+		<string key="IBDocument.AppKitVersion">1038.25</string>
+		<string key="IBDocument.HIToolboxVersion">458.00</string>
+		<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
+			<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+			<string key="NS.object.0">62</string>
+		</object>
+		<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
+			<bool key="EncodedWithXMLCoder">YES</bool>
+			<integer value="10"/>
+		</object>
+		<object class="NSArray" key="IBDocument.PluginDependencies">
+			<bool key="EncodedWithXMLCoder">YES</bool>
+			<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+		</object>
+		<object class="NSMutableDictionary" key="IBDocument.Metadata">
+			<bool key="EncodedWithXMLCoder">YES</bool>
+			<object class="NSArray" key="dict.sortedKeys" id="0">
+				<bool key="EncodedWithXMLCoder">YES</bool>
+			</object>
+			<object class="NSMutableArray" key="dict.values">
+				<bool key="EncodedWithXMLCoder">YES</bool>
+			</object>
+		</object>
+		<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
+			<bool key="EncodedWithXMLCoder">YES</bool>
+			<object class="IBProxyObject" id="841351856">
+				<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
+			</object>
+			<object class="IBProxyObject" id="427554174">
+				<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
+			</object>
+			<object class="IBUICustomObject" id="664661524"/>
+			<object class="IBUIWindow" id="380026005">
+				<nil key="NSNextResponder"/>
+				<int key="NSvFlags">1316</int>
+				<object class="NSPSMatrix" key="NSFrameMatrix"/>
+				<string key="NSFrameSize">{320, 480}</string>
+				<object class="NSColor" key="IBUIBackgroundColor">
+					<int key="NSColorSpace">1</int>
+					<bytes key="NSRGB">MSAxIDEAA</bytes>
+				</object>
+				<bool key="IBUIOpaque">NO</bool>
+				<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
+				<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics">
+					<int key="IBUIStatusBarStyle">2</int>
+				</object>
+			</object>
+			<object class="IBUITabBarController" id="949193037">
+				<object class="IBUISimulatedTabBarMetrics" key="IBUISimulatedBottomBarMetrics"/>
+				<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics">
+					<int key="IBUIStatusBarStyle">2</int>
+				</object>
+				<bool key="IBUIWantsFullScreenLayout">YES</bool>
+				<object class="IBUIViewController" key="IBUISelectedViewController" id="967197078">
+					<string key="IBUITitle">Item 5</string>
+					<object class="IBUITabBarItem" key="IBUITabBarItem" id="1027647142">
+						<int key="IBUITag">4</int>
+						<string key="IBUITitle">Custom</string>
+						<object class="NSCustomResource" key="IBUIImage">
+							<string key="NSClassName">NSImage</string>
+							<string key="NSResourceName">toolicon.png</string>
+						</object>
+						<reference key="IBUITabBar"/>
+					</object>
+					<reference key="IBUIToolbarItems" ref="0"/>
+					<reference key="IBUIParentViewController" ref="949193037"/>
+					<string key="IBUINibName">CustomPickerViewController</string>
+				</object>
+				<object class="NSMutableArray" key="IBUIViewControllers">
+					<bool key="EncodedWithXMLCoder">YES</bool>
+					<object class="IBUIViewController" id="316666609">
+						<string key="IBUITitle">Item 1</string>
+						<object class="IBUITabBarItem" key="IBUITabBarItem" id="649951061">
+							<string key="IBUITitle">Date</string>
+							<object class="NSCustomResource" key="IBUIImage">
+								<string key="NSClassName">NSImage</string>
+								<string key="NSResourceName">clockicon.png</string>
+							</object>
+							<reference key="IBUITabBar"/>
+						</object>
+						<reference key="IBUIParentViewController" ref="949193037"/>
+						<string key="IBUINibName">DatePickerViewController</string>
+					</object>
+					<object class="IBUIViewController" id="56776854">
+						<string key="IBUITitle">Item 2</string>
+						<object class="IBUITabBarItem" key="IBUITabBarItem" id="121845716">
+							<int key="IBUITag">1</int>
+							<string key="IBUITitle">Single</string>
+							<object class="NSCustomResource" key="IBUIImage">
+								<string key="NSClassName">NSImage</string>
+								<string key="NSResourceName">singleicon.png</string>
+							</object>
+							<reference key="IBUITabBar"/>
+						</object>
+						<reference key="IBUIParentViewController" ref="949193037"/>
+						<string key="IBUINibName">SingleComponentPickerViewController</string>
+					</object>
+					<object class="IBUIViewController" id="18996086">
+						<string key="IBUITitle">Item 3</string>
+						<object class="IBUITabBarItem" key="IBUITabBarItem" id="588275822">
+							<int key="IBUITag">2</int>
+							<string key="IBUITitle">Double</string>
+							<object class="NSCustomResource" key="IBUIImage">
+								<string key="NSClassName">NSImage</string>
+								<string key="NSResourceName">doubleicon.png</string>
+							</object>
+							<reference key="IBUITabBar"/>
+						</object>
+						<reference key="IBUIToolbarItems" ref="0"/>
+						<reference key="IBUIParentViewController" ref="949193037"/>
+						<string key="IBUINibName">DoubleComponentPickerViewController</string>
+					</object>
+					<object class="IBUIViewController" id="78432802">
+						<string key="IBUITitle">Item 4</string>
+						<object class="IBUITabBarItem" key="IBUITabBarItem" id="457331497">
+							<int key="IBUITag">3</int>
+							<string key="IBUITitle">Dependent</string>
+							<object class="NSCustomResource" key="IBUIImage">
+								<string key="NSClassName">NSImage</string>
+								<string key="NSResourceName">dependenticon.png</string>
+							</object>
+							<reference key="IBUITabBar"/>
+						</object>
+						<reference key="IBUIToolbarItems" ref="0"/>
+						<reference key="IBUIParentViewController" ref="949193037"/>
+						<string key="IBUINibName">DependentComponentPickerViewController</string>
+					</object>
+					<reference ref="967197078"/>
+				</object>
+				<object class="IBUITabBar" key="IBUITabBar" id="906583108">
+					<nil key="NSNextResponder"/>
+					<int key="NSvFlags">266</int>
+					<string key="NSFrame">{{129, 330}, {163, 49}}</string>
+					<object class="NSColor" key="IBUIBackgroundColor">
+						<int key="NSColorSpace">3</int>
+						<bytes key="NSWhite">MCAwAA</bytes>
+					</object>
+					<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
+				</object>
+			</object>
+		</object>
+		<object class="IBObjectContainer" key="IBDocument.Objects">
+			<object class="NSMutableArray" key="connectionRecords">
+				<bool key="EncodedWithXMLCoder">YES</bool>
+				<object class="IBConnectionRecord">
+					<object class="IBCocoaTouchOutletConnection" key="connection">
+						<string key="label">delegate</string>
+						<reference key="source" ref="841351856"/>
+						<reference key="destination" ref="664661524"/>
+					</object>
+					<int key="connectionID">4</int>
+				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBCocoaTouchOutletConnection" key="connection">
+						<string key="label">controller</string>
+						<reference key="source" ref="664661524"/>
+						<reference key="destination" ref="949193037"/>
+					</object>
+					<int key="connectionID">23</int>
+				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBCocoaTouchOutletConnection" key="connection">
+						<string key="label">window</string>
+						<reference key="source" ref="664661524"/>
+						<reference key="destination" ref="380026005"/>
+					</object>
+					<int key="connectionID">24</int>
+				</object>
+			</object>
+			<object class="IBMutableOrderedSet" key="objectRecords">
+				<object class="NSArray" key="orderedObjects">
+					<bool key="EncodedWithXMLCoder">YES</bool>
+					<object class="IBObjectRecord">
+						<int key="objectID">0</int>
+						<reference key="object" ref="0"/>
+						<reference key="children" ref="1000"/>
+						<nil key="parent"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">2</int>
+						<reference key="object" ref="380026005"/>
+						<object class="NSMutableArray" key="children">
+							<bool key="EncodedWithXMLCoder">YES</bool>
+						</object>
+						<reference key="parent" ref="0"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">-1</int>
+						<reference key="object" ref="841351856"/>
+						<reference key="parent" ref="0"/>
+						<string key="objectName">File's Owner</string>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">3</int>
+						<reference key="object" ref="664661524"/>
+						<reference key="parent" ref="0"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">-2</int>
+						<reference key="object" ref="427554174"/>
+						<reference key="parent" ref="0"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">10</int>
+						<reference key="object" ref="949193037"/>
+						<object class="NSMutableArray" key="children">
+							<bool key="EncodedWithXMLCoder">YES</bool>
+							<reference ref="906583108"/>
+							<reference ref="316666609"/>
+							<reference ref="56776854"/>
+							<reference ref="18996086"/>
+							<reference ref="78432802"/>
+							<reference ref="967197078"/>
+						</object>
+						<reference key="parent" ref="0"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">11</int>
+						<reference key="object" ref="906583108"/>
+						<reference key="parent" ref="949193037"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">12</int>
+						<reference key="object" ref="316666609"/>
+						<object class="NSMutableArray" key="children">
+							<bool key="EncodedWithXMLCoder">YES</bool>
+							<reference ref="649951061"/>
+						</object>
+						<reference key="parent" ref="949193037"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">13</int>
+						<reference key="object" ref="56776854"/>
+						<object class="NSMutableArray" key="children">
+							<bool key="EncodedWithXMLCoder">YES</bool>
+							<reference ref="121845716"/>
+						</object>
+						<reference key="parent" ref="949193037"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">14</int>
+						<reference key="object" ref="121845716"/>
+						<reference key="parent" ref="56776854"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">15</int>
+						<reference key="object" ref="649951061"/>
+						<reference key="parent" ref="316666609"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">16</int>
+						<reference key="object" ref="18996086"/>
+						<object class="NSMutableArray" key="children">
+							<bool key="EncodedWithXMLCoder">YES</bool>
+							<reference ref="588275822"/>
+						</object>
+						<reference key="parent" ref="949193037"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">17</int>
+						<reference key="object" ref="588275822"/>
+						<reference key="parent" ref="18996086"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">18</int>
+						<reference key="object" ref="78432802"/>
+						<object class="NSMutableArray" key="children">
+							<bool key="EncodedWithXMLCoder">YES</bool>
+							<reference ref="457331497"/>
+						</object>
+						<reference key="parent" ref="949193037"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">19</int>
+						<reference key="object" ref="457331497"/>
+						<reference key="parent" ref="78432802"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">20</int>
+						<reference key="object" ref="967197078"/>
+						<object class="NSMutableArray" key="children">
+							<bool key="EncodedWithXMLCoder">YES</bool>
+							<reference ref="1027647142"/>
+						</object>
+						<reference key="parent" ref="949193037"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">21</int>
+						<reference key="object" ref="1027647142"/>
+						<reference key="parent" ref="967197078"/>
+					</object>
+				</object>
+			</object>
+			<object class="NSMutableDictionary" key="flattenedProperties">
+				<bool key="EncodedWithXMLCoder">YES</bool>
+				<object class="NSArray" key="dict.sortedKeys">
+					<bool key="EncodedWithXMLCoder">YES</bool>
+					<string>-1.CustomClassName</string>
+					<string>-2.CustomClassName</string>
+					<string>10.IBEditorWindowLastContentRect</string>
+					<string>10.IBPluginDependency</string>
+					<string>11.IBPluginDependency</string>
+					<string>12.CustomClassName</string>
+					<string>12.IBPluginDependency</string>
+					<string>13.CustomClassName</string>
+					<string>13.IBPluginDependency</string>
+					<string>14.IBPluginDependency</string>
+					<string>15.IBPluginDependency</string>
+					<string>16.CustomClassName</string>
+					<string>18.CustomClassName</string>
+					<string>2.IBAttributePlaceholdersKey</string>
+					<string>2.IBEditorWindowLastContentRect</string>
+					<string>2.IBPluginDependency</string>
+					<string>20.CustomClassName</string>
+					<string>3.CustomClassName</string>
+					<string>3.IBPluginDependency</string>
+				</object>
+				<object class="NSMutableArray" key="dict.values">
+					<bool key="EncodedWithXMLCoder">YES</bool>
+					<string>UIApplication</string>
+					<string>UIResponder</string>
+					<string>{{0, 654}, {320, 480}}</string>
+					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+					<string>DatePickerViewController</string>
+					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+					<string>SingleComponentPickerViewController</string>
+					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+					<string>DoubleComponentPickerViewController</string>
+					<string>DependentComponentPickerViewController</string>
+					<object class="NSMutableDictionary">
+						<bool key="EncodedWithXMLCoder">YES</bool>
+						<reference key="dict.sortedKeys" ref="0"/>
+						<object class="NSMutableArray" key="dict.values">
+							<bool key="EncodedWithXMLCoder">YES</bool>
+						</object>
+					</object>
+					<string>{{820, 472}, {320, 480}}</string>
+					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+					<string>CustomPickerViewController</string>
+					<string>SDLUIKitDelegate</string>
+					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+				</object>
+			</object>
+			<object class="NSMutableDictionary" key="unlocalizedProperties">
+				<bool key="EncodedWithXMLCoder">YES</bool>
+				<reference key="dict.sortedKeys" ref="0"/>
+				<object class="NSMutableArray" key="dict.values">
+					<bool key="EncodedWithXMLCoder">YES</bool>
+				</object>
+			</object>
+			<nil key="activeLocalization"/>
+			<object class="NSMutableDictionary" key="localizations">
+				<bool key="EncodedWithXMLCoder">YES</bool>
+				<reference key="dict.sortedKeys" ref="0"/>
+				<object class="NSMutableArray" key="dict.values">
+					<bool key="EncodedWithXMLCoder">YES</bool>
+				</object>
+			</object>
+			<nil key="sourceID"/>
+			<int key="maxID">24</int>
+		</object>
+		<object class="IBClassDescriber" key="IBDocument.Classes">
+			<object class="NSMutableArray" key="referencedPartialClassDescriptions">
+				<bool key="EncodedWithXMLCoder">YES</bool>
+				<object class="IBPartialClassDescription">
+					<string key="className">DatePickerViewController</string>
+					<string key="superclassName">UIViewController</string>
+					<object class="NSMutableDictionary" key="actions">
+						<string key="NS.key.0">buttonPressed</string>
+						<string key="NS.object.0">id</string>
+					</object>
+					<object class="NSMutableDictionary" key="outlets">
+						<string key="NS.key.0">date_picker</string>
+						<string key="NS.object.0">UIDatePicker</string>
+					</object>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBProjectSource</string>
+						<string key="minorKey">../begchap7/Classes/DatePickerViewController.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">SDLUIKitDelegate</string>
+					<string key="superclassName">NSObject</string>
+					<object class="NSMutableDictionary" key="actions">
+						<string key="NS.key.0">startSDLgame</string>
+						<string key="NS.object.0">id</string>
+					</object>
+					<object class="NSMutableDictionary" key="outlets">
+						<bool key="EncodedWithXMLCoder">YES</bool>
+						<object class="NSArray" key="dict.sortedKeys">
+							<bool key="EncodedWithXMLCoder">YES</bool>
+							<string>controller</string>
+							<string>window</string>
+						</object>
+						<object class="NSMutableArray" key="dict.values">
+							<bool key="EncodedWithXMLCoder">YES</bool>
+							<string>UITabBarController</string>
+							<string>UIWindow</string>
+						</object>
+					</object>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBProjectSource</string>
+						<string key="minorKey">Classes/SDL_uikitappdelegate.h</string>
+					</object>
+				</object>
+			</object>
+			<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
+				<bool key="EncodedWithXMLCoder">YES</bool>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">Foundation.framework/Headers/NSError.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">Foundation.framework/Headers/NSNetServices.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">Foundation.framework/Headers/NSObject.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">Foundation.framework/Headers/NSPort.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">Foundation.framework/Headers/NSStream.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">Foundation.framework/Headers/NSThread.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">Foundation.framework/Headers/NSURL.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">Foundation.framework/Headers/NSXMLParser.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">QuartzCore.framework/Headers/CAAnimation.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">QuartzCore.framework/Headers/CALayer.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UIAccessibility.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UINibLoading.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier" id="186590129">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UIResponder.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">UIApplication</string>
+					<string key="superclassName">UIResponder</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UIApplication.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">UIBarItem</string>
+					<string key="superclassName">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UIBarItem.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">UIControl</string>
+					<string key="superclassName">UIView</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UIControl.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">UIDatePicker</string>
+					<string key="superclassName">UIControl</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UIDatePicker.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">UIResponder</string>
+					<string key="superclassName">NSObject</string>
+					<reference key="sourceIdentifier" ref="186590129"/>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">UISearchBar</string>
+					<string key="superclassName">UIView</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UISearchBar.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">UISearchDisplayController</string>
+					<string key="superclassName">NSObject</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UISearchDisplayController.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">UITabBar</string>
+					<string key="superclassName">UIView</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UITabBar.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">UITabBarController</string>
+					<string key="superclassName">UIViewController</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier" id="779948122">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UITabBarController.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">UITabBarItem</string>
+					<string key="superclassName">UIBarItem</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UITabBarItem.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">UIView</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UITextField.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">UIView</string>
+					<string key="superclassName">UIResponder</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UIView.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">UIViewController</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UINavigationController.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">UIViewController</string>
+					<reference key="sourceIdentifier" ref="779948122"/>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">UIViewController</string>
+					<string key="superclassName">UIResponder</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UIViewController.h</string>
+					</object>
+				</object>
+				<object class="IBPartialClassDescription">
+					<string key="className">UIWindow</string>
+					<string key="superclassName">UIView</string>
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
+						<string key="majorKey">IBFrameworkSource</string>
+						<string key="minorKey">UIKit.framework/Headers/UIWindow.h</string>
+					</object>
+				</object>
+			</object>
+		</object>
+		<int key="IBDocument.localizationMode">0</int>
+		<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
+			<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
+			<integer value="784" key="NS.object.0"/>
+		</object>
+		<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
+			<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
+			<integer value="3100" key="NS.object.0"/>
+		</object>
+		<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
+		<string key="IBDocument.LastKnownRelativeProjectPath">../hwengine.xcodeproj</string>
+		<int key="IBDocument.defaultPropertyAccessControl">3</int>
+		<string key="IBCocoaTouchPluginVersion">3.1</string>
+	</data>
+</archive>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cocoaTouch/SDL_uikitappdelegate.h	Thu Jan 07 05:23:23 2010 +0000
@@ -0,0 +1,40 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2009 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga, mods for Hedgewars by Vittorio Giovara
+    slouken@libsdl.org, vittorio.giovara@gmail.com
+*/
+
+#import <UIKit/UIKit.h>
+#import "SDL_video.h"
+
+@interface SDLUIKitDelegate:NSObject<UIApplicationDelegate> {
+    UIWindow *window;
+	SDL_WindowID windowID;
+	UITabBarController *controller;
+}
+
+// the outlets are set in MainWindow.xib
+@property (readwrite, retain) IBOutlet UIWindow *window;
+@property (readwrite, assign) SDL_WindowID windowID;
+@property (nonatomic, retain) IBOutlet UITabBarController *controller;
+
++(SDLUIKitDelegate *)sharedAppDelegate;
+-(void) startSDLgame;
+
+@end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cocoaTouch/SDL_uikitappdelegate.m	Thu Jan 07 05:23:23 2010 +0000
@@ -0,0 +1,136 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2009 Sam Lantinga
+ 
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+ 
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ Lesser General Public License for more details.
+ 
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ 
+ Sam Lantinga, mods for Hedgewars by Vittorio Giovara
+ slouken@libsdl.org, vittorio.giovara@gmail.com
+*/
+
+#import "SDL_uikitappdelegate.h"
+#import "SDL_uikitopenglview.h"
+#import "SDL_events_c.h"
+#import "jumphack.h"
+#import "SDL_video.h"
+
+#ifdef main
+#undef main
+#endif
+
+extern int SDL_main(int argc, char *argv[]);
+static int forward_argc;
+static char **forward_argv;
+
+int main(int argc, char **argv) {
+	int i;
+	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+	
+	/* store arguments */
+	forward_argc = argc;
+	forward_argv = (char **)malloc(argc * sizeof(char *));
+	for (i=0; i<argc; i++) {
+		forward_argv[i] = malloc( (strlen(argv[i])+1) * sizeof(char));
+		strcpy(forward_argv[i], argv[i]);
+	}
+
+	/* Give over control to run loop, SDLUIKitDelegate will handle most things from here */
+	UIApplicationMain(argc, argv, NULL, @"SDLUIKitDelegate");
+	
+	[pool release];
+}
+
+@implementation SDLUIKitDelegate
+
+@synthesize window, windowID, controller;
+
+/* convenience method */
++(SDLUIKitDelegate *)sharedAppDelegate {
+	/* the delegate is set in UIApplicationMain(), which is garaunteed to be called before this method */
+	return (SDLUIKitDelegate *)[[UIApplication sharedApplication] delegate];
+}
+
+/*- (id)init {
+	self = [super init];
+	window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] ;
+	windowID = 0;
+	return self;
+}*/
+
+- (void) startSDLgame {
+	// HACK: remove the current window and let SDL create a new one
+	[self.window release];
+	if (nil != self.window)
+		self.window = nil;
+	
+	/* run the user's application, passing argc and argv */
+	NSLog(@"Game is launching");
+	SDL_main(forward_argc, forward_argv);
+	NSLog(@"Game exited");
+	
+	//[self performSelector:@selector(makeNewView) withObject:nil afterDelay:0.0];
+	/* exit, passing the return status from the user's application */
+	//exit(exit_status);
+}
+
+// override the direct execution of SDL_main to allow us to implement the frontend (even using a nib)
+-(void) applicationDidFinishLaunching:(UIApplication *)application {
+	[application setStatusBarHidden:YES animated:NO];
+
+	/* Set working directory to resource path */
+	[[NSFileManager defaultManager] changeCurrentDirectoryPath: [[NSBundle mainBundle] resourcePath]];
+	
+	[window addSubview:controller.view];
+	[window makeKeyAndVisible];
+}
+
+-(void) applicationWillTerminate:(UIApplication *)application {
+	/* free the memory we used to hold copies of argc and argv */
+	int i;
+	for (i=0; i<forward_argc; i++) {
+		free(forward_argv[i]);
+	}
+	free(forward_argv);	
+	SDL_SendQuit();
+	 /* hack to prevent automatic termination.  See SDL_uikitevents.m for details */
+	longjmp(*(jump_env()), 1);
+}
+
+-(void) applicationWillResignActive:(UIApplication*)application
+{
+//	NSLog(@"%@", NSStringFromSelector(_cmd));
+	SDL_SendWindowEvent(self.windowID, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
+}
+
+-(void) applicationDidBecomeActive:(UIApplication*)application
+{
+//	NSLog(@"%@", NSStringFromSelector(_cmd));
+	SDL_SendWindowEvent(self.windowID, SDL_WINDOWEVENT_RESTORED, 0, 0);
+}
+
+/*
+-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
+	NSLog(@"Rotating...");
+	return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
+}
+*/
+
+-(void) dealloc {
+	[controller release];
+	[window release];
+	[super dealloc];
+}
+
+@end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cocoaTouch/SDL_uikitview.h	Thu Jan 07 05:23:23 2010 +0000
@@ -0,0 +1,65 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2009 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+	Sam Lantinga, mods for Hedgewars by Vittorio Giovara
+	slouken@libsdl.org, vittorio.giovara@gmail.com
+*/
+
+#import <UIKit/UIKit.h>
+#include "SDL_stdinc.h"
+#include "SDL_mouse.h"
+#include "SDL_mouse_c.h"
+#include "SDL_events.h"
+
+#import "CGPointUtils.h"
+
+#if SDL_IPHONE_MULTIPLE_MICE
+#define MAX_SIMULTANEOUS_TOUCHES 5
+#else
+#define MAX_SIMULTANEOUS_TOUCHES 1
+#endif
+
+#define kMinimumPinchDelta 100
+/* *INDENT-OFF* */
+#if SDL_IPHONE_KEYBOARD
+@interface SDL_uikitview : UIView<UITextFieldDelegate> {
+#else
+@interface SDL_uikitview : UIView {
+#endif
+	SDL_Mouse mice[MAX_SIMULTANEOUS_TOUCHES];
+	CGFloat initialDistance;
+#if SDL_IPHONE_KEYBOARD
+	UITextField *textField;
+	BOOL keyboardVisible;
+#endif
+}
+- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
+- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
+- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
+
+@property CGFloat initialDistance;
+
+#if SDL_IPHONE_KEYBOARD
+- (void)showKeyboard;
+- (void)hideKeyboard;
+- (void)initializeKeyboard;
+@property (readonly) BOOL keyboardVisible;
+#endif 
+	
+@end
+/* *INDENT-ON* */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cocoaTouch/SDL_uikitview.m	Thu Jan 07 05:23:23 2010 +0000
@@ -0,0 +1,438 @@
+/*
+ SDL - Simple DirectMedia Layer
+ Copyright (C) 1997-2009 Sam Lantinga
+ 
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+ 
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ Lesser General Public License for more details.
+ 
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ 
+ Sam Lantinga, mods for Hedgewars by Vittorio Giovara
+ slouken@libsdl.org, vittorio.giovara@gmail.com
+ */
+
+#include "PascalImports.h"
+#import "SDL_uikitview.h"
+
+#if SDL_IPHONE_KEYBOARD
+#import "SDL_keyboard_c.h"
+#import "keyinfotable.h"
+#import "SDL_uikitwindow.h"
+#import "SDL_uikitappdelegate.h"
+#endif
+
+@implementation SDL_uikitview
+
+@synthesize initialDistance;
+
+- (void)dealloc {
+#if SDL_IPHONE_KEYBOARD
+	SDL_DelKeyboard(0);
+	[textField release];
+#endif
+	[super dealloc];
+}
+
+- (id)initWithFrame:(CGRect)frame {
+
+	self = [super initWithFrame: frame];
+	
+#if SDL_IPHONE_KEYBOARD
+	[self initializeKeyboard];
+#endif	
+
+	int i;
+	for (i=0; i<MAX_SIMULTANEOUS_TOUCHES; i++) {
+        mice[i].id = i;
+		mice[i].driverdata = NULL;
+		SDL_AddMouse(&mice[i], "Mouse", 0, 0, 1);
+	}
+	self.multipleTouchEnabled = YES;
+			
+	return self;
+
+}
+
+#pragma mark -
+#pragma mark Custom SDL_UIView input handling
+
+// we override default touch input to implement our own gestures
+- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
+
+	/*NSEnumerator *enumerator = [touches objectEnumerator];
+	UITouch *touch =(UITouch*)[enumerator nextObject];
+	
+	/* associate touches with mice, so long as we have slots 
+	int i;
+	int found = 0;
+	for(i=0; touch && i < MAX_SIMULTANEOUS_TOUCHES; i++) {
+	
+		/* check if this mouse is already tracking a touch 
+		if (mice[i].driverdata != NULL) {
+			continue;
+		}
+		/*	
+			mouse not associated with anything right now,
+			associate the touch with this mouse
+		
+		found = 1;
+		
+		/* save old mouse so we can switch back 
+		int oldMouse = SDL_SelectMouse(-1);
+		
+		/* select this slot's mouse 
+		SDL_SelectMouse(i);
+		CGPoint locationInView = [touch locationInView: self];
+		
+		/* set driver data to touch object, we'll use touch object later 
+		mice[i].driverdata = [touch retain];
+		
+		/* send moved event 
+		SDL_SendMouseMotion(i, 0, locationInView.x, locationInView.y, 0);
+		
+		/* send mouse down event 
+		SDL_SendMouseButton(i, SDL_PRESSED, SDL_BUTTON_LEFT);
+		
+		/* re-calibrate relative mouse motion 
+		SDL_GetRelativeMouseState(i, NULL, NULL);
+		
+		/* grab next touch 
+		touch = (UITouch*)[enumerator nextObject]; 
+		
+		/* switch back to our old mouse 
+		SDL_SelectMouse(oldMouse);
+		
+	}	*/
+	UITouch *touch = [touches anyObject];
+	if (2 == [touch tapCount] ) {
+		HW_ammoMenu();
+	}
+	
+	if (2 == [touches count]) {
+		NSArray *twoTouches = [touches allObjects];
+		UITouch *first = [twoTouches objectAtIndex:0];
+		UITouch *second = [twoTouches objectAtIndex:1];
+		initialDistance = distanceBetweenPoints([first locationInView:self], [second locationInView:self]);
+	}
+}
+
+- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
+	initialDistance = 0;
+	/*NSEnumerator *enumerator = [touches objectEnumerator];
+	UITouch *touch=nil;
+	
+	while(touch = (UITouch *)[enumerator nextObject]) {
+		/* search for the mouse slot associated with this touch 
+		int i, found = NO;
+		for (i=0; i<MAX_SIMULTANEOUS_TOUCHES && !found; i++) {
+			if (mice[i].driverdata == touch) {
+				/* found the mouse associate with the touch 
+				[(UITouch*)(mice[i].driverdata) release];
+				mice[i].driverdata = NULL;
+				/* send mouse up 
+				SDL_SendMouseButton(i, SDL_RELEASED, SDL_BUTTON_LEFT);
+				/* discontinue search for this touch 
+				found = YES;
+			}
+		}
+	}*/
+}
+
+- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
+	/*
+		this can happen if the user puts more than 5 touches on the screen
+		at once, or perhaps in other circumstances.  Usually (it seems)
+		all active touches are canceled.
+	*/
+	[self touchesEnded: touches withEvent: event];
+}
+
+
+- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
+	
+//	NSEnumerator *enumerator = [touches objectEnumerator];
+//	UITouch *touch=nil;
+
+	if (2 == [touches count]) {
+		NSArray *twoTouches = [touches allObjects];
+		UITouch *first = [twoTouches objectAtIndex:0];
+		UITouch *second = [twoTouches objectAtIndex:1];
+		CGFloat currentDistance = distanceBetweenPoints([first locationInView:self], [second locationInView:self]);
+	
+		if (0 == initialDistance) 
+			initialDistance = currentDistance;
+		else if (currentDistance - initialDistance > kMinimumPinchDelta) {
+			NSLog(@"Outward pinch detected");
+			HW_zoomOut();
+		}
+		else if (initialDistance - currentDistance > kMinimumPinchDelta) {
+			NSLog(@"Inward pinch detected");
+			HW_zoomIn();
+		}
+	}
+	
+	/*while(touch = (UITouch *)[enumerator nextObject]) {
+		// try to find the mouse associated with this touch 
+		int i, found = NO;
+		for (i=0; i<MAX_SIMULTANEOUS_TOUCHES && !found; i++) {
+			if (mice[i].driverdata == touch) {
+				// found proper mouse 
+				CGPoint locationInView = [touch locationInView: self];
+				// send moved event 
+				SDL_SendMouseMotion(i, 0, locationInView.x, locationInView.y, 0);
+				// discontinue search 
+				found = YES;
+			}
+		}
+	}*/
+}
+
+#pragma mark -
+#pragma mark default routines
+/*
+	---- Keyboard related functionality below this line ----
+*/
+#if SDL_IPHONE_KEYBOARD
+
+/* Is the iPhone virtual keyboard visible onscreen? */
+- (BOOL)keyboardVisible {
+	return keyboardVisible;
+}
+
+/* Set ourselves up as a UITextFieldDelegate */
+- (void)initializeKeyboard {
+		
+	textField = [[[UITextField alloc] initWithFrame: CGRectZero] autorelease];
+	textField.delegate = self;
+	/* placeholder so there is something to delete! */
+	textField.text = @" ";	
+	
+	/* set UITextInputTrait properties, mostly to defaults */
+	textField.autocapitalizationType = UITextAutocapitalizationTypeNone;
+	textField.autocorrectionType = UITextAutocorrectionTypeNo;
+	textField.enablesReturnKeyAutomatically = NO;
+	textField.keyboardAppearance = UIKeyboardAppearanceDefault;
+	textField.keyboardType = UIKeyboardTypeDefault;
+	textField.returnKeyType = UIReturnKeyDefault;
+	textField.secureTextEntry = NO;	
+	
+	textField.hidden = YES;
+	keyboardVisible = NO;
+	/* add the UITextField (hidden) to our view */
+	[self addSubview: textField];
+	
+	/* create our SDL_Keyboard */
+	SDL_Keyboard keyboard;
+	SDL_zero(keyboard);
+	SDL_AddKeyboard(&keyboard, 0);
+	SDLKey keymap[SDL_NUM_SCANCODES];
+	SDL_GetDefaultKeymap(keymap);
+	SDL_SetKeymap(0, 0, keymap, SDL_NUM_SCANCODES);
+	
+}
+
+/* reveal onscreen virtual keyboard */
+- (void)showKeyboard {
+	keyboardVisible = YES;
+	[textField becomeFirstResponder];
+}
+
+/* hide onscreen virtual keyboard */
+- (void)hideKeyboard {
+	keyboardVisible = NO;
+	[textField resignFirstResponder];
+}
+
+/* UITextFieldDelegate method.  Invoked when user types something. */
+- (BOOL)textField:(UITextField *)_textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
+	
+	if ([string length] == 0) {
+		/* it wants to replace text with nothing, ie a delete */
+		SDL_SendKeyboardKey( 0, SDL_PRESSED, SDL_SCANCODE_DELETE);
+		SDL_SendKeyboardKey( 0, SDL_RELEASED, SDL_SCANCODE_DELETE);
+	}
+	else {
+		/* go through all the characters in the string we've been sent
+		   and convert them to key presses */
+		int i;
+		for (i=0; i<[string length]; i++) {
+			
+			unichar c = [string characterAtIndex: i];
+			
+			Uint16 mod = 0;
+			SDL_scancode code;
+			
+			if (c < 127) {
+				/* figure out the SDL_scancode and SDL_keymod for this unichar */
+				code = unicharToUIKeyInfoTable[c].code;
+				mod  = unicharToUIKeyInfoTable[c].mod;
+			}
+			else {
+				/* we only deal with ASCII right now */
+				code = SDL_SCANCODE_UNKNOWN;
+				mod = 0;
+			}
+			
+			if (mod & KMOD_SHIFT) {
+				/* If character uses shift, press shift down */
+				SDL_SendKeyboardKey( 0, SDL_PRESSED, SDL_SCANCODE_LSHIFT);
+			}
+			/* send a keydown and keyup even for the character */
+			SDL_SendKeyboardKey( 0, SDL_PRESSED, code);
+			SDL_SendKeyboardKey( 0, SDL_RELEASED, code);
+			if (mod & KMOD_SHIFT) {
+				/* If character uses shift, press shift back up */
+				SDL_SendKeyboardKey( 0, SDL_RELEASED, SDL_SCANCODE_LSHIFT);
+			}			
+		}
+	}
+	return NO; /* don't allow the edit! (keep placeholder text there) */
+}
+
+/* Terminates the editing session */
+- (BOOL)textFieldShouldReturn:(UITextField*)_textField {
+	[self hideKeyboard];
+	return YES;
+}
+
+#endif
+
+@end
+
+/* iPhone keyboard addition functions */
+#if SDL_IPHONE_KEYBOARD
+
+int SDL_iPhoneKeyboardShow(SDL_WindowID windowID) {
+	
+	SDL_Window *window = SDL_GetWindowFromID(windowID);
+	SDL_WindowData *data;
+	SDL_uikitview *view;
+	
+	if (NULL == window) {
+		SDL_SetError("Window does not exist");
+		return -1;
+	}
+	
+	data = (SDL_WindowData *)window->driverdata;
+	view = data->view;
+	
+	if (nil == view) {
+		SDL_SetError("Window has no view");
+		return -1;
+	}
+	else {
+		[view showKeyboard];
+		return 0;
+	}
+}
+
+int SDL_iPhoneKeyboardHide(SDL_WindowID windowID) {
+	
+	SDL_Window *window = SDL_GetWindowFromID(windowID);
+	SDL_WindowData *data;
+	SDL_uikitview *view;
+	
+	if (NULL == window) {
+		SDL_SetError("Window does not exist");
+		return -1;
+	}	
+	
+	data = (SDL_WindowData *)window->driverdata;
+	view = data->view;
+	
+	if (NULL == view) {
+		SDL_SetError("Window has no view");
+		return -1;
+	}
+	else {
+		[view hideKeyboard];
+		return 0;
+	}
+}
+
+SDL_bool SDL_iPhoneKeyboardIsShown(SDL_WindowID windowID) {
+	
+	SDL_Window *window = SDL_GetWindowFromID(windowID);
+	SDL_WindowData *data;
+	SDL_uikitview *view;
+	
+	if (NULL == window) {
+		SDL_SetError("Window does not exist");
+		return -1;
+	}	
+	
+	data = (SDL_WindowData *)window->driverdata;
+	view = data->view;
+	
+	if (NULL == view) {
+		SDL_SetError("Window has no view");
+		return 0;
+	}
+	else {
+		return view.keyboardVisible;
+	}
+}
+
+int SDL_iPhoneKeyboardToggle(SDL_WindowID windowID) {
+	
+	SDL_Window *window = SDL_GetWindowFromID(windowID);
+	SDL_WindowData *data;
+	SDL_uikitview *view;
+	
+	if (NULL == window) {
+		SDL_SetError("Window does not exist");
+		return -1;
+	}	
+	
+	data = (SDL_WindowData *)window->driverdata;
+	view = data->view;
+	
+	if (NULL == view) {
+		SDL_SetError("Window has no view");
+		return -1;
+	}
+	else {
+		if (SDL_iPhoneKeyboardIsShown(windowID)) {
+			SDL_iPhoneKeyboardHide(windowID);
+		}
+		else {
+			SDL_iPhoneKeyboardShow(windowID);
+		}
+		return 0;
+	}
+}
+
+#else
+
+/* stubs, used if compiled without keyboard support */
+
+int SDL_iPhoneKeyboardShow(SDL_WindowID windowID) {
+	SDL_SetError("Not compiled with keyboard support");
+	return -1;
+}
+
+int SDL_iPhoneKeyboardHide(SDL_WindowID windowID) {
+	SDL_SetError("Not compiled with keyboard support");
+	return -1;
+}
+
+SDL_bool SDL_iPhoneKeyboardIsShown(SDL_WindowID windowID) {
+	return 0;
+}
+
+int SDL_iPhoneKeyboardToggle(SDL_WindowID windowID) {
+	SDL_SetError("Not compiled with keyboard support");
+	return -1;
+}
+
+
+#endif /* SDL_IPHONE_KEYBOARD */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cocoaTouch/otherSrc/CGPointUtils.c	Thu Jan 07 05:23:23 2010 +0000
@@ -0,0 +1,40 @@
+/*
+ *  CGPointUtils.c
+ *  PinchMe
+ *
+ *  Created by Jeff LaMarche on 8/2/08.
+ *  Copyright 2008 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#include "CGPointUtils.h"
+#include <math.h>
+
+#define degreesToRadian(x) (M_PI * x / 180.0)
+#define radiansToDegrees(x) (180.0 * x / M_PI)
+
+CGFloat distanceBetweenPoints (CGPoint first, CGPoint second) {
+	CGFloat deltaX = second.x - first.x;
+	CGFloat deltaY = second.y - first.y;
+	return sqrt(deltaX*deltaX + deltaY*deltaY );
+};
+
+CGFloat angleBetweenPoints(CGPoint first, CGPoint second) {
+	CGFloat height = second.y - first.y;
+	CGFloat width = first.x - second.x;
+	CGFloat rads = atan(height/width);
+	return radiansToDegrees(rads);
+	//degs = degrees(atan((top - bottom)/(right - left)))
+}
+
+CGFloat angleBetweenLines(CGPoint line1Start, CGPoint line1End, CGPoint line2Start, CGPoint line2End) {
+	
+	CGFloat a = line1End.x - line1Start.x;
+	CGFloat b = line1End.y - line1Start.y;
+	CGFloat c = line2End.x - line2Start.x;
+	CGFloat d = line2End.y - line2Start.y;
+	
+	CGFloat rads = acos(((a*c) + (b*d)) / ((sqrt(a*a + b*b)) * (sqrt(c*c + d*d))));
+	
+	return radiansToDegrees(rads);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cocoaTouch/otherSrc/CGPointUtils.h	Thu Jan 07 05:23:23 2010 +0000
@@ -0,0 +1,14 @@
+/*
+ *  CGPointUtils.h
+ *  PinchMe
+ *
+ *  Created by Jeff LaMarche on 8/2/08.
+ *  Copyright 2008 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#import <CoreGraphics/CoreGraphics.h>
+
+CGFloat distanceBetweenPoints (CGPoint first, CGPoint second);
+CGFloat angleBetweenPoints(CGPoint first, CGPoint second);
+CGFloat angleBetweenLines(CGPoint line1Start, CGPoint line1End, CGPoint line2Start, CGPoint lin2End);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cocoaTouch/otherSrc/PascalImports.h	Thu Jan 07 05:23:23 2010 +0000
@@ -0,0 +1,30 @@
+/*
+ *  PascalImports.h
+//  fpciphonedel
+//
+//  Created by Vittorio on 07/01/10.
+//  Copyright __MyCompanyName__ 2010. All rights reserved.
+ *
+ */
+
+#ifndef PASCALIMPORTS
+#define PASCALIMPORTS
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* add C declarations below for all exported Pascal functions/procedure
+ * that you want to use
+ */
+	
+void HW_click(void);
+void HW_zoomIn(void);
+void HW_zoomOut(void);
+void HW_ammoMenu(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
\ No newline at end of file
Binary file cocoaTouch/resources/Default.png has changed
Binary file cocoaTouch/resources/Icon.png has changed
--- a/hedgewars/hwengine.pas	Tue Jan 05 21:26:38 2010 +0000
+++ b/hedgewars/hwengine.pas	Thu Jan 07 05:23:23 2010 +0000
@@ -19,7 +19,8 @@
 {$INCLUDE "options.inc"}
 
 program hwengine;
-uses	SDLh in 'SDLh.pas',
+uses
+	SDLh in 'SDLh.pas',
 {$IFDEF GLES11}
 	gles11,
 {$ELSE}
@@ -116,7 +117,7 @@
 
 SDL_GL_SwapBuffers();
 {$IFNDEF IPHONEOS}
-// not going to make captures on the iPhone
+// not going to make captures on the iPhone (nor resizing)
 if flagMakeCapture then
 	begin
 	flagMakeCapture:= false;
@@ -125,6 +126,17 @@
 	MakeScreenshot(s);
 //	SDL_SaveBMP_RW(SDLPrimSurface, SDL_RWFromFile(Str2PChar(s), 'wb'), 1)
 	end;
+end;
+
+////////////////////////////////
+procedure Resize(w, h: LongInt);
+begin
+cScreenWidth:= w;
+cScreenHeight:= h;
+if cFullScreen then
+	ParseCommand('/fullscr 1', true)
+else
+	ParseCommand('/fullscr 0', true);
 {$ENDIF}
 end;
 
@@ -142,17 +154,6 @@
 halt
 end;
 
-////////////////////////////////
-procedure Resize(w, h: LongInt);
-begin
-cScreenWidth:= w;
-cScreenHeight:= h;
-if cFullScreen then
-	ParseCommand('/fullscr 1', true)
-else
-	ParseCommand('/fullscr 0', true);
-end;
-
 ///////////////////
 procedure MainLoop;
 var PrevTime,
@@ -160,8 +161,7 @@
     event: TSDL_Event;
 {$IFDEF TOUCHINPUT}
 type TDirection = (nodir, left, right);
-var x, y, dx, dy, mouseState: LongInt;
-//    tiltValue: LongInt;
+var tiltValue: LongInt;
     direction: TDirection = nodir;
     movedbybuttons: boolean = false;
 {$ENDIF}
@@ -181,168 +181,44 @@
 {$ENDIF}
 	case event.type_ of
 {$IFDEF SDL13}
-                SDL_WINDOWEVENT:
+		SDL_WINDOWEVENT:
 {$ELSE}
 		SDL_KEYDOWN: if GameState = gsChat then KeyPressChat(event.key.keysym.unicode);
-                SDL_ACTIVEEVENT:
+		SDL_ACTIVEEVENT:
 {$ENDIF}
-                        if (event.active.state and SDL_APPINPUTFOCUS) <> 0 then
+			if (event.active.state and SDL_APPINPUTFOCUS) <> 0 then
 				cHasFocus:= event.active.gain = 1;
 		//SDL_VIDEORESIZE: Resize(max(event.resize.w, 600), max(event.resize.h, 450));
-{$IFDEF TOUCHINPUT}
-                SDL_MOUSEMOTION: begin
-{$IFDEF DEBUGFILE}
-                        AddFileLog('*********************************************       motion');
-{$ENDIF}
-						SDL_SelectMouse(event.motion.which);
-                        mouseState:= SDL_GetMouseState(@x, @y);
-                        SDL_GetRelativeMouseState(event.motion.which, @dx, @dy);
-                        
-                        direction:= nodir;
-
-                        if boolean(mouseState) then
-                        begin
-{$IFDEF DEBUGFILE}		
-                                AddFileLog('x: ' + inttostr(x) + ' y: ' + inttostr(y) + ' dx: ' + inttostr(dx) + ' dy: ' + inttostr(dy));
-{$ENDIF}
-
-                                {* zoom slider *}
-                                if (x <= 50) and (y <= 430) and (y > 50) then 
-                                begin
-                                        if (dy > 0) then uKeys.wheelDown:= true
-                                        else if (dy < 0) then uKeys.wheelUp:= true;
-                                end;
-
-                                {* aim slider *}
-                                if (x > 270) and (y > 50) and (y <= 430) then
-                                begin
-                                        if (dy > 0) then uKeys.downKey:= true
-                                        else if (dy < 0) then uKeys.upKey:= true;
-                                end;
-
-                                {* switch *}
-                                if (x > 50) and (x <= 270) and (y > 400) then
-                                begin
-                                        if (dy <> 0) then uKeys.tabKey:= true
-                                end;
-                        end;
-                end;
-        {*MoveCamera is in uWord.pas -- conflicts with other commands*}
-                SDL_MOUSEBUTTONDOWN: begin
-{$IFDEF DEBUGFILE}
-                        AddFileLog('*********************************************       touch down');
-{$ENDIF}
-						SDL_SelectMouse(event.motion.which);
-                        mouseState:= SDL_GetMouseState(@x, @y);
-                        SDL_GetRelativeMouseState(event.motion.which, @dx, @dy);
-                        {* attack *}
-                        if (x > 50) and (x <= 270) and (y <= 50) then
-                        begin
-                                WriteLnToConsole('Space DOWN -- x: ' + inttostr(x) + ' y: ' + inttostr(y));
-                                uKeys.spaceKey:= true;
-                                uKeys.isAttacking:= true;
-                        end;
-
-                        if (x <= 50) and (y <= 50) then
-                        begin
-                                WriteLnToConsole('Left Arrow Key DOWN -- x: ' + inttostr(x) + ' y: ' + inttostr(y));
-                                direction:= left;
-				movedbybuttons:= true;
-                        end;
-                        
-                        if (x > 270) and (y <= 50) then
-                        begin
-                                WriteLnToConsole('Right Arrow Key DOWN -- x: ' + inttostr(x) + ' y: ' + inttostr(y));
-                                direction:= right;
-				movedbybuttons:= true;
-                        end;
-
-                        {* high jump *}                        
-                        if (x > 160) and (x <= 270) and (y > 400) then
-                        begin
-{$IFDEF DEBUGFILE}
-                                AddFileLog('Backspace -- x: ' + inttostr(x) + ' y: ' + inttostr(y));
-{$ENDIF}
-                                uKeys.backspaceKey:= true;
-                        end;
-                end;
-                SDL_MOUSEBUTTONUP: begin
-{$IFDEF DEBUGFILE}
-                        AddFileLog('*********************************************       touch up');
-{$ENDIF}
-
-						SDL_SelectMouse(event.motion.which);
-                        mouseState:= SDL_GetMouseState(@x, @y);
-                        SDL_GetRelativeMouseState(event.motion.which, @dx, @dy);
-						uKeys.leftClick:= true;
-
-                        {* open ammo menu *}
-                        if (y > 430) and (x > 270) then
-                        begin
-{$IFDEF DEBUGFILE}
-                                AddFileLog('Right Click -- x: ' + inttostr(x) + ' y: ' + inttostr(y) );
-{$ENDIF}
-                                uKeys.rightClick:= true;
-                        end;
-
-                        {* long jump *}                        
-                        if (x > 50) and (x <= 160) and (y > 400) then
-                        begin
-{$IFDEF DEBUGFILE}
-                                AddFileLog('Enter -- x: ' + inttostr(x) + ' y: ' + inttostr(y));
-{$ENDIF}
-                                uKeys.enterKey:= true;
-                        end;
-
-                        {* reset zoom *}
-                        if (x <= 50) and (y > 430) then
-                        begin
-{$IFDEF DEBUGFILE}
-                                AddFileLog('Middle Click -- x: ' + inttostr(x) + ' y: ' + inttostr(y));
-{$ENDIF}
-                                uKeys.middleClick:= true;
-                        end;
-
-                        {* end movement and attack *}
-{$IFDEF DEBUGFILE}
-                        AddFileLog('Arrow Keys UP | Space UP -- x: ' + inttostr(x) + ' y: ' + inttostr(y) );
-{$ENDIF}
-                        direction:= nodir;
-			movedbybuttons:= false;
-                        uKeys.isAttacking:= false;
-		end;
-{$ENDIF}
 {$IFDEF IPHONEOS}
 (*		SDL_JOYAXISMOTION: begin
                 {* axis 0 = left and right;
                    axis 1 = up and down;
                    axis 2 = back and forth; *}
 
-                        WriteLnToConsole('*********************************************       accelerometer');
+			WriteLnToConsole('*********************************************       accelerometer');
 			
 			tiltValue:= SDL_JoystickGetAxis(uKeys.theJoystick, 0);
 
-                        if (CurrentTeam <> nil) then
-                        begin
+			if (CurrentTeam <> nil) then
+			begin
 {$IFDEF DEBUGFILE}
 				AddFileLog('Joystick: 0; Axis: 0; Value: ' + inttostr(tiltValue));
 {$ENDIF}
-
-                                if tiltValue > 1500 then
-                                begin
-					uKeys.rightKey:= true;
-					uKeys.isWalking:= true;
-                                end
-                                else
-                                        if tiltValue <= -1500 then
-                                        begin 
-						uKeys.leftKey:= true;
+					if tiltValue > 1500 then
+					begin
+						uKeys.rightKey:= true;
 						uKeys.isWalking:= true;
-                                        end
-                                        else
-                                                if (tiltValue  > -1500) and (tiltValue <= 1500) and (movedbybuttons = false) then uKeys.isWalking:= false;  
+					end
+					else
+						if tiltValue <= -1500 then
+						begin 
+							uKeys.leftKey:= true;
+							uKeys.isWalking:= true;
+						end
+						else
+							if (tiltValue  > -1500) and (tiltValue <= 1500) and (movedbybuttons = false) then uKeys.isWalking:= false;  
                         end;
-                end;*)
+			end;*)
 {$ELSE}
 		SDL_MOUSEBUTTONDOWN: if event.button.button = SDL_BUTTON_WHEELDOWN then uKeys.wheelDown:= true;
 		SDL_MOUSEBUTTONUP: if event.button.button = SDL_BUTTON_WHEELUP then uKeys.wheelUp:= true;
--- a/hedgewars/uKeys.pas	Tue Jan 05 21:26:38 2010 +0000
+++ b/hedgewars/uKeys.pas	Thu Jan 07 05:23:23 2010 +0000
@@ -17,6 +17,7 @@
  *)
 
 {$INCLUDE "options.inc"}
+{$IFDEF IPHONEOS} {$MODE OBJFPC} {$ENDIF}
 
 unit uKeys;
 interface
@@ -40,13 +41,20 @@
 procedure ControllerHatEvent(joy, hat, value: Byte);
 procedure ControllerButtonEvent(joy, button: Byte; pressed: Boolean);
 
+{$IFDEF IPHONEOS}
+procedure HW_click; cdecl; export;
+procedure HW_zoomIn; cdecl; export;
+procedure HW_zoomOut; cdecl; export;
+procedure HW_ammoMenu; cdecl; export;
+{$ENDIF}
+
 var	hideAmmoMenu: boolean;
 	wheelUp: boolean = false;
 	wheelDown: boolean = false;
 {$IFDEF TOUCHINPUT}
-        leftClick: boolean = false;
-        middleClick: boolean = false;
-        rightClick: boolean = false;
+	leftClick: boolean = false;
+	middleClick: boolean = false;
+	rightClick: boolean = false;
 
 	upKey: boolean = false;
 	downKey: boolean = false;
@@ -83,13 +91,45 @@
     KeyNames: array [0..cKeyMaxIndex] of string[15];
     DefaultBinds, CurrentBinds: TBinds;
 
-function KeyNameToCode(name: string): word;
-var Result: Word;
+{$IFDEF IPHONEOS}
+// these are called by the touch functions present in SDL_uikitview.m
+procedure HW_click; cdecl; export;
+begin
+	WriteLnToConsole('HW - general click');
+	leftClick:= true;
+	exit
+end;
+
+procedure HW_zoomIn; cdecl; export;
+begin
+	WriteLnToConsole('HW - zooming in');
+	wheelUp:= true;
+	exit
+end;
+
+procedure HW_zoomOut; cdecl; export;
 begin
-Result:= cKeyMaxIndex;
-while (Result > 0) and (KeyNames[Result] <> name) do dec(Result);
-KeyNameToCode:= Result
+	WriteLnToConsole('HW - zooming out');
+	wheelDown:= true;
+	exit
+end;
+
+procedure HW_ammoMenu; cdecl; export;
+begin
+	WriteLnToConsole('HW - opening ammomenu');
+	rightClick:= true;
+	exit
 end;
+{$ENDIF}
+	
+function KeyNameToCode(name: string): word;
+var code: Word;
+begin
+	code:= cKeyMaxIndex;
+	while (code > 0) and (KeyNames[code] <> name) do dec(code);
+	KeyNameToCode:= code;
+end;
+
 
 procedure ProcessKbd;
 var  i, j, k: LongInt;
@@ -128,7 +168,7 @@
 {$ENDIF}
 tkbdn[2]:= ((k shr 1) and 1);
 
-// mouse wheels (see event loop in project file)
+// mouse wheels
 tkbdn[4]:= ord(wheelDown);
 tkbdn[5]:= ord(wheelUp);
 wheelUp:= false;