Commit 5dfa71dc authored by Jesse Freeman's avatar Jesse Freeman

Fixed missing contributors to the code header files.

parent b40fd253
......@@ -8,7 +8,9 @@
// --------------------------------------------------------
// This is the official list of Pixel Vision 8 contributors:
//
// Jesse Freeman
// Jesse Freeman - @JesseFreeman
// Christer Kaitila - @McFunkypants
// Pedro Medeiros - @saint11
//
using System;
......@@ -20,6 +22,7 @@ using PixelVisionSDK.Engine.Utils;
namespace PixelVisionSDK
{
/// <summary>
/// The <see cref="APIBridge" /> is the communication layer between the games
/// and the engine's chips. It's designed to provide a clean and safe API
......@@ -32,8 +35,9 @@ namespace PixelVisionSDK
/// </remarks>
public class APIBridge : IAPIBridge
{
//TODO need to make sure this is correctly sized when sprite sizes change
private static readonly int[] tmpPixelData = new int[8*8];
private static readonly int[] tmpPixelData = new int[8 * 8];
protected bool _paused;
/// <summary>
......@@ -169,8 +173,8 @@ namespace PixelVisionSDK
var id = Convert.ToInt32(ids[i]);
if (id > -1)
{
var newX = MathUtil.FloorToInt(i%width)*spriteWidth + x;
var newY = MathUtil.FloorToInt(i/width)*spriteWidth + y;
var newX = MathUtil.FloorToInt(i % width) * spriteWidth + x;
var newY = MathUtil.FloorToInt(i / width) * spriteWidth + y;
DrawSprite(id, newX, newY, flipH, flipV, aboveBG, colorOffset);
}
......@@ -247,7 +251,7 @@ namespace PixelVisionSDK
{
chips.spriteChip.ReadSpriteAt(spriteID, tmpPixelData);
DrawBufferData(tmpPixelData, column*spriteWidth, row*spriteHeight, spriteWidth, spriteHeight);
DrawBufferData(tmpPixelData, column * spriteWidth, row * spriteHeight, spriteWidth, spriteHeight);
}
public void DrawTilesToBuffer(int[] ids, int column, int row, int columns, int colorOffset = 0)
......@@ -263,8 +267,8 @@ namespace PixelVisionSDK
var id = Convert.ToInt32(ids[i]);
if (id > -1)
{
var newX = MathUtil.FloorToInt(i%columns) + column;
var newY = MathUtil.FloorToInt(i/columns) + row;
var newX = MathUtil.FloorToInt(i % columns) + column;
var newY = MathUtil.FloorToInt(i / columns) + row;
DrawTileToBuffer(id, newX, newY, 0);
}
......@@ -353,10 +357,10 @@ namespace PixelVisionSDK
var spriteChip = chips.spriteChip;
var spriteWidth = spriteChip.width;
var spriteHeight = spriteChip.height;
var realHeight = spriteHeight*MathUtil.CeilToInt(ids.Length/width);
var realWidth = spriteWidth*width;
var realHeight = spriteHeight * MathUtil.CeilToInt(ids.Length / width);
var realWidth = spriteWidth * width;
var pixelData = new int[realWidth*realHeight];
var pixelData = new int[realWidth * realHeight];
SpriteChipUtil.CovertSpritesToRawData(ref pixelData, ids, width,
chips);
......@@ -435,5 +439,7 @@ namespace PixelVisionSDK
return pixelData;
}
}
}
\ No newline at end of file
......@@ -8,7 +8,9 @@
// --------------------------------------------------------
// This is the official list of Pixel Vision 8 contributors:
//
// Jesse Freeman
// Jesse Freeman - @JesseFreeman
// Christer Kaitila - @McFunkypants
// Pedro Medeiros - @saint11
//
using PixelVisionSDK.Engine;
......@@ -16,6 +18,7 @@ using PixelVisionSDK.Engine.Chips;
namespace PixelVisionSDK
{
/// <summary>
/// This internal defines the APIs for the
/// <see cref="IAPIBridge" /> which allows games to talk to the engine's
......@@ -23,9 +26,12 @@ namespace PixelVisionSDK
/// </summary>
public interface IAPIBridge : IPixelVisionAPI
{
/// <summary>
/// A reference to the core <see cref="chips" /> in the engine.
/// </summary>
IEngineChips chips { get; set; }
}
}
\ No newline at end of file
......@@ -8,7 +8,9 @@
// --------------------------------------------------------
// This is the official list of Pixel Vision 8 contributors:
//
// Jesse Freeman
// Jesse Freeman - @JesseFreeman
// Christer Kaitila - @McFunkypants
// Pedro Medeiros - @saint11
//
using System;
......@@ -17,6 +19,7 @@ using System.Text;
namespace PixelVisionSDK.Engine.Chips
{
/// <summary>
/// The AbstractChip represents plug-in that adds new functionality to the
/// PixelVisionEngine. Simply extend this abstract class and override the
......@@ -42,6 +45,7 @@ namespace PixelVisionSDK.Engine.Chips
/// </example>
public class AbstractChip : IChip
{
protected PixelVisionEngine engine;
/// <summary>
......@@ -144,5 +148,7 @@ namespace PixelVisionSDK.Engine.Chips
public virtual void Reset()
{
}
}
}
\ No newline at end of file
......@@ -8,7 +8,9 @@
// --------------------------------------------------------
// This is the official list of Pixel Vision 8 contributors:
//
// Jesse Freeman
// Jesse Freeman - @JesseFreeman
// Christer Kaitila - @McFunkypants
// Pedro Medeiros - @saint11
//
using System;
......@@ -17,6 +19,7 @@ using PixelVisionSDK.Engine.Utils;
namespace PixelVisionSDK.Engine.Chips.Audio
{
/// <summary>
/// The MusicChpip is a sequencer for playing back ISoundData. It
/// keeps track of playback time and moves through TrackData playing
......@@ -26,6 +29,7 @@ namespace PixelVisionSDK.Engine.Chips.Audio
/// </summary>
public class MusicChip : AbstractChip, IUpdate
{
protected int currentSong;
public bool loopSong;
public int maxNoteNum = 127; // how many notes in these arrays below
......@@ -34,7 +38,7 @@ namespace PixelVisionSDK.Engine.Chips.Audio
protected float[] noteHZ; // a lookup table of all musical notes in Hz
protected int notesPerTrack = 32;
protected float[] noteStartFrequency; // same, but for sfxr frequency 0..1 range
protected float noteTickS = 30.0f/120.0f; // (30.0f/120.0f) = 120BPM eighth notes
protected float noteTickS = 30.0f / 120.0f; // (30.0f/120.0f) = 120BPM eighth notes
protected float noteTickSEven;
protected float noteTickSOdd;
protected long sequencerBeatNumber;
......@@ -44,6 +48,7 @@ namespace PixelVisionSDK.Engine.Chips.Audio
protected int songLoopCount = 0;
protected float swingRhythmFactor = 0.7f;
//1.0f;//0.66666f; // how much "shuffle" - turnaround on the offbeat triplet
protected float time;
......@@ -111,7 +116,7 @@ namespace PixelVisionSDK.Engine.Chips.Audio
{
if (time >= nextBeatTimestamp)
{
nextBeatTimestamp = time + (sequencerBeatNumber%2 == 1 ? noteTickSOdd : noteTickSEven);
nextBeatTimestamp = time + (sequencerBeatNumber % 2 == 1 ? noteTickSOdd : noteTickSEven);
OnBeat();
}
}
......@@ -123,8 +128,10 @@ namespace PixelVisionSDK.Engine.Chips.Audio
public override void Configure()
{
engine.musicChip = this;
//engine.chipManager.AddToUpdateList(this);
totalLoops = 16;
// Setup the sequencer values
var a = 440.0f; // a is 440 hz...
......@@ -137,7 +144,7 @@ namespace PixelVisionSDK.Engine.Chips.Audio
for (var x = 0; x < maxNoteNum; ++x)
{
// what Hz is a particular musical note? (eg A#)
hertz = a/32.0f*(float) Math.Pow(2.0f, (x - 9.0f)/12.0f);
hertz = a / 32.0f * (float) Math.Pow(2.0f, (x - 9.0f) / 12.0f);
noteHZ[x] = hertz; // this appears to be correct: C = 60 = 261.6255Hz
// derive the SFXR sine wave frequency to play this Hz
......@@ -145,7 +152,8 @@ namespace PixelVisionSDK.Engine.Chips.Audio
// note_startFrequency[x] = Mathf.Sqrt(hertz / SR * 100.0f / 8.0f - 0.001f);
// maybe the algorithm assumes 1 based array etc?
if (x < 126) // let's just hack in one semitone lower sounds (but not overflow array)
noteStartFrequency[x + 1] = (float) Math.Sqrt(hertz/SR*100.0f/8.0f - 0.001f) - 0.0018f;
noteStartFrequency[x + 1] = (float) Math.Sqrt(hertz / SR * 100.0f / 8.0f - 0.001f) - 0.0018f;
// last num is a hack using my ears to "tune"
}
}
......@@ -228,6 +236,7 @@ namespace PixelVisionSDK.Engine.Chips.Audio
return;
}
}
sequencerBeatNumber = 0;
// the next loop might have different instruments
......@@ -238,7 +247,7 @@ namespace PixelVisionSDK.Engine.Chips.Audio
for (var trackNum = 0; trackNum < tracksPerLoop; trackNum++)
{
// what note is it?
var gotANote = activeSongData.tracks[trackNum].notes[sequencerBeatNumber%notesPerTrack];
var gotANote = activeSongData.tracks[trackNum].notes[sequencerBeatNumber % notesPerTrack];
var instrument = soundChip.ReadChannel(trackNum);
......@@ -248,6 +257,7 @@ namespace PixelVisionSDK.Engine.Chips.Audio
if ((gotANote > 0) && (gotANote < maxNoteNum) && (instrument != null))
{
var frequency = noteStartFrequency[gotANote];
//$CTK midi num offset fix -1]; // -1 to account for 0 based array
instrument.Play(frequency);
}
......@@ -276,9 +286,9 @@ namespace PixelVisionSDK.Engine.Chips.Audio
protected void UpdateNoteTickLengths()
{
noteTickS = 30.0f/activeSongData.speedInBPM; // (30.0f/120.0f) = 120BPM eighth notes [tempo]
noteTickSOdd = noteTickS*swingRhythmFactor; // small beat
noteTickSEven = noteTickS*2 - noteTickSOdd; // long beat
noteTickS = 30.0f / activeSongData.speedInBPM; // (30.0f/120.0f) = 120BPM eighth notes [tempo]
noteTickSOdd = noteTickS * swingRhythmFactor; // small beat
noteTickSEven = noteTickS * 2 - noteTickSOdd; // long beat
}
/// <summary>
......@@ -323,5 +333,7 @@ namespace PixelVisionSDK.Engine.Chips.Audio
}
}
}
}
}
\ No newline at end of file
......@@ -8,7 +8,9 @@
// --------------------------------------------------------
// This is the official list of Pixel Vision 8 contributors:
//
// Jesse Freeman
// Jesse Freeman - @JesseFreeman
// Christer Kaitila - @McFunkypants
// Pedro Medeiros - @saint11
//
using System;
......@@ -17,12 +19,14 @@ using PixelVisionSDK.Engine.Utils;
namespace PixelVisionSDK.Engine.Chips.Audio
{
/// <summary>
/// The <see cref="SoundChip" /> is responsible for playing back sound
/// effects in the engine. It's powered by SFxr.
/// </summary>
public class SoundChip : AbstractChip
{
protected int _totalSounds;
protected ISoundData[] channels = new ISoundData[0];
......@@ -179,5 +183,7 @@ namespace PixelVisionSDK.Engine.Chips.Audio
return channels[index];
}
}
}
\ No newline at end of file
......@@ -8,7 +8,9 @@
// --------------------------------------------------------
// This is the official list of Pixel Vision 8 contributors:
//
// Jesse Freeman
// Jesse Freeman - @JesseFreeman
// Christer Kaitila - @McFunkypants
// Pedro Medeiros - @saint11
//
using System;
......@@ -20,6 +22,7 @@ using PixelVisionSDK.Engine.Chips.IO.File;
namespace PixelVisionSDK.Engine.Chips
{
/// <summary>
/// The <see cref="ChipManager" /> is responsible for managing all of the
/// chips in the engine. It allows the engine to create chips from a string
......@@ -29,6 +32,7 @@ namespace PixelVisionSDK.Engine.Chips
/// </summary>
public class ChipManager : IGameLoop, ISave, ILoad
{
protected Dictionary<string, AbstractChip> chips = new Dictionary<string, AbstractChip>();
protected List<IDraw> drawChips = new List<IDraw>();
protected PixelVisionEngine engine;
......@@ -336,5 +340,7 @@ namespace PixelVisionSDK.Engine.Chips
chips.Remove(item.Key);
}
}
}
}
\ No newline at end of file
......@@ -8,7 +8,9 @@
// --------------------------------------------------------
// This is the official list of Pixel Vision 8 contributors:
//
// Jesse Freeman
// Jesse Freeman - @JesseFreeman
// Christer Kaitila - @McFunkypants
// Pedro Medeiros - @saint11
//
using System.Collections.Generic;
......@@ -17,6 +19,7 @@ using PixelVisionSDK.Engine.Chips.IO.File;
namespace PixelVisionSDK.Engine.Chips.Data
{
/// <summary>
/// The AbstractData class represents a standard foundation for all
/// data objects in the engine. It implements the ISave, ILoad and
......@@ -25,6 +28,7 @@ namespace PixelVisionSDK.Engine.Chips.Data
/// </summary>
public class AbstractData : ISave, ILoad, IInvalidate
{
protected bool _invalid;
/// <summary>
......@@ -106,5 +110,7 @@ namespace PixelVisionSDK.Engine.Chips.Data
{
// override with custom serialized data
}
}
}
\ No newline at end of file
......@@ -8,7 +8,9 @@
// --------------------------------------------------------
// This is the official list of Pixel Vision 8 contributors:
//
// Jesse Freeman
// Jesse Freeman - @JesseFreeman
// Christer Kaitila - @McFunkypants
// Pedro Medeiros - @saint11
//
using System;
......@@ -17,6 +19,7 @@ using System.Text.RegularExpressions;
namespace PixelVisionSDK.Engine.Chips.Data
{
/// <summary>
/// The ColorData class is a wraper for color data in the engine.
/// It provides a simple interface for storing RBG color data as
......@@ -24,6 +27,7 @@ namespace PixelVisionSDK.Engine.Chips.Data
/// </summary>
public class ColorData : AbstractData
{
protected float _b;
protected float _g;
......@@ -104,8 +108,8 @@ namespace PixelVisionSDK.Engine.Chips.Data
/// <returns></returns>
public static string ColorToHex(float r, float g, float b)
{
var hex = "#" + ((int) (r*255)).ToString("X2") + ((int) (g*255)).ToString("X2") +
((int) (b*255)).ToString("X2");
var hex = "#" + ((int) (r * 255)).ToString("X2") + ((int) (g * 255)).ToString("X2") +
((int) (b * 255)).ToString("X2");
return hex;
}
......@@ -126,9 +130,9 @@ namespace PixelVisionSDK.Engine.Chips.Data
if (hex[0] == '#')
hex = hex.Substring(1);
r = byte.Parse(hex.Substring(0, 2), NumberStyles.HexNumber)/(float) byte.MaxValue;
g = byte.Parse(hex.Substring(2, 2), NumberStyles.HexNumber)/(float) byte.MaxValue;
b = byte.Parse(hex.Substring(4, 2), NumberStyles.HexNumber)/(float) byte.MaxValue;
r = byte.Parse(hex.Substring(0, 2), NumberStyles.HexNumber) / (float) byte.MaxValue;
g = byte.Parse(hex.Substring(2, 2), NumberStyles.HexNumber) / (float) byte.MaxValue;
b = byte.Parse(hex.Substring(4, 2), NumberStyles.HexNumber) / (float) byte.MaxValue;
}
/// <summary>
......@@ -141,9 +145,9 @@ namespace PixelVisionSDK.Engine.Chips.Data
public static float Brightness(float r, float g, float b)
{
return (float) Math.Sqrt(
r*r*.241 +
g*g*.691 +
b*b*.068);
r * r * .241 +
g * g * .691 +
b * b * .068);
}
/// <summary>
......@@ -158,5 +162,7 @@ namespace PixelVisionSDK.Engine.Chips.Data
var match = regex.Match(color);
return match.Success;
}
}
}
\ No newline at end of file
......@@ -8,13 +8,17 @@
// --------------------------------------------------------
// This is the official list of Pixel Vision 8 contributors:
//
// Jesse Freeman
// Jesse Freeman - @JesseFreeman
// Christer Kaitila - @McFunkypants
// Pedro Medeiros - @saint11
//
namespace PixelVisionSDK.Engine.Chips.Data
{
public interface IInvalidate
{
/// <summary>
/// The invalid flag allows you to quickly see if data has been changed
/// on the AbstractData instance. This is used in conjunction with the
......@@ -41,5 +45,7 @@ namespace PixelVisionSDK.Engine.Chips.Data
/// done changing.
/// </summary>
void ResetValidation();
}
}
\ No newline at end of file
......@@ -8,13 +8,16 @@
// --------------------------------------------------------
// This is the official list of Pixel Vision 8 contributors:
//
// Jesse Freeman
// Jesse Freeman - @JesseFreeman
// Christer Kaitila - @McFunkypants
// Pedro Medeiros - @saint11
//
using PixelVisionSDK.Engine.Chips.IO.File;
namespace PixelVisionSDK.Engine.Chips.Data
{
/// <summary>
/// The ISoundData interface reprents a basic API for working
/// with sound objects in the PixelVisionSDK. Implement this
......@@ -23,6 +26,7 @@ namespace PixelVisionSDK.Engine.Chips.Data
/// </summary>
public interface ISoundData : ISave, ILoad
{
/// <summary>
/// Plays the sound at a specific frequency.
/// </summary>
......@@ -38,5 +42,7 @@ namespace PixelVisionSDK.Engine.Chips.Data
/// Caches the sound file to improve performance
/// </summary>
void CacheSound();
}
}
\ No newline at end of file
......@@ -8,19 +8,23 @@
// --------------------------------------------------------
// This is the official list of Pixel Vision 8 contributors:
//
// Jesse Freeman
// Jesse Freeman - @JesseFreeman
// Christer Kaitila - @McFunkypants
// Pedro Medeiros - @saint11
//
using System;
namespace PixelVisionSDK.Engine.Chips.Data
{
/// <summary>
/// The Rect is a basic rectangle class used for determining
/// bounding box collision based on x, y , width and hight values.
/// </summary>
public class Rect
{
/// <summary>
/// Height of the Rect.
/// </summary>
......@@ -101,5 +105,7 @@ namespace PixelVisionSDK.Engine.Chips.Data
return false;
}
}
}
\ No newline at end of file
......@@ -8,7 +8,9 @@
// --------------------------------------------------------
// This is the official list of Pixel Vision 8 contributors:
//
// Jesse Freeman
// Jesse Freeman - @JesseFreeman
// Christer Kaitila - @McFunkypants
// Pedro Medeiros - @saint11
//
using System;
......@@ -18,6 +20,7 @@ using PixelVisionSDK.Engine.Utils;
namespace PixelVisionSDK.Engine.Chips.Data
{
/// <summary>
/// The SongData class represents a collection of tracks and
/// meta data used by the MusicChip to play back ISoundData
......@@ -25,6 +28,7 @@ namespace PixelVisionSDK.Engine.Chips.Data
/// </summary>
public class SongData : AbstractData
{
protected int _speedInBPM = 120;
/// <summary>
......@@ -153,5 +157,7 @@ namespace PixelVisionSDK.Engine.Chips.Data
track.Reset(true);
}
}
}
}
\ No newline at end of file
......@@ -8,7 +8,9 @@
// --------------------------------------------------------
// This is the official list of Pixel Vision 8 contributors:
//
// Jesse Freeman
// Jesse Freeman - @JesseFreeman
// Christer Kaitila - @McFunkypants
// Pedro Medeiros - @saint11
//
using System;
......@@ -17,6 +19,7 @@ using PixelVisionSDK.Engine.Utils;
namespace PixelVisionSDK.Engine.Chips.Data
{
/// <summary>
/// <see cref="TextureData" /> represent a grid of pixel data in the engine.
/// Pixel data areint values that can be used to
......@@ -28,6 +31,7 @@ namespace PixelVisionSDK.Engine.Chips.Data
/// </summary>
public class TextureData : AbstractData
{
protected Rect oRect = new Rect();
protected int[] pixels = new int[0];
protected Rect sRect = new Rect();
......@@ -100,7 +104,7 @@ namespace PixelVisionSDK.Engine.Chips.Data
y = MathUtil.Repeat(y, height - 1);
}
var index = x + width*y;
var index = x + width * y;
return pixels[index];
}
......@@ -115,7 +119,7 @@ namespace PixelVisionSDK.Engine.Chips.Data
public int[] GetPixels()
{
//TODO depricate this for the CopyPixels method
var total = width*height;
var total = width * height;
var copy = new int[total];
Array.Copy(pixels, copy, total);
return copy;
......@@ -130,7 +134,7 @@ namespace PixelVisionSDK.Engine.Chips.Data
/// </param>
public void CopyPixels(int[] data)
{
var total = width*height;
var total = width * height;
if (data.Length != total)
{
......@@ -166,7 +170,7 @@ namespace PixelVisionSDK.Engine.Chips.Data
/// </param>
public void GetPixels(int x, int y, int blockWidth, int blockHeight, int[] data)
{
tmpTotal = blockWidth*blockHeight;
tmpTotal = blockWidth * blockHeight;
if (data.Length != tmpTotal)
Array.Resize(ref data, tmpTotal);
......@@ -224,7 +228,7 @@ namespace PixelVisionSDK.Engine.Chips.Data
return;
}
var index = x + width*y;
var index = x + width * y;
if (index < 0)
return;
......@@ -263,14 +267,14 @@ namespace PixelVisionSDK.Engine.Chips.Data
/// <param name="pixels">The pixel data to be used.</param>
public virtual void SetPixels(int x, int y, int blockWidth, int blockHeight, int[] pixels)
{
var total = blockWidth*blockHeight;
var total = blockWidth * blockHeight;
int column, newX, newY, row = 0;
var maxColumns = blockWidth - 1;
for (var i = 0; i < total; i++)
{
column = i%blockWidth;
column = i % blockWidth;
newX = column + x;
newY = row + y;
......@@ -297,7 +301,7 @@ namespace PixelVisionSDK.Engine.Chips.Data
tRect.width = width;
tRect.height = height;
Array.Resize(ref pixels, width*height);
Array.Resize(ref pixels, width * height);
Clear();
}
......@@ -350,17 +354,17 @@ namespace PixelVisionSDK.Engine.Chips.Data
int transparent = -1)
{
// Exit out of a merge if the data doesn't match up
if (srcPixels.Length != blockWidth*blockHeight)
if (srcPixels.Length != blockWidth * blockHeight)
return;
var total = blockWidth*blockHeight;
var total = blockWidth * blockHeight;
tmpColumn = tmpX = tmpY = tmpRow = 0;
var maxColumns = blockWidth - 1;
for (var i = 0; i < total; i++)
{
tmpColumn = i%blockWidth;
tmpColumn = i % blockWidth;
tmpX = tmpColumn + x;
tmpY = tmpRow + y;
......@@ -398,5 +402,7 @@ namespace PixelVisionSDK.Engine.Chips.Data
sb.Append("\"spriteIDs\":[" + string.Join(",", Array.ConvertAll(pixels, x => x.ToString())) + "]");
}
}
}
\ No newline at end of file
......@@ -8,7 +8,9 @@
// --------------------------------------------------------
// This is the official list of Pixel Vision 8 contributors:
//
// Jesse Freeman
// Jesse Freeman - @JesseFreeman
// Christer Kaitila - @McFunkypants
// Pedro Medeiros - @saint11
//
using System;
......@@ -18,6 +20,7 @@ using PixelVisionSDK.Engine.Utils;
namespace PixelVisionSDK.Engine.Chips.Data
{
/// <summary>
/// A track is a collection of ISoundData that is played
/// back in a specific sequence. The track uses notes to
......@@ -25,6 +28,7 @@ namespace PixelVisionSDK.Engine.Chips.Data
/// </summary>
public class TrackData : AbstractData
{
/// <summary>
/// Total number of notes in a single track.
/// </summary>
......@@ -116,5 +120,7 @@ namespace PixelVisionSDK.Engine.Chips.Data
notes[i] = 0;
}
}
}
}
\ No newline at end of file
......@@ -8,16 +8,20 @@
// --------------------------------------------------------
// This is the official list of Pixel Vision 8 contributors:
//
// Jesse Freeman
// Jesse Freeman - @JesseFreeman
// Christer Kaitila - @McFunkypants
// Pedro Medeiros - @saint11
//