first commit
This commit is contained in:
191
trunk/src/Icarus/Graphics/Animation.vjsproj
Normal file
191
trunk/src/Icarus/Graphics/Animation.vjsproj
Normal file
@@ -0,0 +1,191 @@
|
||||
<VisualStudioProject>
|
||||
<VISUALJSHARP
|
||||
ProjectType = "Local"
|
||||
ProductVersion = "7.10.3077"
|
||||
SchemaVersion = "2.0"
|
||||
ProjectGuid = "{38EF5765-4D23-4D19-8805-0398E220AB88}"
|
||||
>
|
||||
<Build>
|
||||
<Settings
|
||||
AssemblyKeyContainerName = ""
|
||||
AssemblyName = "Icarus.Animation"
|
||||
AssemblyOriginatorKeyFile = ""
|
||||
DefaultClientScript = "JScript"
|
||||
DefaultHTMLPageLayout = "Grid"
|
||||
DefaultTargetSchema = "IE50"
|
||||
OutputType = "Library"
|
||||
PreBuildEvent = ""
|
||||
PostBuildEvent = ""
|
||||
RootNamespace = "Icarus.Graphics"
|
||||
RunPostBuildEvent = "OnBuildSuccess"
|
||||
StartupObject = ""
|
||||
>
|
||||
<Config
|
||||
Name = "Debug"
|
||||
BaseAddress = "285212672"
|
||||
ConfigurationOverrideFile = ""
|
||||
DefineConstants = "DEBUG;TRACE"
|
||||
DebugSymbols = "true"
|
||||
NoWarn = ""
|
||||
Optimize = "false"
|
||||
OutputPath = "bin\Debug\"
|
||||
RegisterForComInterop = "false"
|
||||
TreatWarningsAsErrors = "false"
|
||||
WarningLevel = "4"
|
||||
AdditionalOptions = ""
|
||||
/>
|
||||
<Config
|
||||
Name = "Release"
|
||||
BaseAddress = "285212672"
|
||||
ConfigurationOverrideFile = ""
|
||||
DefineConstants = "TRACE"
|
||||
DebugSymbols = "false"
|
||||
NoWarn = ""
|
||||
Optimize = "true"
|
||||
OutputPath = "bin\Release\"
|
||||
RegisterForComInterop = "false"
|
||||
TreatWarningsAsErrors = "true"
|
||||
WarningLevel = "4"
|
||||
AdditionalOptions = ""
|
||||
/>
|
||||
</Settings>
|
||||
<References>
|
||||
<Reference
|
||||
Name = "vjslib"
|
||||
AssemblyName = "vjslib"
|
||||
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\vjslib.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System"
|
||||
AssemblyName = "System"
|
||||
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.Data"
|
||||
AssemblyName = "System.Data"
|
||||
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.XML"
|
||||
AssemblyName = "System.Xml"
|
||||
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.Drawing"
|
||||
AssemblyName = "System.Drawing"
|
||||
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Drawing.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "Resources"
|
||||
Project = "{592DE8CE-998E-436C-940B-11EE84B2BEAC}"
|
||||
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.Windows.Forms"
|
||||
AssemblyName = "System.Windows.Forms"
|
||||
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Windows.Forms.dll"
|
||||
/>
|
||||
</References>
|
||||
</Build>
|
||||
<Files>
|
||||
<Include>
|
||||
<File
|
||||
RelPath = "AssemblyInfo.jsl"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Animation\AbstractFrame.jsl"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Animation\AbstractRenderable.jsl"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Animation\AbstractText.jsl"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Animation\AnimationFactory.jsl"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Animation\AnimationType.jsl"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Animation\Frameset.jsl"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Animation\FramesetAnimation.jsl"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Animation\FramesetManager.jsl"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Animation\IFrame.jsl"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Animation\IFramesetProvider.jsl"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Animation\IRenderable.jsl"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Animation\IRenderParameters.jsl"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Animation\PazeraFramesetProvider.jsl"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Animation\SimpleFramesetProvider.jsl"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Animation\TiledFrame.jsl"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Animation\GDI\GDIAnimationFactory.jsl"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Animation\GDI\GDIFrame.jsl"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Animation\GDI\GDIRenderParameters.jsl"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
</Include>
|
||||
</Files>
|
||||
</VISUALJSHARP>
|
||||
</VisualStudioProject>
|
||||
|
||||
48
trunk/src/Icarus/Graphics/Animation.vjsproj.user
Normal file
48
trunk/src/Icarus/Graphics/Animation.vjsproj.user
Normal file
@@ -0,0 +1,48 @@
|
||||
<VisualStudioProject>
|
||||
<VISUALJSHARP LastOpenVersion = "7.10.3077" >
|
||||
<Build>
|
||||
<Settings ReferencePath = "" >
|
||||
<Config
|
||||
Name = "Debug"
|
||||
EnableASPDebugging = "false"
|
||||
EnableASPXDebugging = "false"
|
||||
EnableUnmanagedDebugging = "false"
|
||||
EnableSQLServerDebugging = "false"
|
||||
RemoteDebugEnabled = "false"
|
||||
RemoteDebugMachine = ""
|
||||
StartAction = "Project"
|
||||
StartArguments = ""
|
||||
StartPage = ""
|
||||
StartProgram = ""
|
||||
StartURL = ""
|
||||
StartWorkingDirectory = ""
|
||||
StartWithIE = "false"
|
||||
/>
|
||||
<Config
|
||||
Name = "Release"
|
||||
EnableASPDebugging = "false"
|
||||
EnableASPXDebugging = "false"
|
||||
EnableUnmanagedDebugging = "false"
|
||||
EnableSQLServerDebugging = "false"
|
||||
RemoteDebugEnabled = "false"
|
||||
RemoteDebugMachine = ""
|
||||
StartAction = "Project"
|
||||
StartArguments = ""
|
||||
StartPage = ""
|
||||
StartProgram = ""
|
||||
StartURL = ""
|
||||
StartWorkingDirectory = ""
|
||||
StartWithIE = "false"
|
||||
/>
|
||||
</Settings>
|
||||
</Build>
|
||||
<OtherProjectSettings
|
||||
CopyProjectDestinationFolder = ""
|
||||
CopyProjectUncPath = ""
|
||||
CopyProjectOption = "0"
|
||||
ProjectView = "ProjectFiles"
|
||||
ProjectTrust = "0"
|
||||
/>
|
||||
</VISUALJSHARP>
|
||||
</VisualStudioProject>
|
||||
|
||||
67
trunk/src/Icarus/Graphics/Animation/AbstractFrame.jsl
Normal file
67
trunk/src/Icarus/Graphics/Animation/AbstractFrame.jsl
Normal file
@@ -0,0 +1,67 @@
|
||||
package Icarus.Graphics.Animation;
|
||||
|
||||
import System.Drawing.*;
|
||||
|
||||
/**
|
||||
* The abstract frame provides some of the functionality common to all frames.
|
||||
*
|
||||
* @author $Author: asskoala $
|
||||
* @version $Revision: 1.1 $ $Date: 2005/12/11 21:07:21 $
|
||||
*/
|
||||
public abstract class AbstractFrame extends AbstractRenderable implements IFrame
|
||||
{
|
||||
/**
|
||||
* This is the anchor point used for the frame.
|
||||
*/
|
||||
private Point m_AnchorPoint = new Point(0, 0);
|
||||
|
||||
/**
|
||||
* This is the size of the frame.
|
||||
*/
|
||||
private Size m_FrameSize = new Size(0, 0);
|
||||
|
||||
/**
|
||||
* Returns the anchor point of the frame.
|
||||
*/
|
||||
public Point getAnchorPoint()
|
||||
{
|
||||
return m_AnchorPoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up a new anchor point.
|
||||
*/
|
||||
public void setAnchorPoint(Point p)
|
||||
{
|
||||
m_AnchorPoint = p;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the frame using the anchor point and bitmap
|
||||
* passed in, and returns true if the initialization went
|
||||
* through successfully, and false if it did not.
|
||||
*/
|
||||
public boolean initialize(Point anchor, Bitmap image)
|
||||
{
|
||||
this.setAnchorPoint(anchor);
|
||||
|
||||
this.m_FrameSize.set_Width(image.get_Width());
|
||||
this.m_FrameSize.set_Height(image.get_Height());
|
||||
|
||||
return this.initializeFromBitmap(image);
|
||||
}
|
||||
|
||||
/**
|
||||
* Will return the size of the frame.
|
||||
*/
|
||||
public Size GetSize()
|
||||
{
|
||||
return m_FrameSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs any necessary operations to initialize the frame
|
||||
* from a bitmap.
|
||||
*/
|
||||
protected abstract boolean initializeFromBitmap(Bitmap image);
|
||||
}
|
||||
19
trunk/src/Icarus/Graphics/Animation/AbstractRenderable.jsl
Normal file
19
trunk/src/Icarus/Graphics/Animation/AbstractRenderable.jsl
Normal file
@@ -0,0 +1,19 @@
|
||||
package Icarus.Graphics.Animation;
|
||||
|
||||
import System.Drawing.Point;
|
||||
import System.Drawing.Rectangle;
|
||||
import System.Drawing.Size;
|
||||
|
||||
/**
|
||||
* This is just a convenience class providing a default implementation of what originally was a function used by everything and then turned out to just be a helper when more functionality was needed.
|
||||
*/
|
||||
public abstract class AbstractRenderable implements IRenderable
|
||||
{
|
||||
/**
|
||||
* Renders the thing.
|
||||
*/
|
||||
public void Render(Point coordinates, IRenderParameters parameters)
|
||||
{
|
||||
this.Render(new Rectangle(coordinates, Size.Empty), parameters);
|
||||
}
|
||||
}
|
||||
81
trunk/src/Icarus/Graphics/Animation/AbstractText.jsl
Normal file
81
trunk/src/Icarus/Graphics/Animation/AbstractText.jsl
Normal file
@@ -0,0 +1,81 @@
|
||||
package Icarus.Graphics.Animation;
|
||||
|
||||
import System.Drawing.Graphics;
|
||||
import System.Drawing.Color;
|
||||
import System.Drawing.Size;
|
||||
import System.Drawing.Font;
|
||||
import System.Drawing.FontFamily;
|
||||
|
||||
/**
|
||||
* The abstract text class, which will allow us to render text in an efficient manner.
|
||||
*/
|
||||
public abstract class AbstractText extends AbstractRenderable
|
||||
{
|
||||
public static final Graphics DefaultGraphics = Graphics.FromImage(new System.Drawing.Bitmap(1, 1));
|
||||
|
||||
private String mText = null;
|
||||
private Color mColor = Color.get_Black();
|
||||
private Font mFont = null;
|
||||
|
||||
public AbstractText()
|
||||
{
|
||||
this("");
|
||||
}
|
||||
|
||||
public AbstractText(String text)
|
||||
{
|
||||
this(text, Color.get_Black());
|
||||
}
|
||||
|
||||
public AbstractText(String text, Color c)
|
||||
{
|
||||
this(text, c, new Font(FontFamily.get_GenericSansSerif().get_Name(), 12));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of the abstract text.
|
||||
*/
|
||||
public AbstractText(String text, Color c, Font f)
|
||||
{
|
||||
mText = text;
|
||||
mColor = c;
|
||||
mFont = f;
|
||||
|
||||
UpdateText();
|
||||
}
|
||||
|
||||
public String GetText() { return mText; }
|
||||
public void SetText(String text)
|
||||
{
|
||||
mText = text;
|
||||
UpdateText();
|
||||
}
|
||||
|
||||
public Color GetColor() { return mColor; }
|
||||
public void SetColor(Color color)
|
||||
{
|
||||
mColor = color;
|
||||
UpdateText();
|
||||
}
|
||||
|
||||
public Font GetFont() { return mFont; }
|
||||
public void SetFont(Font font)
|
||||
{
|
||||
mFont = font;
|
||||
UpdateText();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the size of the text in pixels.
|
||||
*/
|
||||
public Size GetSize()
|
||||
{
|
||||
System.Drawing.SizeF fsize = AbstractText.DefaultGraphics.MeasureString(this.GetText(), this.GetFont());
|
||||
return new Size((int) fsize.get_Width(), (int) fsize.get_Height());
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the text. This will be called any time the text itself, or the color or the font is changed.
|
||||
*/
|
||||
protected abstract void UpdateText();
|
||||
}
|
||||
31
trunk/src/Icarus/Graphics/Animation/AnimationFactory.jsl
Normal file
31
trunk/src/Icarus/Graphics/Animation/AnimationFactory.jsl
Normal file
@@ -0,0 +1,31 @@
|
||||
package Icarus.Graphics.Animation;
|
||||
|
||||
/**
|
||||
* This thingey allows for context-independent animation handling.
|
||||
*
|
||||
* @author $Author: asskoala $
|
||||
* @version $Revision: 1.1 $ $Date: 2005/12/11 21:07:21 $
|
||||
*/
|
||||
public abstract class AnimationFactory
|
||||
{
|
||||
/**
|
||||
* Singleton Implementation.
|
||||
*/
|
||||
private static AnimationFactory mg_Instance = null;
|
||||
|
||||
/**
|
||||
* Singleton Implementation.
|
||||
*/
|
||||
public static final AnimationFactory getInstance() { return mg_Instance; }
|
||||
public static final void setInstance(AnimationFactory factory) { mg_Instance = factory; }
|
||||
|
||||
/**
|
||||
* Returns a blank frame.
|
||||
*/
|
||||
public abstract IFrame makeBlankFrame();
|
||||
|
||||
/**
|
||||
* Returns blank text.
|
||||
*/
|
||||
public abstract AbstractText makeText(String text, System.Drawing.Color c, System.Drawing.Font f);
|
||||
}
|
||||
35
trunk/src/Icarus/Graphics/Animation/AnimationType.jsl
Normal file
35
trunk/src/Icarus/Graphics/Animation/AnimationType.jsl
Normal file
@@ -0,0 +1,35 @@
|
||||
package Icarus.Graphics.Animation;
|
||||
|
||||
/**
|
||||
* This class enumerates all the possible looping modes for an animation.
|
||||
*
|
||||
* @author $Author: asskoala $
|
||||
* @version $Revision: 1.1 $ $Date: 2005/12/11 21:07:21 $
|
||||
*/
|
||||
public class AnimationType // extends System.Enum //Can't author enums :(
|
||||
{
|
||||
/**
|
||||
* Denotes that the animation is static.
|
||||
*/
|
||||
public static AnimationType None = new AnimationType("None");
|
||||
|
||||
/**
|
||||
* The animation loops through once, and freezes at the last frame.
|
||||
*/
|
||||
public static AnimationType LoopOnce = new AnimationType("LoopOnce");
|
||||
|
||||
/**
|
||||
* The animation will loop forever.
|
||||
*/
|
||||
public static AnimationType LoopForever = new AnimationType("LoopForever");
|
||||
|
||||
private String name;
|
||||
private AnimationType(String n) { name = n; }
|
||||
public String ToString() { return name; }
|
||||
public static AnimationType FromString(String v)
|
||||
{
|
||||
if (v.equals("LoopOnce")) return AnimationType.LoopOnce;
|
||||
else if (v.equals("LoopForever")) return AnimationType.LoopForever;
|
||||
else return AnimationType.None;
|
||||
}
|
||||
}
|
||||
63
trunk/src/Icarus/Graphics/Animation/Frameset.jsl
Normal file
63
trunk/src/Icarus/Graphics/Animation/Frameset.jsl
Normal file
@@ -0,0 +1,63 @@
|
||||
package Icarus.Graphics.Animation;
|
||||
|
||||
import System.Collections.*;
|
||||
import System.Drawing.*;
|
||||
|
||||
/**
|
||||
* This class provides the functionality of a frameset.
|
||||
*
|
||||
* @author $Author: asskoala $
|
||||
* @version $Revision: 1.1 $ $Date: 2005/12/11 21:07:21 $
|
||||
*/
|
||||
public class Frameset
|
||||
{
|
||||
/**
|
||||
* The list of frames in this frameset.
|
||||
*/
|
||||
private IList m_FrameList;
|
||||
|
||||
/**
|
||||
* Performs some necessary initialization.
|
||||
*/
|
||||
public Frameset()
|
||||
{
|
||||
m_FrameList = new ArrayList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of frames in the frameset.
|
||||
*/
|
||||
public int getFrameCount()
|
||||
{
|
||||
return m_FrameList.get_Count();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new frame to the frameset and returns the current number of frames in the frameset.
|
||||
*/
|
||||
public int addFrame(IFrame frame)
|
||||
{
|
||||
m_FrameList.Add(frame);
|
||||
|
||||
return this.getFrameCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new frame to the frameset and returns the current number of frames in the frameset.
|
||||
*/
|
||||
public int addFrame(Bitmap img, Point anchor)
|
||||
{
|
||||
IFrame new_frame = AnimationFactory.getInstance().makeBlankFrame();
|
||||
new_frame.initialize(anchor, img);
|
||||
|
||||
return this.addFrame(new_frame);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the frame at the specified index.
|
||||
*/
|
||||
public IFrame getFrameAt(int index)
|
||||
{
|
||||
return (IFrame) m_FrameList.get_Item(index);
|
||||
}
|
||||
}
|
||||
215
trunk/src/Icarus/Graphics/Animation/FramesetAnimation.jsl
Normal file
215
trunk/src/Icarus/Graphics/Animation/FramesetAnimation.jsl
Normal file
@@ -0,0 +1,215 @@
|
||||
package Icarus.Graphics.Animation;
|
||||
|
||||
/**
|
||||
* This is an animation that uses a frameset as the underlying set of images.
|
||||
*
|
||||
* @author $Author: asskoala $
|
||||
* @version $Revision: 1.1 $ $Date: 2005/12/11 21:07:21 $
|
||||
*/
|
||||
public class FramesetAnimation
|
||||
{
|
||||
/**
|
||||
* The path where the animation was loaded from.
|
||||
*/
|
||||
private String m_FramesetPath;
|
||||
|
||||
/**
|
||||
* The set of frames used for the animation.
|
||||
*/
|
||||
private Frameset m_Frameset;
|
||||
|
||||
/**
|
||||
* The looping type of the animation.
|
||||
*/
|
||||
private AnimationType m_AnimationType;
|
||||
|
||||
/**
|
||||
* The delay, in abstract time units, between the frames of the animation.
|
||||
*/
|
||||
private long m_AnimationDelay;
|
||||
|
||||
/**
|
||||
* The index of the currently displayed frame in the animation.
|
||||
*/
|
||||
private int m_CurrentFrameIndex;
|
||||
|
||||
/**
|
||||
* If we receive an update message and it is not time yet to update the frame, then we can just add to the cumulative delay over here, and check the correct number next time around.
|
||||
*/
|
||||
private long m_CumulativeDelay;
|
||||
|
||||
/**
|
||||
* Sets up a blank frameset animation.
|
||||
*/
|
||||
public FramesetAnimation()
|
||||
{
|
||||
this.set_AnimationDelay(1);
|
||||
this.set_AnimationType(AnimationType.None);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the new frameset animation.
|
||||
*/
|
||||
public FramesetAnimation(Frameset frames, AnimationType loopMode, long delay)
|
||||
{
|
||||
this.set_AnimationType(loopMode);
|
||||
this.setFrameset(frames);
|
||||
this.set_AnimationDelay(delay);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is just a little optimization that makes it so when the animation has only one frame, the update method won't try to do anything funny.
|
||||
*/
|
||||
private void processAnimationType()
|
||||
{
|
||||
if (m_Frameset != null && m_Frameset.getFrameCount() < 2)
|
||||
{
|
||||
//No reason to loop:
|
||||
m_AnimationType = AnimationType.None;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the frameset.
|
||||
*/
|
||||
public Frameset getFrameset() { return m_Frameset; }
|
||||
|
||||
/**
|
||||
* Sets up a new frameset.
|
||||
*/
|
||||
protected void setFrameset(Frameset frames)
|
||||
{
|
||||
m_Frameset = frames;
|
||||
m_CurrentFrameIndex = 0;
|
||||
m_CumulativeDelay = 0;
|
||||
|
||||
processAnimationType();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the path to the frameset.
|
||||
*
|
||||
* @property
|
||||
*/
|
||||
public String get_FramesetPath() { return this.m_FramesetPath; }
|
||||
|
||||
/**
|
||||
* Sets the path to the frameset.
|
||||
*
|
||||
* @property
|
||||
*/
|
||||
public void set_FramesetPath(String value)
|
||||
{
|
||||
this.m_FramesetPath = value;
|
||||
this.setFrameset(FramesetManager.getInstance().getFrameset(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the animation type.
|
||||
*
|
||||
* @property
|
||||
* @attribute System.Xml.Serialization.XmlIgnore()
|
||||
*/
|
||||
public AnimationType get_AnimationType() { return m_AnimationType; }
|
||||
|
||||
/**
|
||||
* Sets up the new animation type.
|
||||
*
|
||||
* @property
|
||||
*/
|
||||
public void set_AnimationType(AnimationType type)
|
||||
{
|
||||
m_AnimationType = type;
|
||||
processAnimationType();
|
||||
}
|
||||
|
||||
/**
|
||||
* This is sort of a hack property for serialization purposes because J# + enums = headache.
|
||||
*
|
||||
* @property
|
||||
*/
|
||||
public String get_AnimationTypeId() { return this.m_AnimationType.ToString(); }
|
||||
|
||||
/**
|
||||
* This is sort of a hack property for serialization purposes because J# + enums = headache.
|
||||
*
|
||||
* @property
|
||||
*/
|
||||
public void set_AnimationTypeId(String v)
|
||||
{
|
||||
this.set_AnimationType(AnimationType.FromString(v));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the delay, in abstract time units, between the frames of the animation.
|
||||
*
|
||||
* @property
|
||||
*/
|
||||
public long get_AnimationDelay() { return m_AnimationDelay; }
|
||||
|
||||
/**
|
||||
* Sets the new animation delay.
|
||||
*
|
||||
* @property
|
||||
*/
|
||||
public void set_AnimationDelay(long delay) { m_AnimationDelay = delay; }
|
||||
|
||||
/**
|
||||
* Returns the index of the current frame.
|
||||
*
|
||||
* @property
|
||||
* @attribute System.Xml.Serialization.XmlIgnore()
|
||||
*/
|
||||
public int get_CurrentFrameIndex()
|
||||
{
|
||||
return m_CurrentFrameIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current frame of the animation.
|
||||
*
|
||||
* @property
|
||||
* @attribute System.Xml.Serialization.XmlIgnore()
|
||||
*/
|
||||
public IFrame get_CurrentFrame()
|
||||
{
|
||||
return m_Frameset.getFrameAt(this.get_CurrentFrameIndex());
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an update of the animation given the delay since the previous call in abstract time units.
|
||||
*/
|
||||
public void update(long time)
|
||||
{
|
||||
if (m_AnimationType == AnimationType.None)
|
||||
{
|
||||
//Nothing much to do...
|
||||
return;
|
||||
}
|
||||
|
||||
m_CumulativeDelay += time;
|
||||
if (m_CumulativeDelay < this.get_AnimationDelay())
|
||||
{
|
||||
//Not time yet...
|
||||
return;
|
||||
}
|
||||
|
||||
m_CumulativeDelay = 0;
|
||||
|
||||
int index = m_CurrentFrameIndex;
|
||||
if (index >= m_Frameset.getFrameCount() - 1)
|
||||
{
|
||||
if (m_AnimationType == AnimationType.LoopForever)
|
||||
{
|
||||
index ++;
|
||||
index %= m_Frameset.getFrameCount();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
index ++;
|
||||
}
|
||||
|
||||
m_CurrentFrameIndex = index;
|
||||
}
|
||||
}
|
||||
102
trunk/src/Icarus/Graphics/Animation/FramesetManager.jsl
Normal file
102
trunk/src/Icarus/Graphics/Animation/FramesetManager.jsl
Normal file
@@ -0,0 +1,102 @@
|
||||
package Icarus.Graphics.Animation;
|
||||
|
||||
import System.Collections.*;
|
||||
import System.Drawing.Bitmap;
|
||||
import System.Type;
|
||||
import System.Reflection.ConstructorInfo;
|
||||
|
||||
/**
|
||||
* The frameset manager singleton class will handle the framesets in memory. It will load each frameset only once, so that we don't waste memory, and it will sometimes unload the framesets that haven't been used for a while.
|
||||
*
|
||||
* @author $Author: asskoala $
|
||||
* @version $Revision: 1.1 $ $Date: 2005/12/11 21:07:21 $
|
||||
*/
|
||||
public class FramesetManager
|
||||
{
|
||||
/**
|
||||
* Singleton Implementation.
|
||||
*/
|
||||
private static final FramesetManager mg_Instance = new FramesetManager();
|
||||
|
||||
/**
|
||||
* Maps strings to frameset references.
|
||||
*/
|
||||
private IDictionary m_Framesets; //TODO: Maybe use soft references here, to provide caching.
|
||||
|
||||
/**
|
||||
* The default frameset provider to use.
|
||||
*/
|
||||
private IFramesetProvider m_DefaultFramesetProvider;
|
||||
|
||||
/**
|
||||
* Singleton Implementation.
|
||||
*/
|
||||
private FramesetManager()
|
||||
{
|
||||
m_Framesets = new Hashtable();
|
||||
m_DefaultFramesetProvider = new PazeraFramesetProvider();
|
||||
}
|
||||
|
||||
/**
|
||||
* Singleton Implementation.
|
||||
*/
|
||||
public static final FramesetManager getInstance() { return mg_Instance; }
|
||||
|
||||
/**
|
||||
* Sets up the new default frameset provider.
|
||||
*/
|
||||
public void setDefaultFramesetProvider(IFramesetProvider provider) { m_DefaultFramesetProvider = provider; }
|
||||
|
||||
/**
|
||||
* Returns the frameset with the specified ID. If the frameset cannot be loaded, will probably throw an exception.
|
||||
*/
|
||||
public Frameset getFrameset(String id)
|
||||
{
|
||||
if (!m_Framesets.Contains(id))
|
||||
{
|
||||
this.loadFramesetFromId(id, null);
|
||||
}
|
||||
|
||||
return (Frameset) m_Framesets.get_Item(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the frameset with the specified id. If a frameset with that id already exists, it is overwritten.
|
||||
*/
|
||||
public void addFrameset(String id, Frameset frameset)
|
||||
{
|
||||
m_Framesets.Add(id, frameset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses the id passed in as the filename to look for the image in the base image folder.
|
||||
*/
|
||||
public void loadFramesetFromId(String id, IFramesetProvider provider)
|
||||
{
|
||||
this.loadFramesetFromFile(Icarus.Resources.ResourceManager.get_Instance().get_ImagePath() + id, id, provider);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the frameset with the specified id from the full path passed in using the specified frameset provider.
|
||||
*/
|
||||
public void loadFramesetFromFile(String filename, String id, IFramesetProvider provider)
|
||||
{
|
||||
if (provider == null)
|
||||
{
|
||||
provider = m_DefaultFramesetProvider;
|
||||
}
|
||||
|
||||
Frameset new_set = new Frameset();
|
||||
provider.fillFrameset(new_set, (Bitmap) Bitmap.FromFile(filename));
|
||||
|
||||
this.addFrameset(id, new_set);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an id of an image, loads it.
|
||||
*/
|
||||
public Bitmap loadImageFromId(String id)
|
||||
{
|
||||
return (Bitmap) Bitmap.FromFile(Icarus.Resources.ResourceManager.get_Instance().get_ImagePath() + id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package Icarus.Graphics.Animation.GDI;
|
||||
|
||||
import Icarus.Graphics.Animation.AnimationFactory;
|
||||
import Icarus.Graphics.Animation.IFrame;
|
||||
import Icarus.Graphics.Animation.AbstractText;
|
||||
|
||||
/**
|
||||
* Allows for animation using GDI.
|
||||
*/
|
||||
public class GDIAnimationFactory extends AnimationFactory
|
||||
{
|
||||
/**
|
||||
* Returns a blank frame.
|
||||
*/
|
||||
public IFrame makeBlankFrame()
|
||||
{
|
||||
return new GDIFrame();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns blank text.
|
||||
*/
|
||||
public AbstractText makeText(String text, System.Drawing.Color c, System.Drawing.Font f)
|
||||
{
|
||||
throw new RuntimeException("Text rendering for GDI is not implemented, because it hasn't been needed yet.");
|
||||
}
|
||||
}
|
||||
85
trunk/src/Icarus/Graphics/Animation/GDI/GDIFrame.jsl
Normal file
85
trunk/src/Icarus/Graphics/Animation/GDI/GDIFrame.jsl
Normal file
@@ -0,0 +1,85 @@
|
||||
package Icarus.Graphics.Animation.GDI;
|
||||
|
||||
import Icarus.Graphics.Animation.*;
|
||||
|
||||
import System.Drawing.*;
|
||||
|
||||
/**
|
||||
* This is a frame that can be rendered on a GDI control, such as a button, or something like that.
|
||||
*
|
||||
* @author $Author: asskoala $
|
||||
* @version $Revision: 1.1 $ $Date: 2005/12/11 21:07:21 $
|
||||
*/
|
||||
public class GDIFrame extends AbstractFrame
|
||||
{
|
||||
/**
|
||||
* The frame image...
|
||||
*/
|
||||
private Bitmap m_FrameImage;
|
||||
|
||||
/**
|
||||
* Doesn't do a whole lot...
|
||||
*/
|
||||
protected boolean initializeFromBitmap(Bitmap image)
|
||||
{
|
||||
m_FrameImage = image;
|
||||
|
||||
return (m_FrameImage != null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a bitmap showing the contents of the frame. This is for saving a frame to a file.
|
||||
*/
|
||||
public Bitmap getFrameImage()
|
||||
{
|
||||
return m_FrameImage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the size of the renderable.
|
||||
*/
|
||||
public Size GetSize()
|
||||
{
|
||||
return m_FrameImage.get_Size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the width of the frame image.
|
||||
*/
|
||||
public int getImageWidth()
|
||||
{
|
||||
return m_FrameImage.get_Width();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the height of the frame image.
|
||||
*/
|
||||
public int getImageHeight()
|
||||
{
|
||||
return m_FrameImage.get_Height();
|
||||
}
|
||||
|
||||
/**
|
||||
* Will render the frame in the specified context, at the specified coordinates. Note that it is not necessarily the top-left corner of the frame that will be rendered at those coordinates, but rather the anchor point.
|
||||
*/
|
||||
public void Render(Rectangle coordinates, IRenderParameters params)
|
||||
{
|
||||
GDIRenderParameters p = (GDIRenderParameters) params;
|
||||
|
||||
int x = coordinates.get_X() - this.getAnchorPoint().get_X();
|
||||
int y = coordinates.get_Y() - this.getAnchorPoint().get_Y();
|
||||
|
||||
if (coordinates.get_Size() == Size.Empty)
|
||||
{
|
||||
p.getGraphics().DrawImageUnscaled(m_FrameImage, x, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
int width = Math.min(m_FrameImage.get_Width(), coordinates.get_Width());
|
||||
int height = Math.min(m_FrameImage.get_Height(), coordinates.get_Height());
|
||||
Rectangle src = new Rectangle(0, 0, width, height);
|
||||
|
||||
p.getGraphics().DrawImage(m_FrameImage, x, y, src, GraphicsUnit.Pixel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package Icarus.Graphics.Animation.GDI;
|
||||
|
||||
import System.Drawing.Point;
|
||||
import System.Drawing.Graphics;
|
||||
|
||||
import Icarus.Graphics.Animation.IRenderParameters;
|
||||
|
||||
/**
|
||||
* The render parameters needed to make render to GDI.
|
||||
*/
|
||||
public class GDIRenderParameters implements IRenderParameters
|
||||
{
|
||||
/**
|
||||
* The graphics context in which we want to render the graphics.
|
||||
*/
|
||||
private Graphics m_GraphicsContext;
|
||||
|
||||
/**
|
||||
* Initializes the rendering parameters.
|
||||
*/
|
||||
public GDIRenderParameters(Graphics context)
|
||||
{
|
||||
this.setGraphics(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the graphics context.
|
||||
*/
|
||||
public Graphics getGraphics()
|
||||
{
|
||||
return m_GraphicsContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the new graphics context.
|
||||
*/
|
||||
private void setGraphics(Graphics g)
|
||||
{
|
||||
m_GraphicsContext = g;
|
||||
}
|
||||
}
|
||||
35
trunk/src/Icarus/Graphics/Animation/IFrame.jsl
Normal file
35
trunk/src/Icarus/Graphics/Animation/IFrame.jsl
Normal file
@@ -0,0 +1,35 @@
|
||||
package Icarus.Graphics.Animation;
|
||||
|
||||
import System.Drawing.*;
|
||||
|
||||
/**
|
||||
* The implementors of this interface are frames that can be rendered
|
||||
* on screen.
|
||||
*
|
||||
* @author $Author: asskoala $
|
||||
* @version $Revision: 1.1 $ $Date: 2005/12/11 21:07:21 $
|
||||
*/
|
||||
public interface IFrame extends IRenderable
|
||||
{
|
||||
/**
|
||||
* Returns the anchor point of the frame. The anchor point is
|
||||
* essentially a coordinate in the frame such that when the
|
||||
* frame is rendered at some point on the screen, the point in
|
||||
* the frame referenced by the anchor is actually the one put
|
||||
* in that screen position - not necessarily the top-left
|
||||
* corner of the frame.
|
||||
*/
|
||||
public Point getAnchorPoint();
|
||||
|
||||
/**
|
||||
* Initializes the frame using the anchor point and bitmap
|
||||
* passed in, and returns true if the initialization went
|
||||
* through successfully, and false if it did not.
|
||||
*/
|
||||
public boolean initialize(Point anchor, Bitmap image);
|
||||
|
||||
/**
|
||||
* Returns a bitmap showing the contents of the frame. This is for saving a frame to a file.
|
||||
*/
|
||||
public Bitmap getFrameImage();
|
||||
}
|
||||
31
trunk/src/Icarus/Graphics/Animation/IFramesetProvider.jsl
Normal file
31
trunk/src/Icarus/Graphics/Animation/IFramesetProvider.jsl
Normal file
@@ -0,0 +1,31 @@
|
||||
package Icarus.Graphics.Animation;
|
||||
|
||||
import System.Drawing.*;
|
||||
|
||||
/**
|
||||
* The implementors of this interface will be used to parse a file
|
||||
* from disk and generate bitmap/point pairs for framesets, as well as
|
||||
* to export a frameset to a file.
|
||||
*
|
||||
* @author $Author: asskoala $
|
||||
* @version $Revision: 1.1 $ $Date: 2005/12/11 21:07:21 $
|
||||
*/
|
||||
public interface IFramesetProvider
|
||||
{
|
||||
/**
|
||||
* Goes through the image and extracts frames from it.
|
||||
*/
|
||||
public void fillFrameset(Frameset frameSet, Bitmap source);
|
||||
|
||||
/**
|
||||
* Will export the frameset passed in to a file, whose name is
|
||||
* passed in. The export is such that it is guaranteed to be
|
||||
* loadable by the corresponding fillFrameset function. Other
|
||||
* than that, nothing should be assumed about the export. This
|
||||
* function assumes that the filename points to a file that
|
||||
* can actually be created, and if there are any problems,
|
||||
* like null filename, or frameset, or premission problems
|
||||
* with creating the file, an Exception will be thrown.
|
||||
*/
|
||||
public void exportFrameset(Frameset frameset, String filename) throws System.Exception;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package Icarus.Graphics.Animation;
|
||||
|
||||
/**
|
||||
* The implementors of this marker interface denote rendering parameters.
|
||||
*/
|
||||
public interface IRenderParameters
|
||||
{
|
||||
}
|
||||
22
trunk/src/Icarus/Graphics/Animation/IRenderable.jsl
Normal file
22
trunk/src/Icarus/Graphics/Animation/IRenderable.jsl
Normal file
@@ -0,0 +1,22 @@
|
||||
package Icarus.Graphics.Animation;
|
||||
|
||||
/**
|
||||
* The implementors of the renderable interface are things that can be rendered... Duh. ;)
|
||||
*/
|
||||
public interface IRenderable
|
||||
{
|
||||
/**
|
||||
* Returns the size of the renderable.
|
||||
*/
|
||||
public System.Drawing.Size GetSize();
|
||||
|
||||
/**
|
||||
* Renders the thing.
|
||||
*/
|
||||
public void Render(System.Drawing.Point coordinates, IRenderParameters parameters);
|
||||
|
||||
/**
|
||||
* Renders the thing. Note that the destination parameter can be used to specify clipping. The size of the rectangle can be empty, in which case no clipping will be applied.
|
||||
*/
|
||||
public void Render(System.Drawing.Rectangle destination, IRenderParameters parameters);
|
||||
}
|
||||
405
trunk/src/Icarus/Graphics/Animation/PazeraFramesetProvider.jsl
Normal file
405
trunk/src/Icarus/Graphics/Animation/PazeraFramesetProvider.jsl
Normal file
@@ -0,0 +1,405 @@
|
||||
package Icarus.Graphics.Animation;
|
||||
|
||||
import System.Drawing.*;
|
||||
import System.Drawing.Imaging.*;
|
||||
import System.Collections.*;
|
||||
|
||||
/**
|
||||
* The Pazera frameset provider implements the plain-image frameset format described by Ernest Pazera in the following article originally posted on Gamedev.net: http://www.gamedev.net/reference/articles/article1122.asp
|
||||
*
|
||||
* @author $Author: asskoala $
|
||||
* @version $Revision: 1.1 $ $Date: 2005/12/11 21:07:21 $
|
||||
*/
|
||||
public class PazeraFramesetProvider implements IFramesetProvider
|
||||
{
|
||||
|
||||
/**
|
||||
* Exports the frameset.
|
||||
*/
|
||||
public void exportFrameset(Frameset frameset, String filename)
|
||||
{
|
||||
//First, we want to figure out the dimensions of the image in frames:
|
||||
int frameCount = frameset.getFrameCount();
|
||||
double dimension = System.Math.Sqrt(frameCount);
|
||||
int width = (int) System.Math.Ceiling(dimension);
|
||||
int height = (int) System.Math.Ceiling(((double) frameCount) / ((double) width));
|
||||
|
||||
//Generate a matrix of frames to output:
|
||||
IFrame[][] frameMatrix = new IFrame[height][width];
|
||||
for (int i = 0; i < frameCount; i++)
|
||||
{
|
||||
frameMatrix[i / width][i % width] = frameset.getFrameAt(i);
|
||||
}
|
||||
for (int i = frameCount; i < width * height; i++)
|
||||
{
|
||||
frameMatrix[i / width][i % width] = null;
|
||||
}
|
||||
|
||||
//Now, precalculate the dimensions of each frame, taking the anchor point into consideration:
|
||||
Size[][] frameSizes = new Size[height][width];
|
||||
for (int i = 0; i < frameCount; i++)
|
||||
{
|
||||
//Get the frame information:
|
||||
Point anch = frameset.getFrameAt(i).getAnchorPoint();
|
||||
Size size = frameset.getFrameAt(i).GetSize();
|
||||
|
||||
//Adjust the size by the anchor point:
|
||||
if (anch.get_X() < 0) { size.set_Width(size.get_Width() - anch.get_X()); }
|
||||
else if (anch.get_X() >= size.get_Width()) { size.set_Width(anch.get_X() + 1); }
|
||||
|
||||
if (anch.get_Y() < 0) { size.set_Height(size.get_Height() - anch.get_Y()); }
|
||||
else if (anch.get_Y() >= size.get_Height()) { size.set_Height(anch.get_Y() + 1); }
|
||||
|
||||
frameSizes[i / width][i % width] = size;
|
||||
}
|
||||
for (int i = frameCount; i < width * height; i++)
|
||||
{
|
||||
frameSizes[i / width][i % width] = new Size(0, 0);
|
||||
}
|
||||
|
||||
//Compute the widths of each column:
|
||||
int[] columnWidths = new int[width];
|
||||
for (int i = 0; i < width; i++)
|
||||
{
|
||||
int w = 0;
|
||||
|
||||
for (int j = 0; j < height; j++)
|
||||
{
|
||||
if (w < frameSizes[j][i].get_Width())
|
||||
{
|
||||
w = frameSizes[j][i].get_Width();
|
||||
}
|
||||
}
|
||||
|
||||
columnWidths[i] = w;
|
||||
}
|
||||
|
||||
//Compute the heights of each row:
|
||||
int[] rowHeights = new int[height];
|
||||
for (int i = 0; i < height; i++)
|
||||
{
|
||||
int h = 0;
|
||||
|
||||
for (int j = 0; j < width; j++)
|
||||
{
|
||||
if (h < frameSizes[i][j].get_Height())
|
||||
{
|
||||
h = frameSizes[i][j].get_Height();
|
||||
}
|
||||
}
|
||||
|
||||
rowHeights[i] = h;
|
||||
}
|
||||
|
||||
//Compute the total dimension of the image:
|
||||
int imageWidth = 1;
|
||||
for (int i = 0; i < width; i++) { imageWidth += columnWidths[i] + 1; }
|
||||
|
||||
int imageHeight = 1;
|
||||
for (int i = 0; i < height; i++) { imageHeight += rowHeights[i] + 1; }
|
||||
|
||||
//Generate the rectangles corresponding to each frame:
|
||||
Rectangle[] frameRectangles = new Rectangle[frameCount];
|
||||
for (int i = 0; i < frameCount; i++)
|
||||
{
|
||||
int row = i / width;
|
||||
int col = i % width;
|
||||
|
||||
int x = 1;
|
||||
if (col > 0) { x += frameRectangles[i - 1].get_Right(); }
|
||||
|
||||
int y = 1;
|
||||
if (row > 0) { y += frameRectangles[i - width].get_Bottom(); }
|
||||
|
||||
frameRectangles[i] = new Rectangle(x, y, columnWidths[col], rowHeights[row]);
|
||||
}
|
||||
|
||||
//Sahweet, now we can start making the image:
|
||||
Bitmap output = new Bitmap(imageWidth, imageHeight);
|
||||
Graphics g = Graphics.FromImage(output);
|
||||
|
||||
//Set up control colors:
|
||||
Color colorBound = Color.FromArgb(255, 0, 255);
|
||||
Color colorInside = Color.FromArgb(0, 255, 0);
|
||||
Color colorAnchor = Color.FromArgb(0, 255, 255);
|
||||
Color colorOutside = Color.FromArgb(255, 255, 255);
|
||||
|
||||
//Paint background with the bounds color:
|
||||
Brush outsideBrush = new SolidBrush(colorOutside);
|
||||
Brush boundBrush = new SolidBrush(colorBound);
|
||||
g.FillRectangle(boundBrush, 0, 0, imageWidth, imageHeight);
|
||||
|
||||
//Iterate through the rectangles and paint images and their control patterns:
|
||||
for (int i = 0; i < frameCount; i++)
|
||||
{
|
||||
IFrame cf = frameset.getFrameAt(i);
|
||||
Point anchor = cf.getAnchorPoint();
|
||||
Bitmap img = cf.getFrameImage();
|
||||
|
||||
int x = frameRectangles[i].get_X();
|
||||
int y = frameRectangles[i].get_Y();
|
||||
|
||||
int startx = x;
|
||||
int starty = y;
|
||||
int anchx = x;
|
||||
int anchy = y;
|
||||
|
||||
if (anchor.get_X() < 0)
|
||||
{
|
||||
startx -= anchor.get_X();
|
||||
}
|
||||
else
|
||||
{
|
||||
anchx += anchor.get_X();
|
||||
}
|
||||
|
||||
if (anchor.get_Y() < 0)
|
||||
{
|
||||
starty -= anchor.get_Y();
|
||||
}
|
||||
else
|
||||
{
|
||||
anchy += anchor.get_Y();
|
||||
}
|
||||
|
||||
//Paint inside / outside:
|
||||
//Horizontal:
|
||||
for (int j = x; j < startx; j++) { output.SetPixel(j, y - 1, colorOutside); }
|
||||
for (int j = startx; j < startx + img.get_Width(); j++) { output.SetPixel(j, y - 1, colorInside); }
|
||||
for (int j = startx + img.get_Width(); j < x + columnWidths[i % width]; j++) { output.SetPixel(j, y - 1, colorOutside); }
|
||||
|
||||
//Vertical:
|
||||
for (int j = y; j < starty; j++) { output.SetPixel(x - 1, j, colorOutside); }
|
||||
for (int j = starty; j < starty + img.get_Height(); j++) { output.SetPixel(x - 1, j, colorInside); }
|
||||
for (int j = starty + img.get_Height(); j < y + rowHeights[i / width]; j++) { output.SetPixel(x - 1, j, colorOutside); }
|
||||
|
||||
//Paint anchor points:
|
||||
output.SetPixel(anchx, y - 1, colorAnchor);
|
||||
output.SetPixel(x - 1, anchy, colorAnchor);
|
||||
|
||||
//Render actual image:
|
||||
g.DrawImage(img, startx, starty);
|
||||
}
|
||||
|
||||
//Render the remaining, unfilled frames:
|
||||
Rectangle previousRect = frameRectangles[frameCount - 1];
|
||||
for (int i = frameCount; i < width * height; i++)
|
||||
{
|
||||
Rectangle curr = new Rectangle(previousRect.get_Right() + 1, previousRect.get_Top(), columnWidths[i % height], previousRect.get_Height());
|
||||
g.FillRectangle(outsideBrush, curr.get_X() - 1, curr.get_Y(), 1, curr.get_Height());
|
||||
g.FillRectangle(outsideBrush, curr.get_Left(), curr.get_Y() - 1, curr.get_Width(), 1);
|
||||
}
|
||||
|
||||
//Now we also need to render right-most blank lines:
|
||||
for (int i = 0; i < width; i++)
|
||||
{
|
||||
Rectangle cr = frameRectangles[i];
|
||||
for (int j = cr.get_X(); j < cr.get_Right(); j++) { output.SetPixel(j, imageHeight - 1, colorOutside); }
|
||||
}
|
||||
for (int i = 0; i < height; i++)
|
||||
{
|
||||
Rectangle cr = frameRectangles[i * width];
|
||||
for (int j = cr.get_Y(); j < cr.get_Bottom(); j++) { output.SetPixel(imageWidth - 1, j, colorOutside); }
|
||||
}
|
||||
|
||||
//Also, render the control structure:
|
||||
output.SetPixel(imageWidth - 1, 1, colorInside);
|
||||
output.SetPixel(imageWidth - 1, 2, colorAnchor);
|
||||
|
||||
//Remove ugly pink:
|
||||
//output.MakeTransparent(colorBound);
|
||||
|
||||
//Save the image:
|
||||
String[] fileparts = filename.Split(new char[] {'.'});
|
||||
String extension = fileparts[fileparts.length - 1];
|
||||
ImageFormat fmt = ImageFormat.get_Bmp();
|
||||
if (extension.equalsIgnoreCase("gif")) { fmt = ImageFormat.get_Gif(); }
|
||||
else if (extension.equalsIgnoreCase("jpg") || extension.equalsIgnoreCase("jpeg")) { fmt = ImageFormat.get_Jpeg(); }
|
||||
else if (extension.equalsIgnoreCase("png")) { fmt = ImageFormat.get_Png(); }
|
||||
|
||||
output.Save(filename, fmt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Goes through the image and extracts frames from it.
|
||||
*/
|
||||
public void fillFrameset(Frameset frameSet, Bitmap source)
|
||||
{
|
||||
//Initialize the control colors:
|
||||
ControlColors colors = new ControlColors(source);
|
||||
|
||||
//Find frame bounds.
|
||||
IList v_bounds = findVerticalBounds(source, colors);
|
||||
IList h_bounds = findHorizontalBounds(source, colors);
|
||||
|
||||
//Make rectangles that denote the bounds:
|
||||
IList rectangles = boundsToRectangles(h_bounds, v_bounds);
|
||||
IEnumerator i = rectangles.GetEnumerator();
|
||||
while (i.MoveNext())
|
||||
{
|
||||
Rectangle r = (Rectangle) i.get_Current();
|
||||
Rectangle realBounds = findRealBounds(source, colors, r);
|
||||
//if (realBounds.get_IsEmpty()) { continue; }
|
||||
if (realBounds.get_Width() < 1 || realBounds.get_Height() < 1) { continue; }
|
||||
|
||||
Point anchor = findAnchor(source, colors, r);
|
||||
|
||||
//Adjust anchor coordinates to the current frame reference:
|
||||
anchor.set_X(anchor.get_X() - realBounds.get_X());
|
||||
anchor.set_Y(anchor.get_Y() - realBounds.get_Y());
|
||||
|
||||
Bitmap frame = extractFrame(source, colors, realBounds);
|
||||
frame.MakeTransparent(colors.bound);
|
||||
|
||||
frameSet.addFrame(frame, anchor);
|
||||
}
|
||||
}
|
||||
|
||||
private IList findVerticalBounds(Bitmap source, ControlColors colors)
|
||||
{
|
||||
IList result = new ArrayList();
|
||||
|
||||
int width = source.get_Width();
|
||||
int index = 0;
|
||||
|
||||
while (index < width)
|
||||
{
|
||||
index = firstHorizontalInstance(source, colors.bound, index, width, 0);
|
||||
result.Add(new Integer(index));
|
||||
index++;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private IList findHorizontalBounds(Bitmap source, ControlColors colors)
|
||||
{
|
||||
IList result = new ArrayList();
|
||||
|
||||
int height = source.get_Height();
|
||||
int index = 0;
|
||||
|
||||
while (index < height)
|
||||
{
|
||||
index = firstVerticalInstance(source, colors.bound, index, height, 0);
|
||||
result.Add(new Integer(index));
|
||||
index++;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Goes through the y-th row of the image, looking at x from start to stop, exclusive, and returns the first instance of color c, or stop if there is no such color in the row in the range.
|
||||
*/
|
||||
private int firstHorizontalInstance(Bitmap source, Color c, int start, int stop, int y)
|
||||
{
|
||||
int index = 0;
|
||||
for (index = start; index < stop; index++)
|
||||
{
|
||||
if (source.GetPixel(index, y).Equals(c))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Goes through the x-th column of the image, looking at y from start to stop, exclusive, and returns the first instance of color c, or stop if there is no such color in the column in the range.
|
||||
*/
|
||||
private int firstVerticalInstance(Bitmap source, Color c, int start, int stop, int x)
|
||||
{
|
||||
int index = 0;
|
||||
for (index = start; index < stop; index++)
|
||||
{
|
||||
if (source.GetPixel(x, index).Equals(c))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
private IList boundsToRectangles(IList horizontal, IList vertical)
|
||||
{
|
||||
IList result = new ArrayList();
|
||||
|
||||
for (int row = 0; row < horizontal.get_Count() - 1; row ++)
|
||||
{
|
||||
for (int col = 0; col < vertical.get_Count() - 1; col ++)
|
||||
{
|
||||
int left = ((Integer) vertical.get_Item(col)).intValue();
|
||||
int right = ((Integer) vertical.get_Item(col + 1)).intValue();
|
||||
int top = ((Integer) horizontal.get_Item(row)).intValue();
|
||||
int bottom = ((Integer) horizontal.get_Item(row + 1)).intValue();
|
||||
|
||||
result.Add(new Rectangle(left, top, right - left, bottom - top));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private Point findAnchor(Bitmap source, ControlColors colors, Rectangle reference)
|
||||
{
|
||||
int x = firstHorizontalInstance(source, colors.anchor, reference.get_Left(), reference.get_Right(), reference.get_Top());
|
||||
int y = firstVerticalInstance(source, colors.anchor, reference.get_Top(), reference.get_Bottom(), reference.get_Left());
|
||||
|
||||
return new Point(x, y);
|
||||
}
|
||||
|
||||
private Bitmap extractFrame(Bitmap source, ControlColors colors, Rectangle reference)
|
||||
{
|
||||
//Make new result image:
|
||||
Bitmap result = new Bitmap(reference.get_Width(), reference.get_Height());
|
||||
|
||||
//Make graphics so we can render onto the image:
|
||||
Graphics g = Graphics.FromImage(result);
|
||||
|
||||
//Render:
|
||||
g.DrawImage(
|
||||
source,
|
||||
new Rectangle(0, 0, reference.get_Width(), reference.get_Height()),
|
||||
reference,
|
||||
GraphicsUnit.Pixel
|
||||
);
|
||||
// g.DrawImage(source, -reference.get_X(), -reference.get_Y(), reference.get_Width(), reference.get_Height());
|
||||
// DrawImage(source, -reference.get_X(), -reference.get_Y());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private Rectangle findRealBounds(Bitmap source, ControlColors colors, Rectangle reference)
|
||||
{
|
||||
int left = firstHorizontalInstance(source, colors.inside, reference.get_Left(), reference.get_Right(), reference.get_Top());
|
||||
int top = firstVerticalInstance(source, colors.inside, reference.get_Top(), reference.get_Bottom(), reference.get_Left());
|
||||
int right = firstHorizontalInstance(source, colors.outside, left, reference.get_Right(), reference.get_Top());
|
||||
int bottom = firstVerticalInstance(source, colors.outside, top, reference.get_Bottom(), reference.get_Left());
|
||||
|
||||
return new Rectangle(left, top, right - left, bottom - top);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is just a little struct-like thing to simplify passing around the control colors.
|
||||
*/
|
||||
private class ControlColors
|
||||
{
|
||||
public Color bound;
|
||||
public Color inside;
|
||||
public Color anchor;
|
||||
public Color outside;
|
||||
|
||||
public ControlColors(Bitmap img)
|
||||
{
|
||||
int width = img.get_Width();
|
||||
|
||||
bound = img.GetPixel(width - 1, 0);
|
||||
inside = img.GetPixel(width - 1, 1);
|
||||
anchor = img.GetPixel(width - 1, 2);
|
||||
outside = img.GetPixel(width - 1, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package Icarus.Graphics.Animation;
|
||||
|
||||
import System.Drawing.*;
|
||||
import System.Drawing.Imaging.*;
|
||||
import System.IO.*;
|
||||
|
||||
/**
|
||||
* This frameset provider simply goes through the frames of an animated image and adds them to the frameset. Basically, this one is good for things like animated GIFs.
|
||||
*
|
||||
* @author $Author: asskoala $
|
||||
* @version $Revision: 1.1 $ $Date: 2005/12/11 21:07:21 $
|
||||
*/
|
||||
public class SimpleFramesetProvider implements IFramesetProvider
|
||||
{
|
||||
/**
|
||||
* Goes through the image and extracts frames from it.
|
||||
*/
|
||||
public void fillFrameset(Frameset frameSet, Bitmap source)
|
||||
{
|
||||
//Get frame count:
|
||||
FrameDimension fd = new FrameDimension(source.get_FrameDimensionsList()[0]);
|
||||
int frameCount = source.GetFrameCount(fd.get_Time());
|
||||
|
||||
//Save the frames:
|
||||
for (int i = 0; i < frameCount; i++)
|
||||
{
|
||||
MemoryStream stream = new MemoryStream();
|
||||
|
||||
source.SelectActiveFrame(fd, i);
|
||||
source.Save(stream, ImageFormat.get_Bmp());
|
||||
|
||||
frameSet.addFrame(((Bitmap) Bitmap.FromStream(stream)), new Point(0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Exports the frame as an animated gif.
|
||||
*/
|
||||
public void exportFrameset(Frameset frameset, String filename) throws System.Exception
|
||||
{
|
||||
throw new System.NotImplementedException("Sorry, but at this point, .NET cannot generate animated GIFs. Please try one of the other Frameset Providers.");
|
||||
}
|
||||
}
|
||||
66
trunk/src/Icarus/Graphics/Animation/TiledFrame.jsl
Normal file
66
trunk/src/Icarus/Graphics/Animation/TiledFrame.jsl
Normal file
@@ -0,0 +1,66 @@
|
||||
package Icarus.Graphics.Animation;
|
||||
|
||||
import System.Drawing.Rectangle;
|
||||
import System.Drawing.Size;
|
||||
|
||||
/**
|
||||
* This thingey will render and grid of child renderables, where the count of the renderables depends on the GridSize property.
|
||||
*/
|
||||
public class TiledFrame extends AbstractRenderable
|
||||
{
|
||||
/**
|
||||
* The size of the tiled frame. Basically, this is the number of times the frame will be tiled.
|
||||
*/
|
||||
private Size mGridSize;
|
||||
|
||||
/**
|
||||
* This is the renderable that will be tiled.
|
||||
*/
|
||||
private IRenderable mChildRenderable;
|
||||
|
||||
/** @property */
|
||||
public Size get_GridSize() { return mGridSize; }
|
||||
/** @property */
|
||||
public void set_GridSize(Size v) { mGridSize = v; }
|
||||
|
||||
/** @property */
|
||||
public IRenderable get_ChildRenderable() { return mChildRenderable; }
|
||||
/** @property */
|
||||
public void set_ChildRenderable(IRenderable v) { mChildRenderable = v; }
|
||||
|
||||
/**
|
||||
* Returns the size of the renderable.
|
||||
*/
|
||||
public Size GetSize()
|
||||
{
|
||||
Size result = this.get_ChildRenderable().GetSize();
|
||||
result.set_Width(result.get_Width() * this.get_GridSize().get_Width());
|
||||
result.set_Height(result.get_Height() * this.get_GridSize().get_Height());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the thing. Note that the destination parameter can be used to specify clipping. The size of the rectangle can be empty, in which case no clipping will be applied.
|
||||
*/
|
||||
public void Render(Rectangle destination, IRenderParameters parameters)
|
||||
{
|
||||
for (int r = 0; r < this.get_GridSize().get_Height(); r++)
|
||||
{
|
||||
int yoffset = this.get_ChildRenderable().GetSize().get_Height() * r;
|
||||
destination.set_Y(destination.get_Y() + yoffset);
|
||||
|
||||
for (int c = 0; c < this.get_GridSize().get_Width(); c++)
|
||||
{
|
||||
int xoffset = this.get_ChildRenderable().GetSize().get_Width() * c;
|
||||
destination.set_X(destination.get_X() + xoffset);
|
||||
|
||||
this.get_ChildRenderable().Render(destination, parameters);
|
||||
|
||||
destination.set_X(destination.get_X() - xoffset);
|
||||
}
|
||||
|
||||
destination.set_Y(destination.get_Y() - yoffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
58
trunk/src/Icarus/Graphics/AssemblyInfo.jsl
Normal file
58
trunk/src/Icarus/Graphics/AssemblyInfo.jsl
Normal file
@@ -0,0 +1,58 @@
|
||||
import System.Reflection.*;
|
||||
import System.Runtime.CompilerServices.*;
|
||||
|
||||
//
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
//
|
||||
/** @assembly AssemblyTitle("") */
|
||||
/** @assembly AssemblyDescription("") */
|
||||
/** @assembly AssemblyConfiguration("") */
|
||||
/** @assembly AssemblyCompany("") */
|
||||
/** @assembly AssemblyProduct("") */
|
||||
/** @assembly AssemblyCopyright("") */
|
||||
/** @assembly AssemblyTrademark("") */
|
||||
/** @assembly AssemblyCulture("") */
|
||||
|
||||
//
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build
|
||||
// Numbers by using the '*' as shown below:
|
||||
|
||||
/** @assembly AssemblyVersion("1.0.*") */
|
||||
|
||||
//
|
||||
// In order to sign your assembly you must specify a key to use. Refer to the
|
||||
// Microsoft .NET Framework documentation for more information on assembly signing.
|
||||
//
|
||||
// Use the attributes below to control which key is used for signing.
|
||||
//
|
||||
// Notes:
|
||||
// (*) If no key is specified, the assembly is not signed.
|
||||
// (*) KeyName refers to a key that has been installed in the Crypto Service
|
||||
// Provider (CSP) on your machine. KeyFile refers to a file which contains
|
||||
// a key.
|
||||
// (*) If the KeyFile and the KeyName values are both specified, the
|
||||
// following processing occurs:
|
||||
// (1) If the KeyName can be found in the CSP, that key is used.
|
||||
// (2) If the KeyName does not exist and the KeyFile does exist, the key
|
||||
// in the KeyFile is installed into the CSP and used.
|
||||
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
|
||||
// When specifying the KeyFile, the location of the KeyFile should be
|
||||
// relative to the project directory. For example, if your KeyFile is
|
||||
// located in the project directory itself, you would specify the
|
||||
// AssemblyKeyFile attribute as @assembly AssemblyKeyFile("mykey.snk")
|
||||
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
|
||||
// documentation for more information on this.
|
||||
//
|
||||
|
||||
/** @assembly AssemblyDelaySign(false) */
|
||||
/** @assembly AssemblyKeyFile("") */
|
||||
/** @assembly AssemblyKeyName("") */
|
||||
BIN
trunk/src/Icarus/Graphics/bin/Debug/Icarus.Animation.dll
Normal file
BIN
trunk/src/Icarus/Graphics/bin/Debug/Icarus.Animation.dll
Normal file
Binary file not shown.
BIN
trunk/src/Icarus/Graphics/bin/Debug/Icarus.Animation.pdb
Normal file
BIN
trunk/src/Icarus/Graphics/bin/Debug/Icarus.Animation.pdb
Normal file
Binary file not shown.
BIN
trunk/src/Icarus/Graphics/bin/Debug/Icarus.Resources.dll
Normal file
BIN
trunk/src/Icarus/Graphics/bin/Debug/Icarus.Resources.dll
Normal file
Binary file not shown.
BIN
trunk/src/Icarus/Graphics/bin/Release/Icarus.Animation.dll
Normal file
BIN
trunk/src/Icarus/Graphics/bin/Release/Icarus.Animation.dll
Normal file
Binary file not shown.
BIN
trunk/src/Icarus/Graphics/bin/Release/Icarus.Resources.dll
Normal file
BIN
trunk/src/Icarus/Graphics/bin/Release/Icarus.Resources.dll
Normal file
Binary file not shown.
207
trunk/src/Icarus/Graphics/bin/Release/Resources.xml
Normal file
207
trunk/src/Icarus/Graphics/bin/Release/Resources.xml
Normal file
@@ -0,0 +1,207 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>Icarus.Resources</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:Icarus.Resources.ConfigParser">
|
||||
<summary>
|
||||
The Config Parser will parse a config file of the following format:
|
||||
|
||||
# This is a comment
|
||||
variable: value
|
||||
variable: value
|
||||
variable: value
|
||||
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Resources.ConfigParser.#ctor(System.String)">
|
||||
<summary>
|
||||
Generate a new ConfigParser
|
||||
</summary>
|
||||
<param name="fileName">The configuration file to parse</param>
|
||||
</member>
|
||||
<member name="M:Icarus.Resources.ConfigParser.ParseConfigFile(System.String)">
|
||||
<summary>
|
||||
Parses the configuration file.
|
||||
</summary>
|
||||
<param name="filename"></param>
|
||||
</member>
|
||||
<member name="M:Icarus.Resources.ConfigParser.nextVcombo(System.IO.StreamReader)">
|
||||
<summary>
|
||||
Retrieve the next Vcombo object
|
||||
</summary>
|
||||
<returns>The next Vcombo, null if there is none</returns>
|
||||
</member>
|
||||
<member name="M:Icarus.Resources.ConfigParser.nextLine(System.IO.StreamReader)">
|
||||
<summary>
|
||||
Retrieve the next line, automagically skips the comments
|
||||
</summary>
|
||||
<returns>The next non-comment line, null if there is none</returns>
|
||||
</member>
|
||||
<member name="P:Icarus.Resources.ConfigParser.Item(System.String)">
|
||||
<summary>
|
||||
Gets or sets configuration properties.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Icarus.Resources.ConfigParser.Vcombo">
|
||||
<summary>
|
||||
This stores a variable/value combination as generated by
|
||||
the ConfigParser class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Resources.ConfigParser.Vcombo.#ctor(System.String,System.String)">
|
||||
<summary>
|
||||
Generate a new Vcombo with fields as defined
|
||||
in the parameter list
|
||||
</summary>
|
||||
<param name="name">The variable name</param>
|
||||
<param name="val">The variable value</param>
|
||||
</member>
|
||||
<member name="P:Icarus.Resources.ConfigParser.Vcombo.Name">
|
||||
<summary>
|
||||
This stores the variable name in string Representaton
|
||||
|
||||
The variable name is everything before the first ":"
|
||||
|
||||
Example:
|
||||
Stinkyness: -50
|
||||
|
||||
Variable is the string "Strinkyness"
|
||||
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Resources.ConfigParser.Vcombo.Value">
|
||||
<summary>
|
||||
The value of the variable in a string Representation
|
||||
|
||||
This contains everything after the first ":" not including
|
||||
whitespace.
|
||||
|
||||
Example:
|
||||
Stinkyness:-50
|
||||
Stinkyness: -50
|
||||
Stinkyness: -50
|
||||
|
||||
All have a value of the string "-50"
|
||||
|
||||
Example:
|
||||
PATH: C:\My Stuff\Video Games\SuperCool
|
||||
|
||||
Has a value of the string: "C:\My Stuff\Video Games\SuperCool"
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Icarus.Resources.ResourceManager">
|
||||
<summary>
|
||||
The resource manager class gives us a central repository of paths that the application needs to access its assets, like graphics, sounds, etc.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Resources.ResourceManager.mg_Instance">
|
||||
<summary>
|
||||
Singleton Implementation.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Resources.ResourceManager.#ctor">
|
||||
<summary>
|
||||
Singleton Implementation.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Resources.ResourceManager.m_BasePath">
|
||||
<summary>
|
||||
The base path of the application.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Resources.ResourceManager.m_ImageDirName">
|
||||
<summary>
|
||||
The name of the directory, relative to the base path, where the images reside.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Resources.ResourceManager.m_LevelDirName">
|
||||
<summary>
|
||||
The name of the directory, relative to the base path, where the levels reside.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Resources.ResourceManager.m_MusicDirName">
|
||||
<summary>
|
||||
The name of the directory, relative to the base path, where the music resides.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Resources.ResourceManager.m_TextDirName">
|
||||
<summary>
|
||||
The name of the directory, relative to the base path, where the text files reside.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Resources.ResourceManager.m_SoundDirName">
|
||||
<summary>
|
||||
The name of the directory, relative to the base path, where the sound files reside.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Resources.ResourceManager.GetRandomSoundFrom(System.String)">
|
||||
<summary>
|
||||
Gets a random sound from the directory whose id is passed in.
|
||||
</summary>
|
||||
<param name="dirId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="P:Icarus.Resources.ResourceManager.Instance">
|
||||
<summary>
|
||||
Singleton Implementation.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Resources.ResourceManager.BasePath">
|
||||
<summary>
|
||||
Returns the base path for all the resources. By default, the base path is the directory from which the application is launched.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Resources.ResourceManager.ImageDirName">
|
||||
<summary>
|
||||
Gets or sets the name of the directory, relative to the base path, where the images reside.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Resources.ResourceManager.LevelDirName">
|
||||
<summary>
|
||||
Gets or sets the name of the directory, relative to the base path, where the levels reside.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Resources.ResourceManager.MusicDirName">
|
||||
<summary>
|
||||
Gets or sets the name of the directory, relative to the base path, where the music resides.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Resources.ResourceManager.TextDirName">
|
||||
<summary>
|
||||
Gets or sets the name of the directory, relative to the base path, where the text files reside.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Resources.ResourceManager.SoundDirName">
|
||||
<summary>
|
||||
Gets or sets the name of the directory, relative to the base path, where the sound files reside.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Resources.ResourceManager.ImagePath">
|
||||
<summary>
|
||||
Gets the full path to the image directory.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Resources.ResourceManager.LevelPath">
|
||||
<summary>
|
||||
Gets the full path to the levels directory.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Resources.ResourceManager.MusicPath">
|
||||
<summary>
|
||||
Gets the full path to the music directory.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Resources.ResourceManager.SoundPath">
|
||||
<summary>
|
||||
Gets the full path to the sound directory.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Resources.ResourceManager.TextPath">
|
||||
<summary>
|
||||
Gets the full path to the text directory.
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
BIN
trunk/src/Icarus/Graphics/obj/Debug/Animation.vjsprojdata
Normal file
BIN
trunk/src/Icarus/Graphics/obj/Debug/Animation.vjsprojdata
Normal file
Binary file not shown.
BIN
trunk/src/Icarus/Graphics/obj/Debug/Animation.vjsprojdata1
Normal file
BIN
trunk/src/Icarus/Graphics/obj/Debug/Animation.vjsprojdata1
Normal file
Binary file not shown.
BIN
trunk/src/Icarus/Graphics/obj/Debug/Icarus.Animation.dll
Normal file
BIN
trunk/src/Icarus/Graphics/obj/Debug/Icarus.Animation.dll
Normal file
Binary file not shown.
BIN
trunk/src/Icarus/Graphics/obj/Debug/Icarus.Animation.pdb
Normal file
BIN
trunk/src/Icarus/Graphics/obj/Debug/Icarus.Animation.pdb
Normal file
Binary file not shown.
BIN
trunk/src/Icarus/Graphics/obj/Release/Animation.vjsprojdata
Normal file
BIN
trunk/src/Icarus/Graphics/obj/Release/Animation.vjsprojdata
Normal file
Binary file not shown.
BIN
trunk/src/Icarus/Graphics/obj/Release/Icarus.Animation.dll
Normal file
BIN
trunk/src/Icarus/Graphics/obj/Release/Icarus.Animation.dll
Normal file
Binary file not shown.
BIN
trunk/src/Icarus/Input/App.ico
Normal file
BIN
trunk/src/Icarus/Input/App.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
58
trunk/src/Icarus/Input/AssemblyInfo.cs
Normal file
58
trunk/src/Icarus/Input/AssemblyInfo.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
//
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
//
|
||||
[assembly: AssemblyTitle("")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
//
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
//
|
||||
// In order to sign your assembly you must specify a key to use. Refer to the
|
||||
// Microsoft .NET Framework documentation for more information on assembly signing.
|
||||
//
|
||||
// Use the attributes below to control which key is used for signing.
|
||||
//
|
||||
// Notes:
|
||||
// (*) If no key is specified, the assembly is not signed.
|
||||
// (*) KeyName refers to a key that has been installed in the Crypto Service
|
||||
// Provider (CSP) on your machine. KeyFile refers to a file which contains
|
||||
// a key.
|
||||
// (*) If the KeyFile and the KeyName values are both specified, the
|
||||
// following processing occurs:
|
||||
// (1) If the KeyName can be found in the CSP, that key is used.
|
||||
// (2) If the KeyName does not exist and the KeyFile does exist, the key
|
||||
// in the KeyFile is installed into the CSP and used.
|
||||
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
|
||||
// When specifying the KeyFile, the location of the KeyFile should be
|
||||
// relative to the project output directory which is
|
||||
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
|
||||
// located in the project directory, you would specify the AssemblyKeyFile
|
||||
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
|
||||
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
|
||||
// documentation for more information on this.
|
||||
//
|
||||
[assembly: AssemblyDelaySign(false)]
|
||||
[assembly: AssemblyKeyFile("")]
|
||||
[assembly: AssemblyKeyName("")]
|
||||
49
trunk/src/Icarus/Input/BoundAction.cs
Normal file
49
trunk/src/Icarus/Input/BoundAction.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
|
||||
namespace Icarus.Input {
|
||||
/// <summary>
|
||||
/// BoundAction is an action associated with a given
|
||||
/// key or button on an input device.
|
||||
/// </summary>
|
||||
public class BoundAction {
|
||||
#region Instance Variables
|
||||
/// <summary>
|
||||
/// Name of the button or key this bound action will be applied to.
|
||||
/// </summary>
|
||||
private string keyname = null;
|
||||
/// <summary>
|
||||
/// The action to be done when the button or key is pressed.
|
||||
/// </summary>
|
||||
private string action = null;
|
||||
#endregion
|
||||
|
||||
#region Initialization
|
||||
/// <summary>
|
||||
/// Constructor for a BoundAction.
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the button or key to be mapped.</param>
|
||||
/// <param name="boundAction">Action to be assigned to the given key.</param>
|
||||
public BoundAction(string name, string boundAction) {
|
||||
keyname = name;
|
||||
action = boundAction;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Accessors/Modifiers
|
||||
/// <summary>
|
||||
/// Accessor for keyname.
|
||||
/// </summary>
|
||||
public string gs_keyname {
|
||||
get { return keyname; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Accessor/Modifer for action.
|
||||
/// </summary>
|
||||
public string gs_action {
|
||||
get { return action; }
|
||||
set { action = value; }
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
84
trunk/src/Icarus/Input/ButtonEvents/ButtonPressEvent.cs
Normal file
84
trunk/src/Icarus/Input/ButtonEvents/ButtonPressEvent.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
using System;
|
||||
|
||||
namespace Icarus.Input.ButtonEvents {
|
||||
|
||||
/// <summary>
|
||||
/// Stores event information for when a button is pressed on a device.
|
||||
/// </summary>
|
||||
public class ButtonPressEvent {
|
||||
|
||||
#region Instance Variables
|
||||
/// <summary>
|
||||
/// Name of the button or key that was pressed.
|
||||
/// </summary>
|
||||
private string buttonName = string.Empty;
|
||||
/// <summary>
|
||||
/// Initial button state for when a button or key has been pressed.
|
||||
/// </summary>
|
||||
private bool buttonPressed = false;
|
||||
/// <summary>
|
||||
/// Button state for when a button has been depressed and held down.
|
||||
/// </summary>
|
||||
private bool buttonDown = false;
|
||||
/// <summary>
|
||||
/// Final button state for when a button has been released.
|
||||
/// </summary>
|
||||
private bool buttonReleased = false;
|
||||
#endregion
|
||||
|
||||
#region Accessors and Modifiers
|
||||
/// <summary>
|
||||
/// The name of the button or key that was pressed.
|
||||
/// </summary>
|
||||
public string Name {
|
||||
get { return buttonName; }
|
||||
set { buttonName = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not the button or key was just pressed.
|
||||
/// </summary>
|
||||
public bool Pressed {
|
||||
get { return buttonPressed; }
|
||||
set { buttonPressed = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not the button or key is being held down.
|
||||
/// </summary>
|
||||
public bool Down {
|
||||
get { return buttonDown; }
|
||||
set { buttonDown = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not the button or key was just released.
|
||||
/// </summary>
|
||||
public bool Released {
|
||||
get { return buttonReleased; }
|
||||
set { buttonReleased = value; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region General Use
|
||||
/// <summary>
|
||||
/// Overridden string representation of this object.
|
||||
/// </summary>
|
||||
/// <returns>String representation of this object.</returns>
|
||||
public override string ToString() {
|
||||
string state = string.Empty;
|
||||
|
||||
if (buttonPressed) {
|
||||
state = "Pressed";
|
||||
} else if (buttonDown) {
|
||||
state = "Down";
|
||||
} else if (buttonReleased) {
|
||||
state = "Released";
|
||||
}
|
||||
|
||||
return buttonName + " " + state;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
|
||||
namespace Icarus.Input.ButtonEvents {
|
||||
|
||||
/// <summary>
|
||||
/// Stores event information for when a button is pressed on a joystick.
|
||||
/// </summary>
|
||||
public class JoystickButtonPressEvent : ButtonPressEvent {
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new JoystickButtonPressEvent.
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the joystick button that was pressed.</param>
|
||||
/// <param name="pressed">Whether or not this button was just pressed.</param>
|
||||
/// <param name="down">Whether or not this button is being held down.</param>
|
||||
/// <param name="released">Whether or not this button was just released.</param>
|
||||
public JoystickButtonPressEvent(string name, bool pressed, bool down, bool released) {
|
||||
this.Name = name;
|
||||
this.Pressed = pressed;
|
||||
this.Down = down;
|
||||
this.Released = released;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
|
||||
namespace Icarus.Input.ButtonEvents {
|
||||
|
||||
/// <summary>
|
||||
/// Stores event information for when a key is pressed on a keyboard.
|
||||
/// </summary>
|
||||
public class KeyboardButtonPressEvent : ButtonPressEvent {
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new KeyboardButtonPressEvent.
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the keyboard key that was pressed.</param>
|
||||
/// <param name="pressed">Whether or not this key was just pressed.</param>
|
||||
/// <param name="down">Whether or not this key is being held down.</param>
|
||||
/// <param name="released">Whether or not this key was just released.</param>
|
||||
public KeyboardButtonPressEvent(string name, bool pressed, bool down, bool released) {
|
||||
this.Name = name;
|
||||
this.Pressed = pressed;
|
||||
this.Down = down;
|
||||
this.Released = released;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
24
trunk/src/Icarus/Input/ButtonEvents/MouseButtonPressEvent.cs
Normal file
24
trunk/src/Icarus/Input/ButtonEvents/MouseButtonPressEvent.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
|
||||
namespace Icarus.Input.ButtonEvents {
|
||||
|
||||
/// <summary>
|
||||
/// Stores event information for when a button is pressed on a mouse.
|
||||
/// </summary>
|
||||
public class MouseButtonPressEvent : ButtonPressEvent {
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new MouseButtonPressEvent.
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the mouse button that was pressed.</param>
|
||||
/// <param name="pressed">Whether or not this button was just pressed.</param>
|
||||
/// <param name="down">Whether or not this button is being held down.</param>
|
||||
/// <param name="released">Whether or not this button was just released.</param>
|
||||
public MouseButtonPressEvent(string name, bool pressed, bool down, bool released) {
|
||||
this.Name = name;
|
||||
this.Pressed = pressed;
|
||||
this.Down = down;
|
||||
this.Released = released;
|
||||
}
|
||||
}
|
||||
}
|
||||
186
trunk/src/Icarus/Input/Input.csproj
Normal file
186
trunk/src/Icarus/Input/Input.csproj
Normal file
@@ -0,0 +1,186 @@
|
||||
<VisualStudioProject>
|
||||
<CSHARP
|
||||
ProjectType = "Local"
|
||||
ProductVersion = "7.10.3077"
|
||||
SchemaVersion = "2.0"
|
||||
ProjectGuid = "{7BAAA06F-5B67-417E-9A36-26C5C6EB931C}"
|
||||
>
|
||||
<Build>
|
||||
<Settings
|
||||
ApplicationIcon = "App.ico"
|
||||
AssemblyKeyContainerName = ""
|
||||
AssemblyName = "Icarus.Input"
|
||||
AssemblyOriginatorKeyFile = ""
|
||||
DefaultClientScript = "JScript"
|
||||
DefaultHTMLPageLayout = "Grid"
|
||||
DefaultTargetSchema = "IE50"
|
||||
DelaySign = "false"
|
||||
OutputType = "Library"
|
||||
PreBuildEvent = ""
|
||||
PostBuildEvent = ""
|
||||
RootNamespace = "Input"
|
||||
RunPostBuildEvent = "OnBuildSuccess"
|
||||
StartupObject = ""
|
||||
>
|
||||
<Config
|
||||
Name = "Debug"
|
||||
AllowUnsafeBlocks = "false"
|
||||
BaseAddress = "285212672"
|
||||
CheckForOverflowUnderflow = "false"
|
||||
ConfigurationOverrideFile = ""
|
||||
DefineConstants = "DEBUG;TRACE"
|
||||
DocumentationFile = ""
|
||||
DebugSymbols = "true"
|
||||
FileAlignment = "4096"
|
||||
IncrementalBuild = "false"
|
||||
NoStdLib = "false"
|
||||
NoWarn = ""
|
||||
Optimize = "false"
|
||||
OutputPath = "bin\Debug\"
|
||||
RegisterForComInterop = "false"
|
||||
RemoveIntegerChecks = "false"
|
||||
TreatWarningsAsErrors = "false"
|
||||
WarningLevel = "4"
|
||||
/>
|
||||
<Config
|
||||
Name = "Release"
|
||||
AllowUnsafeBlocks = "false"
|
||||
BaseAddress = "285212672"
|
||||
CheckForOverflowUnderflow = "false"
|
||||
ConfigurationOverrideFile = ""
|
||||
DefineConstants = "TRACE"
|
||||
DocumentationFile = "Input.xml"
|
||||
DebugSymbols = "false"
|
||||
FileAlignment = "4096"
|
||||
IncrementalBuild = "false"
|
||||
NoStdLib = "false"
|
||||
NoWarn = ""
|
||||
Optimize = "true"
|
||||
OutputPath = "bin\Release\"
|
||||
RegisterForComInterop = "false"
|
||||
RemoveIntegerChecks = "false"
|
||||
TreatWarningsAsErrors = "false"
|
||||
WarningLevel = "4"
|
||||
/>
|
||||
</Settings>
|
||||
<References>
|
||||
<Reference
|
||||
Name = "System"
|
||||
AssemblyName = "System"
|
||||
HintPath = "D:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.Data"
|
||||
AssemblyName = "System.Data"
|
||||
HintPath = "D:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.XML"
|
||||
AssemblyName = "System.Xml"
|
||||
HintPath = "D:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.Drawing"
|
||||
AssemblyName = "System.Drawing"
|
||||
HintPath = "D:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Drawing.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.Windows.Forms"
|
||||
AssemblyName = "System.Windows.Forms"
|
||||
HintPath = "D:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Windows.Forms.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "Microsoft.DirectX"
|
||||
AssemblyName = "Microsoft.DirectX"
|
||||
HintPath = "D:\WINDOWS\Microsoft.NET\Managed DirectX\v9.02.2904\Microsoft.DirectX.dll"
|
||||
AssemblyFolderKey = "hklm\current managed directx 9.2"
|
||||
/>
|
||||
<Reference
|
||||
Name = "Microsoft.DirectX.DirectInput"
|
||||
AssemblyName = "Microsoft.DirectX.DirectInput"
|
||||
HintPath = "D:\WINDOWS\Microsoft.NET\Managed DirectX\v9.02.2904\Microsoft.DirectX.DirectInput.dll"
|
||||
AssemblyFolderKey = "hklm\current managed directx 9.2"
|
||||
/>
|
||||
</References>
|
||||
</Build>
|
||||
<Files>
|
||||
<Include>
|
||||
<File
|
||||
RelPath = "App.ico"
|
||||
BuildAction = "Content"
|
||||
/>
|
||||
<File
|
||||
RelPath = "AssemblyInfo.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "BoundAction.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "InputEngine.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "InputSettings.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "InputTester.cs"
|
||||
SubType = "Form"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "InputTester.resx"
|
||||
DependentUpon = "InputTester.cs"
|
||||
BuildAction = "EmbeddedResource"
|
||||
/>
|
||||
<File
|
||||
RelPath = "QueueEventSorter.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "ButtonEvents\ButtonPressEvent.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "ButtonEvents\JoystickButtonPressEvent.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "ButtonEvents\KeyboardButtonPressEvent.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "ButtonEvents\MouseButtonPressEvent.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "MovementEvents\JoystickMovementEvent.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "MovementEvents\MouseMovementEvent.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "MovementEvents\MovementEvent.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
</Include>
|
||||
</Files>
|
||||
</CSHARP>
|
||||
</VisualStudioProject>
|
||||
|
||||
48
trunk/src/Icarus/Input/Input.csproj.user
Normal file
48
trunk/src/Icarus/Input/Input.csproj.user
Normal file
@@ -0,0 +1,48 @@
|
||||
<VisualStudioProject>
|
||||
<CSHARP LastOpenVersion = "7.10.3077" >
|
||||
<Build>
|
||||
<Settings ReferencePath = "" >
|
||||
<Config
|
||||
Name = "Debug"
|
||||
EnableASPDebugging = "false"
|
||||
EnableASPXDebugging = "false"
|
||||
EnableUnmanagedDebugging = "false"
|
||||
EnableSQLServerDebugging = "false"
|
||||
RemoteDebugEnabled = "false"
|
||||
RemoteDebugMachine = ""
|
||||
StartAction = "Project"
|
||||
StartArguments = ""
|
||||
StartPage = ""
|
||||
StartProgram = ""
|
||||
StartURL = ""
|
||||
StartWorkingDirectory = ""
|
||||
StartWithIE = "false"
|
||||
/>
|
||||
<Config
|
||||
Name = "Release"
|
||||
EnableASPDebugging = "false"
|
||||
EnableASPXDebugging = "false"
|
||||
EnableUnmanagedDebugging = "false"
|
||||
EnableSQLServerDebugging = "false"
|
||||
RemoteDebugEnabled = "false"
|
||||
RemoteDebugMachine = ""
|
||||
StartAction = "Project"
|
||||
StartArguments = ""
|
||||
StartPage = ""
|
||||
StartProgram = ""
|
||||
StartURL = ""
|
||||
StartWorkingDirectory = ""
|
||||
StartWithIE = "false"
|
||||
/>
|
||||
</Settings>
|
||||
</Build>
|
||||
<OtherProjectSettings
|
||||
CopyProjectDestinationFolder = ""
|
||||
CopyProjectUncPath = ""
|
||||
CopyProjectOption = "0"
|
||||
ProjectView = "ProjectFiles"
|
||||
ProjectTrust = "0"
|
||||
/>
|
||||
</CSHARP>
|
||||
</VisualStudioProject>
|
||||
|
||||
632
trunk/src/Icarus/Input/Input.xml
Normal file
632
trunk/src/Icarus/Input/Input.xml
Normal file
@@ -0,0 +1,632 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>Icarus.Input</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:Icarus.Input.ButtonEvents.ButtonPressEvent">
|
||||
<summary>
|
||||
Stores event information for when a button is pressed on a device.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.ButtonEvents.ButtonPressEvent.buttonName">
|
||||
<summary>
|
||||
Name of the button or key that was pressed.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.ButtonEvents.ButtonPressEvent.buttonPressed">
|
||||
<summary>
|
||||
Initial button state for when a button or key has been pressed.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.ButtonEvents.ButtonPressEvent.buttonDown">
|
||||
<summary>
|
||||
Button state for when a button has been depressed and held down.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.ButtonEvents.ButtonPressEvent.buttonReleased">
|
||||
<summary>
|
||||
Final button state for when a button has been released.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.ButtonEvents.ButtonPressEvent.ToString">
|
||||
<summary>
|
||||
Overridden string representation of this object.
|
||||
</summary>
|
||||
<returns>String representation of this object.</returns>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.ButtonEvents.ButtonPressEvent.Name">
|
||||
<summary>
|
||||
The name of the button or key that was pressed.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.ButtonEvents.ButtonPressEvent.Pressed">
|
||||
<summary>
|
||||
Whether or not the button or key was just pressed.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.ButtonEvents.ButtonPressEvent.Down">
|
||||
<summary>
|
||||
Whether or not the button or key is being held down.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.ButtonEvents.ButtonPressEvent.Released">
|
||||
<summary>
|
||||
Whether or not the button or key was just released.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Icarus.Input.ButtonEvents.JoystickButtonPressEvent">
|
||||
<summary>
|
||||
Stores event information for when a button is pressed on a joystick.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.ButtonEvents.JoystickButtonPressEvent.#ctor(System.String,System.Boolean,System.Boolean,System.Boolean)">
|
||||
<summary>
|
||||
Creates a new JoystickButtonPressEvent.
|
||||
</summary>
|
||||
<param name="name">Name of the joystick button that was pressed.</param>
|
||||
<param name="pressed">Whether or not this button was just pressed.</param>
|
||||
<param name="down">Whether or not this button is being held down.</param>
|
||||
<param name="released">Whether or not this button was just released.</param>
|
||||
</member>
|
||||
<member name="T:Icarus.Input.ButtonEvents.KeyboardButtonPressEvent">
|
||||
<summary>
|
||||
Stores event information for when a key is pressed on a keyboard.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.ButtonEvents.KeyboardButtonPressEvent.#ctor(System.String,System.Boolean,System.Boolean,System.Boolean)">
|
||||
<summary>
|
||||
Creates a new KeyboardButtonPressEvent.
|
||||
</summary>
|
||||
<param name="name">Name of the keyboard key that was pressed.</param>
|
||||
<param name="pressed">Whether or not this key was just pressed.</param>
|
||||
<param name="down">Whether or not this key is being held down.</param>
|
||||
<param name="released">Whether or not this key was just released.</param>
|
||||
</member>
|
||||
<member name="T:Icarus.Input.ButtonEvents.MouseButtonPressEvent">
|
||||
<summary>
|
||||
Stores event information for when a button is pressed on a mouse.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.ButtonEvents.MouseButtonPressEvent.#ctor(System.String,System.Boolean,System.Boolean,System.Boolean)">
|
||||
<summary>
|
||||
Creates a new MouseButtonPressEvent.
|
||||
</summary>
|
||||
<param name="name">Name of the mouse button that was pressed.</param>
|
||||
<param name="pressed">Whether or not this button was just pressed.</param>
|
||||
<param name="down">Whether or not this button is being held down.</param>
|
||||
<param name="released">Whether or not this button was just released.</param>
|
||||
</member>
|
||||
<member name="T:Icarus.Input.MovementEvents.JoystickMovementEvent">
|
||||
<summary>
|
||||
Stores event information for when a joystick is moved.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Icarus.Input.MovementEvents.MovementEvent">
|
||||
<summary>
|
||||
Stores event information for when a device is moved.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.MovementEvents.MovementEvent.deltaX">
|
||||
<summary>
|
||||
The change incurred in the x-direction by the device.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.MovementEvents.MovementEvent.deltaY">
|
||||
<summary>
|
||||
The change incurred in the y-direction by the device.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.MovementEvents.MovementEvent.deltaZ">
|
||||
<summary>
|
||||
The change incurred in the z-direction by the device.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.MovementEvents.MovementEvent.ToString">
|
||||
<summary>
|
||||
Overridden string representation of this object.
|
||||
</summary>
|
||||
<returns>String representation of this object.</returns>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.MovementEvents.MovementEvent.DX">
|
||||
<summary>
|
||||
Delta X. The change in the x-coordinate of the device.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.MovementEvents.MovementEvent.DY">
|
||||
<summary>
|
||||
Delta Y. The change in the y-coordinate of the device.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.MovementEvents.MovementEvent.DZ">
|
||||
<summary>
|
||||
Delta Z. The change in the z-coordinate of the device.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.MovementEvents.JoystickMovementEvent.#ctor(System.Int32,System.Int32,System.Int32)">
|
||||
<summary>
|
||||
Creates a new JoystickMovementEvent.
|
||||
</summary>
|
||||
<param name="dx">Change in the x-coordinate.</param>
|
||||
<param name="dy">Change in the y-coordinate.</param>
|
||||
<param name="dz">Change in the z-coordinate.</param>
|
||||
</member>
|
||||
<member name="T:Icarus.Input.MovementEvents.MouseMovementEvent">
|
||||
<summary>
|
||||
Stores event information for when the mouse is moved.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.MovementEvents.MouseMovementEvent.#ctor(System.Int32,System.Int32,System.Int32)">
|
||||
<summary>
|
||||
Creates a new MouseMovementEvent.
|
||||
</summary>
|
||||
<param name="dx">Change in the x-coordinate.</param>
|
||||
<param name="dy">Change in the y-coordinate.</param>
|
||||
<param name="dz">Change in the z-coordinate.</param>
|
||||
</member>
|
||||
<member name="T:Icarus.Input.BoundAction">
|
||||
<summary>
|
||||
BoundAction is an action associated with a given
|
||||
key or button on an input device.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.BoundAction.keyname">
|
||||
<summary>
|
||||
Name of the button or key this bound action will be applied to.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.BoundAction.action">
|
||||
<summary>
|
||||
The action to be done when the button or key is pressed.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.BoundAction.#ctor(System.String,System.String)">
|
||||
<summary>
|
||||
Constructor for a BoundAction.
|
||||
</summary>
|
||||
<param name="name">Name of the button or key to be mapped.</param>
|
||||
<param name="boundAction">Action to be assigned to the given key.</param>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.BoundAction.gs_keyname">
|
||||
<summary>
|
||||
Accessor for keyname.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.BoundAction.gs_action">
|
||||
<summary>
|
||||
Accessor/Modifer for action.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Icarus.Input.InputEngine">
|
||||
<summary>
|
||||
Summary description for UserInputEngine.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputEngine.settings">
|
||||
<summary>
|
||||
General settings for the Input Engine.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputEngine.controller">
|
||||
<summary>
|
||||
Control Form for devices to be attached to.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputEngine.keyboard">
|
||||
<summary>
|
||||
Keyboard input device.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputEngine.mouse">
|
||||
<summary>
|
||||
Mouse input device.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputEngine.joystick">
|
||||
<summary>
|
||||
Joystick Input device.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputEngine.keyboardEventQueue">
|
||||
<summary>
|
||||
Queue of keyboard events that have yet been processed by the system.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputEngine.mouseEventQueue">
|
||||
<summary>
|
||||
Queue of mouse events that have yet been processed by the system.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputEngine.joystickEventQueue">
|
||||
<summary>
|
||||
Queue of joystick events that have yet been processed by the system.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputEngine.boundKeys">
|
||||
<summary>
|
||||
Array list of all key bindings for the keyboard.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputEngine.boundMouseButtons">
|
||||
<summary>
|
||||
Array list of all button bindings for the mouse.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputEngine.boundJoystickButtons">
|
||||
<summary>
|
||||
Array list of all button bindings for the joystick.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputEngine.listenLoopThread">
|
||||
<summary>
|
||||
Thread that constantly polls for input received.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputEngine.sorter">
|
||||
<summary>
|
||||
Sorts and creates button and movement events and stores them in a queue.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputEngine.instance">
|
||||
<summary>
|
||||
The singleton class instance of this class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.#ctor">
|
||||
<summary>
|
||||
Private singleton constructor.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.Initialize(System.Windows.Forms.Control)">
|
||||
<summary>
|
||||
Initializes and configures the devices, based on the given Controller.
|
||||
</summary>
|
||||
<param name="owner">The Controller Form that owns these devices.</param>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.InitDevices">
|
||||
<summary>
|
||||
Initializes the devices from the system.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.ConfigureDevices">
|
||||
<summary>
|
||||
Configures and acquires the devices for use.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.UpdateDevices">
|
||||
<summary>
|
||||
Updates all devices.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.UpdateKeyboard">
|
||||
<summary>
|
||||
Updates the keyboard event queue based on the actual input to the keyboard.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.UpdateMouse">
|
||||
<summary>
|
||||
Updates the mouse event queue based on the actual input to the mouse.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.UpdateJoystick">
|
||||
<summary>
|
||||
Updates the joystick event queue based on the actual input to the joystick.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.bindKey(System.String,System.String)">
|
||||
<summary>
|
||||
Binds an action to a keyboard key.
|
||||
</summary>
|
||||
<param name="name">Name of the key.</param>
|
||||
<param name="action">Name of the action.</param>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.bindMouseButton(System.String,System.String)">
|
||||
<summary>
|
||||
Binds an action to a mouse button.
|
||||
</summary>
|
||||
<param name="name">Name of the button.</param>
|
||||
<param name="action">Name of the action.</param>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.bindJoystickButton(System.String,System.String)">
|
||||
<summary>
|
||||
Binds an action to a joystick button.
|
||||
</summary>
|
||||
<param name="name">Name of the button.</param>
|
||||
<param name="action">Name of the action.</param>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.makeBinding(System.String,System.String,System.Collections.ArrayList)">
|
||||
<summary>
|
||||
Adds a BoundAction of the given name and action to the given bindingList.
|
||||
</summary>
|
||||
<param name="name">Name of the key/button.</param>
|
||||
<param name="action">Name of the action.</param>
|
||||
<param name="bindingList">List of BoundActions to be added to.</param>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.getKeyAction(System.String)">
|
||||
<summary>
|
||||
Gets the action bound to the specified keyboard key.
|
||||
</summary>
|
||||
<param name="name">Key to get action for.</param>
|
||||
<returns>The action for the key.</returns>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.getKeyAction">
|
||||
<summary>
|
||||
Gets the action bound to the specified keyboard key.
|
||||
</summary>
|
||||
<returns>The action for the key.</returns>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.getMouseButtonAction(System.String)">
|
||||
<summary>
|
||||
Gets the action bound to the specified mouse button.
|
||||
</summary>
|
||||
<param name="name">Button to get action for.</param>
|
||||
<returns>The action for the button.</returns>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.getMouseButtonAction">
|
||||
<summary>
|
||||
Gets the action bound to the specified mouse button.
|
||||
</summary>
|
||||
<returns>The action for the button.</returns>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.getJoystickButtonAction(System.String)">
|
||||
<summary>
|
||||
Gets the action bound to the specified joystick button.
|
||||
</summary>
|
||||
<param name="name">Button to get action for.</param>
|
||||
<returns>The action for the button.</returns>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.getJoystickButtonAction">
|
||||
<summary>
|
||||
Gets the action bound to the specified joystick button.
|
||||
</summary>
|
||||
<returns>The action for the button.</returns>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.getCurrentButtonAction">
|
||||
<summary>
|
||||
Returns the current action.
|
||||
If several input devices are invoked at the same time,
|
||||
first joystick will be chosen, then mouse, then keyboard.
|
||||
</summary>
|
||||
<returns>String value of the action to be performed.</returns>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.getAction(System.String,System.Collections.ArrayList)">
|
||||
<summary>
|
||||
Gets the action bound to the key/button in the given list of BoundActions.
|
||||
</summary>
|
||||
<param name="name">The key/button to get the action for.</param>
|
||||
<param name="bindingList">List of BoundActions to search in.</param>
|
||||
<returns>The action for the key/button.</returns>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.StartListening">
|
||||
<summary>
|
||||
Starts the thread looping and polling for new input on devices.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.StopListening">
|
||||
<summary>
|
||||
Stops the thread from looping and polling for new input on devices
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.LoopAndListen">
|
||||
<summary>
|
||||
Continually updates input information from all devices.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.InputEngine.Instance">
|
||||
<summary>
|
||||
Accessor/Modifier for the singleton class instance.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.InputEngine.KeyboardEventQueue">
|
||||
<summary>
|
||||
The current queue of inputs from the keyboard.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.InputEngine.MouseEventQueue">
|
||||
<summary>
|
||||
The current queue of inputs from the mouse.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.InputEngine.JoystickEventQueue">
|
||||
<summary>
|
||||
The current queue of inputs from the joystick.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Icarus.Input.InputSettings">
|
||||
<summary>
|
||||
I am a singleton which can be used to retrieve Input Engine settings.
|
||||
Members are straightforward to access.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputSettings.instance">
|
||||
<summary>
|
||||
Singleton instance.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputSettings.maxKeyboardEvents">
|
||||
<summary>
|
||||
Maximum length of keyboard event queue before input loss is incurred.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputSettings.maxMouseEvents">
|
||||
<summary>
|
||||
Maximum length of mouse event queue before input loss is incurred.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputSettings.maxJoystickEvents">
|
||||
<summary>
|
||||
Maximum length of joystick event queue before input loss is incurred.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputSettings.loopIntervalTime">
|
||||
<summary>
|
||||
Time the thread takes between each update of devices.
|
||||
Missed input can occur if value is set too high, Performance is lowered if value is too low.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputSettings.#ctor">
|
||||
<summary>
|
||||
Initializes the Input Settings to the default values for the Game Engine.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputSettings.#ctor(System.String)">
|
||||
<summary>
|
||||
Load the Input Settings from fileName.
|
||||
Loads defaults then overwrites them with values in File.
|
||||
</summary>
|
||||
<param name="fileName">Name of File to load</param>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.InputSettings.Instance">
|
||||
<summary>
|
||||
Accessor/Modifier for singleton instance.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.InputSettings.MaxKeyboardEvents">
|
||||
<summary>
|
||||
This sets and accesses the GLOBAL maximum number of keyboard events that are queued.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.InputSettings.MaxMouseEvents">
|
||||
<summary>
|
||||
This sets and accesses the GLOBAL maximum number of mouse events that are queued.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.InputSettings.MaxJoystickEvents">
|
||||
<summary>
|
||||
This sets and accesses the GLOBAL maximum number of joystick events that are queued.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.InputSettings.LoopIntervalTime">
|
||||
<summary>
|
||||
This sets and accesses the GLOBAL time interval between input intervals.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Icarus.Input.InputTester">
|
||||
<summary>
|
||||
Summary description for InputTester.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputTester.engine">
|
||||
<summary>
|
||||
The singleton input engine.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputTester.listenLoopThread">
|
||||
<summary>
|
||||
Thread that constantly polls for input received.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputTester.Main">
|
||||
<summary>
|
||||
Executes this tester form.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputTester.#ctor">
|
||||
<summary>
|
||||
Constructor for this Tester Form.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputTester.fillComboBox(System.Windows.Forms.ComboBox)">
|
||||
<summary>
|
||||
Adds various test commands to be bound for testing.
|
||||
</summary>
|
||||
<param name="cBox">The comboBox to add these commands to.</param>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputTester.Dispose(System.Boolean)">
|
||||
<summary>
|
||||
Clean up any resources being used.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputTester.InitializeComponent">
|
||||
<summary>
|
||||
Required method for Designer support - do not modify
|
||||
the contents of this method with the code editor.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputTester.LoopAndListen">
|
||||
<summary>
|
||||
Method executed by the thread, that loops forever
|
||||
polling the InputEngine for any input received.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputTester.stopListening">
|
||||
<summary>
|
||||
Stop the thread from looping and polling the InputEngine.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputTester.startListening">
|
||||
<summary>
|
||||
Starts the thread looping and polling the InputEngine.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Icarus.Input.QueueEventSorter">
|
||||
<summary>
|
||||
Sorts and adds button and movement events to event queues.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.QueueEventSorter.currentKeyboardDownList">
|
||||
<summary>
|
||||
List of current keyboard keys that are being held down.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.QueueEventSorter.currentMouseDownList">
|
||||
<summary>
|
||||
List of current mouse buttons that are being held down.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.QueueEventSorter.currentJoystickDownList">
|
||||
<summary>
|
||||
List of current joystick buttons that are being held down.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.QueueEventSorter.AddKeyboardEvents(System.Collections.ArrayList,Microsoft.DirectX.DirectInput.Key[])">
|
||||
<summary>
|
||||
Takes in a list of new events and determines the current states of each
|
||||
and adds them to the current queue.
|
||||
</summary>
|
||||
<param name="queue">Current keyboard queue to add new events to.</param>
|
||||
<param name="events">List of new events to sort and add.</param>
|
||||
<returns>The updated current keyboard event queue.</returns>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.QueueEventSorter.AddMouseEvents(System.Collections.ArrayList,System.Byte[])">
|
||||
<summary>
|
||||
Takes in a list of new events and determines the current states of each
|
||||
and adds them to the current queue.
|
||||
</summary>
|
||||
<param name="queue">Current mouse queue to add new events to.</param>
|
||||
<param name="events">List of new events to sort and add.</param>
|
||||
<returns>The updated current mouse event queue.</returns>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.QueueEventSorter.AddJoystickEvents(System.Collections.ArrayList,System.Byte[])">
|
||||
<summary>
|
||||
Takes in a list of new events and determines the current states of each
|
||||
and adds them to the current queue.
|
||||
</summary>
|
||||
<param name="queue">Current joystick queue to add new events to.</param>
|
||||
<param name="events">List of new events to sort and add.</param>
|
||||
<returns>The updated current joystick event queue.</returns>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.QueueEventSorter.AddMouseMovementEvent(System.Collections.ArrayList,System.Int32,System.Int32,System.Int32)">
|
||||
<summary>
|
||||
Takes in assorted movement readings from the mouse to create a new event
|
||||
and add it to the current queue.
|
||||
</summary>
|
||||
<param name="queue">Current mouse queue to add new event to.</param>
|
||||
<param name="dx">Change in x-coordinate.</param>
|
||||
<param name="dy">Change in y-coordinate.</param>
|
||||
<param name="dz">Change in z-coordinate.</param>
|
||||
<returns>The updated current mouse event queue.</returns>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.QueueEventSorter.AddJoystickMovementEvent(System.Collections.ArrayList,System.Int32,System.Int32,System.Int32)">
|
||||
<summary>
|
||||
Takes in assorted movement readings from the joystick to create a new event
|
||||
and add it to the current queue.
|
||||
</summary>
|
||||
<param name="queue">Current joystick queue to add new event to.</param>
|
||||
<param name="dx">Change in x-coordinate.</param>
|
||||
<param name="dy">Change in y-coordinate.</param>
|
||||
<param name="dz">Change in z-coordinate.</param>
|
||||
<returns>The updated current joystick event queue.</returns>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
460
trunk/src/Icarus/Input/InputEngine.cs
Normal file
460
trunk/src/Icarus/Input/InputEngine.cs
Normal file
@@ -0,0 +1,460 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Collections;
|
||||
using System.Windows.Forms;
|
||||
using Microsoft.DirectX.DirectInput;
|
||||
using Icarus.Input.ButtonEvents;
|
||||
using Icarus.Input.MovementEvents;
|
||||
|
||||
namespace Icarus.Input {
|
||||
/// <summary>
|
||||
/// Summary description for UserInputEngine.
|
||||
/// </summary>
|
||||
public class InputEngine {
|
||||
|
||||
#region Instance Variables
|
||||
/// <summary>
|
||||
/// General settings for the Input Engine.
|
||||
/// </summary>
|
||||
private InputSettings settings = InputSettings.Instance;
|
||||
/// <summary>
|
||||
/// Control Form for devices to be attached to.
|
||||
/// </summary>
|
||||
private Control controller = null;
|
||||
/// <summary>
|
||||
/// Keyboard input device.
|
||||
/// </summary>
|
||||
private Device keyboard = null;
|
||||
/// <summary>
|
||||
/// Mouse input device.
|
||||
/// </summary>
|
||||
private Device mouse = null;
|
||||
/// <summary>
|
||||
/// Joystick Input device.
|
||||
/// </summary>
|
||||
private Device joystick = null;
|
||||
/// <summary>
|
||||
/// Queue of keyboard events that have yet been processed by the system.
|
||||
/// </summary>
|
||||
private ArrayList keyboardEventQueue = new ArrayList();
|
||||
/// <summary>
|
||||
/// Queue of mouse events that have yet been processed by the system.
|
||||
/// </summary>
|
||||
private ArrayList mouseEventQueue = new ArrayList();
|
||||
/// <summary>
|
||||
/// Queue of joystick events that have yet been processed by the system.
|
||||
/// </summary>
|
||||
private ArrayList joystickEventQueue = new ArrayList();
|
||||
/// <summary>
|
||||
/// Array list of all key bindings for the keyboard.
|
||||
/// </summary>
|
||||
private ArrayList boundKeys = new ArrayList();
|
||||
/// <summary>
|
||||
/// Array list of all button bindings for the mouse.
|
||||
/// </summary>
|
||||
private ArrayList boundMouseButtons = new ArrayList();
|
||||
/// <summary>
|
||||
/// Array list of all button bindings for the joystick.
|
||||
/// </summary>
|
||||
private ArrayList boundJoystickButtons = new ArrayList();
|
||||
/// <summary>
|
||||
/// Thread that constantly polls for input received.
|
||||
/// </summary>
|
||||
private Thread listenLoopThread = null;
|
||||
/// <summary>
|
||||
/// Sorts and creates button and movement events and stores them in a queue.
|
||||
/// </summary>
|
||||
private QueueEventSorter sorter = new QueueEventSorter();
|
||||
#endregion
|
||||
|
||||
#region Singleton Stuff
|
||||
/// <summary>
|
||||
/// The singleton class instance of this class.
|
||||
/// </summary>
|
||||
private static InputEngine instance = new InputEngine();
|
||||
|
||||
/// <summary>
|
||||
/// Private singleton constructor.
|
||||
/// </summary>
|
||||
private InputEngine() {
|
||||
boundKeys = new ArrayList();
|
||||
boundMouseButtons = new ArrayList();
|
||||
boundJoystickButtons = new ArrayList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Accessor/Modifier for the singleton class instance.
|
||||
/// </summary>
|
||||
public static InputEngine Instance {
|
||||
get { return instance; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Initialization
|
||||
/// <summary>
|
||||
/// Initializes and configures the devices, based on the given Controller.
|
||||
/// </summary>
|
||||
/// <param name="owner">The Controller Form that owns these devices.</param>
|
||||
public void Initialize(Control owner) {
|
||||
controller = owner;
|
||||
InitDevices();
|
||||
ConfigureDevices();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the devices from the system.
|
||||
/// </summary>
|
||||
private void InitDevices() {
|
||||
keyboard = new Device(SystemGuid.Keyboard);
|
||||
if (keyboard == null) {
|
||||
Console.WriteLine(" -- No keyboard found.");
|
||||
}
|
||||
|
||||
mouse = new Device(SystemGuid.Mouse);
|
||||
if(mouse == null) {
|
||||
Console.WriteLine(" -- No mouse found.");
|
||||
}
|
||||
|
||||
foreach (DeviceInstance di in Manager.GetDevices(DeviceClass.GameControl, EnumDevicesFlags.AttachedOnly)) {
|
||||
joystick = new Device(di.InstanceGuid);
|
||||
break;
|
||||
}
|
||||
if(joystick == null) {
|
||||
Console.WriteLine(" -- No joystick found.");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configures and acquires the devices for use.
|
||||
/// </summary>
|
||||
private void ConfigureDevices() {
|
||||
if (keyboard != null) {
|
||||
//keyboard.SetCooperativeLevel(controller, CooperativeLevelFlags.Foreground);
|
||||
keyboard.Acquire();
|
||||
}
|
||||
|
||||
if (mouse != null) {
|
||||
//mouse.Properties.AxisModeAbsolute = true;
|
||||
//mouse.SetCooperativeLevel(controller, CooperativeLevelFlags.Foreground);
|
||||
mouse.Acquire();
|
||||
}
|
||||
|
||||
if (joystick != null) {
|
||||
//Set joystick axis ranges.
|
||||
foreach (DeviceObjectInstance doi in joystick.Objects) {
|
||||
if ((doi.ObjectId & (int) DeviceObjectTypeFlags.Axis) != 0) {
|
||||
joystick.Properties.SetRange(ParameterHow.ById, doi.ObjectId, new InputRange(-5000,5000));
|
||||
}
|
||||
}
|
||||
//joystick.Properties.AxisModeAbsolute = true;
|
||||
//joystick.SetCooperativeLevel(controller, CooperativeLevelFlags.Foreground);
|
||||
joystick.Acquire();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Accessors/Modifiers
|
||||
/// <summary>
|
||||
/// The current queue of inputs from the keyboard.
|
||||
/// </summary>
|
||||
public ArrayList KeyboardEventQueue {
|
||||
get {
|
||||
ArrayList eventQueue = (ArrayList) keyboardEventQueue.Clone();
|
||||
keyboardEventQueue.Clear();
|
||||
return eventQueue;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The current queue of inputs from the mouse.
|
||||
/// </summary>
|
||||
public ArrayList MouseEventQueue {
|
||||
get {
|
||||
ArrayList eventQueue = (ArrayList) mouseEventQueue.Clone();
|
||||
mouseEventQueue.Clear();
|
||||
return eventQueue;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The current queue of inputs from the joystick.
|
||||
/// </summary>
|
||||
public ArrayList JoystickEventQueue {
|
||||
get {
|
||||
ArrayList eventQueue = (ArrayList) joystickEventQueue.Clone();
|
||||
joystickEventQueue.Clear();
|
||||
return eventQueue;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Device Capturing
|
||||
/// <summary>
|
||||
/// Updates all devices.
|
||||
/// </summary>
|
||||
private void UpdateDevices() {
|
||||
UpdateKeyboard();
|
||||
UpdateMouse();
|
||||
UpdateJoystick();
|
||||
|
||||
int MAXSIZE;
|
||||
MAXSIZE = settings.MaxKeyboardEvents;
|
||||
if (keyboardEventQueue.Count >= MAXSIZE) {
|
||||
keyboardEventQueue = keyboardEventQueue.GetRange(0, MAXSIZE);
|
||||
}
|
||||
MAXSIZE = settings.MaxMouseEvents;
|
||||
if (mouseEventQueue.Count >= MAXSIZE) {
|
||||
mouseEventQueue = mouseEventQueue.GetRange(0, MAXSIZE);
|
||||
}
|
||||
MAXSIZE = settings.MaxJoystickEvents;
|
||||
if (joystickEventQueue.Count >= MAXSIZE) {
|
||||
joystickEventQueue = joystickEventQueue.GetRange(0, MAXSIZE);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the keyboard event queue based on the actual input to the keyboard.
|
||||
/// </summary>
|
||||
private void UpdateKeyboard() {
|
||||
if (keyboard != null) {
|
||||
try {
|
||||
keyboardEventQueue = sorter.AddKeyboardEvents(keyboardEventQueue, keyboard.GetPressedKeys());
|
||||
} catch (NotAcquiredException) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the mouse event queue based on the actual input to the mouse.
|
||||
/// </summary>
|
||||
private void UpdateMouse() {
|
||||
if (mouse != null) {
|
||||
try {
|
||||
MouseState state = mouse.CurrentMouseState;
|
||||
mouseEventQueue = sorter.AddMouseMovementEvent(mouseEventQueue, state.X, state.Y, state.Z);
|
||||
mouseEventQueue = sorter.AddMouseEvents(mouseEventQueue, state.GetMouseButtons());
|
||||
} catch (NotAcquiredException) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the joystick event queue based on the actual input to the joystick.
|
||||
/// </summary>
|
||||
private void UpdateJoystick() {
|
||||
if (joystick != null) {
|
||||
try {
|
||||
JoystickState state = joystick.CurrentJoystickState;
|
||||
joystickEventQueue = sorter.AddJoystickMovementEvent(joystickEventQueue, state.X, state.Y, state.Z);
|
||||
joystickEventQueue = sorter.AddJoystickEvents(joystickEventQueue, state.GetButtons());
|
||||
} catch (NotAcquiredException) {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Key/Button Binding
|
||||
/// <summary>
|
||||
/// Binds an action to a keyboard key.
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the key.</param>
|
||||
/// <param name="action">Name of the action.</param>
|
||||
public void bindKey (string name, string action) {
|
||||
makeBinding(name, action, boundKeys);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Binds an action to a mouse button.
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the button.</param>
|
||||
/// <param name="action">Name of the action.</param>
|
||||
public void bindMouseButton (string name, string action) {
|
||||
makeBinding(name, action, boundMouseButtons);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Binds an action to a joystick button.
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the button.</param>
|
||||
/// <param name="action">Name of the action.</param>
|
||||
public void bindJoystickButton (string name, string action) {
|
||||
makeBinding(name, action, boundJoystickButtons);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a BoundAction of the given name and action to the given bindingList.
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the key/button.</param>
|
||||
/// <param name="action">Name of the action.</param>
|
||||
/// <param name="bindingList">List of BoundActions to be added to.</param>
|
||||
private void makeBinding(string name, string action, ArrayList bindingList) {
|
||||
foreach (BoundAction ba in bindingList) {
|
||||
if (ba.gs_keyname == name) {
|
||||
if (action != null) {
|
||||
ba.gs_action = action;
|
||||
} else {
|
||||
bindingList.Remove(ba);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (action != null) {
|
||||
bindingList.Add(new BoundAction(name, action));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Bound Key/Button Action Requests
|
||||
/// <summary>
|
||||
/// Gets the action bound to the specified keyboard key.
|
||||
/// </summary>
|
||||
/// <param name="name">Key to get action for.</param>
|
||||
/// <returns>The action for the key.</returns>
|
||||
public string getKeyAction (string name) {
|
||||
return getAction(name, boundKeys);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the action bound to the specified keyboard key.
|
||||
/// </summary>
|
||||
/// <returns>The action for the key.</returns>
|
||||
public string getKeyAction () {
|
||||
if (keyboard == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Key[] keys = keyboard.GetPressedKeys();
|
||||
if (keys.Length < 1) {
|
||||
return null;
|
||||
}
|
||||
else return getKeyAction(keys[0].ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the action bound to the specified mouse button.
|
||||
/// </summary>
|
||||
/// <param name="name">Button to get action for.</param>
|
||||
/// <returns>The action for the button.</returns>
|
||||
public string getMouseButtonAction (string name) {
|
||||
return getAction(name, boundMouseButtons);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the action bound to the specified mouse button.
|
||||
/// </summary>
|
||||
/// <returns>The action for the button.</returns>
|
||||
public string getMouseButtonAction () {
|
||||
if (mouse == null) return null;
|
||||
|
||||
byte[] buttons = mouse.CurrentMouseState.GetMouseButtons();
|
||||
if (buttons.Length < 1) return null;
|
||||
else return getMouseButtonAction(buttons[0].ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the action bound to the specified joystick button.
|
||||
/// </summary>
|
||||
/// <param name="name">Button to get action for.</param>
|
||||
/// <returns>The action for the button.</returns>
|
||||
public string getJoystickButtonAction (string name) {
|
||||
return getAction(name, boundJoystickButtons);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the action bound to the specified joystick button.
|
||||
/// </summary>
|
||||
/// <returns>The action for the button.</returns>
|
||||
public string getJoystickButtonAction () {
|
||||
if (joystick == null) return null;
|
||||
|
||||
byte[] keys = joystick.CurrentJoystickState.GetButtons();
|
||||
if (keys.Length < 1) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
for (int i = 0; i < keys.Length; i++) {
|
||||
if (keys[i] != 0)
|
||||
return getJoystickButtonAction(i.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the current action.
|
||||
/// If several input devices are invoked at the same time,
|
||||
/// first joystick will be chosen, then mouse, then keyboard.
|
||||
/// </summary>
|
||||
/// <returns>String value of the action to be performed.</returns>
|
||||
public string getCurrentButtonAction() {
|
||||
string action = null;
|
||||
|
||||
action = getJoystickButtonAction();
|
||||
if (action != null) {
|
||||
return action;
|
||||
}
|
||||
|
||||
action = getMouseButtonAction();
|
||||
if (action != null) {
|
||||
return action;
|
||||
}
|
||||
|
||||
action = getKeyAction();
|
||||
if (action != null) {
|
||||
return action;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the action bound to the key/button in the given list of BoundActions.
|
||||
/// </summary>
|
||||
/// <param name="name">The key/button to get the action for.</param>
|
||||
/// <param name="bindingList">List of BoundActions to search in.</param>
|
||||
/// <returns>The action for the key/button.</returns>
|
||||
private string getAction(string name, ArrayList bindingList) {
|
||||
foreach (BoundAction ba in bindingList) {
|
||||
if (ba.gs_keyname == name) {
|
||||
return ba.gs_action;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Listening Thread Logic
|
||||
/// <summary>
|
||||
/// Starts the thread looping and polling for new input on devices.
|
||||
/// </summary>
|
||||
public void StartListening() {
|
||||
if (listenLoopThread == null) {
|
||||
listenLoopThread = new Thread(new ThreadStart(LoopAndListen));
|
||||
listenLoopThread.Start();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops the thread from looping and polling for new input on devices
|
||||
/// </summary>
|
||||
public void StopListening() {
|
||||
if (listenLoopThread != null) {
|
||||
listenLoopThread.Abort();
|
||||
listenLoopThread = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Continually updates input information from all devices.
|
||||
/// </summary>
|
||||
private void LoopAndListen() {
|
||||
while (true) {
|
||||
UpdateDevices();
|
||||
Thread.Sleep(settings.LoopIntervalTime);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
97
trunk/src/Icarus/Input/InputSettings.cs
Normal file
97
trunk/src/Icarus/Input/InputSettings.cs
Normal file
@@ -0,0 +1,97 @@
|
||||
using System;
|
||||
|
||||
namespace Icarus.Input {
|
||||
/// <summary>
|
||||
/// I am a singleton which can be used to retrieve Input Engine settings.
|
||||
/// Members are straightforward to access.
|
||||
/// </summary>
|
||||
public class InputSettings {
|
||||
|
||||
#region Singleton Stuff
|
||||
/// <summary>
|
||||
/// Singleton instance.
|
||||
/// </summary>
|
||||
private static InputSettings instance = new InputSettings();
|
||||
|
||||
/// <summary>
|
||||
/// Accessor/Modifier for singleton instance.
|
||||
/// </summary>
|
||||
public static InputSettings Instance {
|
||||
get { return instance; }
|
||||
set { instance = value;}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Instance Variables
|
||||
/// <summary>
|
||||
/// Maximum length of keyboard event queue before input loss is incurred.
|
||||
/// </summary>
|
||||
private int maxKeyboardEvents;
|
||||
/// <summary>
|
||||
/// Maximum length of mouse event queue before input loss is incurred.
|
||||
/// </summary>
|
||||
private int maxMouseEvents;
|
||||
/// <summary>
|
||||
/// Maximum length of joystick event queue before input loss is incurred.
|
||||
/// </summary>
|
||||
private int maxJoystickEvents;
|
||||
/// <summary>
|
||||
/// Time the thread takes between each update of devices.
|
||||
/// Missed input can occur if value is set too high, Performance is lowered if value is too low.
|
||||
/// </summary>
|
||||
private int loopIntervalTime;
|
||||
#endregion
|
||||
|
||||
#region Accessors/Modifiers
|
||||
/// <summary>
|
||||
/// This sets and accesses the GLOBAL maximum number of keyboard events that are queued.
|
||||
/// </summary>
|
||||
public int MaxKeyboardEvents {
|
||||
get { return maxKeyboardEvents; }
|
||||
set { maxKeyboardEvents = value;}
|
||||
}
|
||||
/// <summary>
|
||||
/// This sets and accesses the GLOBAL maximum number of mouse events that are queued.
|
||||
/// </summary>
|
||||
public int MaxMouseEvents {
|
||||
get { return maxMouseEvents; }
|
||||
set { maxMouseEvents = value;}
|
||||
}
|
||||
/// <summary>
|
||||
/// This sets and accesses the GLOBAL maximum number of joystick events that are queued.
|
||||
/// </summary>
|
||||
public int MaxJoystickEvents {
|
||||
get { return maxJoystickEvents; }
|
||||
set { maxJoystickEvents = value;}
|
||||
}
|
||||
/// <summary>
|
||||
/// This sets and accesses the GLOBAL time interval between input intervals.
|
||||
/// </summary>
|
||||
public int LoopIntervalTime {
|
||||
get { return loopIntervalTime; }
|
||||
set { loopIntervalTime = value; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Initialization
|
||||
/// <summary>
|
||||
/// Initializes the Input Settings to the default values for the Game Engine.
|
||||
/// </summary>
|
||||
private InputSettings() {
|
||||
maxKeyboardEvents = 100000;
|
||||
maxMouseEvents = 100000;
|
||||
maxJoystickEvents = 100000;
|
||||
loopIntervalTime = 25;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load the Input Settings from fileName.
|
||||
/// Loads defaults then overwrites them with values in File.
|
||||
/// </summary>
|
||||
/// <param name="fileName">Name of File to load</param>
|
||||
private InputSettings(string fileName) : this() {
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
441
trunk/src/Icarus/Input/InputTester.cs
Normal file
441
trunk/src/Icarus/Input/InputTester.cs
Normal file
@@ -0,0 +1,441 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Forms;
|
||||
using System.Threading;
|
||||
using Icarus.Input.ButtonEvents;
|
||||
|
||||
namespace Icarus.Input {
|
||||
/// <summary>
|
||||
/// Summary description for InputTester.
|
||||
/// </summary>
|
||||
public class InputTester : System.Windows.Forms.Form {
|
||||
|
||||
#region GUI Components
|
||||
private System.Windows.Forms.TextBox keyboardDisplay;
|
||||
private System.Windows.Forms.TextBox mouseDisplay;
|
||||
private System.Windows.Forms.TextBox joystickDisplay;
|
||||
private System.Windows.Forms.Label keyboardLabel;
|
||||
private System.Windows.Forms.Label mouseLabel;
|
||||
private System.Windows.Forms.Label joystickLabel;
|
||||
private System.Windows.Forms.Button startButton;
|
||||
private System.Windows.Forms.Button stopButton;
|
||||
private System.Windows.Forms.TextBox keyTextBox;
|
||||
private System.Windows.Forms.ComboBox keyComboBox;
|
||||
private System.Windows.Forms.Button keyButton;
|
||||
private System.Windows.Forms.Button mouseButton;
|
||||
private System.Windows.Forms.ComboBox mouseComboBox;
|
||||
private System.Windows.Forms.TextBox mouseTextBox;
|
||||
private System.Windows.Forms.Button joystickButton;
|
||||
private System.Windows.Forms.ComboBox joystickComboBox;
|
||||
private System.Windows.Forms.TextBox joystickTextBox;
|
||||
private System.ComponentModel.Container components = null;
|
||||
#endregion
|
||||
|
||||
#region Instance Variables
|
||||
/// <summary>
|
||||
/// The singleton input engine.
|
||||
/// </summary>
|
||||
private InputEngine engine = null;
|
||||
/// <summary>
|
||||
/// Thread that constantly polls for input received.
|
||||
/// </summary>
|
||||
private Thread listenLoopThread = null;
|
||||
#endregion
|
||||
|
||||
#region Execution
|
||||
/// <summary>
|
||||
/// Executes this tester form.
|
||||
/// </summary>
|
||||
public static void Main() {
|
||||
Console.WriteLine("You are now running the tester program for the InputEngine of the Icarus Game Engine");
|
||||
new InputTester().Show();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for this Tester Form.
|
||||
/// </summary>
|
||||
public InputTester() {
|
||||
// Required for Windows Form Designer support
|
||||
InitializeComponent();
|
||||
fillComboBox(keyComboBox);
|
||||
fillComboBox(mouseComboBox);
|
||||
fillComboBox(joystickComboBox);
|
||||
engine = InputEngine.Instance;
|
||||
engine.Initialize(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds various test commands to be bound for testing.
|
||||
/// </summary>
|
||||
/// <param name="cBox">The comboBox to add these commands to.</param>
|
||||
private void fillComboBox(ComboBox cBox) {
|
||||
cBox.Items.Add("<DO NOTHING>");
|
||||
cBox.Items.Add("Red");
|
||||
cBox.Items.Add("Blue");
|
||||
cBox.Items.Add("Green");
|
||||
cBox.Items.Add("Yellow");
|
||||
cBox.Items.Add("Magenta");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
protected override void Dispose( bool disposing ) {
|
||||
if( disposing ) {
|
||||
if(components != null) {
|
||||
components.Dispose();
|
||||
}
|
||||
}
|
||||
base.Dispose( disposing );
|
||||
stopListening();
|
||||
Console.WriteLine("You have exited the tester program for the InputEngine of the Icarus Game Engine.");
|
||||
Console.WriteLine("Have A Nice Day!");
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent() {
|
||||
this.keyboardDisplay = new System.Windows.Forms.TextBox();
|
||||
this.mouseDisplay = new System.Windows.Forms.TextBox();
|
||||
this.joystickDisplay = new System.Windows.Forms.TextBox();
|
||||
this.keyboardLabel = new System.Windows.Forms.Label();
|
||||
this.mouseLabel = new System.Windows.Forms.Label();
|
||||
this.joystickLabel = new System.Windows.Forms.Label();
|
||||
this.startButton = new System.Windows.Forms.Button();
|
||||
this.stopButton = new System.Windows.Forms.Button();
|
||||
this.keyTextBox = new System.Windows.Forms.TextBox();
|
||||
this.keyComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.keyButton = new System.Windows.Forms.Button();
|
||||
this.mouseButton = new System.Windows.Forms.Button();
|
||||
this.mouseComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.mouseTextBox = new System.Windows.Forms.TextBox();
|
||||
this.joystickButton = new System.Windows.Forms.Button();
|
||||
this.joystickComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.joystickTextBox = new System.Windows.Forms.TextBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// keyboardDisplay
|
||||
//
|
||||
this.keyboardDisplay.Location = new System.Drawing.Point(32, 40);
|
||||
this.keyboardDisplay.Multiline = true;
|
||||
this.keyboardDisplay.Name = "keyboardDisplay";
|
||||
this.keyboardDisplay.ReadOnly = true;
|
||||
this.keyboardDisplay.Size = new System.Drawing.Size(272, 80);
|
||||
this.keyboardDisplay.TabIndex = 0;
|
||||
this.keyboardDisplay.Text = "";
|
||||
//
|
||||
// mouseDisplay
|
||||
//
|
||||
this.mouseDisplay.Location = new System.Drawing.Point(32, 168);
|
||||
this.mouseDisplay.Multiline = true;
|
||||
this.mouseDisplay.Name = "mouseDisplay";
|
||||
this.mouseDisplay.ReadOnly = true;
|
||||
this.mouseDisplay.Size = new System.Drawing.Size(272, 80);
|
||||
this.mouseDisplay.TabIndex = 1;
|
||||
this.mouseDisplay.Text = "";
|
||||
//
|
||||
// joystickDisplay
|
||||
//
|
||||
this.joystickDisplay.Location = new System.Drawing.Point(32, 296);
|
||||
this.joystickDisplay.Multiline = true;
|
||||
this.joystickDisplay.Name = "joystickDisplay";
|
||||
this.joystickDisplay.ReadOnly = true;
|
||||
this.joystickDisplay.Size = new System.Drawing.Size(272, 80);
|
||||
this.joystickDisplay.TabIndex = 2;
|
||||
this.joystickDisplay.Text = "";
|
||||
//
|
||||
// keyboardLabel
|
||||
//
|
||||
this.keyboardLabel.Location = new System.Drawing.Point(32, 16);
|
||||
this.keyboardLabel.Name = "keyboardLabel";
|
||||
this.keyboardLabel.Size = new System.Drawing.Size(88, 23);
|
||||
this.keyboardLabel.TabIndex = 3;
|
||||
this.keyboardLabel.Text = "Keyboard Input:";
|
||||
this.keyboardLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// mouseLabel
|
||||
//
|
||||
this.mouseLabel.Location = new System.Drawing.Point(32, 144);
|
||||
this.mouseLabel.Name = "mouseLabel";
|
||||
this.mouseLabel.Size = new System.Drawing.Size(72, 23);
|
||||
this.mouseLabel.TabIndex = 4;
|
||||
this.mouseLabel.Text = "Mouse Input:";
|
||||
this.mouseLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// joystickLabel
|
||||
//
|
||||
this.joystickLabel.Location = new System.Drawing.Point(32, 272);
|
||||
this.joystickLabel.Name = "joystickLabel";
|
||||
this.joystickLabel.Size = new System.Drawing.Size(80, 23);
|
||||
this.joystickLabel.TabIndex = 5;
|
||||
this.joystickLabel.Text = "Joystick Input:";
|
||||
this.joystickLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// startButton
|
||||
//
|
||||
this.startButton.Location = new System.Drawing.Point(72, 400);
|
||||
this.startButton.Name = "startButton";
|
||||
this.startButton.Size = new System.Drawing.Size(88, 23);
|
||||
this.startButton.TabIndex = 6;
|
||||
this.startButton.Text = "Start Listening";
|
||||
this.startButton.Click += new System.EventHandler(this.startButton_Click);
|
||||
//
|
||||
// stopButton
|
||||
//
|
||||
this.stopButton.Location = new System.Drawing.Point(176, 400);
|
||||
this.stopButton.Name = "stopButton";
|
||||
this.stopButton.Size = new System.Drawing.Size(88, 23);
|
||||
this.stopButton.TabIndex = 7;
|
||||
this.stopButton.Text = "Stop Listening";
|
||||
this.stopButton.Click += new System.EventHandler(this.stopButton_Click);
|
||||
//
|
||||
// keyTextBox
|
||||
//
|
||||
this.keyTextBox.Location = new System.Drawing.Point(320, 40);
|
||||
this.keyTextBox.Name = "keyTextBox";
|
||||
this.keyTextBox.TabIndex = 8;
|
||||
this.keyTextBox.Text = "<Key Name>";
|
||||
//
|
||||
// keyComboBox
|
||||
//
|
||||
this.keyComboBox.Location = new System.Drawing.Point(320, 72);
|
||||
this.keyComboBox.Name = "keyComboBox";
|
||||
this.keyComboBox.Size = new System.Drawing.Size(104, 21);
|
||||
this.keyComboBox.TabIndex = 9;
|
||||
this.keyComboBox.Text = "<Action>";
|
||||
//
|
||||
// keyButton
|
||||
//
|
||||
this.keyButton.Location = new System.Drawing.Point(328, 104);
|
||||
this.keyButton.Name = "keyButton";
|
||||
this.keyButton.TabIndex = 10;
|
||||
this.keyButton.Text = "Bind Key";
|
||||
this.keyButton.Click += new System.EventHandler(this.keyButton_Click);
|
||||
//
|
||||
// mouseButton
|
||||
//
|
||||
this.mouseButton.Location = new System.Drawing.Point(328, 232);
|
||||
this.mouseButton.Name = "mouseButton";
|
||||
this.mouseButton.TabIndex = 13;
|
||||
this.mouseButton.Text = "Bind Button";
|
||||
this.mouseButton.Click += new System.EventHandler(this.mouseButton_Click);
|
||||
//
|
||||
// mouseComboBox
|
||||
//
|
||||
this.mouseComboBox.Location = new System.Drawing.Point(320, 200);
|
||||
this.mouseComboBox.Name = "mouseComboBox";
|
||||
this.mouseComboBox.Size = new System.Drawing.Size(104, 21);
|
||||
this.mouseComboBox.TabIndex = 12;
|
||||
this.mouseComboBox.Text = "<Action>";
|
||||
//
|
||||
// mouseTextBox
|
||||
//
|
||||
this.mouseTextBox.Location = new System.Drawing.Point(320, 168);
|
||||
this.mouseTextBox.Name = "mouseTextBox";
|
||||
this.mouseTextBox.TabIndex = 11;
|
||||
this.mouseTextBox.Text = "<Button Name>";
|
||||
//
|
||||
// joystickButton
|
||||
//
|
||||
this.joystickButton.Location = new System.Drawing.Point(328, 360);
|
||||
this.joystickButton.Name = "joystickButton";
|
||||
this.joystickButton.TabIndex = 16;
|
||||
this.joystickButton.Text = "Bind Button";
|
||||
this.joystickButton.Click += new System.EventHandler(this.joystickButton_Click);
|
||||
//
|
||||
// joystickComboBox
|
||||
//
|
||||
this.joystickComboBox.Location = new System.Drawing.Point(320, 328);
|
||||
this.joystickComboBox.Name = "joystickComboBox";
|
||||
this.joystickComboBox.Size = new System.Drawing.Size(104, 21);
|
||||
this.joystickComboBox.TabIndex = 15;
|
||||
this.joystickComboBox.Text = "<Action>";
|
||||
//
|
||||
// joystickTextBox
|
||||
//
|
||||
this.joystickTextBox.Location = new System.Drawing.Point(320, 296);
|
||||
this.joystickTextBox.Name = "joystickTextBox";
|
||||
this.joystickTextBox.TabIndex = 14;
|
||||
this.joystickTextBox.Text = "<Button Name>";
|
||||
//
|
||||
// InputTester
|
||||
//
|
||||
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
|
||||
this.ClientSize = new System.Drawing.Size(440, 446);
|
||||
this.Controls.Add(this.joystickButton);
|
||||
this.Controls.Add(this.joystickComboBox);
|
||||
this.Controls.Add(this.joystickTextBox);
|
||||
this.Controls.Add(this.mouseButton);
|
||||
this.Controls.Add(this.mouseComboBox);
|
||||
this.Controls.Add(this.mouseTextBox);
|
||||
this.Controls.Add(this.keyButton);
|
||||
this.Controls.Add(this.keyComboBox);
|
||||
this.Controls.Add(this.keyTextBox);
|
||||
this.Controls.Add(this.stopButton);
|
||||
this.Controls.Add(this.startButton);
|
||||
this.Controls.Add(this.joystickLabel);
|
||||
this.Controls.Add(this.mouseLabel);
|
||||
this.Controls.Add(this.keyboardLabel);
|
||||
this.Controls.Add(this.joystickDisplay);
|
||||
this.Controls.Add(this.mouseDisplay);
|
||||
this.Controls.Add(this.keyboardDisplay);
|
||||
this.Name = "InputTester";
|
||||
this.Text = "InputTester";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Input Listening Thread Operations
|
||||
/// <summary>
|
||||
/// Method executed by the thread, that loops forever
|
||||
/// polling the InputEngine for any input received.
|
||||
/// </summary>
|
||||
private void LoopAndListen() {
|
||||
string key = null;
|
||||
string action = null;
|
||||
|
||||
engine.StartListening();
|
||||
while (true) {
|
||||
ArrayList keyboardQueue = engine.KeyboardEventQueue;
|
||||
foreach (object keyEvent in keyboardQueue) {
|
||||
keyboardDisplay.AppendText(keyEvent.ToString() + " ");
|
||||
if (keyEvent is KeyboardButtonPressEvent) {
|
||||
key = ((KeyboardButtonPressEvent) keyEvent).Name;
|
||||
action = engine.getKeyAction(key);
|
||||
performAction(action, keyboardDisplay);
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList mouseQueue = engine.MouseEventQueue;
|
||||
foreach (object mouseEvent in mouseQueue) {
|
||||
mouseDisplay.AppendText(mouseEvent.ToString() + " ");
|
||||
if (mouseEvent is MouseButtonPressEvent) {
|
||||
key = ((MouseButtonPressEvent) mouseEvent).Name;
|
||||
action = engine.getMouseButtonAction(key);
|
||||
performAction(action, mouseDisplay);
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList joystickQueue = engine.JoystickEventQueue;
|
||||
foreach (object joystickEvent in joystickQueue) {
|
||||
joystickDisplay.AppendText(joystickEvent.ToString() + " ");
|
||||
if (joystickEvent is JoystickButtonPressEvent) {
|
||||
key = ((JoystickButtonPressEvent) joystickEvent).Name;
|
||||
action = engine.getJoystickButtonAction(key);
|
||||
performAction(action, joystickDisplay);
|
||||
}
|
||||
}
|
||||
|
||||
Thread.Sleep(1000);
|
||||
keyboardDisplay.Text = "";
|
||||
mouseDisplay.Text = "";
|
||||
joystickDisplay.Text = "";
|
||||
}
|
||||
}
|
||||
|
||||
private void performAction(string action, TextBox display) {
|
||||
if(action == "Red") {
|
||||
display.BackColor = Color.Red;
|
||||
} else if(action == "Blue") {
|
||||
display.BackColor = Color.Blue;
|
||||
} else if(action == "Green") {
|
||||
display.BackColor = Color.Lime;
|
||||
} else if(action == "Yellow") {
|
||||
display.BackColor = Color.Yellow;
|
||||
} else if(action == "Magenta") {
|
||||
display.BackColor = Color.Magenta;
|
||||
} else {
|
||||
display.BackColor = Color.White;
|
||||
}
|
||||
}
|
||||
|
||||
private string getFirstKeyInput(string input) {
|
||||
input = input.Substring("Keyboard:".Length, input.Length - ("Keyboard:".Length));
|
||||
input = input.TrimStart(' ');
|
||||
if (input.IndexOf(" ") > 0) {
|
||||
input = input.Substring(0, input.IndexOf(" "));
|
||||
return input;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private string getFirstButtonInput(string input) {
|
||||
int start = input.IndexOf("Button:");
|
||||
if (start > 0) {
|
||||
start += "Button:".Length;
|
||||
input = input.Substring(start, input.Length - start);
|
||||
if (input.IndexOf("Button:") > 0) {
|
||||
input = input.Substring(0, input.IndexOf("Button:"));
|
||||
}
|
||||
input = input.Trim();
|
||||
return input;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stop the thread from looping and polling the InputEngine.
|
||||
/// </summary>
|
||||
public void stopListening() {
|
||||
if (listenLoopThread != null) {
|
||||
engine.StopListening();
|
||||
listenLoopThread.Abort();
|
||||
listenLoopThread = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts the thread looping and polling the InputEngine.
|
||||
/// </summary>
|
||||
public void startListening() {
|
||||
if (listenLoopThread == null) {
|
||||
listenLoopThread = new Thread(new ThreadStart(LoopAndListen));
|
||||
listenLoopThread.Start();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Button Click Methods
|
||||
private void startButton_Click(object sender, System.EventArgs e) {
|
||||
startListening();
|
||||
}
|
||||
|
||||
private void stopButton_Click(object sender, System.EventArgs e) {
|
||||
stopListening();
|
||||
}
|
||||
|
||||
private void keyButton_Click(object sender, System.EventArgs e) {
|
||||
string action = (string) keyComboBox.SelectedItem;
|
||||
if (action == "<DO NOTHING>") {
|
||||
action = null;
|
||||
}
|
||||
engine.bindKey(keyTextBox.Text, action);
|
||||
}
|
||||
|
||||
private void mouseButton_Click(object sender, System.EventArgs e) {
|
||||
string action = (string) mouseComboBox.SelectedItem;
|
||||
if (action == "<DO NOTHING>") {
|
||||
action = null;
|
||||
}
|
||||
engine.bindMouseButton(mouseTextBox.Text, action);
|
||||
}
|
||||
|
||||
private void joystickButton_Click(object sender, System.EventArgs e) {
|
||||
string action = (string) joystickComboBox.SelectedItem;
|
||||
if (action == "<DO NOTHING>") {
|
||||
action = null;
|
||||
}
|
||||
engine.bindJoystickButton(joystickTextBox.Text, action);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
283
trunk/src/Icarus/Input/InputTester.resx
Normal file
283
trunk/src/Icarus/Input/InputTester.resx
Normal file
@@ -0,0 +1,283 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 1.3
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">1.3</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1">this is my long string</data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
[base64 mime encoded serialized .NET Framework object]
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
[base64 mime encoded string representing a byte array form of the .NET Framework object]
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used forserialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="keyboardDisplay.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="keyboardDisplay.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="keyboardDisplay.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="mouseDisplay.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="mouseDisplay.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="mouseDisplay.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="joystickDisplay.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="joystickDisplay.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="joystickDisplay.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="keyboardLabel.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="keyboardLabel.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="keyboardLabel.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="mouseLabel.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="mouseLabel.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="mouseLabel.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="joystickLabel.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="joystickLabel.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="joystickLabel.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="startButton.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="startButton.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="startButton.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="stopButton.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="stopButton.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="stopButton.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="keyTextBox.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="keyTextBox.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="keyTextBox.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="keyComboBox.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="keyComboBox.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="keyComboBox.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="keyButton.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="keyButton.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="keyButton.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="mouseButton.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="mouseButton.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="mouseButton.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="mouseComboBox.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="mouseComboBox.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="mouseComboBox.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="mouseTextBox.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="mouseTextBox.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="mouseTextBox.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="joystickButton.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="joystickButton.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="joystickButton.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="joystickComboBox.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="joystickComboBox.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="joystickComboBox.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="joystickTextBox.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="joystickTextBox.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="joystickTextBox.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="$this.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>(Default)</value>
|
||||
</data>
|
||||
<data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.Localizable" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>8, 8</value>
|
||||
</data>
|
||||
<data name="$this.Name">
|
||||
<value>InputTester</value>
|
||||
</data>
|
||||
<data name="$this.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="$this.TrayHeight" type="System.Int32, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>80</value>
|
||||
</data>
|
||||
<data name="$this.SnapToGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
|
||||
namespace Icarus.Input.MovementEvents {
|
||||
|
||||
/// <summary>
|
||||
/// Stores event information for when a joystick is moved.
|
||||
/// </summary>
|
||||
public class JoystickMovementEvent : MovementEvent {
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new JoystickMovementEvent.
|
||||
/// </summary>
|
||||
/// <param name="dx">Change in the x-coordinate.</param>
|
||||
/// <param name="dy">Change in the y-coordinate.</param>
|
||||
/// <param name="dz">Change in the z-coordinate.</param>
|
||||
public JoystickMovementEvent(int dx, int dy, int dz) {
|
||||
this.DX = dx;
|
||||
this.DY = dy;
|
||||
this.DZ = dz;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
23
trunk/src/Icarus/Input/MovementEvents/MouseMovementEvent.cs
Normal file
23
trunk/src/Icarus/Input/MovementEvents/MouseMovementEvent.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
|
||||
namespace Icarus.Input.MovementEvents {
|
||||
|
||||
/// <summary>
|
||||
/// Stores event information for when the mouse is moved.
|
||||
/// </summary>
|
||||
public class MouseMovementEvent : MovementEvent {
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new MouseMovementEvent.
|
||||
/// </summary>
|
||||
/// <param name="dx">Change in the x-coordinate.</param>
|
||||
/// <param name="dy">Change in the y-coordinate.</param>
|
||||
/// <param name="dz">Change in the z-coordinate.</param>
|
||||
public MouseMovementEvent(int dx, int dy, int dz) {
|
||||
this.DX = dx;
|
||||
this.DY = dy;
|
||||
this.DZ = dz;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
62
trunk/src/Icarus/Input/MovementEvents/MovementEvent.cs
Normal file
62
trunk/src/Icarus/Input/MovementEvents/MovementEvent.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using System;
|
||||
|
||||
namespace Icarus.Input.MovementEvents {
|
||||
|
||||
/// <summary>
|
||||
/// Stores event information for when a device is moved.
|
||||
/// </summary>
|
||||
public class MovementEvent {
|
||||
|
||||
#region Instance Variables
|
||||
/// <summary>
|
||||
/// The change incurred in the x-direction by the device.
|
||||
/// </summary>
|
||||
private int deltaX = 0;
|
||||
/// <summary>
|
||||
/// The change incurred in the y-direction by the device.
|
||||
/// </summary>
|
||||
private int deltaY = 0;
|
||||
/// <summary>
|
||||
/// The change incurred in the z-direction by the device.
|
||||
/// </summary>
|
||||
private int deltaZ = 0;
|
||||
#endregion
|
||||
|
||||
#region Accessors and Modifiers
|
||||
/// <summary>
|
||||
/// Delta X. The change in the x-coordinate of the device.
|
||||
/// </summary>
|
||||
public int DX {
|
||||
get { return deltaX; }
|
||||
set { deltaX = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delta Y. The change in the y-coordinate of the device.
|
||||
/// </summary>
|
||||
public int DY {
|
||||
get { return deltaY; }
|
||||
set { deltaY = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delta Z. The change in the z-coordinate of the device.
|
||||
/// </summary>
|
||||
public int DZ {
|
||||
get { return deltaZ; }
|
||||
set { deltaZ = value; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region General Use
|
||||
/// <summary>
|
||||
/// Overridden string representation of this object.
|
||||
/// </summary>
|
||||
/// <returns>String representation of this object.</returns>
|
||||
public override string ToString() {
|
||||
return "DX=" + deltaX + ", DY=" + deltaY + ", DZ=" + deltaZ;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
162
trunk/src/Icarus/Input/QueueEventSorter.cs
Normal file
162
trunk/src/Icarus/Input/QueueEventSorter.cs
Normal file
@@ -0,0 +1,162 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Microsoft.DirectX.DirectInput;
|
||||
using Icarus.Input.ButtonEvents;
|
||||
using Icarus.Input.MovementEvents;
|
||||
|
||||
namespace Icarus.Input {
|
||||
|
||||
/// <summary>
|
||||
/// Sorts and adds button and movement events to event queues.
|
||||
/// </summary>
|
||||
public class QueueEventSorter {
|
||||
|
||||
#region Instance Variables
|
||||
/// <summary>
|
||||
/// List of current keyboard keys that are being held down.
|
||||
/// </summary>
|
||||
private ArrayList currentKeyboardDownList = new ArrayList();
|
||||
/// <summary>
|
||||
/// List of current mouse buttons that are being held down.
|
||||
/// </summary>
|
||||
private ArrayList currentMouseDownList = new ArrayList();
|
||||
/// <summary>
|
||||
/// List of current joystick buttons that are being held down.
|
||||
/// </summary>
|
||||
private ArrayList currentJoystickDownList = new ArrayList();
|
||||
#endregion
|
||||
|
||||
#region Key and Button Event Adding
|
||||
/// <summary>
|
||||
/// Takes in a list of new events and determines the current states of each
|
||||
/// and adds them to the current queue.
|
||||
/// </summary>
|
||||
/// <param name="queue">Current keyboard queue to add new events to.</param>
|
||||
/// <param name="events">List of new events to sort and add.</param>
|
||||
/// <returns>The updated current keyboard event queue.</returns>
|
||||
public ArrayList AddKeyboardEvents(ArrayList queue, Key[] events) {
|
||||
ArrayList newDownList = new ArrayList();
|
||||
|
||||
foreach(Key k in events) {
|
||||
newDownList.Add(k.ToString());
|
||||
if (currentKeyboardDownList.Contains(k.ToString())) {
|
||||
queue.Add(new KeyboardButtonPressEvent(k.ToString(), false, true, false));
|
||||
} else {
|
||||
currentKeyboardDownList.Add(k.ToString());
|
||||
queue.Add(new KeyboardButtonPressEvent(k.ToString(), true, false, false));
|
||||
}
|
||||
}
|
||||
|
||||
foreach (string key in currentKeyboardDownList) {
|
||||
if (!newDownList.Contains(key)) {
|
||||
queue.Add(new KeyboardButtonPressEvent(key, false, false, true));
|
||||
}
|
||||
}
|
||||
currentKeyboardDownList = newDownList;
|
||||
|
||||
return queue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes in a list of new events and determines the current states of each
|
||||
/// and adds them to the current queue.
|
||||
/// </summary>
|
||||
/// <param name="queue">Current mouse queue to add new events to.</param>
|
||||
/// <param name="events">List of new events to sort and add.</param>
|
||||
/// <returns>The updated current mouse event queue.</returns>
|
||||
public ArrayList AddMouseEvents(ArrayList queue, byte[] events) {
|
||||
ArrayList newDownList = new ArrayList();
|
||||
|
||||
for (int i = 0; i < events.Length; i++) {
|
||||
string name = "Button:" + i;
|
||||
if (events[i] != 0) {
|
||||
newDownList.Add(name);
|
||||
if (currentMouseDownList.Contains(name)) {
|
||||
queue.Add(new MouseButtonPressEvent(name, false, true, false));
|
||||
} else {
|
||||
currentMouseDownList.Add(name);
|
||||
queue.Add(new MouseButtonPressEvent(name, true, false, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (string buttonName in currentMouseDownList) {
|
||||
if (!newDownList.Contains(buttonName)) {
|
||||
queue.Add(new MouseButtonPressEvent(buttonName, false, false, true));
|
||||
}
|
||||
}
|
||||
currentMouseDownList = newDownList;
|
||||
|
||||
return queue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes in a list of new events and determines the current states of each
|
||||
/// and adds them to the current queue.
|
||||
/// </summary>
|
||||
/// <param name="queue">Current joystick queue to add new events to.</param>
|
||||
/// <param name="events">List of new events to sort and add.</param>
|
||||
/// <returns>The updated current joystick event queue.</returns>
|
||||
public ArrayList AddJoystickEvents(ArrayList queue, byte[] events) {
|
||||
ArrayList newDownList = new ArrayList();
|
||||
|
||||
for (int i = 0; i < events.Length; i++) {
|
||||
string name = "Button:" + i;
|
||||
if (events[i] != 0) {
|
||||
newDownList.Add(name);
|
||||
if (currentJoystickDownList.Contains(name)) {
|
||||
queue.Add(new JoystickButtonPressEvent(name, false, true, false));
|
||||
} else {
|
||||
currentJoystickDownList.Add(name);
|
||||
queue.Add(new JoystickButtonPressEvent(name, true, false, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (string buttonName in currentJoystickDownList) {
|
||||
if (!newDownList.Contains(buttonName)) {
|
||||
queue.Add(new JoystickButtonPressEvent(buttonName, false, false, true));
|
||||
}
|
||||
}
|
||||
currentJoystickDownList = newDownList;
|
||||
|
||||
return queue;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Movement Event Adding
|
||||
/// <summary>
|
||||
/// Takes in assorted movement readings from the mouse to create a new event
|
||||
/// and add it to the current queue.
|
||||
/// </summary>
|
||||
/// <param name="queue">Current mouse queue to add new event to.</param>
|
||||
/// <param name="dx">Change in x-coordinate.</param>
|
||||
/// <param name="dy">Change in y-coordinate.</param>
|
||||
/// <param name="dz">Change in z-coordinate.</param>
|
||||
/// <returns>The updated current mouse event queue.</returns>
|
||||
public ArrayList AddMouseMovementEvent(ArrayList queue, int dx, int dy, int dz) {
|
||||
if (dx != 0 || dy != 0 || dz != 0) {
|
||||
queue.Add(new MouseMovementEvent(dx, dy, dz));
|
||||
}
|
||||
return queue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes in assorted movement readings from the joystick to create a new event
|
||||
/// and add it to the current queue.
|
||||
/// </summary>
|
||||
/// <param name="queue">Current joystick queue to add new event to.</param>
|
||||
/// <param name="dx">Change in x-coordinate.</param>
|
||||
/// <param name="dy">Change in y-coordinate.</param>
|
||||
/// <param name="dz">Change in z-coordinate.</param>
|
||||
/// <returns>The updated current joystick event queue.</returns>
|
||||
public ArrayList AddJoystickMovementEvent(ArrayList queue, int dx, int dy, int dz) {
|
||||
if (dx != 0 || dy != 0 || dz != 0) {
|
||||
queue.Add(new JoystickMovementEvent(dx, dy, dz));
|
||||
}
|
||||
return queue;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
BIN
trunk/src/Icarus/Input/bin/Debug/Icarus.Input.dll
Normal file
BIN
trunk/src/Icarus/Input/bin/Debug/Icarus.Input.dll
Normal file
Binary file not shown.
BIN
trunk/src/Icarus/Input/bin/Debug/Icarus.Input.pdb
Normal file
BIN
trunk/src/Icarus/Input/bin/Debug/Icarus.Input.pdb
Normal file
Binary file not shown.
BIN
trunk/src/Icarus/Input/bin/Release/Icarus.Input.dll
Normal file
BIN
trunk/src/Icarus/Input/bin/Release/Icarus.Input.dll
Normal file
Binary file not shown.
632
trunk/src/Icarus/Input/bin/Release/Input.xml
Normal file
632
trunk/src/Icarus/Input/bin/Release/Input.xml
Normal file
@@ -0,0 +1,632 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>Icarus.Input</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:Icarus.Input.ButtonEvents.ButtonPressEvent">
|
||||
<summary>
|
||||
Stores event information for when a button is pressed on a device.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.ButtonEvents.ButtonPressEvent.buttonName">
|
||||
<summary>
|
||||
Name of the button or key that was pressed.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.ButtonEvents.ButtonPressEvent.buttonPressed">
|
||||
<summary>
|
||||
Initial button state for when a button or key has been pressed.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.ButtonEvents.ButtonPressEvent.buttonDown">
|
||||
<summary>
|
||||
Button state for when a button has been depressed and held down.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.ButtonEvents.ButtonPressEvent.buttonReleased">
|
||||
<summary>
|
||||
Final button state for when a button has been released.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.ButtonEvents.ButtonPressEvent.ToString">
|
||||
<summary>
|
||||
Overridden string representation of this object.
|
||||
</summary>
|
||||
<returns>String representation of this object.</returns>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.ButtonEvents.ButtonPressEvent.Name">
|
||||
<summary>
|
||||
The name of the button or key that was pressed.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.ButtonEvents.ButtonPressEvent.Pressed">
|
||||
<summary>
|
||||
Whether or not the button or key was just pressed.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.ButtonEvents.ButtonPressEvent.Down">
|
||||
<summary>
|
||||
Whether or not the button or key is being held down.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.ButtonEvents.ButtonPressEvent.Released">
|
||||
<summary>
|
||||
Whether or not the button or key was just released.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Icarus.Input.ButtonEvents.JoystickButtonPressEvent">
|
||||
<summary>
|
||||
Stores event information for when a button is pressed on a joystick.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.ButtonEvents.JoystickButtonPressEvent.#ctor(System.String,System.Boolean,System.Boolean,System.Boolean)">
|
||||
<summary>
|
||||
Creates a new JoystickButtonPressEvent.
|
||||
</summary>
|
||||
<param name="name">Name of the joystick button that was pressed.</param>
|
||||
<param name="pressed">Whether or not this button was just pressed.</param>
|
||||
<param name="down">Whether or not this button is being held down.</param>
|
||||
<param name="released">Whether or not this button was just released.</param>
|
||||
</member>
|
||||
<member name="T:Icarus.Input.ButtonEvents.KeyboardButtonPressEvent">
|
||||
<summary>
|
||||
Stores event information for when a key is pressed on a keyboard.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.ButtonEvents.KeyboardButtonPressEvent.#ctor(System.String,System.Boolean,System.Boolean,System.Boolean)">
|
||||
<summary>
|
||||
Creates a new KeyboardButtonPressEvent.
|
||||
</summary>
|
||||
<param name="name">Name of the keyboard key that was pressed.</param>
|
||||
<param name="pressed">Whether or not this key was just pressed.</param>
|
||||
<param name="down">Whether or not this key is being held down.</param>
|
||||
<param name="released">Whether or not this key was just released.</param>
|
||||
</member>
|
||||
<member name="T:Icarus.Input.ButtonEvents.MouseButtonPressEvent">
|
||||
<summary>
|
||||
Stores event information for when a button is pressed on a mouse.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.ButtonEvents.MouseButtonPressEvent.#ctor(System.String,System.Boolean,System.Boolean,System.Boolean)">
|
||||
<summary>
|
||||
Creates a new MouseButtonPressEvent.
|
||||
</summary>
|
||||
<param name="name">Name of the mouse button that was pressed.</param>
|
||||
<param name="pressed">Whether or not this button was just pressed.</param>
|
||||
<param name="down">Whether or not this button is being held down.</param>
|
||||
<param name="released">Whether or not this button was just released.</param>
|
||||
</member>
|
||||
<member name="T:Icarus.Input.MovementEvents.JoystickMovementEvent">
|
||||
<summary>
|
||||
Stores event information for when a joystick is moved.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Icarus.Input.MovementEvents.MovementEvent">
|
||||
<summary>
|
||||
Stores event information for when a device is moved.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.MovementEvents.MovementEvent.deltaX">
|
||||
<summary>
|
||||
The change incurred in the x-direction by the device.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.MovementEvents.MovementEvent.deltaY">
|
||||
<summary>
|
||||
The change incurred in the y-direction by the device.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.MovementEvents.MovementEvent.deltaZ">
|
||||
<summary>
|
||||
The change incurred in the z-direction by the device.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.MovementEvents.MovementEvent.ToString">
|
||||
<summary>
|
||||
Overridden string representation of this object.
|
||||
</summary>
|
||||
<returns>String representation of this object.</returns>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.MovementEvents.MovementEvent.DX">
|
||||
<summary>
|
||||
Delta X. The change in the x-coordinate of the device.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.MovementEvents.MovementEvent.DY">
|
||||
<summary>
|
||||
Delta Y. The change in the y-coordinate of the device.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.MovementEvents.MovementEvent.DZ">
|
||||
<summary>
|
||||
Delta Z. The change in the z-coordinate of the device.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.MovementEvents.JoystickMovementEvent.#ctor(System.Int32,System.Int32,System.Int32)">
|
||||
<summary>
|
||||
Creates a new JoystickMovementEvent.
|
||||
</summary>
|
||||
<param name="dx">Change in the x-coordinate.</param>
|
||||
<param name="dy">Change in the y-coordinate.</param>
|
||||
<param name="dz">Change in the z-coordinate.</param>
|
||||
</member>
|
||||
<member name="T:Icarus.Input.MovementEvents.MouseMovementEvent">
|
||||
<summary>
|
||||
Stores event information for when the mouse is moved.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.MovementEvents.MouseMovementEvent.#ctor(System.Int32,System.Int32,System.Int32)">
|
||||
<summary>
|
||||
Creates a new MouseMovementEvent.
|
||||
</summary>
|
||||
<param name="dx">Change in the x-coordinate.</param>
|
||||
<param name="dy">Change in the y-coordinate.</param>
|
||||
<param name="dz">Change in the z-coordinate.</param>
|
||||
</member>
|
||||
<member name="T:Icarus.Input.BoundAction">
|
||||
<summary>
|
||||
BoundAction is an action associated with a given
|
||||
key or button on an input device.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.BoundAction.keyname">
|
||||
<summary>
|
||||
Name of the button or key this bound action will be applied to.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.BoundAction.action">
|
||||
<summary>
|
||||
The action to be done when the button or key is pressed.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.BoundAction.#ctor(System.String,System.String)">
|
||||
<summary>
|
||||
Constructor for a BoundAction.
|
||||
</summary>
|
||||
<param name="name">Name of the button or key to be mapped.</param>
|
||||
<param name="boundAction">Action to be assigned to the given key.</param>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.BoundAction.gs_keyname">
|
||||
<summary>
|
||||
Accessor for keyname.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.BoundAction.gs_action">
|
||||
<summary>
|
||||
Accessor/Modifer for action.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Icarus.Input.InputEngine">
|
||||
<summary>
|
||||
Summary description for UserInputEngine.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputEngine.settings">
|
||||
<summary>
|
||||
General settings for the Input Engine.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputEngine.controller">
|
||||
<summary>
|
||||
Control Form for devices to be attached to.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputEngine.keyboard">
|
||||
<summary>
|
||||
Keyboard input device.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputEngine.mouse">
|
||||
<summary>
|
||||
Mouse input device.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputEngine.joystick">
|
||||
<summary>
|
||||
Joystick Input device.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputEngine.keyboardEventQueue">
|
||||
<summary>
|
||||
Queue of keyboard events that have yet been processed by the system.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputEngine.mouseEventQueue">
|
||||
<summary>
|
||||
Queue of mouse events that have yet been processed by the system.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputEngine.joystickEventQueue">
|
||||
<summary>
|
||||
Queue of joystick events that have yet been processed by the system.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputEngine.boundKeys">
|
||||
<summary>
|
||||
Array list of all key bindings for the keyboard.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputEngine.boundMouseButtons">
|
||||
<summary>
|
||||
Array list of all button bindings for the mouse.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputEngine.boundJoystickButtons">
|
||||
<summary>
|
||||
Array list of all button bindings for the joystick.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputEngine.listenLoopThread">
|
||||
<summary>
|
||||
Thread that constantly polls for input received.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputEngine.sorter">
|
||||
<summary>
|
||||
Sorts and creates button and movement events and stores them in a queue.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputEngine.instance">
|
||||
<summary>
|
||||
The singleton class instance of this class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.#ctor">
|
||||
<summary>
|
||||
Private singleton constructor.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.Initialize(System.Windows.Forms.Control)">
|
||||
<summary>
|
||||
Initializes and configures the devices, based on the given Controller.
|
||||
</summary>
|
||||
<param name="owner">The Controller Form that owns these devices.</param>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.InitDevices">
|
||||
<summary>
|
||||
Initializes the devices from the system.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.ConfigureDevices">
|
||||
<summary>
|
||||
Configures and acquires the devices for use.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.UpdateDevices">
|
||||
<summary>
|
||||
Updates all devices.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.UpdateKeyboard">
|
||||
<summary>
|
||||
Updates the keyboard event queue based on the actual input to the keyboard.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.UpdateMouse">
|
||||
<summary>
|
||||
Updates the mouse event queue based on the actual input to the mouse.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.UpdateJoystick">
|
||||
<summary>
|
||||
Updates the joystick event queue based on the actual input to the joystick.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.bindKey(System.String,System.String)">
|
||||
<summary>
|
||||
Binds an action to a keyboard key.
|
||||
</summary>
|
||||
<param name="name">Name of the key.</param>
|
||||
<param name="action">Name of the action.</param>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.bindMouseButton(System.String,System.String)">
|
||||
<summary>
|
||||
Binds an action to a mouse button.
|
||||
</summary>
|
||||
<param name="name">Name of the button.</param>
|
||||
<param name="action">Name of the action.</param>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.bindJoystickButton(System.String,System.String)">
|
||||
<summary>
|
||||
Binds an action to a joystick button.
|
||||
</summary>
|
||||
<param name="name">Name of the button.</param>
|
||||
<param name="action">Name of the action.</param>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.makeBinding(System.String,System.String,System.Collections.ArrayList)">
|
||||
<summary>
|
||||
Adds a BoundAction of the given name and action to the given bindingList.
|
||||
</summary>
|
||||
<param name="name">Name of the key/button.</param>
|
||||
<param name="action">Name of the action.</param>
|
||||
<param name="bindingList">List of BoundActions to be added to.</param>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.getKeyAction(System.String)">
|
||||
<summary>
|
||||
Gets the action bound to the specified keyboard key.
|
||||
</summary>
|
||||
<param name="name">Key to get action for.</param>
|
||||
<returns>The action for the key.</returns>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.getKeyAction">
|
||||
<summary>
|
||||
Gets the action bound to the specified keyboard key.
|
||||
</summary>
|
||||
<returns>The action for the key.</returns>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.getMouseButtonAction(System.String)">
|
||||
<summary>
|
||||
Gets the action bound to the specified mouse button.
|
||||
</summary>
|
||||
<param name="name">Button to get action for.</param>
|
||||
<returns>The action for the button.</returns>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.getMouseButtonAction">
|
||||
<summary>
|
||||
Gets the action bound to the specified mouse button.
|
||||
</summary>
|
||||
<returns>The action for the button.</returns>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.getJoystickButtonAction(System.String)">
|
||||
<summary>
|
||||
Gets the action bound to the specified joystick button.
|
||||
</summary>
|
||||
<param name="name">Button to get action for.</param>
|
||||
<returns>The action for the button.</returns>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.getJoystickButtonAction">
|
||||
<summary>
|
||||
Gets the action bound to the specified joystick button.
|
||||
</summary>
|
||||
<returns>The action for the button.</returns>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.getCurrentButtonAction">
|
||||
<summary>
|
||||
Returns the current action.
|
||||
If several input devices are invoked at the same time,
|
||||
first joystick will be chosen, then mouse, then keyboard.
|
||||
</summary>
|
||||
<returns>String value of the action to be performed.</returns>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.getAction(System.String,System.Collections.ArrayList)">
|
||||
<summary>
|
||||
Gets the action bound to the key/button in the given list of BoundActions.
|
||||
</summary>
|
||||
<param name="name">The key/button to get the action for.</param>
|
||||
<param name="bindingList">List of BoundActions to search in.</param>
|
||||
<returns>The action for the key/button.</returns>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.StartListening">
|
||||
<summary>
|
||||
Starts the thread looping and polling for new input on devices.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.StopListening">
|
||||
<summary>
|
||||
Stops the thread from looping and polling for new input on devices
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputEngine.LoopAndListen">
|
||||
<summary>
|
||||
Continually updates input information from all devices.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.InputEngine.Instance">
|
||||
<summary>
|
||||
Accessor/Modifier for the singleton class instance.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.InputEngine.KeyboardEventQueue">
|
||||
<summary>
|
||||
The current queue of inputs from the keyboard.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.InputEngine.MouseEventQueue">
|
||||
<summary>
|
||||
The current queue of inputs from the mouse.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.InputEngine.JoystickEventQueue">
|
||||
<summary>
|
||||
The current queue of inputs from the joystick.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Icarus.Input.InputSettings">
|
||||
<summary>
|
||||
I am a singleton which can be used to retrieve Input Engine settings.
|
||||
Members are straightforward to access.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputSettings.instance">
|
||||
<summary>
|
||||
Singleton instance.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputSettings.maxKeyboardEvents">
|
||||
<summary>
|
||||
Maximum length of keyboard event queue before input loss is incurred.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputSettings.maxMouseEvents">
|
||||
<summary>
|
||||
Maximum length of mouse event queue before input loss is incurred.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputSettings.maxJoystickEvents">
|
||||
<summary>
|
||||
Maximum length of joystick event queue before input loss is incurred.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputSettings.loopIntervalTime">
|
||||
<summary>
|
||||
Time the thread takes between each update of devices.
|
||||
Missed input can occur if value is set too high, Performance is lowered if value is too low.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputSettings.#ctor">
|
||||
<summary>
|
||||
Initializes the Input Settings to the default values for the Game Engine.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputSettings.#ctor(System.String)">
|
||||
<summary>
|
||||
Load the Input Settings from fileName.
|
||||
Loads defaults then overwrites them with values in File.
|
||||
</summary>
|
||||
<param name="fileName">Name of File to load</param>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.InputSettings.Instance">
|
||||
<summary>
|
||||
Accessor/Modifier for singleton instance.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.InputSettings.MaxKeyboardEvents">
|
||||
<summary>
|
||||
This sets and accesses the GLOBAL maximum number of keyboard events that are queued.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.InputSettings.MaxMouseEvents">
|
||||
<summary>
|
||||
This sets and accesses the GLOBAL maximum number of mouse events that are queued.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.InputSettings.MaxJoystickEvents">
|
||||
<summary>
|
||||
This sets and accesses the GLOBAL maximum number of joystick events that are queued.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Icarus.Input.InputSettings.LoopIntervalTime">
|
||||
<summary>
|
||||
This sets and accesses the GLOBAL time interval between input intervals.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Icarus.Input.InputTester">
|
||||
<summary>
|
||||
Summary description for InputTester.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputTester.engine">
|
||||
<summary>
|
||||
The singleton input engine.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.InputTester.listenLoopThread">
|
||||
<summary>
|
||||
Thread that constantly polls for input received.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputTester.Main">
|
||||
<summary>
|
||||
Executes this tester form.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputTester.#ctor">
|
||||
<summary>
|
||||
Constructor for this Tester Form.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputTester.fillComboBox(System.Windows.Forms.ComboBox)">
|
||||
<summary>
|
||||
Adds various test commands to be bound for testing.
|
||||
</summary>
|
||||
<param name="cBox">The comboBox to add these commands to.</param>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputTester.Dispose(System.Boolean)">
|
||||
<summary>
|
||||
Clean up any resources being used.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputTester.InitializeComponent">
|
||||
<summary>
|
||||
Required method for Designer support - do not modify
|
||||
the contents of this method with the code editor.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputTester.LoopAndListen">
|
||||
<summary>
|
||||
Method executed by the thread, that loops forever
|
||||
polling the InputEngine for any input received.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputTester.stopListening">
|
||||
<summary>
|
||||
Stop the thread from looping and polling the InputEngine.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.InputTester.startListening">
|
||||
<summary>
|
||||
Starts the thread looping and polling the InputEngine.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Icarus.Input.QueueEventSorter">
|
||||
<summary>
|
||||
Sorts and adds button and movement events to event queues.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.QueueEventSorter.currentKeyboardDownList">
|
||||
<summary>
|
||||
List of current keyboard keys that are being held down.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.QueueEventSorter.currentMouseDownList">
|
||||
<summary>
|
||||
List of current mouse buttons that are being held down.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Icarus.Input.QueueEventSorter.currentJoystickDownList">
|
||||
<summary>
|
||||
List of current joystick buttons that are being held down.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.QueueEventSorter.AddKeyboardEvents(System.Collections.ArrayList,Microsoft.DirectX.DirectInput.Key[])">
|
||||
<summary>
|
||||
Takes in a list of new events and determines the current states of each
|
||||
and adds them to the current queue.
|
||||
</summary>
|
||||
<param name="queue">Current keyboard queue to add new events to.</param>
|
||||
<param name="events">List of new events to sort and add.</param>
|
||||
<returns>The updated current keyboard event queue.</returns>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.QueueEventSorter.AddMouseEvents(System.Collections.ArrayList,System.Byte[])">
|
||||
<summary>
|
||||
Takes in a list of new events and determines the current states of each
|
||||
and adds them to the current queue.
|
||||
</summary>
|
||||
<param name="queue">Current mouse queue to add new events to.</param>
|
||||
<param name="events">List of new events to sort and add.</param>
|
||||
<returns>The updated current mouse event queue.</returns>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.QueueEventSorter.AddJoystickEvents(System.Collections.ArrayList,System.Byte[])">
|
||||
<summary>
|
||||
Takes in a list of new events and determines the current states of each
|
||||
and adds them to the current queue.
|
||||
</summary>
|
||||
<param name="queue">Current joystick queue to add new events to.</param>
|
||||
<param name="events">List of new events to sort and add.</param>
|
||||
<returns>The updated current joystick event queue.</returns>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.QueueEventSorter.AddMouseMovementEvent(System.Collections.ArrayList,System.Int32,System.Int32,System.Int32)">
|
||||
<summary>
|
||||
Takes in assorted movement readings from the mouse to create a new event
|
||||
and add it to the current queue.
|
||||
</summary>
|
||||
<param name="queue">Current mouse queue to add new event to.</param>
|
||||
<param name="dx">Change in x-coordinate.</param>
|
||||
<param name="dy">Change in y-coordinate.</param>
|
||||
<param name="dz">Change in z-coordinate.</param>
|
||||
<returns>The updated current mouse event queue.</returns>
|
||||
</member>
|
||||
<member name="M:Icarus.Input.QueueEventSorter.AddJoystickMovementEvent(System.Collections.ArrayList,System.Int32,System.Int32,System.Int32)">
|
||||
<summary>
|
||||
Takes in assorted movement readings from the joystick to create a new event
|
||||
and add it to the current queue.
|
||||
</summary>
|
||||
<param name="queue">Current joystick queue to add new event to.</param>
|
||||
<param name="dx">Change in x-coordinate.</param>
|
||||
<param name="dy">Change in y-coordinate.</param>
|
||||
<param name="dz">Change in z-coordinate.</param>
|
||||
<returns>The updated current joystick event queue.</returns>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
BIN
trunk/src/Icarus/Input/obj/Debug/Icarus.Input.dll
Normal file
BIN
trunk/src/Icarus/Input/obj/Debug/Icarus.Input.dll
Normal file
Binary file not shown.
BIN
trunk/src/Icarus/Input/obj/Debug/Icarus.Input.pdb
Normal file
BIN
trunk/src/Icarus/Input/obj/Debug/Icarus.Input.pdb
Normal file
Binary file not shown.
BIN
trunk/src/Icarus/Input/obj/Debug/Input.projdata
Normal file
BIN
trunk/src/Icarus/Input/obj/Debug/Input.projdata
Normal file
Binary file not shown.
BIN
trunk/src/Icarus/Input/obj/Debug/Input.projdata1
Normal file
BIN
trunk/src/Icarus/Input/obj/Debug/Input.projdata1
Normal file
Binary file not shown.
Binary file not shown.
BIN
trunk/src/Icarus/Input/obj/Release/Icarus.Input.dll
Normal file
BIN
trunk/src/Icarus/Input/obj/Release/Icarus.Input.dll
Normal file
Binary file not shown.
BIN
trunk/src/Icarus/Input/obj/Release/Input.projdata
Normal file
BIN
trunk/src/Icarus/Input/obj/Release/Input.projdata
Normal file
Binary file not shown.
273
trunk/src/Icarus/LUCIE/AbstractComponent.cs
Normal file
273
trunk/src/Icarus/LUCIE/AbstractComponent.cs
Normal file
@@ -0,0 +1,273 @@
|
||||
// $Author: asskoala $
|
||||
// $Date: 2005/12/11 21:07:21 $
|
||||
// $Revision: 1.1 $
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Drawing;
|
||||
|
||||
using Icarus.Graphics.Animation;
|
||||
|
||||
namespace Icarus.LUCIE
|
||||
{
|
||||
/// <summary>
|
||||
/// Delegate for receiving information about clicks on LUCIE components.
|
||||
/// </summary>
|
||||
public delegate void ClickCallback(AbstractComponent sender);
|
||||
|
||||
/// <summary>
|
||||
/// Delegate for receiving information about child additions and removals in LUCIE.
|
||||
/// </summary>
|
||||
public delegate void ChildCallback(AbstractComponent sender, AbstractComponent child);
|
||||
|
||||
/// <summary>
|
||||
/// Delegate for receiving information about resizing a component.
|
||||
/// </summary>
|
||||
public delegate void ResizedCallback(AbstractComponent sender, Size oldSize);
|
||||
|
||||
/// <summary>
|
||||
/// The base component class, from which all of the more specific controls, such as buttons and labels, will be derived.
|
||||
/// </summary>
|
||||
public abstract class AbstractComponent : AbstractRenderable
|
||||
{
|
||||
#region Private Members
|
||||
/// <summary>
|
||||
/// The bounds of the component relative to the parent component.
|
||||
/// </summary>
|
||||
private Rectangle mBounds;
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not this component is visible.
|
||||
/// </summary>
|
||||
private bool mIsVisible;
|
||||
|
||||
/// <summary>
|
||||
/// The list of child components.
|
||||
/// </summary>
|
||||
private IList mChildren;
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
/// <summary>
|
||||
/// Triggered whenever the component is clicked.
|
||||
/// </summary>
|
||||
public event ClickCallback Click;
|
||||
|
||||
/// <summary>
|
||||
/// Triggers the click event.
|
||||
/// </summary>
|
||||
public void OnClick()
|
||||
{
|
||||
//Notify self:
|
||||
Clicked();
|
||||
|
||||
//Notify others:
|
||||
if (Click != null)
|
||||
{
|
||||
Click(this);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Triggered whenever a child is added to or removed from this component.
|
||||
/// </summary>
|
||||
public event ChildCallback ChildrenChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Triggers the ChildrenChanged event.
|
||||
/// </summary>
|
||||
/// <param name="child"></param>
|
||||
public void OnChildrenChanged(AbstractComponent child)
|
||||
{
|
||||
if (ChildrenChanged != null)
|
||||
{
|
||||
ChildrenChanged(this, child);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Triggered whenever the component's Size property is changed.
|
||||
/// </summary>
|
||||
public event ResizedCallback Resized;
|
||||
|
||||
/// <summary>
|
||||
/// Triggers the Resized event.
|
||||
/// </summary>
|
||||
/// <param name="oldSize"></param>
|
||||
public void OnResized(Size oldSize)
|
||||
{
|
||||
if (Resized != null)
|
||||
{
|
||||
Resized(this, oldSize);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Initialization and Cleanup
|
||||
/// <summary>
|
||||
/// Default constructor that creates a new component of zero size, at the origin, which is invisible.
|
||||
/// </summary>
|
||||
public AbstractComponent()
|
||||
{
|
||||
mBounds = new Rectangle(0, 0, 0, 0);
|
||||
mIsVisible = false;
|
||||
mChildren = new ArrayList();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
/// <summary>
|
||||
/// Whether or not this component is visible.
|
||||
/// </summary>
|
||||
public bool IsVisible
|
||||
{
|
||||
get { return mIsVisible; }
|
||||
set { mIsVisible = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The location of the component.
|
||||
/// </summary>
|
||||
public Point Location
|
||||
{
|
||||
get { return mBounds.Location; }
|
||||
set { mBounds.Location = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The size of the component. This will be set automagically. So get your grubby paws away from the setter.
|
||||
/// </summary>
|
||||
public Size Size
|
||||
{
|
||||
get { return mBounds.Size; }
|
||||
|
||||
//TODO: Now, you know, .NET 2.0 supports this. We should swtich. We TOTALLY should.
|
||||
//protected//
|
||||
set
|
||||
{
|
||||
Size oldSize = mBounds.Size;
|
||||
mBounds.Size = value;
|
||||
this.OnResized(oldSize);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the bounds of the control.
|
||||
/// </summary>
|
||||
public Rectangle Bounds
|
||||
{
|
||||
get { return mBounds; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The children of this component.
|
||||
/// </summary>
|
||||
public IList Children
|
||||
{
|
||||
get { return mChildren; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Parents and Children
|
||||
/// <summary>
|
||||
/// Adds a child to this component.
|
||||
/// </summary>
|
||||
/// <param name="child"></param>
|
||||
public void AddChild(AbstractComponent child)
|
||||
{
|
||||
if (!mChildren.Contains(child))
|
||||
{
|
||||
mChildren.Add(child);
|
||||
this.OnChildrenChanged(child);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the child from this component, if such child exists.
|
||||
/// </summary>
|
||||
/// <param name="child"></param>
|
||||
public void RemoveChild(AbstractComponent child)
|
||||
{
|
||||
if (mChildren.Contains(child))
|
||||
{
|
||||
mChildren.Remove(child);
|
||||
this.OnChildrenChanged(child);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the component at the specified coordinates, or null if no such component exists.
|
||||
/// </summary>
|
||||
/// <param name="position"></param>
|
||||
/// <returns></returns>
|
||||
public AbstractComponent FindChildAt(Point position)
|
||||
{
|
||||
AbstractComponent theChild = null;
|
||||
|
||||
if (!this.mBounds.Contains(position))
|
||||
{
|
||||
//The position is out of my bounds, so no component there.
|
||||
return null;
|
||||
}
|
||||
|
||||
position.Offset(-this.Location.X, -this.Location.Y);
|
||||
|
||||
//We want to check the top components first, so we must iterate the list in reverse:
|
||||
for (int i = this.Children.Count - 1; i >= 0; i--)
|
||||
{
|
||||
AbstractComponent c = (AbstractComponent) this.Children[i];
|
||||
theChild = c.FindChildAt(position);
|
||||
if (theChild != null) break;
|
||||
}
|
||||
|
||||
position.Offset(this.Location.X, this.Location.Y);
|
||||
|
||||
if (theChild == null)
|
||||
{
|
||||
if (this.IsVisible)
|
||||
return this;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return theChild;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IRenderable Members
|
||||
public override Size GetSize()
|
||||
{
|
||||
return this.Size;
|
||||
}
|
||||
|
||||
public override void Render(Rectangle coordinates, IRenderParameters parameters)
|
||||
{
|
||||
if (this.IsVisible)
|
||||
{
|
||||
coordinates.Offset(this.Location.X, this.Location.Y);
|
||||
|
||||
RenderSelf(coordinates, parameters);
|
||||
|
||||
//Render children:
|
||||
foreach (AbstractComponent c in mChildren)
|
||||
{
|
||||
c.Render(coordinates, parameters);
|
||||
}
|
||||
|
||||
coordinates.Offset(-this.Location.X, -this.Location.Y);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void RenderSelf(Rectangle coordinates, IRenderParameters parameters);
|
||||
#endregion
|
||||
|
||||
#region Virtual Functions
|
||||
/// <summary>
|
||||
/// Gets called when the control is clicked.
|
||||
/// </summary>
|
||||
public virtual void Clicked() { }
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
58
trunk/src/Icarus/LUCIE/AssemblyInfo.cs
Normal file
58
trunk/src/Icarus/LUCIE/AssemblyInfo.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
//
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
//
|
||||
[assembly: AssemblyTitle("")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
//
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
//
|
||||
// In order to sign your assembly you must specify a key to use. Refer to the
|
||||
// Microsoft .NET Framework documentation for more information on assembly signing.
|
||||
//
|
||||
// Use the attributes below to control which key is used for signing.
|
||||
//
|
||||
// Notes:
|
||||
// (*) If no key is specified, the assembly is not signed.
|
||||
// (*) KeyName refers to a key that has been installed in the Crypto Service
|
||||
// Provider (CSP) on your machine. KeyFile refers to a file which contains
|
||||
// a key.
|
||||
// (*) If the KeyFile and the KeyName values are both specified, the
|
||||
// following processing occurs:
|
||||
// (1) If the KeyName can be found in the CSP, that key is used.
|
||||
// (2) If the KeyName does not exist and the KeyFile does exist, the key
|
||||
// in the KeyFile is installed into the CSP and used.
|
||||
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
|
||||
// When specifying the KeyFile, the location of the KeyFile should be
|
||||
// relative to the project output directory which is
|
||||
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
|
||||
// located in the project directory, you would specify the AssemblyKeyFile
|
||||
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
|
||||
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
|
||||
// documentation for more information on this.
|
||||
//
|
||||
[assembly: AssemblyDelaySign(false)]
|
||||
[assembly: AssemblyKeyFile("")]
|
||||
[assembly: AssemblyKeyName("")]
|
||||
107
trunk/src/Icarus/LUCIE/ComponentGrid.cs
Normal file
107
trunk/src/Icarus/LUCIE/ComponentGrid.cs
Normal file
@@ -0,0 +1,107 @@
|
||||
// $Author: asskoala $
|
||||
// $Date: 2005/12/11 21:07:21 $
|
||||
// $Revision: 1.1 $
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
namespace Icarus.LUCIE
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies how the components in the grid will be laid out.
|
||||
/// </summary>
|
||||
public enum Layout
|
||||
{
|
||||
Row,
|
||||
Column
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is a grid of components.
|
||||
/// </summary>
|
||||
/// Basically, we can add a bunch of components to this control and they will be nicely laid out in a row or column.
|
||||
public class ComponentGrid : AbstractComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// The layout of the grid.
|
||||
/// </summary>
|
||||
private Layout mLayout;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the component grid.
|
||||
/// </summary>
|
||||
/// <param name="l">How will the components be laid out?</param>
|
||||
public ComponentGrid(Layout l)
|
||||
{
|
||||
this.Layout = l;
|
||||
|
||||
//Register to listen for child changes:
|
||||
this.ChildrenChanged += new ChildCallback(ComponentGrid_ChildrenChanged);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets how the components are laid out.
|
||||
/// </summary>
|
||||
public Layout Layout
|
||||
{
|
||||
get { return mLayout; }
|
||||
set
|
||||
{
|
||||
this.mLayout = value;
|
||||
this.LayOutComponents();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function lays out the components and updates my own dimensions.
|
||||
/// </summary>
|
||||
private void LayOutComponents()
|
||||
{
|
||||
//The position for the next component:
|
||||
Point position = new Point(0, 0);
|
||||
|
||||
//The maximum dimension in the direction perpendicular to the one being laid out in:
|
||||
int maximumDimension = 0;
|
||||
|
||||
foreach (AbstractComponent child in this.Children)
|
||||
{
|
||||
child.Location = position;
|
||||
|
||||
switch (this.Layout)
|
||||
{
|
||||
case Layout.Column:
|
||||
maximumDimension = Math.Max(maximumDimension, child.Size.Width);
|
||||
position.Y += child.Size.Height;
|
||||
break;
|
||||
|
||||
case Layout.Row:
|
||||
maximumDimension = Math.Max(maximumDimension, child.Size.Height);
|
||||
position.X += child.Size.Width;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (this.Layout)
|
||||
{
|
||||
case Layout.Column:
|
||||
this.Size = new Size(maximumDimension, position.Y);
|
||||
break;
|
||||
|
||||
case Layout.Row:
|
||||
this.Size = new Size(position.X, maximumDimension);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void RenderSelf(System.Drawing.Rectangle coordinates, Icarus.Graphics.Animation.IRenderParameters parameters)
|
||||
{
|
||||
//Nothing special to do. The rendering of children is done on a higher level.
|
||||
}
|
||||
|
||||
private void ComponentGrid_ChildrenChanged(AbstractComponent sender, AbstractComponent child)
|
||||
{
|
||||
//Update layout:
|
||||
this.LayOutComponents();
|
||||
}
|
||||
}
|
||||
}
|
||||
100
trunk/src/Icarus/LUCIE/HighlightGrid.cs
Normal file
100
trunk/src/Icarus/LUCIE/HighlightGrid.cs
Normal file
@@ -0,0 +1,100 @@
|
||||
// $Author: asskoala $
|
||||
// $Date: 2005/12/11 21:07:21 $
|
||||
// $Revision: 1.1 $
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
using Icarus.Graphics.Animation;
|
||||
|
||||
namespace Icarus.LUCIE
|
||||
{
|
||||
/// <summary>
|
||||
/// This is just like a component grid, except it also can highlight an item with a special image.
|
||||
/// </summary>
|
||||
public class HighlightGrid : ComponentGrid
|
||||
{
|
||||
/// <summary>
|
||||
/// The animation used to highlight the selected component.
|
||||
/// </summary>
|
||||
private FramesetAnimation mHighlightAnimation;
|
||||
|
||||
/// <summary>
|
||||
/// Which component is highlighted.
|
||||
/// </summary>
|
||||
private AbstractComponent mHighlightedComponent;
|
||||
|
||||
/// <summary>
|
||||
/// The position of the highlight animation.
|
||||
/// </summary>
|
||||
private Point mHighlightPosition = new Point(0, 0);
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the highlight grid.
|
||||
/// </summary>
|
||||
/// <param name="l">The layout of the components.</param>
|
||||
/// <param name="highlightAnimation">The animation used to highlight the selected item.</param>
|
||||
public HighlightGrid(Layout l, FramesetAnimation highlightAnimation) : base(l)
|
||||
{
|
||||
this.HighlightAnimation = highlightAnimation;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The animation used to highlight the selected component.
|
||||
/// </summary>
|
||||
public FramesetAnimation HighlightAnimation
|
||||
{
|
||||
get { return this.mHighlightAnimation; }
|
||||
set { this.mHighlightAnimation = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Which child should be highlighted?
|
||||
/// </summary>
|
||||
public AbstractComponent HighlightedComponent
|
||||
{
|
||||
get { return this.mHighlightedComponent; }
|
||||
set
|
||||
{
|
||||
this.mHighlightedComponent = value;
|
||||
this.UpdateHighlight();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the position of the highlight depending on which component is currently selected.
|
||||
/// </summary>
|
||||
private void UpdateHighlight()
|
||||
{
|
||||
if (this.HighlightedComponent != null)
|
||||
{
|
||||
//Find the center of the component:
|
||||
switch (this.Layout)
|
||||
{
|
||||
case Layout.Column:
|
||||
mHighlightPosition.X = this.Size.Width / 2;
|
||||
mHighlightPosition.Y = this.HighlightedComponent.Location.Y + this.HighlightedComponent.Size.Height / 2;
|
||||
break;
|
||||
|
||||
case Layout.Row:
|
||||
mHighlightPosition.X = this.HighlightedComponent.Location.X + this.HighlightedComponent.Size.Width / 2;
|
||||
mHighlightPosition.Y = this.Size.Height / 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void RenderSelf(Rectangle coordinates, IRenderParameters parameters)
|
||||
{
|
||||
base.RenderSelf(coordinates, parameters);
|
||||
|
||||
if (this.HighlightAnimation != null && this.HighlightedComponent != null)
|
||||
{
|
||||
coordinates.Offset(mHighlightPosition);
|
||||
this.HighlightAnimation.CurrentFrame.Render(coordinates, parameters);
|
||||
this.HighlightAnimation.update(1);
|
||||
coordinates.Offset(-mHighlightPosition.X, -mHighlightPosition.Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
35
trunk/src/Icarus/LUCIE/ImageComponent.cs
Normal file
35
trunk/src/Icarus/LUCIE/ImageComponent.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
// $Author: asskoala $
|
||||
// $Date: 2005/12/11 21:07:21 $
|
||||
// $Revision: 1.1 $
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
using Icarus.Graphics.Animation;
|
||||
|
||||
namespace Icarus.LUCIE
|
||||
{
|
||||
/// <summary>
|
||||
/// This is a simple component that just displays a static image.
|
||||
/// </summary>
|
||||
public class ImageComponent : AbstractComponent
|
||||
{
|
||||
private Frameset mFrameset;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new image component. Note that the image will be automagically sized to the proper dimensions.
|
||||
/// </summary>
|
||||
/// <param name="image">The image to display. Note that it doesn't have to have the fancy frameset markup. Any old image will do.</param>
|
||||
public ImageComponent(Bitmap image)
|
||||
{
|
||||
this.mFrameset = new Frameset();
|
||||
mFrameset.addFrame(image, new Point(0, 0));
|
||||
this.Size = image.Size;
|
||||
}
|
||||
|
||||
protected override void RenderSelf(Rectangle coordinates, Icarus.Graphics.Animation.IRenderParameters parameters)
|
||||
{
|
||||
mFrameset.getFrameAt(0).Render(coordinates, parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
145
trunk/src/Icarus/LUCIE/LUCIE.csproj
Normal file
145
trunk/src/Icarus/LUCIE/LUCIE.csproj
Normal file
@@ -0,0 +1,145 @@
|
||||
<VisualStudioProject>
|
||||
<CSHARP
|
||||
ProjectType = "Local"
|
||||
ProductVersion = "7.10.3077"
|
||||
SchemaVersion = "2.0"
|
||||
ProjectGuid = "{8532E9F7-4E6A-4CD8-A3E5-FC5E8811635C}"
|
||||
>
|
||||
<Build>
|
||||
<Settings
|
||||
ApplicationIcon = ""
|
||||
AssemblyKeyContainerName = ""
|
||||
AssemblyName = "Icarus.LUCIE"
|
||||
AssemblyOriginatorKeyFile = ""
|
||||
DefaultClientScript = "JScript"
|
||||
DefaultHTMLPageLayout = "Grid"
|
||||
DefaultTargetSchema = "IE50"
|
||||
DelaySign = "false"
|
||||
OutputType = "Library"
|
||||
PreBuildEvent = ""
|
||||
PostBuildEvent = ""
|
||||
RootNamespace = "Icarus.LUCIE"
|
||||
RunPostBuildEvent = "OnBuildSuccess"
|
||||
StartupObject = ""
|
||||
>
|
||||
<Config
|
||||
Name = "Debug"
|
||||
AllowUnsafeBlocks = "false"
|
||||
BaseAddress = "285212672"
|
||||
CheckForOverflowUnderflow = "false"
|
||||
ConfigurationOverrideFile = ""
|
||||
DefineConstants = "DEBUG;TRACE"
|
||||
DocumentationFile = ""
|
||||
DebugSymbols = "true"
|
||||
FileAlignment = "4096"
|
||||
IncrementalBuild = "false"
|
||||
NoStdLib = "false"
|
||||
NoWarn = ""
|
||||
Optimize = "false"
|
||||
OutputPath = "bin\Debug\"
|
||||
RegisterForComInterop = "false"
|
||||
RemoveIntegerChecks = "false"
|
||||
TreatWarningsAsErrors = "false"
|
||||
WarningLevel = "4"
|
||||
/>
|
||||
<Config
|
||||
Name = "Release"
|
||||
AllowUnsafeBlocks = "false"
|
||||
BaseAddress = "285212672"
|
||||
CheckForOverflowUnderflow = "false"
|
||||
ConfigurationOverrideFile = ""
|
||||
DefineConstants = "TRACE"
|
||||
DocumentationFile = ""
|
||||
DebugSymbols = "false"
|
||||
FileAlignment = "4096"
|
||||
IncrementalBuild = "false"
|
||||
NoStdLib = "false"
|
||||
NoWarn = ""
|
||||
Optimize = "true"
|
||||
OutputPath = "bin\Release\"
|
||||
RegisterForComInterop = "false"
|
||||
RemoveIntegerChecks = "false"
|
||||
TreatWarningsAsErrors = "false"
|
||||
WarningLevel = "4"
|
||||
/>
|
||||
</Settings>
|
||||
<References>
|
||||
<Reference
|
||||
Name = "System"
|
||||
AssemblyName = "System"
|
||||
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.Data"
|
||||
AssemblyName = "System.Data"
|
||||
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.XML"
|
||||
AssemblyName = "System.Xml"
|
||||
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.Drawing"
|
||||
AssemblyName = "System.Drawing"
|
||||
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Drawing.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "Animation"
|
||||
Project = "{38EF5765-4D23-4D19-8805-0398E220AB88}"
|
||||
Package = "{E6FDF86B-F3D1-11D4-8576-0002A516ECE8}"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.Windows.Forms"
|
||||
AssemblyName = "System.Windows.Forms"
|
||||
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Windows.Forms.dll"
|
||||
/>
|
||||
</References>
|
||||
</Build>
|
||||
<Files>
|
||||
<Include>
|
||||
<File
|
||||
RelPath = "AbstractComponent.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "AssemblyInfo.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "ComponentGrid.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "HighlightGrid.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "ImageComponent.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Label.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "RootComponent.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "StatusBar.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
</Include>
|
||||
</Files>
|
||||
</CSHARP>
|
||||
</VisualStudioProject>
|
||||
|
||||
48
trunk/src/Icarus/LUCIE/LUCIE.csproj.user
Normal file
48
trunk/src/Icarus/LUCIE/LUCIE.csproj.user
Normal file
@@ -0,0 +1,48 @@
|
||||
<VisualStudioProject>
|
||||
<CSHARP LastOpenVersion = "7.10.3077" >
|
||||
<Build>
|
||||
<Settings ReferencePath = "" >
|
||||
<Config
|
||||
Name = "Debug"
|
||||
EnableASPDebugging = "false"
|
||||
EnableASPXDebugging = "false"
|
||||
EnableUnmanagedDebugging = "false"
|
||||
EnableSQLServerDebugging = "false"
|
||||
RemoteDebugEnabled = "false"
|
||||
RemoteDebugMachine = ""
|
||||
StartAction = "Project"
|
||||
StartArguments = ""
|
||||
StartPage = ""
|
||||
StartProgram = ""
|
||||
StartURL = ""
|
||||
StartWorkingDirectory = ""
|
||||
StartWithIE = "false"
|
||||
/>
|
||||
<Config
|
||||
Name = "Release"
|
||||
EnableASPDebugging = "false"
|
||||
EnableASPXDebugging = "false"
|
||||
EnableUnmanagedDebugging = "false"
|
||||
EnableSQLServerDebugging = "false"
|
||||
RemoteDebugEnabled = "false"
|
||||
RemoteDebugMachine = ""
|
||||
StartAction = "Project"
|
||||
StartArguments = ""
|
||||
StartPage = ""
|
||||
StartProgram = ""
|
||||
StartURL = ""
|
||||
StartWorkingDirectory = ""
|
||||
StartWithIE = "false"
|
||||
/>
|
||||
</Settings>
|
||||
</Build>
|
||||
<OtherProjectSettings
|
||||
CopyProjectDestinationFolder = ""
|
||||
CopyProjectUncPath = ""
|
||||
CopyProjectOption = "0"
|
||||
ProjectView = "ProjectFiles"
|
||||
ProjectTrust = "0"
|
||||
/>
|
||||
</CSHARP>
|
||||
</VisualStudioProject>
|
||||
|
||||
69
trunk/src/Icarus/LUCIE/Label.cs
Normal file
69
trunk/src/Icarus/LUCIE/Label.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
// $Author: asskoala $
|
||||
// $Date: 2005/12/11 21:07:21 $
|
||||
// $Revision: 1.1 $
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
using Icarus.Graphics.Animation;
|
||||
|
||||
namespace Icarus.LUCIE
|
||||
{
|
||||
/// <summary>
|
||||
/// This is a simple label that can be used to... well, label things.
|
||||
/// </summary>
|
||||
/// For those of you that have lived under a rock since before Windows 1.0 came out, a label
|
||||
/// is a piece of text that can be displayed at an arbitrary location on screen.
|
||||
/// For instance, it could be displayed next to this big red button and say something
|
||||
/// like: don't push this button!
|
||||
public class Label : AbstractComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// The context used to render the label.
|
||||
/// </summary>
|
||||
private AbstractText mText;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new label with black color and default font.
|
||||
/// </summary>
|
||||
/// <param name="text">The text of the label</param>
|
||||
public Label(string text) : this(text, Color.Black) { }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new label with the specified color and default font.
|
||||
/// </summary>
|
||||
/// <param name="text"></param>
|
||||
/// <param name="c"></param>
|
||||
public Label(string text, Color c) : this(text, c, new Font(FontFamily.GenericSerif.Name, 12)) { }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new label with the specified text, color and font. Note that the size of the label
|
||||
/// will be automagically set to fit the text. However, you still need to explicitly
|
||||
/// set the position, and make it visible and such.
|
||||
/// </summary>
|
||||
/// <param name="text">The text of the label</param>
|
||||
/// <param name="c">The color of the label</param>
|
||||
/// <param name="f">The font of the label</param>
|
||||
public Label(string text, Color c, Font f)
|
||||
{
|
||||
mText = AnimationFactory.getInstance().makeText(text, c, f);
|
||||
this.Size = mText.GetSize();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The text string of the label.
|
||||
/// </summary>
|
||||
public string Text
|
||||
{
|
||||
get
|
||||
{
|
||||
return mText.GetText();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void RenderSelf(Rectangle coordinates, IRenderParameters parameters)
|
||||
{
|
||||
mText.Render(coordinates, parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
117
trunk/src/Icarus/LUCIE/RootComponent.cs
Normal file
117
trunk/src/Icarus/LUCIE/RootComponent.cs
Normal file
@@ -0,0 +1,117 @@
|
||||
// $Author: asskoala $
|
||||
// $Date: 2005/12/11 21:07:21 $
|
||||
// $Revision: 1.1 $
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Icarus.LUCIE
|
||||
{
|
||||
/// <summary>
|
||||
/// The root component is the invisible container that will have all of the components in a single interface in it. It is told who our parent .NET control is and uses it for things like getting mouse input, if necessary. Note that this component will always resize itself to match the dimensions of the parent control.
|
||||
/// </summary>
|
||||
public class RootComponent: AbstractComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// The parent control of the UI tree.
|
||||
/// </summary>
|
||||
private Control mParentControl;
|
||||
|
||||
private bool mListeningForEvents = false;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the root component.
|
||||
/// </summary>
|
||||
/// <param name="parent">Which control do we use for user events and such?</param>
|
||||
public RootComponent(Control parent)
|
||||
{
|
||||
this.mParentControl = parent;
|
||||
UpdateBounds();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets whether or not this control should listen for events.
|
||||
/// </summary>
|
||||
public bool IsListeningForEvents
|
||||
{
|
||||
get { return mListeningForEvents; }
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
if (!IsListeningForEvents)
|
||||
{
|
||||
//Update variable:
|
||||
mListeningForEvents = true;
|
||||
|
||||
//Attach handlers:
|
||||
this.mParentControl.SizeChanged += new EventHandler(mParentControl_SizeChanged);
|
||||
this.mParentControl.MouseUp += new MouseEventHandler(mParentControl_MouseUp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsListeningForEvents)
|
||||
{
|
||||
//Update variable:
|
||||
mListeningForEvents = false;
|
||||
|
||||
//Detach the events:
|
||||
this.mParentControl.SizeChanged -= new EventHandler(mParentControl_SizeChanged);
|
||||
this.mParentControl.MouseUp -= new MouseEventHandler(mParentControl_MouseUp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The parent .NET control of the UI tree.
|
||||
/// </summary>
|
||||
public Control ParentControl
|
||||
{
|
||||
get { return mParentControl; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function will set the bounds of the root component to match the bounds of the parent control.
|
||||
/// </summary>
|
||||
private void UpdateBounds()
|
||||
{
|
||||
this.Location = new Point(0, 0);
|
||||
this.Size = this.mParentControl.Size;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets called whenever the size of the parent control changes.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void mParentControl_SizeChanged(object sender, EventArgs e)
|
||||
{
|
||||
this.UpdateBounds();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets called whenever the mouse button goes up over the control, which is our cue for a click.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void mParentControl_MouseUp(object sender, MouseEventArgs e)
|
||||
{
|
||||
AbstractComponent c = this.FindChildAt(new Point(e.X, e.Y));
|
||||
|
||||
if (c != null)
|
||||
{
|
||||
//We've been clickzorred!
|
||||
c.OnClick();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void RenderSelf(Rectangle coordinates, Icarus.Graphics.Animation.IRenderParameters parameters)
|
||||
{
|
||||
//I'm invisible.
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
150
trunk/src/Icarus/LUCIE/StatusBar.cs
Normal file
150
trunk/src/Icarus/LUCIE/StatusBar.cs
Normal file
@@ -0,0 +1,150 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
using Icarus.Graphics.Animation;
|
||||
|
||||
namespace Icarus.LUCIE
|
||||
{
|
||||
/// <summary>
|
||||
/// This is a status bar, which can be used to display the value of something out of a maximum. So, for examples, such things as health of the player, or the progress of loading a level can all be displayed using a bar.
|
||||
/// </summary>
|
||||
public class StatusBar : AbstractComponent
|
||||
{
|
||||
private int mMaximumValue;
|
||||
private int mCurrentValue;
|
||||
|
||||
private int mLeftOffset;
|
||||
private AbstractComponent mRightEnd;
|
||||
private TiledFrame mBar;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new status bar.
|
||||
/// </summary>
|
||||
/// <param name="leftEnd">The image to use on the left end of the bar. Can be null to have no left end.</param>
|
||||
/// <param name="barFiller">The image to use for the filler for the bar itself. Must be provided.</param>
|
||||
/// <param name="rightEnd">The image to use on the right end of the bar. Can be null to have no right end.</param>
|
||||
public StatusBar(Bitmap leftEnd, Bitmap barFiller, Bitmap rightEnd)
|
||||
{
|
||||
int height = 0;
|
||||
|
||||
if (leftEnd == null)
|
||||
{
|
||||
mLeftOffset = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
mLeftOffset = leftEnd.Width;
|
||||
ImageComponent left = new ImageComponent(leftEnd);
|
||||
left.Location = new Point(0, 0);
|
||||
left.IsVisible = true;
|
||||
this.AddChild(left);
|
||||
|
||||
height = Math.Max(height, left.Size.Height);
|
||||
}
|
||||
|
||||
if (rightEnd == null)
|
||||
{
|
||||
mRightEnd = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
mRightEnd = new ImageComponent(rightEnd);
|
||||
mRightEnd.Location = new Point(mLeftOffset, 0);
|
||||
mRightEnd.IsVisible = true;
|
||||
this.AddChild(mRightEnd);
|
||||
|
||||
height = Math.Max(height, mRightEnd.Size.Height);
|
||||
}
|
||||
|
||||
mBar = new TiledFrame();
|
||||
IFrame barFrame = AnimationFactory.getInstance().makeBlankFrame();
|
||||
barFrame.initialize(new Point(0, 0), barFiller);
|
||||
mBar.ChildRenderable = barFrame;
|
||||
mBar.GridSize = new Size(0, 1);
|
||||
|
||||
height = Math.Max(height, mBar.GetSize().Height);
|
||||
|
||||
//Set my own size, at least we know the height:
|
||||
Size s = this.Size;
|
||||
s.Height = height;
|
||||
this.Size = s;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The maximum value the bar can display.
|
||||
/// </summary>
|
||||
public int MaximumValue
|
||||
{
|
||||
get { return mMaximumValue; }
|
||||
set
|
||||
{
|
||||
// Set the value:
|
||||
mMaximumValue = value;
|
||||
|
||||
// Enforce current value constraints and update as needed:
|
||||
CurrentValue = CurrentValue;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The current value the bar is displaying.
|
||||
/// </summary>
|
||||
public int CurrentValue
|
||||
{
|
||||
get { return mCurrentValue; }
|
||||
set
|
||||
{
|
||||
if (mCurrentValue == value) return;
|
||||
|
||||
mCurrentValue = Math.Min(value, MaximumValue);
|
||||
ProcessValueUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the visual representation of the bar as needed.
|
||||
/// </summary>
|
||||
private void ProcessValueUpdate()
|
||||
{
|
||||
// Compute the length of the bar for 100%:
|
||||
double length = this.Size.Width - mLeftOffset - mRightEnd.Size.Width;
|
||||
|
||||
// Compute the percent fill of the bar:
|
||||
double percent = ((double) CurrentValue) / ((double) MaximumValue);
|
||||
|
||||
if (percent <= 0.001)
|
||||
{
|
||||
this.IsVisible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.IsVisible = true;
|
||||
|
||||
// Compute the length of the bar:
|
||||
length *= percent;
|
||||
|
||||
// Now, find the number of units of filler we need:
|
||||
int fillerCount = (int) Math.Floor(length / ((double) mBar.ChildRenderable.GetSize().Width));
|
||||
|
||||
// Now we can set the size of the tiled grid:
|
||||
Size s = mBar.GridSize;
|
||||
s.Width = fillerCount;
|
||||
mBar.GridSize = s;
|
||||
|
||||
// Finally, offset right end appropriately:
|
||||
Point l = mRightEnd.Location;
|
||||
l.X = mLeftOffset + mBar.GetSize().Width;
|
||||
mRightEnd.Location = l;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void RenderSelf(Rectangle coordinates, IRenderParameters parameters)
|
||||
{
|
||||
coordinates.X += mLeftOffset;
|
||||
|
||||
mBar.Render(coordinates, parameters);
|
||||
|
||||
coordinates.X -= mLeftOffset;
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
trunk/src/Icarus/LUCIE/bin/Debug/Icarus.Animation.dll
Normal file
BIN
trunk/src/Icarus/LUCIE/bin/Debug/Icarus.Animation.dll
Normal file
Binary file not shown.
BIN
trunk/src/Icarus/LUCIE/bin/Debug/Icarus.LUCIE.dll
Normal file
BIN
trunk/src/Icarus/LUCIE/bin/Debug/Icarus.LUCIE.dll
Normal file
Binary file not shown.
BIN
trunk/src/Icarus/LUCIE/bin/Debug/Icarus.LUCIE.pdb
Normal file
BIN
trunk/src/Icarus/LUCIE/bin/Debug/Icarus.LUCIE.pdb
Normal file
Binary file not shown.
BIN
trunk/src/Icarus/LUCIE/bin/Debug/Icarus.Resources.dll
Normal file
BIN
trunk/src/Icarus/LUCIE/bin/Debug/Icarus.Resources.dll
Normal file
Binary file not shown.
BIN
trunk/src/Icarus/LUCIE/bin/Release/Icarus.Animation.dll
Normal file
BIN
trunk/src/Icarus/LUCIE/bin/Release/Icarus.Animation.dll
Normal file
Binary file not shown.
BIN
trunk/src/Icarus/LUCIE/bin/Release/Icarus.LUCIE.dll
Normal file
BIN
trunk/src/Icarus/LUCIE/bin/Release/Icarus.LUCIE.dll
Normal file
Binary file not shown.
BIN
trunk/src/Icarus/LUCIE/bin/Release/Icarus.Resources.dll
Normal file
BIN
trunk/src/Icarus/LUCIE/bin/Release/Icarus.Resources.dll
Normal file
Binary file not shown.
BIN
trunk/src/Icarus/LUCIE/obj/Debug/Icarus.LUCIE.dll
Normal file
BIN
trunk/src/Icarus/LUCIE/obj/Debug/Icarus.LUCIE.dll
Normal file
Binary file not shown.
BIN
trunk/src/Icarus/LUCIE/obj/Debug/Icarus.LUCIE.pdb
Normal file
BIN
trunk/src/Icarus/LUCIE/obj/Debug/Icarus.LUCIE.pdb
Normal file
Binary file not shown.
BIN
trunk/src/Icarus/LUCIE/obj/Debug/LUCIE.projdata
Normal file
BIN
trunk/src/Icarus/LUCIE/obj/Debug/LUCIE.projdata
Normal file
Binary file not shown.
BIN
trunk/src/Icarus/LUCIE/obj/Debug/LUCIE.projdata1
Normal file
BIN
trunk/src/Icarus/LUCIE/obj/Debug/LUCIE.projdata1
Normal file
Binary file not shown.
BIN
trunk/src/Icarus/LUCIE/obj/Release/Icarus.LUCIE.dll
Normal file
BIN
trunk/src/Icarus/LUCIE/obj/Release/Icarus.LUCIE.dll
Normal file
Binary file not shown.
BIN
trunk/src/Icarus/LUCIE/obj/Release/LUCIE.projdata
Normal file
BIN
trunk/src/Icarus/LUCIE/obj/Release/LUCIE.projdata
Normal file
Binary file not shown.
58
trunk/src/Icarus/Logic/AssemblyInfo.cs
Normal file
58
trunk/src/Icarus/Logic/AssemblyInfo.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
//
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
//
|
||||
[assembly: AssemblyTitle("")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
//
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
//
|
||||
// In order to sign your assembly you must specify a key to use. Refer to the
|
||||
// Microsoft .NET Framework documentation for more information on assembly signing.
|
||||
//
|
||||
// Use the attributes below to control which key is used for signing.
|
||||
//
|
||||
// Notes:
|
||||
// (*) If no key is specified, the assembly is not signed.
|
||||
// (*) KeyName refers to a key that has been installed in the Crypto Service
|
||||
// Provider (CSP) on your machine. KeyFile refers to a file which contains
|
||||
// a key.
|
||||
// (*) If the KeyFile and the KeyName values are both specified, the
|
||||
// following processing occurs:
|
||||
// (1) If the KeyName can be found in the CSP, that key is used.
|
||||
// (2) If the KeyName does not exist and the KeyFile does exist, the key
|
||||
// in the KeyFile is installed into the CSP and used.
|
||||
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
|
||||
// When specifying the KeyFile, the location of the KeyFile should be
|
||||
// relative to the project output directory which is
|
||||
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
|
||||
// located in the project directory, you would specify the AssemblyKeyFile
|
||||
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
|
||||
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
|
||||
// documentation for more information on this.
|
||||
//
|
||||
[assembly: AssemblyDelaySign(false)]
|
||||
[assembly: AssemblyKeyFile("")]
|
||||
[assembly: AssemblyKeyName("")]
|
||||
68
trunk/src/Icarus/Logic/ChildObject.cs
Normal file
68
trunk/src/Icarus/Logic/ChildObject.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using System;
|
||||
|
||||
using Icarus.Logic.Physics;
|
||||
using Icarus.Graphics.Animation;
|
||||
|
||||
namespace Icarus.Logic
|
||||
{
|
||||
/// <summary>
|
||||
/// This is a child object. Basically, it means it's a subcomponent of another object. For instance, suppose we have the Merc world object. He could have a "whip" child object.
|
||||
/// </summary>
|
||||
public class ChildObject: WorldObject
|
||||
{
|
||||
#region Data
|
||||
/// <summary>
|
||||
/// The anchor point for the child.
|
||||
/// </summary>
|
||||
private Point mAnchorPoint;
|
||||
|
||||
/// <summary>
|
||||
/// The parent world object.
|
||||
/// </summary>
|
||||
private WorldObject mParent;
|
||||
#endregion
|
||||
|
||||
#region Fields
|
||||
/// <summary>
|
||||
/// Anchor Point. The anchor point is the coordinate of the parent object where the top-left corner of the child goes.
|
||||
/// </summary>
|
||||
public Point AnchorPoint
|
||||
{
|
||||
get { return mAnchorPoint; }
|
||||
set { mAnchorPoint = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The parent of the child object.
|
||||
/// </summary>
|
||||
[System.Xml.Serialization.XmlIgnore]
|
||||
public WorldObject Parent
|
||||
{
|
||||
get { return mParent; }
|
||||
set { mParent = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The location of the child component.
|
||||
/// </summary>
|
||||
public override Point Location
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.Parent.Location.Add(this.AnchorPoint);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Velocity of the child component.
|
||||
/// </summary>
|
||||
public override Vector Velocity
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.Parent.Velocity;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
129
trunk/src/Icarus/Logic/Controllers/ControllerFactory.cs
Normal file
129
trunk/src/Icarus/Logic/Controllers/ControllerFactory.cs
Normal file
@@ -0,0 +1,129 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
|
||||
namespace Icarus.Logic.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// This guy provides us with controllers.
|
||||
/// </summary>
|
||||
public sealed class ControllerFactory
|
||||
{
|
||||
#region Singleton Stuff
|
||||
/// <summary>
|
||||
/// Singleton Implementation.
|
||||
/// </summary>
|
||||
private static ControllerFactory mgInstance = new ControllerFactory();
|
||||
|
||||
/// <summary>
|
||||
/// Singleton Implementation.
|
||||
/// </summary>
|
||||
public static ControllerFactory Instance
|
||||
{
|
||||
get { return ControllerFactory.mgInstance; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private Parts
|
||||
/// <summary>
|
||||
/// The default controller.
|
||||
/// </summary>
|
||||
private IController mDefaultController = new DefaultController();
|
||||
|
||||
/// <summary>
|
||||
/// The dictionary of registered controllers. This is so that we don't have to look up the type through reflection every time.
|
||||
/// </summary>
|
||||
private IDictionary mControllerTypes;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the controller factory.
|
||||
/// </summary>
|
||||
private ControllerFactory()
|
||||
{
|
||||
// Initialize the dictinary of controllers:
|
||||
mControllerTypes = new ListDictionary();
|
||||
|
||||
// Register the default controller:
|
||||
this.RegisterControllerType(mDefaultController.GetType().FullName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers the controller type with the dictionary.
|
||||
/// </summary>
|
||||
/// <param name="fullName"></param>
|
||||
private void RegisterControllerType(string fullName)
|
||||
{
|
||||
// First, we need to actually find this type they speak of:
|
||||
Type controllerType = GetTypeForName(fullName);
|
||||
|
||||
//TODO: Check that controllerType implements IController.
|
||||
|
||||
// Add this to the list:
|
||||
mControllerTypes.Add(controllerType.FullName, controllerType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the type corresponding to the name passed in, or null if the type is undefined.
|
||||
/// </summary>
|
||||
/// <param name="fullName"></param>
|
||||
/// <returns></returns>
|
||||
private Type GetTypeForName(string fullName)
|
||||
{
|
||||
// Get the main executable assembly:
|
||||
Assembly entryAssembly = Assembly.GetEntryAssembly();
|
||||
|
||||
// See if the type is defined in that assembly:
|
||||
Type result = entryAssembly.GetType(fullName, false, false);
|
||||
if (result != null) { return result; }
|
||||
|
||||
// Get the list of referenced assemblies:
|
||||
AssemblyName[] referencedAssemblies = entryAssembly.GetReferencedAssemblies();
|
||||
|
||||
// Check each referenced assembly for the type:
|
||||
foreach (AssemblyName aName in referencedAssemblies)
|
||||
{
|
||||
Assembly a = Assembly.Load(aName);
|
||||
result = a.GetType(fullName, false, false);
|
||||
|
||||
if (result != null) { return result; }
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a controller for the specified type.
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
private IController GetControllerForType(Type t)
|
||||
{
|
||||
return (IController) t.GetConstructor(Type.EmptyTypes).Invoke(null);
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Returns the default controller for objects.
|
||||
/// </summary>
|
||||
public IController DefaultController
|
||||
{
|
||||
get { return this.mDefaultController; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a controller for the type whose fully qualified name is supplied. Of course, note that if the specified type is not actually a controller, then bad things will happen (exceptions).
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
public IController GetControllerForType(string type)
|
||||
{
|
||||
if (!mControllerTypes.Contains(type))
|
||||
{
|
||||
this.RegisterControllerType(type);
|
||||
}
|
||||
|
||||
return this.GetControllerForType(mControllerTypes[type] as Type);
|
||||
}
|
||||
}
|
||||
}
|
||||
15
trunk/src/Icarus/Logic/Controllers/DefaultController.cs
Normal file
15
trunk/src/Icarus/Logic/Controllers/DefaultController.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
|
||||
namespace Icarus.Logic.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// This is the default controller that doesn't really do anything.
|
||||
/// </summary>
|
||||
public class DefaultController: IController
|
||||
{
|
||||
public void UpdateObject(PhysicsObject obj)
|
||||
{
|
||||
//Nothing to do...
|
||||
}
|
||||
}
|
||||
}
|
||||
16
trunk/src/Icarus/Logic/Controllers/IController.cs
Normal file
16
trunk/src/Icarus/Logic/Controllers/IController.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
|
||||
namespace Icarus.Logic.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// The implementors of this interface are controllers that can control a world object.
|
||||
/// </summary>
|
||||
public interface IController
|
||||
{
|
||||
/// <summary>
|
||||
/// Updates the world object passed in.
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
void UpdateObject(PhysicsObject obj);
|
||||
}
|
||||
}
|
||||
48
trunk/src/Icarus/Logic/GameEngine.csproj.user
Normal file
48
trunk/src/Icarus/Logic/GameEngine.csproj.user
Normal file
@@ -0,0 +1,48 @@
|
||||
<VisualStudioProject>
|
||||
<CSHARP LastOpenVersion = "7.10.3077" >
|
||||
<Build>
|
||||
<Settings ReferencePath = "" >
|
||||
<Config
|
||||
Name = "Debug"
|
||||
EnableASPDebugging = "false"
|
||||
EnableASPXDebugging = "false"
|
||||
EnableUnmanagedDebugging = "false"
|
||||
EnableSQLServerDebugging = "false"
|
||||
RemoteDebugEnabled = "false"
|
||||
RemoteDebugMachine = ""
|
||||
StartAction = "Project"
|
||||
StartArguments = ""
|
||||
StartPage = ""
|
||||
StartProgram = ""
|
||||
StartURL = ""
|
||||
StartWorkingDirectory = ""
|
||||
StartWithIE = "true"
|
||||
/>
|
||||
<Config
|
||||
Name = "Release"
|
||||
EnableASPDebugging = "false"
|
||||
EnableASPXDebugging = "false"
|
||||
EnableUnmanagedDebugging = "false"
|
||||
EnableSQLServerDebugging = "false"
|
||||
RemoteDebugEnabled = "false"
|
||||
RemoteDebugMachine = ""
|
||||
StartAction = "Project"
|
||||
StartArguments = ""
|
||||
StartPage = ""
|
||||
StartProgram = ""
|
||||
StartURL = ""
|
||||
StartWorkingDirectory = ""
|
||||
StartWithIE = "true"
|
||||
/>
|
||||
</Settings>
|
||||
</Build>
|
||||
<OtherProjectSettings
|
||||
CopyProjectDestinationFolder = ""
|
||||
CopyProjectUncPath = ""
|
||||
CopyProjectOption = "0"
|
||||
ProjectView = "ProjectFiles"
|
||||
ProjectTrust = "0"
|
||||
/>
|
||||
</CSHARP>
|
||||
</VisualStudioProject>
|
||||
|
||||
167
trunk/src/Icarus/Logic/GameEngine/GameEngine.cs
Normal file
167
trunk/src/Icarus/Logic/GameEngine/GameEngine.cs
Normal file
@@ -0,0 +1,167 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Threading;
|
||||
|
||||
namespace Icarus.Logic.GameEngine
|
||||
{
|
||||
/// <summary>
|
||||
/// I am the heart of the Icarus Game Engine
|
||||
/// I basically cause everything to start moving, sort of like a Spark Plug.
|
||||
/// I am a Singleton and I get started when the user turns the key by
|
||||
/// executing the executable created by the Runner project.
|
||||
/// </summary>
|
||||
public class GameEngine
|
||||
{
|
||||
|
||||
#region Instance Variables
|
||||
/// <summary>
|
||||
/// This is the stack of game states we have running.
|
||||
/// </summary>
|
||||
private Stack mGameStates;
|
||||
|
||||
/// <summary>
|
||||
/// This tells us if we are running, paused or stopped.
|
||||
/// </summary>
|
||||
private int iDoRun = -1;
|
||||
#endregion
|
||||
|
||||
#region Singleton Stuff
|
||||
private static GameEngine instance = new GameEngine();
|
||||
|
||||
/// <summary>
|
||||
/// Private Constructor for the Game Engine
|
||||
/// It is a Singleton so noone should ever touch the Constructor
|
||||
/// </summary>
|
||||
private GameEngine()
|
||||
{
|
||||
this.mGameStates = new Stack();
|
||||
|
||||
//We need to do this instead of using PushState function, because now the stack is empty.
|
||||
this.mGameStates.Push(new RootState());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The Singleton GameEngine instance
|
||||
/// </summary>
|
||||
public static GameEngine Instance
|
||||
{
|
||||
get { return instance; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region Game State Controls
|
||||
//TODO: When pushing and popping the states, should we check the state of the engine?
|
||||
// Like, suppose we are paused and push a state. Should we call pause on it so it doesn't do anything silly?
|
||||
|
||||
/// <summary>
|
||||
/// The current state of the game engine.
|
||||
/// </summary>
|
||||
public IGameState CurrentState
|
||||
{
|
||||
get { return (IGameState) this.mGameStates.Peek(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pushes a game state onto the game state stack. The state on top of the stack is always the active one.
|
||||
/// </summary>
|
||||
/// <param name="state">The new active state.</param>
|
||||
public void PushState(IGameState state)
|
||||
{
|
||||
//Pause the current state:
|
||||
this.CurrentState.Pause();
|
||||
|
||||
//Enter the new state:
|
||||
state.Enter();
|
||||
|
||||
//Push the new state on the stack:
|
||||
this.mGameStates.Push(state);
|
||||
|
||||
this.CurrentState.Unpause();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pops the current state off the state stack. The previous active state will become active once again.
|
||||
/// </summary>
|
||||
public void PopState()
|
||||
{
|
||||
//Exit current state:
|
||||
this.CurrentState.Exit();
|
||||
|
||||
//Pop state:
|
||||
this.mGameStates.Pop();
|
||||
|
||||
//Unpause the next state:
|
||||
this.CurrentState.Unpause();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Renders the current state.
|
||||
/// </summary>
|
||||
/// <param name="parameters">Render parameters</param>
|
||||
public void RenderCurrentState(Icarus.Graphics.Animation.IRenderParameters parameters)
|
||||
{
|
||||
this.CurrentState.RenderState(parameters);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Run Controls
|
||||
/// <summary>
|
||||
/// Start the game engine.
|
||||
/// </summary>
|
||||
public void Play()
|
||||
{
|
||||
this.CurrentState.Unpause();
|
||||
this.iDoRun = 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pause the game engine.
|
||||
/// </summary>
|
||||
public void Pause()
|
||||
{
|
||||
this.iDoRun = -1;
|
||||
this.CurrentState.Pause();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stop the game engine. Note that this will pop all the states, so we stop cleanly.
|
||||
/// </summary>
|
||||
public void Stop()
|
||||
{
|
||||
//Pop all the states so we stop cleanly:
|
||||
while (!this.CurrentState.GetType().Equals(typeof(RootState)))
|
||||
{
|
||||
this.PopState();
|
||||
}
|
||||
|
||||
this.iDoRun = 0;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Main Game Engine Loop
|
||||
/// <summary>
|
||||
/// The function that needs to be run in its own thread. This controls the game engine.
|
||||
/// </summary>
|
||||
public void RunThread()
|
||||
{
|
||||
while (this.iDoRun != 0)
|
||||
{
|
||||
DateTime start = DateTime.Now;
|
||||
int delay = (int) ((float)GameSettings.Instance.sv_updateRate / GameSettings.Instance.sv_timescale);
|
||||
|
||||
if (this.iDoRun > 0)
|
||||
{
|
||||
this.CurrentState.Step(delay);
|
||||
}
|
||||
|
||||
int millis = DateTime.Now.Subtract(start).Milliseconds;
|
||||
if (millis < delay)
|
||||
{
|
||||
Thread.Sleep(delay - millis);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
37
trunk/src/Icarus/Logic/GameEngine/GameFaction.cs
Normal file
37
trunk/src/Icarus/Logic/GameEngine/GameFaction.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
|
||||
namespace Icarus.Logic.GameEngine
|
||||
{
|
||||
/// <summary>
|
||||
/// I am a combination of Relations that define who
|
||||
/// my enemies and friends are.
|
||||
///
|
||||
/// A Relation is composed of a friend and an enemy
|
||||
/// and is loaded as a script.
|
||||
///
|
||||
/// </summary>
|
||||
public class GameFaction
|
||||
{
|
||||
|
||||
//private Relation[] arrRelations;
|
||||
private string strFactionName;
|
||||
|
||||
/// <summary>
|
||||
/// The faction Name
|
||||
///
|
||||
/// Just a string
|
||||
/// </summary>
|
||||
public string Name {
|
||||
get { return this.strFactionName; }
|
||||
set { this.strFactionName = value;}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the GameFaction object to default values
|
||||
/// </summary>
|
||||
public GameFaction()
|
||||
{
|
||||
strFactionName = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
49
trunk/src/Icarus/Logic/GameEngine/GameProperties.cs
Normal file
49
trunk/src/Icarus/Logic/GameEngine/GameProperties.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
|
||||
namespace Icarus.Logic.GameEngine
|
||||
{
|
||||
/// <summary>
|
||||
/// I contain the Vital information necessary for a great game.
|
||||
///
|
||||
/// I, personally, love value types.
|
||||
/// </summary>
|
||||
public class GameProperties
|
||||
{
|
||||
private float fHealth;
|
||||
private float fCollisionDamage;
|
||||
|
||||
/// <summary>
|
||||
/// This should hold the health of the current Game Object.
|
||||
/// </summary>
|
||||
public float Health {
|
||||
get { return this.fHealth; }
|
||||
set { this.fHealth = value;}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This should contain the damage inflicted by the object
|
||||
/// upon unfriendly objects during a collision
|
||||
/// </summary>
|
||||
public float CollisionDamage {
|
||||
get { return this.fCollisionDamage; }
|
||||
set { this.fCollisionDamage = value;}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print the properties of the object
|
||||
/// </summary>
|
||||
public void PrintGameProperties() {
|
||||
Console.WriteLine(this.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert the GameProperties into a string Representation
|
||||
/// </summary>
|
||||
/// <returns>GameProperties string representation</returns>
|
||||
public override string ToString() {
|
||||
return ("GameProperties:\n" +
|
||||
" Health: " + fHealth +
|
||||
" CollisionDamage: " + fCollisionDamage);
|
||||
}
|
||||
}
|
||||
}
|
||||
358
trunk/src/Icarus/Logic/GameEngine/GameSettings.cs
Normal file
358
trunk/src/Icarus/Logic/GameEngine/GameSettings.cs
Normal file
@@ -0,0 +1,358 @@
|
||||
using System;
|
||||
|
||||
namespace Icarus.Logic.GameEngine
|
||||
{
|
||||
/// <summary>
|
||||
/// I am a singleton which can be used to retrieve Game Engine settings.
|
||||
/// Members are straightforward to access.
|
||||
/// </summary>
|
||||
public class GameSettings
|
||||
{
|
||||
|
||||
#region Instance Variables
|
||||
|
||||
/// <summary>
|
||||
/// Defines the game difficulty, changes the AI, and is used by Game Calculations.
|
||||
/// </summary>
|
||||
private int iDifficulty;
|
||||
|
||||
/// <summary>
|
||||
/// The timescale is used to define the number of times per
|
||||
/// second that the GameEngine executes to update the world.
|
||||
/// </summary>
|
||||
private float iTimeScale;
|
||||
|
||||
/// <summary>
|
||||
/// Defines whether cheats are on or off.
|
||||
/// </summary>
|
||||
private bool bCheatsEnabled;
|
||||
|
||||
/// <summary>
|
||||
/// Defines how many particles are pre-allocated when a level loads.
|
||||
/// </summary>
|
||||
private uint uiMaxParticles;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the number of particles to dynamically load at a time
|
||||
/// when the max number of particles is infinite.
|
||||
/// </summary>
|
||||
private uint uiParticleLoadRate;
|
||||
|
||||
/// <summary>
|
||||
/// Defines how many items are pre-allocated when a level loads.
|
||||
/// </summary>
|
||||
private uint uiMaxItems;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the number of items to dynamically load at a time
|
||||
/// when the max number of items is infinite.
|
||||
/// </summary>
|
||||
private uint uiItemLoadRate;
|
||||
|
||||
/// <summary>
|
||||
/// Defines how many actors are pre-allocated when a level loads.
|
||||
/// </summary>
|
||||
private uint uiMaxActors;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the number of actors to dynamically load at a time
|
||||
/// when the max number of actors is infinite.
|
||||
/// </summary>
|
||||
private uint uiActorLoadRate;
|
||||
|
||||
/// <summary>
|
||||
/// Defines how many terrain world objects are pre-allocated when a level loads.
|
||||
/// </summary>
|
||||
private uint uiMaxTerrainObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the number of terrain ojects to dynamically load at a time
|
||||
/// when the max number of terrain objects is infinite.
|
||||
/// </summary>
|
||||
private uint uiTerrainObjectLoadRate;
|
||||
|
||||
/// <summary>
|
||||
/// Defines how detailed the Physics calculations are.
|
||||
/// </summary>
|
||||
private int iPhysicsDetail;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the maximum number of collision boxes in a level
|
||||
/// </summary>
|
||||
private uint uiMaxCollisionBoxes;
|
||||
|
||||
/// <summary>
|
||||
/// The maximum internal collision rectangles a collision box can hold
|
||||
/// </summary>
|
||||
private uint uiMaxInternalRects;
|
||||
|
||||
/// <summary>
|
||||
/// The maximum internal collision triangles a collision box can hold
|
||||
/// </summary>
|
||||
private uint uiMaxInternalTris;
|
||||
|
||||
/// <summary>
|
||||
/// This defines the time between updates in milliseconds, default is 22 (45fps)
|
||||
/// </summary>
|
||||
private uint uiUpdateRate;
|
||||
|
||||
/// <summary>
|
||||
/// The maximum number of stages per level
|
||||
/// </summary>
|
||||
private uint uiMaxStages;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Singleton Stuff
|
||||
|
||||
private static GameSettings instance = new GameSettings();
|
||||
|
||||
/// <summary>
|
||||
/// Returns the instance of the GameSettings object
|
||||
/// </summary>
|
||||
public static GameSettings Instance
|
||||
{
|
||||
get { return instance; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Accessors/Modifiers
|
||||
/* ------------------- */
|
||||
/* Accessors/Modifiers */
|
||||
/* ------------------- */
|
||||
|
||||
/// <summary>
|
||||
/// Defines the maximum number of collision boxes in a level
|
||||
/// </summary>
|
||||
public uint sv_maxCollisionBoxes
|
||||
{
|
||||
get { return this.uiMaxCollisionBoxes; }
|
||||
set { this.uiMaxCollisionBoxes = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines the maximum number of internal collision rectangles
|
||||
/// a collision box can hold
|
||||
/// </summary>
|
||||
public uint sv_maxInternalRects
|
||||
{
|
||||
get { return this.uiMaxInternalRects; }
|
||||
set { this.uiMaxInternalRects = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines the maximum number of internal collision triangles
|
||||
/// a collision box can hold
|
||||
/// </summary>
|
||||
public uint sv_maxInternalTris
|
||||
{
|
||||
get { return this.uiMaxInternalTris; }
|
||||
set { this.uiMaxInternalTris = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A Negative difficulty should cause all enemies to freeze in place
|
||||
/// (allowing debugging to take place).
|
||||
/// A Positive difficulty becomes more difficult with increasing values.
|
||||
/// Lowest difficulty is 0.
|
||||
/// </summary>
|
||||
public int sv_difficulty
|
||||
{
|
||||
get { return this.iDifficulty; }
|
||||
set { this.iDifficulty = value;}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This sets the game's TimeScale.
|
||||
/// The timescale values can range from FLOAT_MIN to FLOAT_MAX.
|
||||
/// Whether the full range is supported, doesn't matter.
|
||||
/// Negatives don't matter, only the magnitude is used.
|
||||
/// A higher number than 1.0f will result in more updates occuring per second.
|
||||
/// Numbers between 0 and 1.0, exclusive, result in fewer
|
||||
/// updates and, thus, the game moves "slower".
|
||||
/// </summary>
|
||||
public float sv_timescale
|
||||
{
|
||||
get { return this.iTimeScale; }
|
||||
set { this.iTimeScale = value;}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Activating cheats can turn on things like God Mode, which negate damage
|
||||
/// effects to the player, as well as various other nifty debugging tools.
|
||||
/// </summary>
|
||||
public bool sv_cheats
|
||||
{
|
||||
get { return this.bCheatsEnabled; }
|
||||
set { this.bCheatsEnabled = value;}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A value of 0 means that infinite particles are allowed.
|
||||
/// In the case of infinite particles, particles will be loaded dynamically
|
||||
/// sv_particleLoadRate at a time.
|
||||
/// Dynamic loading is much slower, but requires much less memory.
|
||||
/// </summary>
|
||||
public uint sv_maxParticles
|
||||
{
|
||||
get { return this.uiMaxParticles; }
|
||||
set { this.uiMaxParticles = value;}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This defines the number of particles to dynamically load at a time
|
||||
/// when the max number of particles is infinite.
|
||||
/// </summary>
|
||||
public uint sv_particleLoadRate
|
||||
{
|
||||
get { return this.uiParticleLoadRate; }
|
||||
set { this.uiParticleLoadRate = value;}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A value of 0 means that infinite items are allowed.
|
||||
/// In the case of infinite items, items will be loaded dynamically
|
||||
/// sv_itemLoadRate at a time.
|
||||
/// Dynamic loading is much slower, but requires much less memory.
|
||||
/// </summary>
|
||||
public uint sv_maxItems
|
||||
{
|
||||
get { return this.uiMaxItems; }
|
||||
set { this.uiMaxItems = value;}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This defines the number of items to dynamically load at a time
|
||||
/// when the max number of items is infinite.
|
||||
/// </summary>
|
||||
public uint sv_itemLoadRate
|
||||
{
|
||||
get { return this.uiItemLoadRate; }
|
||||
set { this.uiItemLoadRate = value;}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A value of 0 means that infinite actors are allowed.
|
||||
/// In the case of infinite actors, actors will be loaded dynamically
|
||||
/// sv_actorLoadRate at a time.
|
||||
/// Dynamic loading is much slower, but requires much less memory.
|
||||
/// </summary>
|
||||
public uint sv_maxActors
|
||||
{
|
||||
get { return this.uiMaxActors; }
|
||||
set { this.uiMaxActors = value;}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This defines the number of actors to dynamically load at a time
|
||||
/// when the max number of actors is infinite.
|
||||
/// </summary>
|
||||
public uint sv_actorLoadRate
|
||||
{
|
||||
get { return this.uiActorLoadRate; }
|
||||
set { this.uiActorLoadRate = value;}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A value of 0 means that infinite terrain objects are allowed.
|
||||
/// In the case of infinite terrain objects, terrain objects will be
|
||||
/// loaded dynamically sv_terrainObjectLoadRate at a time.
|
||||
/// Dynamic loading is much slower, but requires much less memory.
|
||||
/// </summary>
|
||||
public uint sv_maxTerrainObjects
|
||||
{
|
||||
get { return this.uiMaxTerrainObjects; }
|
||||
set { this.uiMaxTerrainObjects = value;}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This defines the number of terrain objects to dynamically load at a time
|
||||
/// when the max number of terrain objects is infinite.
|
||||
/// </summary>
|
||||
public uint sv_TerrainObjectLoadRate
|
||||
{
|
||||
get { return this.uiTerrainObjectLoadRate; }
|
||||
set { this.uiTerrainObjectLoadRate = value;}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This may cause faster algorithms to be used in place of slower,
|
||||
/// more precise algorithms.
|
||||
/// This varies on Physics Engine implementation/mode.
|
||||
/// Default value is 0 (Full Detail), negative values lower
|
||||
/// detail and positive values (may) increase detail.
|
||||
/// </summary>
|
||||
public int sv_physicsDetail
|
||||
{
|
||||
get { return this.iPhysicsDetail; }
|
||||
set { this.iPhysicsDetail = value;}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This stores the time between updates in milliseconds.
|
||||
///
|
||||
/// Note that the variable sv_timescale speeds up or slows down the
|
||||
/// game itself, this variable will affect the magnitude of vectors in
|
||||
/// the Physics Engine and alter the Physics themselves
|
||||
/// </summary>
|
||||
public uint sv_updateRate
|
||||
{
|
||||
get { return this.uiUpdateRate; }
|
||||
set { this.uiUpdateRate = value;}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The maximum number of stages per level
|
||||
/// </summary>
|
||||
public uint sv_maxStages
|
||||
{
|
||||
get { return this.uiMaxStages; }
|
||||
set { this.uiMaxStages = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Initialization
|
||||
/* -------------- */
|
||||
/* Initialization */
|
||||
/* -------------- */
|
||||
|
||||
/// <summary>
|
||||
/// Uses Icarus preset Game settings as defined in the variable comments.
|
||||
/// </summary>
|
||||
private GameSettings()
|
||||
{
|
||||
this.iDifficulty = 3;
|
||||
this.iPhysicsDetail = 0;
|
||||
this.iTimeScale = 1.0f;
|
||||
this.bCheatsEnabled = false;
|
||||
this.uiParticleLoadRate = 25;
|
||||
this.uiMaxParticles = 1000;
|
||||
this.uiItemLoadRate = 25;
|
||||
this.uiMaxItems = 100;
|
||||
this.uiActorLoadRate = 25;
|
||||
this.uiMaxActors = 100;
|
||||
this.uiTerrainObjectLoadRate = 25;
|
||||
this.uiMaxTerrainObjects = 1000;
|
||||
this.uiMaxCollisionBoxes = 100;
|
||||
this.sv_maxInternalRects = 15;
|
||||
this.sv_maxInternalTris = 15;
|
||||
this.uiUpdateRate = 22; //45fps
|
||||
this.uiMaxStages = 10;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load GameSettings from a File.
|
||||
/// Sets the settings to the Icarus Defaults then loads the settings from
|
||||
/// fileName and replaces the settings specified.
|
||||
/// </summary>
|
||||
/// <param name="fileName">The fileName of settings to replace defaults.</param>
|
||||
private GameSettings(string fileName) : this()
|
||||
{
|
||||
// TODO: Implement me
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
26
trunk/src/Icarus/Logic/GameEngine/GameStateAdapter.cs
Normal file
26
trunk/src/Icarus/Logic/GameEngine/GameStateAdapter.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
|
||||
namespace Icarus.Logic.GameEngine
|
||||
{
|
||||
/// <summary>
|
||||
/// This is an adapter of the IGameState stuff, so that we don't have to implement all the functions.
|
||||
/// </summary>
|
||||
public class GameStateAdapter : IGameState
|
||||
{
|
||||
#region IGameState Members
|
||||
|
||||
public virtual void Enter() { }
|
||||
|
||||
public virtual void Step(int millis) { }
|
||||
|
||||
public virtual void RenderState(Icarus.Graphics.Animation.IRenderParameters parameters) { }
|
||||
|
||||
public virtual void Pause() { }
|
||||
|
||||
public virtual void Unpause() { }
|
||||
|
||||
public virtual void Exit() { }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
42
trunk/src/Icarus/Logic/GameEngine/IGameState.cs
Normal file
42
trunk/src/Icarus/Logic/GameEngine/IGameState.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
|
||||
namespace Icarus.Logic.GameEngine
|
||||
{
|
||||
/// <summary>
|
||||
/// The interface that all game states must implement.
|
||||
/// </summary>
|
||||
public interface IGameState
|
||||
{
|
||||
/// <summary>
|
||||
/// Called when we enter the state.
|
||||
/// </summary>
|
||||
void Enter();
|
||||
|
||||
/// <summary>
|
||||
/// Called at every iteration of the game engine loop.
|
||||
/// </summary>
|
||||
/// <param name="millis">The numbher of milliseconds since the function was last called.</param>
|
||||
void Step(int millis);
|
||||
|
||||
/// <summary>
|
||||
/// Gets called when the state needs to be rendered.
|
||||
/// </summary>
|
||||
/// <param name="parameters"></param>
|
||||
void RenderState(Icarus.Graphics.Animation.IRenderParameters parameters);
|
||||
|
||||
/// <summary>
|
||||
/// This function will be called when the state needs to be paused to be revived later on.
|
||||
/// </summary>
|
||||
void Pause();
|
||||
|
||||
/// <summary>
|
||||
/// This function will be called when the state is revived after a previous pause.
|
||||
/// </summary>
|
||||
void Unpause();
|
||||
|
||||
/// <summary>
|
||||
/// Called when we exit the state.
|
||||
/// </summary>
|
||||
void Exit();
|
||||
}
|
||||
}
|
||||
455
trunk/src/Icarus/Logic/GameEngine/LevelBuilder.cs
Normal file
455
trunk/src/Icarus/Logic/GameEngine/LevelBuilder.cs
Normal file
@@ -0,0 +1,455 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Icarus.Logic.GameEngine
|
||||
{
|
||||
/// <summary>
|
||||
/// Form for creating and editng levels.
|
||||
/// Provides for saving and loading levels.
|
||||
/// </summary>
|
||||
public class LevelBuilder : System.Windows.Forms.Form
|
||||
{
|
||||
|
||||
#region GUI Components
|
||||
private System.Windows.Forms.TextBox levelNameTextBox;
|
||||
private System.Windows.Forms.Label levelNameLabel;
|
||||
private System.Windows.Forms.Label physicsScaleLabel;
|
||||
private System.Windows.Forms.TextBox physicsScaleTextBox;
|
||||
private System.Windows.Forms.Label bgImageLabel;
|
||||
private System.Windows.Forms.TextBox bgImageTextBox;
|
||||
private System.Windows.Forms.Button bgImageButton;
|
||||
private System.Windows.Forms.Button itemButton;
|
||||
private System.Windows.Forms.Button actorButton;
|
||||
private System.Windows.Forms.Button terrainButton;
|
||||
private System.Windows.Forms.Button particleButton;
|
||||
private System.Windows.Forms.ListBox itemList;
|
||||
private System.Windows.Forms.ListBox actorList;
|
||||
private System.Windows.Forms.ListBox terrainList;
|
||||
private System.Windows.Forms.ListBox particleList;
|
||||
private System.Windows.Forms.Button loadButton;
|
||||
private System.Windows.Forms.Button saveButton;
|
||||
private System.Windows.Forms.Button itemEditButton;
|
||||
private System.Windows.Forms.Button itemRemoveButton;
|
||||
private System.Windows.Forms.Button actorRemoveButton;
|
||||
private System.Windows.Forms.Button actorEditButton;
|
||||
private System.Windows.Forms.Button terrainRemoveButton;
|
||||
private System.Windows.Forms.Button terrainEditButton;
|
||||
private System.Windows.Forms.Button particleRemoveButton;
|
||||
private System.Windows.Forms.Button particleEditButton;
|
||||
private System.ComponentModel.Container components = null;
|
||||
#endregion
|
||||
|
||||
#region Execution And Initialization
|
||||
|
||||
/// <summary>
|
||||
/// Executes the Level Builder
|
||||
/// </summary>
|
||||
public static void Main()
|
||||
{
|
||||
new LevelBuilder().Show();
|
||||
Console.WriteLine("You are now running the level builder program for the Icarus Game Engine.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the LevelBuilder object
|
||||
/// </summary>
|
||||
public LevelBuilder()
|
||||
{
|
||||
// Required for Windows Form Designer support
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if( disposing )
|
||||
{
|
||||
if (components != null)
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
}
|
||||
base.Dispose( disposing );
|
||||
Console.WriteLine("You have exited the level builder program for the Icarus Game Engine.");
|
||||
Console.WriteLine("Have A Nice Day!");
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.levelNameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.levelNameLabel = new System.Windows.Forms.Label();
|
||||
this.physicsScaleLabel = new System.Windows.Forms.Label();
|
||||
this.physicsScaleTextBox = new System.Windows.Forms.TextBox();
|
||||
this.bgImageLabel = new System.Windows.Forms.Label();
|
||||
this.bgImageTextBox = new System.Windows.Forms.TextBox();
|
||||
this.bgImageButton = new System.Windows.Forms.Button();
|
||||
this.itemButton = new System.Windows.Forms.Button();
|
||||
this.actorButton = new System.Windows.Forms.Button();
|
||||
this.terrainButton = new System.Windows.Forms.Button();
|
||||
this.particleButton = new System.Windows.Forms.Button();
|
||||
this.itemList = new System.Windows.Forms.ListBox();
|
||||
this.actorList = new System.Windows.Forms.ListBox();
|
||||
this.terrainList = new System.Windows.Forms.ListBox();
|
||||
this.particleList = new System.Windows.Forms.ListBox();
|
||||
this.loadButton = new System.Windows.Forms.Button();
|
||||
this.saveButton = new System.Windows.Forms.Button();
|
||||
this.itemEditButton = new System.Windows.Forms.Button();
|
||||
this.itemRemoveButton = new System.Windows.Forms.Button();
|
||||
this.actorRemoveButton = new System.Windows.Forms.Button();
|
||||
this.actorEditButton = new System.Windows.Forms.Button();
|
||||
this.terrainRemoveButton = new System.Windows.Forms.Button();
|
||||
this.terrainEditButton = new System.Windows.Forms.Button();
|
||||
this.particleRemoveButton = new System.Windows.Forms.Button();
|
||||
this.particleEditButton = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// levelNameTextBox
|
||||
//
|
||||
this.levelNameTextBox.Location = new System.Drawing.Point(112, 48);
|
||||
this.levelNameTextBox.Name = "levelNameTextBox";
|
||||
this.levelNameTextBox.Size = new System.Drawing.Size(416, 20);
|
||||
this.levelNameTextBox.TabIndex = 0;
|
||||
this.levelNameTextBox.Text = "Level";
|
||||
//
|
||||
// levelNameLabel
|
||||
//
|
||||
this.levelNameLabel.Location = new System.Drawing.Point(40, 48);
|
||||
this.levelNameLabel.Name = "levelNameLabel";
|
||||
this.levelNameLabel.Size = new System.Drawing.Size(72, 23);
|
||||
this.levelNameLabel.TabIndex = 1;
|
||||
this.levelNameLabel.Text = "Level Name:";
|
||||
this.levelNameLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// physicsScaleLabel
|
||||
//
|
||||
this.physicsScaleLabel.Location = new System.Drawing.Point(32, 112);
|
||||
this.physicsScaleLabel.Name = "physicsScaleLabel";
|
||||
this.physicsScaleLabel.Size = new System.Drawing.Size(80, 23);
|
||||
this.physicsScaleLabel.TabIndex = 2;
|
||||
this.physicsScaleLabel.Text = "Physics Scale:";
|
||||
this.physicsScaleLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// physicsScaleTextBox
|
||||
//
|
||||
this.physicsScaleTextBox.Location = new System.Drawing.Point(112, 112);
|
||||
this.physicsScaleTextBox.Name = "physicsScaleTextBox";
|
||||
this.physicsScaleTextBox.Size = new System.Drawing.Size(48, 20);
|
||||
this.physicsScaleTextBox.TabIndex = 3;
|
||||
this.physicsScaleTextBox.Text = "1";
|
||||
//
|
||||
// bgImageLabel
|
||||
//
|
||||
this.bgImageLabel.Location = new System.Drawing.Point(8, 80);
|
||||
this.bgImageLabel.Name = "bgImageLabel";
|
||||
this.bgImageLabel.Size = new System.Drawing.Size(104, 23);
|
||||
this.bgImageLabel.TabIndex = 4;
|
||||
this.bgImageLabel.Text = "Background Image:";
|
||||
this.bgImageLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// bgImageTextBox
|
||||
//
|
||||
this.bgImageTextBox.Location = new System.Drawing.Point(112, 80);
|
||||
this.bgImageTextBox.Name = "bgImageTextBox";
|
||||
this.bgImageTextBox.ReadOnly = true;
|
||||
this.bgImageTextBox.Size = new System.Drawing.Size(416, 20);
|
||||
this.bgImageTextBox.TabIndex = 5;
|
||||
this.bgImageTextBox.Text = "[None]";
|
||||
//
|
||||
// bgImageButton
|
||||
//
|
||||
this.bgImageButton.Location = new System.Drawing.Point(536, 80);
|
||||
this.bgImageButton.Name = "bgImageButton";
|
||||
this.bgImageButton.TabIndex = 6;
|
||||
this.bgImageButton.Text = "Browse...";
|
||||
this.bgImageButton.Click += new System.EventHandler(this.bgImageButton_Click);
|
||||
//
|
||||
// itemButton
|
||||
//
|
||||
this.itemButton.Location = new System.Drawing.Point(32, 152);
|
||||
this.itemButton.Name = "itemButton";
|
||||
this.itemButton.Size = new System.Drawing.Size(104, 23);
|
||||
this.itemButton.TabIndex = 7;
|
||||
this.itemButton.Text = "Add New Item";
|
||||
this.itemButton.Click += new System.EventHandler(this.itemButton_Click);
|
||||
//
|
||||
// actorButton
|
||||
//
|
||||
this.actorButton.Location = new System.Drawing.Point(184, 152);
|
||||
this.actorButton.Name = "actorButton";
|
||||
this.actorButton.Size = new System.Drawing.Size(104, 23);
|
||||
this.actorButton.TabIndex = 8;
|
||||
this.actorButton.Text = "Add New Actor";
|
||||
this.actorButton.Click += new System.EventHandler(this.actorButton_Click);
|
||||
//
|
||||
// terrainButton
|
||||
//
|
||||
this.terrainButton.Location = new System.Drawing.Point(336, 152);
|
||||
this.terrainButton.Name = "terrainButton";
|
||||
this.terrainButton.Size = new System.Drawing.Size(104, 23);
|
||||
this.terrainButton.TabIndex = 9;
|
||||
this.terrainButton.Text = "Add New Terrain";
|
||||
this.terrainButton.Click += new System.EventHandler(this.terrainButton_Click);
|
||||
//
|
||||
// particleButton
|
||||
//
|
||||
this.particleButton.Location = new System.Drawing.Point(488, 152);
|
||||
this.particleButton.Name = "particleButton";
|
||||
this.particleButton.Size = new System.Drawing.Size(104, 23);
|
||||
this.particleButton.TabIndex = 10;
|
||||
this.particleButton.Text = "Add New Particle";
|
||||
this.particleButton.Click += new System.EventHandler(this.particleButton_Click);
|
||||
//
|
||||
// itemList
|
||||
//
|
||||
this.itemList.Location = new System.Drawing.Point(16, 184);
|
||||
this.itemList.Name = "itemList";
|
||||
this.itemList.ScrollAlwaysVisible = true;
|
||||
this.itemList.Size = new System.Drawing.Size(136, 238);
|
||||
this.itemList.TabIndex = 11;
|
||||
//
|
||||
// actorList
|
||||
//
|
||||
this.actorList.Location = new System.Drawing.Point(168, 184);
|
||||
this.actorList.Name = "actorList";
|
||||
this.actorList.ScrollAlwaysVisible = true;
|
||||
this.actorList.Size = new System.Drawing.Size(136, 238);
|
||||
this.actorList.TabIndex = 12;
|
||||
//
|
||||
// terrainList
|
||||
//
|
||||
this.terrainList.Location = new System.Drawing.Point(320, 184);
|
||||
this.terrainList.Name = "terrainList";
|
||||
this.terrainList.ScrollAlwaysVisible = true;
|
||||
this.terrainList.Size = new System.Drawing.Size(136, 238);
|
||||
this.terrainList.TabIndex = 13;
|
||||
//
|
||||
// particleList
|
||||
//
|
||||
this.particleList.Location = new System.Drawing.Point(472, 184);
|
||||
this.particleList.Name = "particleList";
|
||||
this.particleList.ScrollAlwaysVisible = true;
|
||||
this.particleList.Size = new System.Drawing.Size(136, 238);
|
||||
this.particleList.TabIndex = 14;
|
||||
//
|
||||
// loadButton
|
||||
//
|
||||
this.loadButton.Location = new System.Drawing.Point(8, 8);
|
||||
this.loadButton.Name = "loadButton";
|
||||
this.loadButton.Size = new System.Drawing.Size(120, 23);
|
||||
this.loadButton.TabIndex = 15;
|
||||
this.loadButton.Text = "Load Level From File";
|
||||
this.loadButton.Click += new System.EventHandler(this.loadButton_Click);
|
||||
//
|
||||
// saveButton
|
||||
//
|
||||
this.saveButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
|
||||
this.saveButton.Location = new System.Drawing.Point(216, 472);
|
||||
this.saveButton.Name = "saveButton";
|
||||
this.saveButton.Size = new System.Drawing.Size(200, 32);
|
||||
this.saveButton.TabIndex = 16;
|
||||
this.saveButton.Text = "Save Level";
|
||||
this.saveButton.Click += new System.EventHandler(this.saveButton_Click);
|
||||
//
|
||||
// itemEditButton
|
||||
//
|
||||
this.itemEditButton.Location = new System.Drawing.Point(24, 432);
|
||||
this.itemEditButton.Name = "itemEditButton";
|
||||
this.itemEditButton.Size = new System.Drawing.Size(56, 23);
|
||||
this.itemEditButton.TabIndex = 17;
|
||||
this.itemEditButton.Text = "Edit";
|
||||
this.itemEditButton.Click += new System.EventHandler(this.itemEditButton_Click);
|
||||
//
|
||||
// itemRemoveButton
|
||||
//
|
||||
this.itemRemoveButton.Location = new System.Drawing.Point(88, 432);
|
||||
this.itemRemoveButton.Name = "itemRemoveButton";
|
||||
this.itemRemoveButton.Size = new System.Drawing.Size(56, 23);
|
||||
this.itemRemoveButton.TabIndex = 18;
|
||||
this.itemRemoveButton.Text = "Remove";
|
||||
this.itemRemoveButton.Click += new System.EventHandler(this.itemRemoveButton_Click);
|
||||
//
|
||||
// actorRemoveButton
|
||||
//
|
||||
this.actorRemoveButton.Location = new System.Drawing.Point(240, 432);
|
||||
this.actorRemoveButton.Name = "actorRemoveButton";
|
||||
this.actorRemoveButton.Size = new System.Drawing.Size(56, 23);
|
||||
this.actorRemoveButton.TabIndex = 20;
|
||||
this.actorRemoveButton.Text = "Remove";
|
||||
this.actorRemoveButton.Click += new System.EventHandler(this.actorRemoveButton_Click);
|
||||
//
|
||||
// actorEditButton
|
||||
//
|
||||
this.actorEditButton.Location = new System.Drawing.Point(176, 432);
|
||||
this.actorEditButton.Name = "actorEditButton";
|
||||
this.actorEditButton.Size = new System.Drawing.Size(56, 23);
|
||||
this.actorEditButton.TabIndex = 19;
|
||||
this.actorEditButton.Text = "Edit";
|
||||
this.actorEditButton.Click += new System.EventHandler(this.actorEditButton_Click);
|
||||
//
|
||||
// terrainRemoveButton
|
||||
//
|
||||
this.terrainRemoveButton.Location = new System.Drawing.Point(392, 432);
|
||||
this.terrainRemoveButton.Name = "terrainRemoveButton";
|
||||
this.terrainRemoveButton.Size = new System.Drawing.Size(56, 23);
|
||||
this.terrainRemoveButton.TabIndex = 22;
|
||||
this.terrainRemoveButton.Text = "Remove";
|
||||
this.terrainRemoveButton.Click += new System.EventHandler(this.terrainRemoveButton_Click);
|
||||
//
|
||||
// terrainEditButton
|
||||
//
|
||||
this.terrainEditButton.Location = new System.Drawing.Point(328, 432);
|
||||
this.terrainEditButton.Name = "terrainEditButton";
|
||||
this.terrainEditButton.Size = new System.Drawing.Size(56, 23);
|
||||
this.terrainEditButton.TabIndex = 21;
|
||||
this.terrainEditButton.Text = "Edit";
|
||||
this.terrainEditButton.Click += new System.EventHandler(this.terrainEditButton_Click);
|
||||
//
|
||||
// particleRemoveButton
|
||||
//
|
||||
this.particleRemoveButton.Location = new System.Drawing.Point(544, 432);
|
||||
this.particleRemoveButton.Name = "particleRemoveButton";
|
||||
this.particleRemoveButton.Size = new System.Drawing.Size(56, 23);
|
||||
this.particleRemoveButton.TabIndex = 24;
|
||||
this.particleRemoveButton.Text = "Remove";
|
||||
this.particleRemoveButton.Click += new System.EventHandler(this.particleRemoveButton_Click);
|
||||
//
|
||||
// particleEditButton
|
||||
//
|
||||
this.particleEditButton.Location = new System.Drawing.Point(480, 432);
|
||||
this.particleEditButton.Name = "particleEditButton";
|
||||
this.particleEditButton.Size = new System.Drawing.Size(56, 23);
|
||||
this.particleEditButton.TabIndex = 23;
|
||||
this.particleEditButton.Text = "Edit";
|
||||
this.particleEditButton.Click += new System.EventHandler(this.particleEditButton_Click);
|
||||
//
|
||||
// LevelBuilder
|
||||
//
|
||||
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
|
||||
this.ClientSize = new System.Drawing.Size(624, 518);
|
||||
this.Controls.Add(this.particleRemoveButton);
|
||||
this.Controls.Add(this.particleEditButton);
|
||||
this.Controls.Add(this.terrainRemoveButton);
|
||||
this.Controls.Add(this.terrainEditButton);
|
||||
this.Controls.Add(this.actorRemoveButton);
|
||||
this.Controls.Add(this.actorEditButton);
|
||||
this.Controls.Add(this.itemRemoveButton);
|
||||
this.Controls.Add(this.itemEditButton);
|
||||
this.Controls.Add(this.saveButton);
|
||||
this.Controls.Add(this.loadButton);
|
||||
this.Controls.Add(this.particleList);
|
||||
this.Controls.Add(this.terrainList);
|
||||
this.Controls.Add(this.actorList);
|
||||
this.Controls.Add(this.itemList);
|
||||
this.Controls.Add(this.particleButton);
|
||||
this.Controls.Add(this.terrainButton);
|
||||
this.Controls.Add(this.actorButton);
|
||||
this.Controls.Add(this.itemButton);
|
||||
this.Controls.Add(this.bgImageButton);
|
||||
this.Controls.Add(this.bgImageTextBox);
|
||||
this.Controls.Add(this.bgImageLabel);
|
||||
this.Controls.Add(this.physicsScaleTextBox);
|
||||
this.Controls.Add(this.physicsScaleLabel);
|
||||
this.Controls.Add(this.levelNameLabel);
|
||||
this.Controls.Add(this.levelNameTextBox);
|
||||
this.Name = "LevelBuilder";
|
||||
this.Text = "LevelBuilder";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region File System Buttons
|
||||
private void loadButton_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void saveButton_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void bgImageButton_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region WorldObject Creation
|
||||
private void itemButton_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void actorButton_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void terrainButton_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void particleButton_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region WorldObject Editing
|
||||
private void itemEditButton_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void actorEditButton_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void terrainEditButton_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void particleEditButton_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region WorldObject Removal
|
||||
private void itemRemoveButton_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void actorRemoveButton_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void terrainRemoveButton_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void particleRemoveButton_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
355
trunk/src/Icarus/Logic/GameEngine/LevelBuilder.resx
Normal file
355
trunk/src/Icarus/Logic/GameEngine/LevelBuilder.resx
Normal file
@@ -0,0 +1,355 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 1.3
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">1.3</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1">this is my long string</data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
[base64 mime encoded serialized .NET Framework object]
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
[base64 mime encoded string representing a byte array form of the .NET Framework object]
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used forserialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="levelNameTextBox.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="levelNameTextBox.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="levelNameTextBox.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="levelNameLabel.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="levelNameLabel.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="levelNameLabel.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="physicsScaleLabel.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="physicsScaleLabel.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="physicsScaleLabel.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="physicsScaleTextBox.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="physicsScaleTextBox.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="physicsScaleTextBox.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="bgImageLabel.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="bgImageLabel.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="bgImageLabel.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="bgImageTextBox.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="bgImageTextBox.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="bgImageTextBox.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="bgImageButton.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="bgImageButton.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="bgImageButton.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="itemButton.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="itemButton.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="itemButton.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="actorButton.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="actorButton.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="actorButton.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="terrainButton.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="terrainButton.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="terrainButton.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="particleButton.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="particleButton.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="particleButton.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="itemList.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="itemList.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="itemList.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="actorList.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="actorList.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="actorList.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="terrainList.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="terrainList.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="terrainList.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="particleList.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="particleList.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="particleList.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="loadButton.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="loadButton.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="loadButton.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="saveButton.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="saveButton.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="saveButton.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="itemEditButton.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="itemEditButton.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="itemEditButton.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="itemRemoveButton.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="itemRemoveButton.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="itemRemoveButton.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="actorRemoveButton.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="actorRemoveButton.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="actorRemoveButton.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="actorEditButton.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="actorEditButton.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="actorEditButton.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="terrainRemoveButton.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="terrainRemoveButton.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="terrainRemoveButton.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="terrainEditButton.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="terrainEditButton.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="terrainEditButton.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="particleRemoveButton.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="particleRemoveButton.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="particleRemoveButton.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="particleEditButton.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="particleEditButton.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="particleEditButton.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="$this.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>(Default)</value>
|
||||
</data>
|
||||
<data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.Localizable" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>8, 8</value>
|
||||
</data>
|
||||
<data name="$this.Name">
|
||||
<value>LevelBuilder</value>
|
||||
</data>
|
||||
<data name="$this.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="$this.TrayHeight" type="System.Int32, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>80</value>
|
||||
</data>
|
||||
<data name="$this.SnapToGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
</root>
|
||||
98
trunk/src/Icarus/Logic/GameEngine/LevelLoader.cs
Normal file
98
trunk/src/Icarus/Logic/GameEngine/LevelLoader.cs
Normal file
@@ -0,0 +1,98 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
using Icarus.Resources;
|
||||
|
||||
namespace Icarus.Logic.GameEngine
|
||||
{
|
||||
/// <summary>
|
||||
/// This class provides the functionality of being able to
|
||||
/// save and load levels. The levels are saved as xml files
|
||||
/// on the harddrive.
|
||||
/// </summary>
|
||||
public class LevelLoader
|
||||
{
|
||||
|
||||
#region Singleton access
|
||||
/// <summary>
|
||||
/// The instance of this loader
|
||||
/// </summary>
|
||||
private static LevelLoader instance = new LevelLoader();
|
||||
|
||||
/// <summary>
|
||||
/// The Singleton LevelLoader instance
|
||||
/// </summary>
|
||||
public static LevelLoader Instance
|
||||
{
|
||||
get { return instance; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Loads a level from an XML file.
|
||||
/// </summary>
|
||||
/// <param name="fileName">The filename of the level XML file.</param>
|
||||
/// <returns>The loaded level or null if no level could be loaded.</returns>
|
||||
public Level LoadLevelXML(string fileName)
|
||||
{
|
||||
//Set the type of Object for deserialization
|
||||
Level level = new Level();
|
||||
XmlSerializer xmls = new XmlSerializer(level.GetType());
|
||||
|
||||
//Open level XML file
|
||||
if (!File.Exists(fileName)) return null;
|
||||
FileStream fs = new FileStream(fileName, FileMode.Open);
|
||||
if(fs == null) return null;
|
||||
|
||||
//read level file and create level
|
||||
XmlReader reader = new XmlTextReader(fs);
|
||||
level = (Level) xmls.Deserialize(reader);
|
||||
|
||||
//Close file
|
||||
fs.Close();
|
||||
|
||||
return level;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Saves a level to an XML file.
|
||||
/// </summary>
|
||||
/// <param name="fileName">The filename used to save the level XML file.</param>
|
||||
/// <returns>True for success, False for failure.</returns>
|
||||
public bool SaveLevelXML(string fileName, Level level)
|
||||
{
|
||||
//Setup serializer:
|
||||
XmlSerializer xmls = new XmlSerializer(level.GetType());
|
||||
|
||||
//Create filestream to save level
|
||||
FileStream fs = new FileStream(fileName, FileMode.Create);
|
||||
|
||||
//Save level
|
||||
xmls.Serialize(fs, level);
|
||||
|
||||
//Close file
|
||||
fs.Close();
|
||||
|
||||
//return success;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the list of ids of available levels.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string[] GetLevelIDList()
|
||||
{
|
||||
return Directory.GetFiles(ResourceManager.Instance.LevelPath, "*.xml");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user