/// <summary> /// Constructor for Halloween effect /// </summary> /// <param name="chessboard">Chessboard background</param> /// <param name="sound">Sound system</param> /// <param name="NumberOfSpiders">How many spiders to show on screen</param> public Halloween(ref Chess chessboard, ref Sound sound, int NumberOfSpiders) { chess = chessboard; snd = sound; textureSpider = Util.LoadTexture(Util.CurrentExecutionPath + "/gfx/spider.bmp", TextureMinFilter.Linear, TextureMagFilter.Linear, TextureWrapMode.Clamp, TextureWrapMode.Clamp, Color.Black); textureGhost = Util.LoadTexture(Util.CurrentExecutionPath + "/gfx/halloween.bmp", TextureMinFilter.Linear, TextureMagFilter.Linear, TextureWrapMode.Clamp, TextureWrapMode.Clamp, Color.FromArgb(255,0,255)); snd.CreateSound(Sound.FileType.Ogg, Util.CurrentExecutionPath + "/Samples/scary.ogg", "Scary"); MaxSpiders = NumberOfSpiders; Spiders = new Spider[MaxSpiders]; Ghost = new Vector3[4]; Size = new SizeF(1.0f, 1.0f); float sZ = 0.4f; for (int i = 0; i < MaxSpiders; i++) { Spiders[i] = new Spider(0.1f, 0.1f, sZ, 1.0f, textureSpider); sZ -= sZ / (NumberOfSpiders + 2000); } X = Util.Rnd.Next(-3, 3) / 10.0f; Y = Util.Rnd.Next(-3, 3) / 10.0f; Z = sZ - 0.001f; Ghost[0] = new Vector3(X, Y, Z); // red Ghost[1] = new Vector3(X, Y + Size.Height, Z); // blue Ghost[2] = new Vector3(X + Size.Width, Y + Size.Height, Z); // green Ghost[3] = new Vector3(X + Size.Width, Y, Z); // yellow LastPlayedDate = string.Empty; }
/// <summary> /// Constructor for f**k me gently effect /// </summary> /// <param name="sound">Sound system</param> /// <param name="chess">Chessboard</param> public F**k(ref Sound sound,ref Chess chess) { img = Util.LoadTexture(System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + "/gfx/f**k.jpg"); bakground = chess; snd = sound; snd.CreateSound(Sound.FileType.Ogg, System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + "/Samples/F**k.ogg", "F**k"); LastDate = string.Empty; }
/// <summary> /// Constructor for Chip and Dale effect /// </summary> /// <param name="sound">Sound system</param> /// <param name="chess">Chessboard</param> public ChipAndDale(ref Sound sound,ref Chess chess) { img = Util.LoadTexture(Util.CurrentExecutionPath + "/gfx/chipanddale.bmp", TextureMinFilter.Linear, TextureMagFilter.Linear, TextureWrapMode.Clamp, TextureWrapMode.Clamp, System.Drawing.Color.FromArgb(255, 0, 255)); bakground = chess; snd = sound; snd.CreateSound(Sound.FileType.Ogg, Util.CurrentExecutionPath + "/Samples/chipanddale.ogg", "Chip"); LastDate = string.Empty; }
/// <summary> /// Constructor for Sailormoon effect /// </summary> /// <param name="sound">Sound system</param> /// <param name="chess">Chessboard</param> public Sailormoon(ref Sound sound,ref Chess chess) { img = Util.LoadTexture(Util.CurrentExecutionPath + "/gfx/sailormoon.jpg"); bakground = chess; snd = sound; snd.CreateSound(Sound.FileType.Ogg, Util.CurrentExecutionPath + "/Samples/SailorJap.ogg", "Moon"); LastDate = string.Empty; }
/// <summary> /// Constructor for Zelda effect /// </summary> /// <param name="sound">Sound system</param> /// <param name="chess">Chessboard</param> public Zelda(ref Sound sound,ref Chess chess) { zelda = Util.LoadTexture(System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + "/gfx/Zelda.png", TextureMinFilter.Linear, TextureMagFilter.Linear, TextureWrapMode.Clamp, TextureWrapMode.Clamp, System.Drawing.Color.FromArgb(255, 0, 255)); link = Util.LoadTexture(System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + "/gfx/Link.png", TextureMinFilter.Linear, TextureMagFilter.Linear, TextureWrapMode.Clamp, TextureWrapMode.Clamp, System.Drawing.Color.FromArgb(255, 0, 255)); ganon = Util.LoadTexture(System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + "/gfx/Ganon.png", TextureMinFilter.Linear, TextureMagFilter.Linear, TextureWrapMode.Clamp, TextureWrapMode.Clamp, System.Drawing.Color.FromArgb(255, 0, 255)); bakground = chess; snd = sound; snd.CreateSound(Sound.FileType.Ogg, System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + "/Samples/zeldaNES.ogg", "Zelda"); LastDate = string.Empty; showGanon = false; }
/// <summary> /// Constructor for Degerfors IF effect /// </summary> /// <param name="chess"></param> /// <param name="sound"></param> public Dif(ref Chess chess, ref Sound sound) { bakground = chess; x = 0.0f; y = 0.0f; image = Util.LoadTexture(Util.CurrentExecutionPath + "/gfx/dif2.bmp", TextureMinFilter.Linear, TextureMagFilter.Linear, TextureWrapMode.Clamp, TextureWrapMode.Clamp, System.Drawing.Color.FromArgb(255, 0, 255)); snd = sound; tick = 0; LastDate = string.Empty; snd.CreateSound(Sound.FileType.Ogg, Util.CurrentExecutionPath + "/Samples/imperial.ogg", "Dif"); }
/// <summary> /// constructor of National day effect /// </summary> /// <param name="chess">Chessboard</param> /// <param name="sound">Sound system</param> public National(ref Chess chess, ref Sound sound) { ticks = 0; oldTicks = 0; currentImage = 0; bakground = chess; snd = sound; LastDate = string.Empty; image = Util.LoadTexture(Util.CurrentExecutionPath + "/gfx/flagga.bmp", TextureMinFilter.Linear, TextureMagFilter.Linear, TextureWrapMode.Clamp, TextureWrapMode.Clamp, System.Drawing.Color.FromArgb(255, 0, 255)); snd.CreateSound(Sound.FileType.Ogg, Util.CurrentExecutionPath + "/Samples/Du gamla du fria (Black Ingvars).ogg", "National"); }
/// <summary> /// Constructor Windows and Linux effect /// </summary> /// <param name="chessboard">Chessboard</param> public WinLinux(ref Chess chessboard) { chess = chessboard; texture = Util.LoadTexture(Util.CurrentExecutionPath + "/gfx/winlogo.bmp", TextureMinFilter.Linear, TextureMagFilter.Linear, TextureWrapMode.Clamp, TextureWrapMode.Clamp, Color.FromArgb(255,0,255)); Ghost = new Vector3[4]; Size = new SizeF(1.4f, 1.4f); X = Util.Rnd.Next(-3, 3) / 10.0f; Y = Util.Rnd.Next(-3, 3) / 10.0f; Z = 0.45f; Ghost[0] = new Vector3(X, Y, Z); // red Ghost[1] = new Vector3(X, Y + Size.Height, Z); // blue Ghost[2] = new Vector3(X + Size.Width, Y + Size.Height, Z); // green Ghost[3] = new Vector3(X + Size.Width, Y, Z); // yellow }
/// <summary> /// Constructor for Swine effect /// </summary> /// <param name="chess">Chessboard</param> /// <param name="txt">Text printer</param> public Swine(ref Chess chess, ref Text2D txt) { disposed = false; slideshowImage1 = Util.LoadTexture(Util.CurrentExecutionPath + "/gfx/bildspel1.jpg"); slideshowImage2 = Util.LoadTexture(Util.CurrentExecutionPath + "/gfx/bildspel2.jpg"); slideshowImage3 = Util.LoadTexture(Util.CurrentExecutionPath + "/gfx/bildspel3.jpg"); bakground = chess; text = txt; currentImage = 0; currentSlideShow = 0; LastDate = string.Empty; ticks = 0; oldTicks = 0; }
/// <summary> /// Constructor for TeknatStyle effect /// </summary> /// <param name="chess">Chessboard</param> /// <param name="sound">Sound system</param> /// <param name="txt">Text printer</param> public TeknatStyle(ref Chess chess, ref Sound sound, ref Text2D txt) { disposed = false; slideshowImage1 = Util.LoadTexture(Util.CurrentExecutionPath + "/gfx/bildspel1.jpg"); slideshowImage2 = Util.LoadTexture(Util.CurrentExecutionPath + "/gfx/bildspel2.jpg"); slideshowImage3 = Util.LoadTexture(Util.CurrentExecutionPath + "/gfx/bildspel3.jpg"); snd = sound; bakground = chess; text = txt; snd.CreateSound(Sound.FileType.Ogg, Util.CurrentExecutionPath + "/Samples/ts.ogg", "TS"); currentImage = 0; currentSlideShow = 0; LastDate = string.Empty; ticks = 0; oldTicks = 0; }
/// <summary> /// Constructor for Lucia effect /// </summary> /// <param name="chessboard">Chessboard</param> /// <param name="sound">Sound system</param> public Lucia(ref Chess chessboard, ref Sound sound) { chess = chessboard; snd = sound; texture = Util.LoadTexture(Util.CurrentExecutionPath + "/gfx/lucia.bmp", TextureMinFilter.Linear, TextureMagFilter.Linear, TextureWrapMode.Clamp, TextureWrapMode.Clamp, Color.Black); //snd.CreateSound(Sound.FileType.Ogg, Util.CurrentExecutionPath + "/Samples/lucia.ogg", "lucia"); Ghost = new Vector3[4]; Size = new SizeF(0.4f, 0.8f); Speed = 0.0045f; X = Util.Rnd.Next(-3, 3) / 10.0f; Y = Util.Rnd.Next(-3, 3) / 10.0f; Z = 0.45f; Ghost[0] = new Vector3(X, Y, Z); // red Ghost[1] = new Vector3(X, Y + Size.Height, Z); // blue Ghost[2] = new Vector3(X + Size.Width, Y + Size.Height, Z); // green Ghost[3] = new Vector3(X + Size.Width, Y, Z); // yellow }
/// <summary> /// Constructor for Nerdy effect /// </summary> /// <param name="chess">Chessboard</param> /// <param name="sound">Sound system</param> public Nerdy(ref Chess chess, ref Sound sound) { disposed = false; n1 = Util.LoadTexture(Util.CurrentExecutionPath + "/gfx/n1.jpg"); n2 = Util.LoadTexture(Util.CurrentExecutionPath + "/gfx/n2.jpg"); n3 = Util.LoadTexture(Util.CurrentExecutionPath + "/gfx/n3.jpg"); n4 = Util.LoadTexture(Util.CurrentExecutionPath + "/gfx/n4.jpg"); n5 = Util.LoadTexture(Util.CurrentExecutionPath + "/gfx/n5.png"); n6 = Util.LoadTexture(Util.CurrentExecutionPath + "/gfx/n6.png"); snd = sound; bakground = chess; snd.CreateSound(Sound.FileType.Ogg, Util.CurrentExecutionPath + "/Samples/Nerdy.ogg", "Nerdy"); currentImage = 0; LastDate = string.Empty; ticks = 0; oldTicks = 0; }
/// <summary> /// Constructor for Scroller effect /// </summary> /// <param name="chess">Chessboard</param> /// <param name="star">Starfield</param> /// <param name="txt">Text printer</param> public Scroller(ref Chess chess, ref Starfield star, ref Text2D txt) { c = chess; sf = star; text = txt; listScrollers = new List<string>(); indexList = new List<int>(); maxIndexValue = 0; randomBackground = 0; randomScrollMove = 0; randomFont = 0; x = 0.0f; y = 0.0f; z = 0.0f; startY = 0.0f; tick = 0; LastPlayedDate = string.Empty; readFromXml(); getRandomScrollerStuff(); }
/// <summary> /// Constructor for Birthday effect /// </summary> /// <param name="sound">Sound system</param> /// <param name="txt">Text printing done with this</param> /// <param name="chess">Chessboard</param> public Birthday(ref Sound sound, ref Text2D txt, ref Chess chess) { image = Util.LoadTexture(Util.CurrentExecutionPath + "/gfx/tarta.bmp", TextureMinFilter.Linear, TextureMagFilter.Linear, TextureWrapMode.Clamp, TextureWrapMode.Clamp, System.Drawing.Color.FromArgb(255, 0, 255)); ballonsImage = Util.LoadTexture(Util.CurrentExecutionPath + "/gfx/ballons2.bmp", TextureMinFilter.Linear, TextureMagFilter.Linear, TextureWrapMode.Clamp, TextureWrapMode.Clamp, System.Drawing.Color.FromArgb(255, 0, 255)); snd = sound; text = txt; this.chess = chess; x = 0.0f; leftborder = false; rightborder = true; randomFontt = 0; randomFont(); //snd.CreateSound(Sound.FileType.WAV, Util.CurrentExecutionPath + "/Samples/birthday.wav", "Birthday"); snd.CreateSound(Sound.FileType.Ogg, Util.CurrentExecutionPath + "/Samples/birthday.ogg", "Birthday"); currentImage = 0; b = new Ballons[NUMBEROFBALLONS]; float z = 0.4f; for (int i = 0; i < NUMBEROFBALLONS; i++) { b[i] = new Ballons((Util.Rnd.Next(-18, 15)) / 10.0f, (Util.Rnd.Next(-10, 20) * -1) / 10.0f, Util.Rnd.Next(2, 8) / 1000.0f, ballonsImage, new Vector2[] { new Vector2(0.0f + (currentImage * 0.2f), 1.0f), new Vector2(0.2f + (currentImage * 0.2f), 1.0f), new Vector2(0.2f + (currentImage * 0.2f), 0.0f), new Vector2(0.0f + (currentImage * 0.2f), 0.0f)}, Util.Rnd.Next(5, 10) * 10.0f, z); z -= 0.00001f; currentImage++; if (currentImage == 4) currentImage = 0; }//for }
/// <summary> /// Dispose method /// </summary> /// <param name="disposing">Is it disposing?</param> protected virtual void Dispose(bool disposing) { if (!this.disposed) { if (disposing) { // free managed resources Util.DeleteTexture(ref texture); chess = null; } // free native resources if there are any. disposed = true; System.Diagnostics.Debug.WriteLine(this.GetType().ToString() + " disposed."); } }
/// <summary> /// Dispose method /// </summary> /// <param name="disposing">Is it disposing?</param> protected virtual void Dispose(bool disposing) { if (!this.disposed) { if (disposing) { // free managed resources c = null; sf = null; } // free native resources if there are any. Debug.WriteLine(this.GetType().ToString() + " disposed."); disposed = true; } }
/// <summary> /// Dispose method /// </summary> /// <param name="disposing">Is it disposing?</param> protected virtual void Dispose(bool disposing) { if (!this.disposed) { if (disposing) { // free managed resources Util.DeleteTexture(ref image); bakground = null; } // free native resources if there are any. Debug.WriteLine(this.GetType().ToString() + " disposed."); disposed = true; } }
/// <summary> /// Dispose method /// </summary> /// <param name="disposing">Is it disposing?</param> protected virtual void Dispose(bool disposing) { if (!this.disposed) { if (disposing) { // free managed resources Util.DeleteTexture(ref textureSpider); Util.DeleteTexture(ref textureGhost); for (int i = 0; i < MaxSpiders; i++) { if (Spiders[i] != null) Spiders[i].Dispose(); //Spiders[i] = null; } chess = null; } // free native resources if there are any. disposed = true; Debug.WriteLine(this.GetType().ToString() + " disposed."); } }
/// <summary> /// Constructor for TurboLogo effect /// </summary> /// <param name="sound">Sound system</param> /// <param name="chess">Chessboard</param> /// <param name="VT">Vårtermin?</param> public TurboLogo(ref Sound sound, ref Chess chess,bool VT = true) { if (Util.Rnd.Next(0, 10) < 6) { moveUp = false; } else { moveUp = true; } if (Util.Rnd.Next(0,10) < 6) { moveLeft = false; } else { moveLeft = true; } bakground = chess; snd = sound; randomChess(); //snd.CreateSound(Sound.FileType.WAV, Util.CurrentExecutionPath + "/Samples/roadrunner.wav", "roadrunner"); snd.CreateSound(Sound.FileType.Ogg, Util.CurrentExecutionPath + "/Samples/roadrunner.ogg", "roadrunner"); VTColour = VT; moveX = 0.0075f; moveY = 0.0075f; X = Y = 0.0f; //Bitmaps for making the 4 different layouts Bitmap bitmap = new Bitmap(Util.CurrentExecutionPath + "/gfx/roadrunner.bmp"); Bitmap bmSprite = new Bitmap(bitmap.Width*2,bitmap.Height*2); Graphics g = Graphics.FromImage(bmSprite); g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit; g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; g.DrawImage(bitmap, 0, 0, bitmap.Width, bitmap.Height); g.DrawImage(bitmap, 0, bitmap.Height, bitmap.Width, bitmap.Height); bitmap.RotateFlip(RotateFlipType.Rotate180FlipY); g.DrawImage(bitmap, bitmap.Width, 0, bitmap.Width, bitmap.Height); g.DrawImage(bitmap, bitmap.Width, bitmap.Height, bitmap.Width, bitmap.Height); // verify that this is not missing as it will crash if not possible to find... // this makes bad resolution on text, it can get distorted... // top left g.DrawString("Turbophesten", new Font("Tahoma", 19.0f, FontStyle.Italic | FontStyle.Bold), Brushes.Black, 75, 135); g.DrawString("Örebro 2013", new Font("Tahoma", 19.0f, FontStyle.Italic | FontStyle.Bold), Brushes.Black, 72, 160); // top right g.DrawString("Turbophesten", new Font("Tahoma", 19.0f, FontStyle.Italic | FontStyle.Bold), Brushes.Black, bitmap.Width + 35, 135); g.DrawString("Örebro 2013", new Font("Tahoma", 19.0f, FontStyle.Italic | FontStyle.Bold), Brushes.Black, bitmap.Width + 55, 160); // bottom left g.DrawString("Turbophesten", new Font("Tahoma", 18.0f, FontStyle.Italic | FontStyle.Bold), Brushes.Black, 75, bitmap.Height + 135); g.DrawString("Örebro 2013", new Font("Tahoma", 18.0f, FontStyle.Italic | FontStyle.Bold), Brushes.Black, 72, bitmap.Height + 160); //bottom right g.DrawString("Turbophesten", new Font("Tahoma", 18.0f, FontStyle.Italic | FontStyle.Bold), Brushes.Black, bitmap.Width + 35, bitmap.Height + 135); g.DrawString("Örebro 2013", new Font("Tahoma", 18.0f, FontStyle.Italic | FontStyle.Bold), Brushes.Black, bitmap.Width + 55, bitmap.Height + 160); g.Dispose(); //End Bitmap creation and edits bmSprite.MakeTransparent(Color.Magenta); // change yellow (255, 214, 0) to blue and ? for (int y = bitmap.Height; y < bmSprite.Height; y++) { for (int x = 0; x < bmSprite.Width; x++) { Color col = bmSprite.GetPixel(x, y); if (col.R == 255 && col.G == 214 && col.B == 0) { bmSprite.SetPixel(x, y, Color.FromArgb(0, 187, 255)); } } } BitmapData data = bmSprite.LockBits(new System.Drawing.Rectangle(0, 0, bmSprite.Width, bmSprite.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); Util.GenTextureID(out texture); GL.BindTexture(TextureTarget.Texture2D, texture); GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, data.Width, data.Height, 0, OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, data.Scan0); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureWrapMode.Clamp); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureWrapMode.Clamp); bmSprite.UnlockBits(data); bmSprite.Dispose(); bitmap.Dispose(); data = null; bmSprite = null; bitmap = null; //data = null; GL.BindTexture(TextureTarget.Texture2D, 0); }