summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2005-01-21 01:10:44 +0000
committerIan C <ianc@noddybox.co.uk>2005-01-21 01:10:44 +0000
commit5b5f4849d4ada11a0f27b6da2ae0280f37eac24a (patch)
tree097c67f8825144cff93a5a2291af27d33177175c
parent1d6e884e69dce97906df309a67fd4252f8b1dd48 (diff)
Initial checkinHEADmaster
-rw-r--r--AssemblyInfo.cs33
-rw-r--r--C64Colour.cs172
-rw-r--r--C64ConfigForm.cs190
-rw-r--r--C64Mono.cs172
-rw-r--r--GfxEdBasePlugin.C64ConfigForm.resourcesbin0 -> 5224 bytes
-rw-r--r--GfxEdBasePlugin.ConfigForm.resourcesbin0 -> 5221 bytes
-rw-r--r--GfxEdBasePlugin.SpecConfigForm.resourcesbin0 -> 4453 bytes
-rw-r--r--GfxEdBasePlugin.cmbx16
-rw-r--r--GfxEdBasePlugin.prjx36
-rw-r--r--Global.cs44
-rw-r--r--Output.cs273
-rw-r--r--SpecConfigForm.cs144
-rw-r--r--Spectrum.cs187
13 files changed, 1267 insertions, 0 deletions
diff --git a/AssemblyInfo.cs b/AssemblyInfo.cs
new file mode 100644
index 0000000..965e66d
--- /dev/null
+++ b/AssemblyInfo.cs
@@ -0,0 +1,33 @@
+// $Id$
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following
+// attributes.
+//
+// change them to the information which is associated with the assembly
+// you compile.
+
+[assembly: AssemblyTitle("")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// The assembly version has following format :
+//
+// Major.Minor.Build.Revision
+//
+// You can specify all values by your own or you can build default build and revision
+// numbers with the '*' character (the default):
+
+[assembly: AssemblyVersion("1.0.*")]
+
+// The following attributes specify the key for the sign of your assembly. See the
+// .NET Framework documentation for more information about signing.
+// This is not required, if you don't want signing let these attributes like they're.
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("")]
diff --git a/C64Colour.cs b/C64Colour.cs
new file mode 100644
index 0000000..4ab9095
--- /dev/null
+++ b/C64Colour.cs
@@ -0,0 +1,172 @@
+// Base plugin for GfxEd8
+// Copyright (C) 2004 Ian Cowburn
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// $Id$
+//
+using System;
+using System.IO;
+using GfxEdInterface;
+
+namespace GfxEdBasePlugin
+{
+ /// <summary>
+ /// Description of MyClass.
+ /// </summary>
+ public class C64Colour : IPlugin
+ {
+ public C64Colour()
+ {
+ m_pal=new Colour[17];
+
+ // Colours taken from VICE screen grab
+ //
+ m_pal[0]=new Colour("Background",0,0,0);
+ m_pal[1]=new Colour("Black",0,0,0);
+ m_pal[2]=new Colour("White",255,255,255);
+ m_pal[3]=new Colour("Red",137,64,54);
+ m_pal[4]=new Colour("Cyan",122,191,199);
+ m_pal[5]=new Colour("Purple",138,70,174);
+ m_pal[6]=new Colour("Green",104,169,65);
+ m_pal[7]=new Colour("Blue",62,49,162);
+ m_pal[8]=new Colour("Yellow",208,220,113);
+ m_pal[9]=new Colour("Orange",144,95,37);
+ m_pal[10]=new Colour("Brown",165,42,42);
+ m_pal[11]=new Colour("Light Red",187,119,109);
+ m_pal[12]=new Colour("Dark Grey",85,85,85);
+ m_pal[13]=new Colour("Medium Grey",128,128,128);
+ m_pal[14]=new Colour("Light Green",172,234,136);
+ m_pal[15]=new Colour("Light Blue",124,112,218);
+ m_pal[16]=new Colour("Light Grey",171,171,171);
+
+ m_size=new SpriteSize[1];
+ m_size[0]=new SpriteSize(12,21,2,1);
+
+ m_paledit=new bool[4] {false,true,true,true};
+ m_palcommon=new bool[4] {true,true,false,true};
+
+ m_config=new C64ConfigForm();
+ m_output=new Output(4,2,true,true);
+ }
+
+ public string Description
+ {
+ get {return "Commodore 64 Colour Sprites";}
+ }
+
+ public string ShortName
+ {
+ get {return "C64 Colour Sprites";}
+ }
+
+ public string Author
+ {
+ get {return Global.Copyright;}
+ }
+
+ public string URL
+ {
+ get {return Global.URL;}
+ }
+
+ public uint MaxColours
+ {
+ get {return 4;}
+ }
+
+ public Colour[] Palette
+ {
+ get {return m_pal;}
+ }
+
+ public bool[] SprPalEditable
+ {
+ get {return m_paledit;}
+ }
+
+ public bool[] SprPalCommon
+ {
+ get {return m_palcommon;}
+ }
+
+ public SpriteSize[] AllowedSizes
+ {
+ get {return m_size;}
+ }
+
+ public string ExportExtension
+ {
+ get
+ {
+ switch(m_config.Format)
+ {
+ case C64ConfigForm.ExportFormat.Assembly:
+ return "asm";
+ case C64ConfigForm.ExportFormat.Basic:
+ return "bas";
+ default:
+ return "c";
+ }
+ }
+ }
+
+ public bool Export(string path, SpriteList sprites)
+ {
+ TextWriter w=File.CreateText(path);
+ int line=6000;
+
+ foreach (Sprite s in sprites)
+ {
+ switch(m_config.Format)
+ {
+ case C64ConfigForm.ExportFormat.Assembly:
+ m_output.Assembly(w,s);
+ break;
+ case C64ConfigForm.ExportFormat.Basic:
+ m_output.Basic(ref line,w,s);
+ break;
+ default:
+ m_output.C(w,s);
+ break;
+ }
+ }
+
+ w.Close();
+
+ return true;
+ }
+
+ public IConfig Config
+ {
+ get {return m_config;}
+ }
+
+ public IProcess Process
+ {
+ get {return null;}
+ }
+
+ // ------------------------------------------------
+ // PRIVATE
+ //
+ private Colour[] m_pal;
+ private SpriteSize[] m_size;
+ private bool[] m_paledit;
+ private bool[] m_palcommon;
+ private C64ConfigForm m_config;
+ private Output m_output;
+ }
+}
diff --git a/C64ConfigForm.cs b/C64ConfigForm.cs
new file mode 100644
index 0000000..dd237e5
--- /dev/null
+++ b/C64ConfigForm.cs
@@ -0,0 +1,190 @@
+// Base plugin for GfxEd8
+// Copyright (C) 2004 Ian Cowburn
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// $Id$
+//
+using System;
+using System.Windows.Forms;
+using System.IO;
+using GfxEdInterface;
+
+namespace GfxEdBasePlugin
+{
+ /// <summary>
+ /// Description of ConfigForm.
+ /// </summary>
+ public class C64ConfigForm : System.Windows.Forms.Form, IConfig
+ {
+ private System.Windows.Forms.RadioButton m_bas;
+ private System.Windows.Forms.GroupBox m_typeGroup;
+ private System.Windows.Forms.Button m_ok;
+ private System.Windows.Forms.RadioButton m_asm;
+ private System.Windows.Forms.RadioButton m_C;
+
+ public enum ExportFormat {Assembly, Basic, C};
+
+ public C64ConfigForm()
+ {
+ //
+ // The InitializeComponent() call is required for Windows Forms designer support.
+ //
+ InitializeComponent();
+ }
+
+ public ExportFormat Format
+ {
+ get
+ {
+ if (m_asm.Checked)
+ {
+ return ExportFormat.Assembly;
+ }
+ else if (m_bas.Checked)
+ {
+ return ExportFormat.Basic;
+ }
+
+ return ExportFormat.C;
+ }
+
+ set
+ {
+ foreach (RadioButton r in m_typeGroup.Controls)
+ {
+ r.Checked=false;
+ }
+
+ switch(value)
+ {
+ case ExportFormat.Assembly:
+ m_asm.Checked=true;
+ break;
+
+ case ExportFormat.Basic:
+ m_bas.Checked=true;
+ break;
+
+ case ExportFormat.C:
+ m_C.Checked=true;
+ break;
+ }
+ }
+ }
+
+ public void Settings(Form parent)
+ {
+ ShowDialog(parent);
+ }
+
+ public void Output(TextWriter stream)
+ {
+ stream.WriteLine(Format.ToString());
+ }
+
+ public void Input(TextReader stream)
+ {
+ string s=stream.ReadLine();
+
+ Format=(ExportFormat)Enum.Parse(typeof(ExportFormat),s);
+ }
+
+ #region Windows Forms Designer generated code
+ /// <summary>
+ /// This method is required for Windows Forms designer support.
+ /// Do not change the method contents inside the source code editor. The Forms designer might
+ /// not be able to load this method if it was changed manually.
+ /// </summary>
+ private void InitializeComponent() {
+ this.m_C = new System.Windows.Forms.RadioButton();
+ this.m_asm = new System.Windows.Forms.RadioButton();
+ this.m_ok = new System.Windows.Forms.Button();
+ this.m_typeGroup = new System.Windows.Forms.GroupBox();
+ this.m_bas = new System.Windows.Forms.RadioButton();
+ this.m_typeGroup.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // m_C
+ //
+ this.m_C.Location = new System.Drawing.Point(8, 72);
+ this.m_C.Name = "m_C";
+ this.m_C.Size = new System.Drawing.Size(120, 16);
+ this.m_C.TabIndex = 2;
+ this.m_C.Text = "C";
+ //
+ // m_asm
+ //
+ this.m_asm.Checked = true;
+ this.m_asm.Location = new System.Drawing.Point(8, 24);
+ this.m_asm.Name = "m_asm";
+ this.m_asm.Size = new System.Drawing.Size(72, 16);
+ this.m_asm.TabIndex = 0;
+ this.m_asm.TabStop = true;
+ this.m_asm.Text = "Assembly";
+ //
+ // m_ok
+ //
+ this.m_ok.Location = new System.Drawing.Point(56, 112);
+ this.m_ok.Name = "m_ok";
+ this.m_ok.Size = new System.Drawing.Size(96, 24);
+ this.m_ok.TabIndex = 0;
+ this.m_ok.Text = "OK";
+ this.m_ok.Click += new System.EventHandler(this.OnOK);
+ //
+ // m_typeGroup
+ //
+ this.m_typeGroup.Controls.Add(this.m_C);
+ this.m_typeGroup.Controls.Add(this.m_bas);
+ this.m_typeGroup.Controls.Add(this.m_asm);
+ this.m_typeGroup.Location = new System.Drawing.Point(8, 8);
+ this.m_typeGroup.Name = "m_typeGroup";
+ this.m_typeGroup.Size = new System.Drawing.Size(144, 96);
+ this.m_typeGroup.TabIndex = 1;
+ this.m_typeGroup.TabStop = false;
+ this.m_typeGroup.Text = "Export Type";
+ //
+ // m_bas
+ //
+ this.m_bas.Location = new System.Drawing.Point(8, 48);
+ this.m_bas.Name = "m_bas";
+ this.m_bas.Size = new System.Drawing.Size(128, 16);
+ this.m_bas.TabIndex = 1;
+ this.m_bas.Text = "Basic (ASCII format)";
+ //
+ // C64ConfigForm
+ //
+ this.AcceptButton = this.m_ok;
+ this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
+ this.ClientSize = new System.Drawing.Size(162, 143);
+ this.ControlBox = false;
+ this.Controls.Add(this.m_typeGroup);
+ this.Controls.Add(this.m_ok);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
+ this.Name = "C64ConfigForm";
+ this.ShowInTaskbar = false;
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ this.Text = "Configuration";
+ this.m_typeGroup.ResumeLayout(false);
+ this.ResumeLayout(false);
+ }
+ #endregion
+ void OnOK(object sender, System.EventArgs e)
+ {
+ Close();
+ }
+
+ }
+}
diff --git a/C64Mono.cs b/C64Mono.cs
new file mode 100644
index 0000000..ead883e
--- /dev/null
+++ b/C64Mono.cs
@@ -0,0 +1,172 @@
+// Base plugin for GfxEd8
+// Copyright (C) 2004 Ian Cowburn
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// $Id$
+//
+using System;
+using System.IO;
+using GfxEdInterface;
+
+namespace GfxEdBasePlugin
+{
+ /// <summary>
+ /// Description of MyClass.
+ /// </summary>
+ public class C64Mono : IPlugin
+ {
+ public C64Mono()
+ {
+ m_pal=new Colour[17];
+
+ // Colours taken from VICE screen grab
+ //
+ m_pal[0]=new Colour("Background",0,0,0);
+ m_pal[1]=new Colour("Black",0,0,0);
+ m_pal[2]=new Colour("White",255,255,255);
+ m_pal[3]=new Colour("Red",137,64,54);
+ m_pal[4]=new Colour("Cyan",122,191,199);
+ m_pal[5]=new Colour("Purple",138,70,174);
+ m_pal[6]=new Colour("Green",104,169,65);
+ m_pal[7]=new Colour("Blue",62,49,162);
+ m_pal[8]=new Colour("Yellow",208,220,113);
+ m_pal[9]=new Colour("Orange",144,95,37);
+ m_pal[10]=new Colour("Brown",165,42,42);
+ m_pal[11]=new Colour("Light Red",187,119,109);
+ m_pal[12]=new Colour("Dark Grey",85,85,85);
+ m_pal[13]=new Colour("Medium Grey",128,128,128);
+ m_pal[14]=new Colour("Light Green",172,234,136);
+ m_pal[15]=new Colour("Light Blue",124,112,218);
+ m_pal[16]=new Colour("Light Grey",171,171,171);
+
+ m_size=new SpriteSize[1];
+ m_size[0]=new SpriteSize(24,21,1,1);
+
+ m_paledit=new bool[2] {false,true};
+ m_palcommon=new bool[2] {true,false};
+
+ m_config=new C64ConfigForm();
+ m_output=new Output(2,1,true,true);
+ }
+
+ public string Description
+ {
+ get {return "Commodore 64 Mono Sprites";}
+ }
+
+ public string ShortName
+ {
+ get {return "C64 Mono Sprites";}
+ }
+
+ public string Author
+ {
+ get {return Global.Copyright;}
+ }
+
+ public string URL
+ {
+ get {return Global.URL;}
+ }
+
+ public uint MaxColours
+ {
+ get {return 2;}
+ }
+
+ public Colour[] Palette
+ {
+ get {return m_pal;}
+ }
+
+ public bool[] SprPalEditable
+ {
+ get {return m_paledit;}
+ }
+
+ public bool[] SprPalCommon
+ {
+ get {return m_palcommon;}
+ }
+
+ public SpriteSize[] AllowedSizes
+ {
+ get {return m_size;}
+ }
+
+ public string ExportExtension
+ {
+ get
+ {
+ switch(m_config.Format)
+ {
+ case C64ConfigForm.ExportFormat.Assembly:
+ return "asm";
+ case C64ConfigForm.ExportFormat.Basic:
+ return "bas";
+ default:
+ return "c";
+ }
+ }
+ }
+
+ public bool Export(string path, SpriteList sprites)
+ {
+ TextWriter w=File.CreateText(path);
+ int line=6000;
+
+ foreach (Sprite s in sprites)
+ {
+ switch(m_config.Format)
+ {
+ case C64ConfigForm.ExportFormat.Assembly:
+ m_output.Assembly(w,s);
+ break;
+ case C64ConfigForm.ExportFormat.Basic:
+ m_output.Basic(ref line,w,s);
+ break;
+ default:
+ m_output.C(w,s);
+ break;
+ }
+ }
+
+ w.Close();
+
+ return true;
+ }
+
+ public IConfig Config
+ {
+ get {return m_config;}
+ }
+
+ public IProcess Process
+ {
+ get {return null;}
+ }
+
+ // ------------------------------------------------
+ // PRIVATE
+ //
+ private Colour[] m_pal;
+ private SpriteSize[] m_size;
+ private bool[] m_paledit;
+ private bool[] m_palcommon;
+ private C64ConfigForm m_config;
+ private Output m_output;
+ }
+}
diff --git a/GfxEdBasePlugin.C64ConfigForm.resources b/GfxEdBasePlugin.C64ConfigForm.resources
new file mode 100644
index 0000000..99d8040
--- /dev/null
+++ b/GfxEdBasePlugin.C64ConfigForm.resources
Binary files differ
diff --git a/GfxEdBasePlugin.ConfigForm.resources b/GfxEdBasePlugin.ConfigForm.resources
new file mode 100644
index 0000000..d6bafa7
--- /dev/null
+++ b/GfxEdBasePlugin.ConfigForm.resources
Binary files differ
diff --git a/GfxEdBasePlugin.SpecConfigForm.resources b/GfxEdBasePlugin.SpecConfigForm.resources
new file mode 100644
index 0000000..51feeec
--- /dev/null
+++ b/GfxEdBasePlugin.SpecConfigForm.resources
Binary files differ
diff --git a/GfxEdBasePlugin.cmbx b/GfxEdBasePlugin.cmbx
new file mode 100644
index 0000000..3a94f9c
--- /dev/null
+++ b/GfxEdBasePlugin.cmbx
@@ -0,0 +1,16 @@
+<Combine fileversion="1.0" name="GfxEdBasePlugin" description="">
+ <StartMode startupentry="GfxEdBasePlugin" single="True">
+ <Execute entry="GfxEdBasePlugin" type="None" />
+ </StartMode>
+ <Entries>
+ <Entry filename=".\.\GfxEdBasePlugin.prjx" />
+ </Entries>
+ <Configurations active="Debug">
+ <Configuration name="Release">
+ <Entry name="GfxEdBasePlugin" configurationname="Debug" build="False" />
+ </Configuration>
+ <Configuration name="Debug">
+ <Entry name="GfxEdBasePlugin" configurationname="Debug" build="False" />
+ </Configuration>
+ </Configurations>
+</Combine> \ No newline at end of file
diff --git a/GfxEdBasePlugin.prjx b/GfxEdBasePlugin.prjx
new file mode 100644
index 0000000..c0cf932
--- /dev/null
+++ b/GfxEdBasePlugin.prjx
@@ -0,0 +1,36 @@
+<Project name="GfxEdBasePlugin" standardNamespace="GfxEdBasePlugin" description="" newfilesearch="None" enableviewstate="True" version="1.1" projecttype="C#">
+ <Contents>
+ <File name=".\AssemblyInfo.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
+ <File name=".\C64Colour.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
+ <File name=".\C64ConfigForm.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
+ <File name=".\C64Mono.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
+ <File name=".\Spectrum.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
+ <File name=".\GfxEdBasePlugin.ConfigForm.resources" subtype="Code" buildaction="EmbedAsResource" dependson="" data="" />
+ <File name=".\Output.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
+ <File name=".\Global.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
+ <File name=".\GfxEdBasePlugin.C64ConfigForm.resources" subtype="Code" buildaction="EmbedAsResource" dependson="" data="" />
+ <File name=".\SpecConfigForm.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
+ <File name=".\GfxEdBasePlugin.SpecConfigForm.resources" subtype="Code" buildaction="EmbedAsResource" dependson="" data="" />
+ </Contents>
+ <References>
+ <Reference type="Project" refto="GfxEdInterface" localcopy="True" />
+ </References>
+ <DeploymentInformation target="" script="" strategy="File" />
+ <Configuration runwithwarnings="True" name="Debug">
+ <CodeGeneration runtime="MsNet" compiler="Csc" compilerversion="" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" target="Library" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" />
+ <Execution commandlineparameters="" consolepause="False" />
+ <Output directory=".\bin\Debug" assembly="GfxEdBasePlugin" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" />
+ </Configuration>
+ <Configurations active="Debug">
+ <Configuration runwithwarnings="True" name="Debug">
+ <CodeGeneration runtime="MsNet" compiler="Csc" compilerversion="" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" target="Library" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" />
+ <Execution commandlineparameters="" consolepause="False" />
+ <Output directory=".\bin\Debug" assembly="GfxEdBasePlugin" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" />
+ </Configuration>
+ <Configuration runwithwarnings="True" name="Release">
+ <CodeGeneration runtime="MsNet" compiler="Csc" compilerversion="" warninglevel="4" nowarn="" includedebuginformation="False" optimize="True" unsafecodeallowed="False" generateoverflowchecks="False" mainclass="" target="Library" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" />
+ <Execution commandlineparameters="" consolepause="False" />
+ <Output directory=".\bin\Release" assembly="GfxEdBasePlugin" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" />
+ </Configuration>
+ </Configurations>
+</Project> \ No newline at end of file
diff --git a/Global.cs b/Global.cs
new file mode 100644
index 0000000..0e80822
--- /dev/null
+++ b/Global.cs
@@ -0,0 +1,44 @@
+// Base plugin for GfxEd8
+// Copyright (C) 2004 Ian Cowburn
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// $Id$
+//
+
+using System;
+
+namespace GfxEdBasePlugin
+{
+ /// <summary>
+ /// Description of Global.
+ /// </summary>
+ internal class Global
+ {
+ public static string Copyright
+ {
+ get {return "Copyright 2004 Ian Cowburn <ianc@noddybox.demon.co.uk>";}
+ }
+
+ public static string URL
+ {
+ get {return "http://www.noddybox.demon.co.uk/gfxed8";}
+ }
+
+ private Global()
+ {
+ }
+ }
+}
diff --git a/Output.cs b/Output.cs
new file mode 100644
index 0000000..b62e221
--- /dev/null
+++ b/Output.cs
@@ -0,0 +1,273 @@
+// Base plugin for GfxEd8
+// Copyright (C) 2004 Ian Cowburn
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// $Id$
+//
+using System;
+using System.IO;
+using GfxEdInterface;
+
+namespace GfxEdBasePlugin
+{
+ /// <summary>
+ /// Description of Output.
+ /// </summary>
+ internal class Output
+ {
+ public Output(uint max_colours, int depth,
+ bool has_pal, bool adjust_pal)
+ {
+ m_maxcol=max_colours;
+ m_depth=depth;
+ m_haspal=has_pal;
+ m_adjpal=adjust_pal;
+ }
+
+ public void Assembly(TextWriter str, Sprite spr)
+ {
+ string name=ValidName(spr.Name);
+
+ str.WriteLine("; Definition for "+spr.Name);
+ str.WriteLine(";");
+
+ if (m_haspal)
+ {
+ for(uint f=1;f<m_maxcol;f++)
+ {
+ str.WriteLine(name.ToUpper() +"_COL" + f + "\t equ " +
+ (spr.Pal(f)-(m_adjpal ? 1:0)));
+ }
+ }
+
+ str.Write(name+":");
+
+ int col=0;
+ uint x=0;
+ uint y=0;
+ uint b;
+
+ while(GetByte(ref x, ref y, out b, spr))
+ {
+ if ((col%8)==0)
+ {
+ str.WriteLine();
+ str.Write("\tdb\t");
+ }
+ else
+ {
+ str.Write(',');
+ }
+
+ str.Write(b);
+
+ col++;
+ }
+
+ str.WriteLine();
+ str.WriteLine();
+ }
+
+ public void AssemblyShifted(TextWriter str, Sprite spr, int shift)
+ {
+ if (spr.Width!=8 || m_depth!=1)
+ {
+ throw new Exception("Can only pre-shift byte wide mono sprites");
+ }
+
+ string name=ValidName(spr.Name);
+
+ if (shift==0)
+ {
+ str.WriteLine("; Definitions for "+spr.Name);
+ str.WriteLine(";");
+ }
+
+ str.Write(name+":");
+
+ int col=0;
+ uint x=0;
+ uint y=0;
+ uint b;
+
+ while(GetByte(ref x, ref y, out b, spr))
+ {
+ if ((col%4)==0)
+ {
+ str.WriteLine();
+ str.Write("\tdb\t");
+ }
+ else
+ {
+ str.Write(',');
+ }
+
+ str.Write(b>>shift);
+ str.Write(',');
+ str.Write((b<<(8-shift))&0xff);
+
+ col++;
+ }
+
+ str.WriteLine();
+ str.WriteLine();
+ }
+
+ public void Basic(ref int line, TextWriter str, Sprite spr)
+ {
+ str.WriteLine((line++)+" REM Sprite " + ValidName(spr.Name));
+ str.WriteLine((line++)+" REM Colour");
+ str.Write((line++)+" DATA ");
+
+ for(uint f=1;f<m_maxcol;f++)
+ {
+ if (f>1)
+ {
+ str.Write(",");
+ }
+
+ str.Write(spr.Pal(f).ToString());
+ }
+
+ str.WriteLine();
+
+ int col=0;
+ uint x=0;
+ uint y=0;
+ uint b;
+
+ str.Write((line++)+" REM Sprite data");
+
+ while(GetByte(ref x, ref y, out b, spr))
+ {
+ if ((col%8)==0)
+ {
+ str.WriteLine();
+ str.Write((line++)+" DATA ");
+ }
+ else
+ {
+ str.Write(',');
+ }
+
+ str.Write(b);
+
+ col++;
+ }
+
+ str.WriteLine();
+ }
+
+ public void C(TextWriter str, Sprite spr)
+ {
+ string name=ValidName(spr.Name);
+ int col=0;
+ uint x=0;
+ uint y=0;
+ uint b;
+
+ if (m_haspal)
+ {
+ for(uint f=1;f<m_maxcol;f++)
+ {
+ str.WriteLine("#define " + name.ToUpper() +
+ "_COL" + f + "\t" +
+ (spr.Pal(f)-(m_adjpal ? 1:0)));
+ }
+ }
+
+ str.WriteLine("static unsigned char "+name+"[]=");
+ str.WriteLine("{");
+
+ while(GetByte(ref x, ref y, out b, spr))
+ {
+ if ((col%8)==0)
+ {
+ str.WriteLine();
+ str.Write("\t");
+ }
+
+ if (col>0)
+ {
+ str.Write(',');
+ }
+
+ str.Write(b);
+
+ col++;
+ }
+
+ str.WriteLine();
+ str.WriteLine("};");
+ str.WriteLine();
+ }
+
+ private string ValidName(string s)
+ {
+ string n="";
+
+ foreach (char c in s)
+ {
+ if (Char.IsLetterOrDigit(c) || c=='_')
+ n+=c;
+ }
+
+ if (n.Length==0)
+ {
+ n="empty_name";
+ }
+
+ return n;
+ }
+
+ // ------------------------------------------------
+ // PRIVATE
+ //
+ private uint m_maxcol;
+ private int m_depth;
+ private bool m_haspal;
+ private bool m_adjpal;
+
+ private bool GetByte(ref uint x, ref uint y, out uint b, Sprite s)
+ {
+ b=0;
+
+ if (x==0 && y==s.Height)
+ {
+ return false;
+ }
+
+ int bit=8-m_depth;
+
+ while(bit>=0)
+ {
+ uint v=s[x,y];
+
+ b|=(v<<bit);
+
+ if (++x==s.Width)
+ {
+ x=0;
+ y++;
+ }
+
+ bit-=m_depth;
+ }
+
+ return true;
+ }
+ }
+}
diff --git a/SpecConfigForm.cs b/SpecConfigForm.cs
new file mode 100644
index 0000000..cba53d0
--- /dev/null
+++ b/SpecConfigForm.cs
@@ -0,0 +1,144 @@
+// Base plugin for GfxEd8
+// Copyright (C) 2004 Ian Cowburn
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// $Id$
+//
+
+using System;
+using System.Windows.Forms;
+using System.IO;
+using GfxEdInterface;
+
+namespace GfxEdBasePlugin
+{
+ /// <summary>
+ /// Description of SpecConfigForm.
+ /// </summary>
+ public class SpecConfigForm : System.Windows.Forms.Form, IConfig
+ {
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.CheckBox m_mask;
+ private System.Windows.Forms.CheckBox m_shift;
+ private System.Windows.Forms.Button m_ok;
+ public SpecConfigForm()
+ {
+ //
+ // The InitializeComponent() call is required for Windows Forms designer support.
+ //
+ InitializeComponent();
+ }
+
+ public bool Mask
+ {
+ get {return m_mask.Checked;}
+ set {m_mask.Checked=value;}
+ }
+
+ public bool Shift
+ {
+ get {return m_shift.Checked;}
+ set {m_shift.Checked=value;}
+ }
+
+ public void Settings(Form parent)
+ {
+ ShowDialog(parent);
+ }
+
+ public void Output(TextWriter stream)
+ {
+ stream.WriteLine(Mask.ToString());
+ stream.WriteLine(Shift.ToString());
+ }
+
+ public void Input(TextReader stream)
+ {
+ Mask=Boolean.Parse(stream.ReadLine());
+ Shift=Boolean.Parse(stream.ReadLine());
+ }
+
+ #region Windows Forms Designer generated code
+ /// <summary>
+ /// This method is required for Windows Forms designer support.
+ /// Do not change the method contents inside the source code editor. The Forms designer might
+ /// not be able to load this method if it was changed manually.
+ /// </summary>
+ private void InitializeComponent() {
+ this.m_ok = new System.Windows.Forms.Button();
+ this.m_shift = new System.Windows.Forms.CheckBox();
+ this.m_mask = new System.Windows.Forms.CheckBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.SuspendLayout();
+ //
+ // m_ok
+ //
+ this.m_ok.Location = new System.Drawing.Point(136, 112);
+ this.m_ok.Name = "m_ok";
+ this.m_ok.Size = new System.Drawing.Size(88, 24);
+ this.m_ok.TabIndex = 0;
+ this.m_ok.Text = "OK";
+ this.m_ok.Click += new System.EventHandler(this.OnOK);
+ //
+ // m_shift
+ //
+ this.m_shift.Location = new System.Drawing.Point(9, 32);
+ this.m_shift.Name = "m_shift";
+ this.m_shift.Size = new System.Drawing.Size(136, 24);
+ this.m_shift.TabIndex = 2;
+ this.m_shift.Text = "Pre-shifted Sprites";
+ //
+ // m_mask
+ //
+ this.m_mask.Location = new System.Drawing.Point(8, 8);
+ this.m_mask.Name = "m_mask";
+ this.m_mask.Size = new System.Drawing.Size(136, 24);
+ this.m_mask.TabIndex = 1;
+ this.m_mask.Text = "Generate Mask Data";
+ //
+ // label1
+ //
+ this.label1.Location = new System.Drawing.Point(8, 56);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(224, 48);
+ this.label1.TabIndex = 3;
+ this.label1.Text = "Note that pre-shifted sprites assume that each 8 sprites make up a single sprite " +
+"to pre-shift";
+ //
+ // SpecConfigForm
+ //
+ this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
+ this.ClientSize = new System.Drawing.Size(234, 143);
+ this.ControlBox = false;
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.m_shift);
+ this.Controls.Add(this.m_mask);
+ this.Controls.Add(this.m_ok);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
+ this.Name = "SpecConfigForm";
+ this.ShowInTaskbar = false;
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ this.Text = "Configuration";
+ this.ResumeLayout(false);
+ }
+ #endregion
+ void OnOK(object sender, System.EventArgs e)
+ {
+ Close();
+ }
+
+ }
+}
diff --git a/Spectrum.cs b/Spectrum.cs
new file mode 100644
index 0000000..44a227c
--- /dev/null
+++ b/Spectrum.cs
@@ -0,0 +1,187 @@
+// Base plugin for GfxEd8
+// Copyright (C) 2004 Ian Cowburn
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// $Id$
+//
+using System;
+using System.IO;
+using GfxEdInterface;
+
+namespace GfxEdBasePlugin
+{
+ /// <summary>
+ /// Description of MyClass.
+ /// </summary>
+ public class Spectrum : IPlugin
+ {
+ public Spectrum()
+ {
+ m_pal=new Colour[2];
+
+ m_pal[0]=new Colour("Background",0x00,0x00,0x00);
+ m_pal[1]=new Colour("White",0xff,0xff,0xff);
+
+ m_size=new SpriteSize[2];
+ m_size[0]=new SpriteSize(8,8,1,1);
+ m_size[1]=new SpriteSize(16,16,1,1);
+
+ m_paledit=new bool[2] {false,false};
+ m_palcommon=new bool[2] {false,false};
+
+ m_config=new SpecConfigForm();
+ m_output=new Output(2,1,false,false);
+ }
+
+ public string Description
+ {
+ get {return "Spectrum Assembly Language (Noddybox Mono Sprites)";}
+ }
+
+ public string ShortName
+ {
+ get {return "Spectrum Mono Sprites";}
+ }
+
+ public string Author
+ {
+ get {return Global.Copyright;}
+ }
+
+ public string URL
+ {
+ get {return Global.URL;}
+ }
+
+ public uint MaxColours
+ {
+ get {return 2;}
+ }
+
+ public Colour[] Palette
+ {
+ get {return m_pal;}
+ }
+
+ public bool[] SprPalEditable
+ {
+ get {return m_paledit;}
+ }
+
+ public bool[] SprPalCommon
+ {
+ get {return m_palcommon;}
+ }
+
+ public SpriteSize[] AllowedSizes
+ {
+ get {return m_size;}
+ }
+
+ public string ExportExtension
+ {
+ get {return "asm";}
+ }
+
+ public bool Export(string path, SpriteList sprites)
+ {
+ if (m_config.Shift && (sprites.Count%8)!=0)
+ {
+ throw new Exception("Must be a multiple of 8 sprites to pre-shift");
+ }
+
+ TextWriter w=File.CreateText(path);
+ int no=0;
+
+ foreach (Sprite s in sprites)
+ {
+ if (m_config.Shift)
+ {
+ m_output.AssemblyShifted(w,s,no);
+ no=(no+1)&7;
+ }
+ else
+ {
+ m_output.Assembly(w,s);
+ }
+ }
+
+ no=0;
+
+ if (m_config.Mask)
+ {
+ foreach (Sprite s in sprites)
+ {
+ Sprite mask=new Sprite(s);
+
+ mask.Name+="_mask";
+
+ for(uint y=0;y<s.Height;y++)
+ {
+ uint x1;
+ uint x2;
+
+ for(x1=0;x1<s.Width;x1++)
+ if (s[x1,y]==1)
+ break;
+
+ for(x2=s.Width;x2>0;x2--)
+ if (s[x2-1,y]==1)
+ break;
+
+ if (x1<s.Width && x2>0)
+ for(uint x=x1;x<x2;x++)
+ mask[x,y]=1;
+ }
+
+ if (m_config.Shift)
+ {
+ m_output.AssemblyShifted(w,mask,no);
+ no=(no+1)&7;
+ }
+ else
+ {
+ m_output.Assembly(w,mask);
+ }
+ }
+ }
+
+ w.Close();
+
+ return true;
+ }
+
+ public IConfig Config
+ {
+ get {return m_config;}
+ }
+
+ public IProcess Process
+ {
+ get {return null;}
+ }
+
+ // ------------------------------------------------
+ // PRIVATE
+ //
+ private Colour[] m_pal;
+ private SpriteSize[] m_size;
+ private bool[] m_paledit;
+ private bool[] m_palcommon;
+ private SpecConfigForm m_config;
+ private Output m_output;
+ }
+}