Ejemplo n.º 1
0
        /// <summary>
        /// Constructor for SuneTxt effect
        /// </summary>
        /// <param name="Text"></param>
        /// <param name="BuiltInFont"></param>
        public SuneTxtHandler(ref Text2D Text, bool BuiltInFont)
        {
            listquotes = new List<string>();
            indexList = new List<int>();
            maxIndexValue = 0;
            text = Text;
            builtInFont = BuiltInFont;

            readFromXml();
            drawInit(builtInFont);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Constructor for Quiz effect
        /// </summary>
        /// <param name="Text">Text printer</param>
        /// <param name="BuiltInFont">Use build in fonts for the text?</param>
        /// <param name="sound">Sound system</param>
        public Quiz(ref Text2D Text, bool BuiltInFont, ref Sound sound)
        {
            listquotes = new List<string>();
            indexList = new List<int>();
            maxIndexValue = 0;
            text = Text;
            builtInFont = BuiltInFont;
            snd = sound;
            snd.CreateSound(Sound.FileType.Ogg, Util.CurrentExecutionPath + "/Samples/Yoda.ogg", "YODA");

            readFromXml();
            drawInit(builtInFont);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Constructor for SuneAnimation
 /// </summary>
 /// <param name="sound">Sound system</param>
 /// <param name="Text">Text printer</param>
 public SuneAnimation(ref Sound sound, ref Text2D Text)
 {
     ticks = 0;
     oldTicks = 0;
     soundOldTicks = 0;
     soundOldTicks = 0;
     currentImage = 0;
     sh = new SuneTxtHandler(ref Text, false);
     snd = sound;
     //text = Text;
     LastPlayedDate = string.Empty;
     image = Util.LoadTexture(Util.CurrentExecutionPath + "/gfx/sune_sprite.bmp");
     //snd.CreateSound(Sound.FileType.WAV, Util.CurrentExecutionPath + "/Samples/laugh.wav", "Sune");
     snd.CreateSound(Sound.FileType.Ogg, Util.CurrentExecutionPath + "/Samples/laugh.ogg", "Sune");
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Constructor for Intro effect
        /// </summary>
        /// <param name="sound">Sound system</param>
        /// <param name="txt">Text printer</param>
        public Intro(ref Sound sound, ref Text2D txt)
        {
            disposed = false;
            snd = sound;
            text = txt;

            ZA = 0.0f;
            ZT = 0.0f;
            ZW = 0.0f;

            XA = 0.0f;
            XT = 0.0f;
            XW = 0.0f;
            XTBack = false;
        }
Ejemplo n.º 5
0
        /// <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;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Constructor for Datasmurf effect
        /// </summary>
        /// <param name="sound">Sound system</param>
        /// <param name="txt">Text printing</param>
        public Datasmurf(ref Sound sound, ref Text2D txt)
        {
            x = -1.0f;
            y = 0.0f;
            image = Util.LoadTexture(Util.CurrentExecutionPath + "/gfx/dataSmurf.bmp", TextureMinFilter.Linear, TextureMagFilter.Linear, TextureWrapMode.Clamp, TextureWrapMode.Clamp, System.Drawing.Color.FromArgb(255,0,255));

            snd = sound;
            text = txt;
            //snd.CreateSound(Sound.FileType.WAV, Util.CurrentExecutionPath + "/Samples/datasmurf.wav", "Smurf");
            snd.CreateSound(Sound.FileType.Ogg, Util.CurrentExecutionPath + "/Samples/datasmurf.ogg", "Smurf");

            tick = 0;
            LastDate = string.Empty;

            currentImage = 0;
            ticks = oldTicks = 0;
        }
Ejemplo n.º 7
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;
        }
Ejemplo n.º 8
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();
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Constructor for Richard Stalman effect
 /// </summary>
 /// <param name="sound">Sound system</param>
 /// <param name="text">Text printer</param>
 public RMS(ref Sound sound, ref Text2D text)
 {
     snd = sound;
     txt = text;
     texture = Util.LoadTexture(Util.CurrentExecutionPath + "/gfx/rms.jpg", TextureMinFilter.Linear, TextureMagFilter.Linear, TextureWrapMode.Clamp, TextureWrapMode.Clamp, Color.Yellow);
     snd.CreateSound(Sound.FileType.Ogg, Util.CurrentExecutionPath + "/Samples/free.ogg", "rms");
     SongText = new string[9];
     CurrentRow = -1;
     DelayRow = 3500; // milisecond
     LastPlayedDate = string.Empty;
     SongText[0] = "Join us now and share the software. You'll be free, hackers, you'll be free.";
     SongText[1] = "Join us now and share the software. You'll be free, hackers, you'll be free.";
     SongText[2] = "Hoarders can get piles of money, That is true, hackers, that is true.";
     SongText[3] = "But they cannot help their neighbors; That's not good, hackers, that's not good.";
     SongText[4] = "When we have enough free software At our call, hackers, at our call.";
     SongText[5] = "We'll kick out those dirty licenses Ever more, hackers, ever more.";
     SongText[6] = "Join us now and share the software. You'll be free, hackers, you'll be free.";
     SongText[7] = "Join us now and share the software. You'll be free, hackers, you'll be free.";
     //SongText[8] = "Richard Stallman - a true hacker's birthday!";
     SongText[8] = "Richard Stallman - a true hacker!";
     lastTick = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond; // lastTick is in milisecond
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Constructor for Matrix effect
        /// </summary>
        /// <param name="txt">Text printer</param>
        public Matrix(ref Text2D txt)
        {
            writeFont = new Font("Tahoma", 8.0f, FontStyle.Bold);
            textureID = txt.getTexture(OpenGL.Text2D.FontName.TypeFont);
            matrixTexture = new int[5];
            matrixTexture[0] = Util.GenTextureID();
            matrixTexture[1] = Util.GenTextureID();
            matrixTexture[2] = Util.GenTextureID();
            matrixTexture[3] = Util.GenTextureID();
            matrixTexture[4] = Util.GenTextureID();
            disposed = false;
            columns = 19;
            textureCoords = new List<float>();
            textureCoordsStart = new List<float>();
            textureCoordsSpeed = new List<float>();
            string[] randomChars = new string[5];
            string valuesChar = txt.getAllowedChars(OpenGL.Text2D.FontName.TypeFont);

            //byt ut 10 mot random 20-40 5 steg
            for (int j = 0; j < randomChars.Length; j++)
            {
                for (int i = 0; i < 20; i++)
                {
                    randomChars[j] += valuesChar[Util.Rnd.Next(0, valuesChar.Length)];
                }
            }

            for (int i = 0; i < columns; i++)
            {
                textureCoordsSpeed.Add((Util.Rnd.Next(100, 1000) / 75000.0f) * -1.0f);
                textureCoordsStart.Add(0.0f);
                textureCoords.Add(0.0f);
            }

            createImage(randomChars, ref txt);
        }
Ejemplo n.º 11
0
        /// <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
        }
Ejemplo n.º 12
0
        /// <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);
                    text = null;
                }
                // free native resources if there are any.
                Debug.WriteLine(this.GetType().ToString() + " disposed.");

                disposed = true;
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Created the images for the scrolling characters
        /// </summary>
        /// <param name="randomChars">Characters to make in to a image</param>
        /// <param name="txt">Text printer</param>
        private void createImage(string[] randomChars, ref Text2D txt)
        {
            for (int i = 0; i < randomChars.Length; i++)
            {
                Bitmap bmSprite = new Bitmap(18, (((int)writeFont.GetHeight() + 1) * randomChars[i].Length));
                SolidBrush mgreen = new SolidBrush(Color.FromArgb(255, 0, 204, 0));
                Graphics g = Graphics.FromImage(bmSprite);
                g.FillRectangle(Brushes.Black, 0, 0, bmSprite.Width, bmSprite.Height);

                //SizeF sizeString = g.MeasureString(randomChars[i], writeFont);

                g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
                g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
                int Y = 0;
                for (int j = 0; j < randomChars[i].Length; j++)
                {
                    g.DrawString(randomChars[i][j].ToString(), writeFont, mgreen, 2, Y);
                    Y += (int)writeFont.GetHeight() + 1;
                }

                //bmSprite.Save("Matrix"+i+".bmp", ImageFormat.Bmp);
                g.Dispose();

                System.Drawing.Imaging.BitmapData data = bmSprite.LockBits(new System.Drawing.Rectangle(0, 0, bmSprite.Width, bmSprite.Height),
                ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);

                GL.BindTexture(TextureTarget.Texture2D, matrixTexture[i]);
                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.Repeat);
                GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureWrapMode.Repeat);

                bmSprite.UnlockBits(data);
                bmSprite.Dispose();
                GL.BindTexture(TextureTarget.Texture2D, 0);
            }
        }
Ejemplo n.º 14
0
 /// <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 textTexture);
             if (textBmp != null) textBmp.Dispose();
             if (font != null) font.Dispose();
             text = null;
             listquotes.Clear();
             indexList.Clear();
         }
         // free native resources if there are any.
         System.Diagnostics.Debug.WriteLine(this.GetType().ToString() + " disposed.");
         disposed = true;
     }
 }
Ejemplo n.º 15
0
        /// <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

                    text = null;
                }
                // free native resources if there are any.
                System.Diagnostics.Debug.WriteLine(this.GetType().ToString() + " disposed.");
                disposed = true;
            }
        }