Example #1
0
        /// <summary>
        /// Loads palettized image with color0=transparent from the specified path.
        /// </summary>
        public LargeImage LoadLargeImage0(GameEngine game, string path)
        {
            string ext = Path.GetExtension(path).ToLower();
            switch (ext)
            {
                case ".png":
                    using (Stream stream = OpenStream(path))
                        return LoadLargePNG(game.Device, stream, true);

                default: throw new Exception("Must call LoadLargeImage0 on supported filetype (png)");
            }
        }
Example #2
0
        public void Run()
        {
            //TODO - this is the source of much trouble. we need a global device, not a global game engine.
            //it may need to be refactored to be a separate xna wapper and game engine (as an optional service)
            //(this is for multiwin support)
            Game = this;

            using (AppFramework app = new AppFramework())
            {
                this.app = app;
                app.IsFixedTimeStep = false;
                InitializeBeforeRun();
                app.Run();
            }
        }
Example #3
0
 public CarotRenderState(GameEngine game)
 {
     this.game = game;
 }
Example #4
0
 public MatrixSet(GameEngine ge)
 {
     this.ge = ge;
 }
Example #5
0
        void init(int scale, Color color, bool dropDown, bool dropRight, Color dropShadowColor)
        {
            int numchars = smal_tbl.Length;
            _ge = GameEngine.Game;
            _scale = scale;
            _color = color;
            //images = new Image[numchars];
            rects = new Rectangle[numchars];

            //figure out the character layout
            int px=0, py=0;
            int ih = 7 * scale;
            if(dropDown) ih++;
            int maxw = 0;
            for(int i = 0; i < numchars; i++) {
                int cw = smal_tbl[i][0];
                int iw = cw * scale;
                if(dropRight) iw++;

                if(px + iw > 2048) {
                    py += ih;
                    px = 0;
                }

                Rectangle r = new Rectangle(px, py, iw, ih);
                rects[i] = r;
                px += iw;
                maxw = Math.Max(maxw,px);
            }

            //now generate the image
            image = _ge.NewImage(maxw, py+ih);
            Blitter b = new Blitter(image);
            b.Clear(Color.Transparent);
            for(int i = 0;i < numchars;i++) {

                Rectangle rect = rects[i];

                //draw the dropshadows
                if(dropDown) {
                    rect.Y++;
                    rect.Height--;

                    b.ApplyWindow(rect);
                    print_char(b, i, dropShadowColor);
                    b.PopWindow();

                    rect.Y--;
                }

                if(dropRight) {
                    rect.X++;
                    rect.Width--;

                    b.ApplyWindow(rect);
                    print_char(b, i, dropShadowColor);
                    b.PopWindow();

                    rect.X--;
                }

                if(dropRight && dropDown) {
                    rect.X++;
                    rect.Y++;
                    b.ApplyWindow(rect);
                    print_char(b, i, dropShadowColor);
                    b.PopWindow();
                    rect.X--;
                    rect.Y--;
                }

                //draw the main character:
                b.ApplyWindow(rect);
                print_char(b, i, color);
                b.PopWindow();

            }
            image.Cache();
        }