public ChaosDisplay(int pDisplayWidth, int pDisplayHeight) { //Create a gradient of Dark Grey to White for our colors to start out. SuperColor tmpInfiniteColor, tmpGradientStartColor, tmpGradientEndColor; tmpInfiniteColor = new SuperColor(0, 0, 0); tmpGradientStartColor = new SuperColor(75, 0, 40); tmpGradientEndColor = new SuperColor(0, 202, 243); //Instantiate the display box and the event handler for it. this._ChaosDisplayBox = new EventBox(); this._ChaosDisplayBox.ButtonPressEvent += new ButtonPressEventHandler(this.ChaosDisplayClickEvent); this._ChaosDisplayBox.ButtonReleaseEvent += new ButtonReleaseEventHandler(this.ChaosDisplayClickReleaseEvent); this._ChaosDisplayBox.MotionNotifyEvent += new MotionNotifyEventHandler(this.ChaosDisplayMouseMotionEvent); this._ChaosDisplayBox.ScrollEvent += new ScrollEventHandler(this.ChaosDisplayMouseScrolledEvent); //The ubiquitous main view. this._OutputChaosRenderingMachine = new ChaosRenderingMachine("MainView", pDisplayWidth, pDisplayHeight, tmpInfiniteColor, tmpGradientStartColor, tmpGradientEndColor, 500); this._OutputChaosRenderingMachine.WriteLog += new WriteLogEventHandler(this.ChainedMachineWriteLog); //Create a chaos engine list this._ChaosEngineList = new ChaosEngineList(); this.InstantiateEngines(); //The rendering method //Hook up the output machine and the engine with the renderer this._ChaosRenderer = new ChaosRenderer(this._OutputChaosRenderingMachine, this._ChaosEngineList.Engine); this._ChaosRenderer.RefreshDisplay += new EventHandler(RenderUpdateDisplayEvent); this._ChaosRenderer.WriteLog += new WriteLogEventHandler(ChainedRendererWriteLog); this.ResetRenderingMachines(); }
public ChaosRenderingMachine(string pMachineName, int pDisplayWidth, int pDisplayHeight, SuperColor pInfiniteColor, SuperColor pStartColor, SuperColor pEndColor, int pColorCount) { //Set the machine name this._MachineName = pMachineName; //Set the machines viewport size this._PixelWidth = pDisplayWidth; this._PixelHeight = pDisplayHeight; //Define a color to represent "infinite" this._InfiniteColor = pInfiniteColor; //Create a simple Gradient Pallete this._Palette = new SuperImagePalette(pStartColor, pEndColor, pColorCount); //Create a simple image; later this could end up being a "subsuper" image? Only buffers no gtk this._MachineOutputImage = new SuperImage(this._PixelWidth, this._PixelHeight, 2); }
//The simplest Constructor public ChaosRenderingMachine(string pMachineName) { //Set the machine name this._MachineName = pMachineName; //Set the machines viewport size this._PixelWidth = 400; this._PixelHeight = 300; //Define a color to represent "infinite" this._InfiniteColor = new SuperColor(0, 15, 0); //Create a simple 100 color pallette SuperColor tmpStartColor = new SuperColor(0, 0, 0); SuperColor tmpEndColor = new SuperColor(255, 255, 255); this._Palette = new SuperImagePalette(tmpStartColor, tmpEndColor, 100); //Create a simple image; later this could end up being a "subsuper" image? Only buffers no gtk this._MachineOutputImage = new SuperImage(this._PixelWidth, this._PixelHeight); }
/// <summary> /// Draw a horizontal line of customizable height, width and color. /// </summary> /// <param name="_height">Line height (in pixels).</param> /// <param name="_width">Line width (in pixels).</param> /// <param name="_color">Line color.</param> public HorizontalLineAttribute(float _height, float _width, SuperColor _color = DefaultColor) : this(_height, _color) { Width = Mathf.Max(0, _width); }
/******************************** ******* CONSTRUCTORS ******* *******************************/ /// <summary> /// Draw a horizontal line of customizable height and color. /// </summary> /// <param name="_height">Line height (in pixels).</param> /// <param name="_color">Line color.</param> public HorizontalLineAttribute(float _height = DefaultHeight, SuperColor _color = DefaultColor) { Height = Mathf.Max(1, _height); Color = _color; }
/// <summary> /// Draws this field as a progress bar. /// </summary> /// <param name="_label">Label displayed at the middle of the progress bar.</param> /// <param name="_maxValue">Progress bar maximum value.</param> /// <param name="_color">Progress bar color.</param> /// <param name="_height">Progress bar height (in pixels).</param> /// <param name="_isEditable">Should this progress bar be editable in inspector.</param> public ProgressBarAttribute(string _label, float _maxValue, SuperColor _color = DefaultColor, float _height = DefaultHeight, bool _isEditable = false) : this(_maxValue, _color, _height, _isEditable) { Label = _label; }
/// <summary> /// Draws this field as a progress bar. /// </summary> /// <param name="_maxValue">Progress bar maximum value.</param> /// <param name="_color">Progress bar color.</param> /// <param name="_height">Progress bar height (in pixels).</param> /// <param name="_isEditable">Should this progress bar be editable in inspector.</param> public ProgressBarAttribute(float _maxValue, SuperColor _color = DefaultColor, float _height = DefaultHeight, bool _isEditable = false) : this(_color, _height, _isEditable) { MaxValue = Mathf.Max(.1f, _maxValue); }
/******************************** ******* CONSTRUCTORS ******* *******************************/ /// <summary> /// Draws a progress bar. /// </summary> /// <param name="_color">Progress bar color.</param> /// <param name="_height">Progress bar height (in pixels).</param> /// <param name="_isEditable">Should this progress bar be editable in inspector.</param> private ProgressBarAttribute(SuperColor _color, float _height, bool _isEditable = false) { Color = _color; Height = Mathf.Max(1, _height); IsEditable = _isEditable; }
/// <summary> /// Draws this field as a progress bar. /// </summary> /// <param name="_maxValueVariableName">Name of the variable acting as this progress bar maximum value.</param> /// <param name="_color">Progress bar color.</param> /// <param name="_height">Progress bar height (in pixels).</param> /// <param name="_isEditable">Should this progress bar be editable in inspector.</param> public ProgressBarAttribute(string _maxValueVariableName, SuperColor _color = DefaultColor, float _height = DefaultHeight, bool _isEditable = false) : this(_color, _height, _isEditable) { MaxValueVariableName = _maxValueVariableName; }
/// <summary> /// Get associated enum value Color. /// </summary> /// <param name="_superColor">Enum value to get Color from.</param> /// <param name="_alpha">Color alpha value (from 0 to 1).</param> /// <returns>Returns the color associated with this enum value.</returns> public static Color GetColor(this SuperColor _superColor, float _alpha = 1) { switch (_superColor) { // White to Black case SuperColor.White: return(new Color(1f, 1f, 1f, _alpha)); case SuperColor.Silver: return(new Color(.753f, .753f, .753f, _alpha)); case SuperColor.Gray: return(new Color(.502f, .502f, .502f, _alpha)); case SuperColor.Black: return(new Color(0f, 0f, 0f, _alpha)); // Maroon to Red case SuperColor.Maroon: return(new Color(.502f, 0f, 0f, _alpha)); case SuperColor.Brown: return(new Color(.588f, .294f, 0f, _alpha)); case SuperColor.Chocolate: return(new Color(.482f, .247f, 0f, _alpha)); case SuperColor.Red: return(new Color(1f, 0f, 0f, _alpha)); case SuperColor.Crimson: return(new Color(.863f, .078f, .235f, _alpha)); // Orange to Yellow case SuperColor.Orange: return(new Color(1f, .647f, .0f, _alpha)); case SuperColor.DarkOrange: return(new Color(1f, .549f, .0f, _alpha)); case SuperColor.Pumpkin: return(new Color(1f, .459f, .094f, _alpha)); case SuperColor.HarvestGold: return(new Color(.855f, .568f, .0f, _alpha)); case SuperColor.Yellow: return(new Color(1f, 1f, .0f, _alpha)); // Lime to Turquoise case SuperColor.Lime: return(new Color(0f, 1f, .0f, _alpha)); case SuperColor.Green: return(new Color(.133f, .8f, 0f, _alpha)); case SuperColor.Aquamarine: return(new Color(.498f, 1f, .831f, _alpha)); case SuperColor.Turquoise: return(new Color(.251f, .878f, .816f, _alpha)); // Cyan to Navy case SuperColor.Cyan: return(new Color(0f, 1f, 1f, _alpha)); case SuperColor.Sapphire: return(new Color(.059f, .322f, .729f, _alpha)); case SuperColor.Blue: return(new Color(0f, 0f, 1f, _alpha)); case SuperColor.Navy: return(new Color(0f, 0f, .502f, _alpha)); // Purple to Pink case SuperColor.Purple: return(new Color(.627f, .125f, .941f, _alpha)); case SuperColor.Lavender: return(new Color(.710f, .494f, .863f, _alpha)); case SuperColor.Indigo: return(new Color(.294f, 0f, .510f, _alpha)); case SuperColor.Raspberry: return(new Color(.890f, .043f, .365f, _alpha)); case SuperColor.SalmonPink: return(new Color(1f, .869f, .643f, _alpha)); // Return white as default color default: return(new Color(1, 1, 1, _alpha)); } }