예제 #1
0
        private static void startUp()
        {
            frameCount = 0;
            TCM_Graphics.Initialize("Game", 1920, 1080, new Color(0, 0, 0, 1));
            TCM_Audio.Initialize();
            rooms = new List <Room>();
            rooms.Add(new Room(2, 1, true));
            currentRoom = rooms[0];
            currentRoom.initialize();

            pause = new Frame();



            //working on it, does scrolly text, needs to be able to reset
            //ProgressingTextVisual pauseText = new ProgressingTextVisual("PAUSED - back to quit\ntesting how much text i can fit in this box"
            //    + "\napparently that wasn't enough, so i'll just keep adding until something weird starts happening", new Color(1, 1, 1, 1));
            //pauseText.setBoundingBox(490, 280, 940, 520);
            //pauseText.setFormat("Consolas", 32);

            //List<ProgressingTextVisual> scrolly = new List<ProgressingTextVisual>();
            //scrolly.Add(pauseText);

            TextVisual pauseText = new TextVisual("PAUSED - back to quit\ntesting how much text i can fit in this box"
                                                  + "\napparently that wasn't enough, so i'll just keep adding until something weird starts happening", new Color(1, 1, 1, 1));

            pauseText.setBoundingBox(490, 280, 940, 520);
            pauseText.setFormat(pauseText.format.FontFamilyName, 32);
            pauseText.setFormat("Consolas", 32);

            BitmapVisual pauseBitmap = new BitmapVisual(TCM_Graphics.loadPNG("blank"), 480, 270, 960, 540);

            pauseBitmap.setTransparency(.5f);
            pause.addVisual(pauseBitmap);
            pause.addVisual(pauseText);
            if (new Controller() != null)
            {
                control            = new TCM_Controller(new Controller(UserIndex.One));
                control.LSDeadZone = .18;
                control.RSDeadZone = .18;
                control.axialLeft  = false;
                control.axialRight = false;
            }
            else
            {
            }
        }
예제 #2
0
 public void addBitmap(BitmapVisual bv)
 {
     addGameRectangle(bv);
 }
예제 #3
0
 public static void drawBitmapVisual(BitmapVisual bv)
 {
     rt.DrawBitmap(bv.bitmap, bv.boundingBox, bv.opacity, BitmapInterpolationMode.NearestNeighbor);
 }
예제 #4
0
        public void initialize()
        {
            farBackground = new Frame();

            midground       = new Frame();
            closeBackground = new Frame();
            platformLayer   = new Frame();
            actorLayer      = new Frame();
            playerLayer     = new Frame();
            closeForeground = new Frame();

            farForeground = new Frame();

            addChild(farBackground, true);

            addChild(midground, false);
            midground.addChild(closeBackground, true);
            midground.addChild(platformLayer, false);
            midground.addChild(actorLayer, false);
            midground.addChild(playerLayer, false);
            midground.addChild(closeForeground, false);
            playerLayer.addChild(player, false);
            actorLayer.addChild(new Enemy(), false);

            addChild(farForeground, false);

            BitmapVisual backgroundBitmap = new BitmapVisual(TCM_Graphics.loadPNG("wall1"));

            backgroundBitmap.opacity = .5f;
            backgroundBitmap.setBoundingBox(0, 0, 1920 + (width - 1) * 16 * 60, 1080 + (height - 1) * 9 * 60);
            farBackground.addVisual(backgroundBitmap);
            int squaresWide = 16 * width + 1;
            int squaresTall = 9 * height + 1;

            string wallImage = "wall1";

            if (enclosed)
            {
                //makes the 4 walls
                Platform topPlatform = new Platform();
                topPlatform.applyTransform(TCM_Matrix3x2.translate(-60, -60));
                topPlatform.setMainBox(120 + 1920 * width, 120, Anchor.topLeft);
                platforms.Add(topPlatform);

                Platform bottomPlatform = new Platform();
                bottomPlatform.applyTransform(TCM_Matrix3x2.translate(-60, -60 + 120 * (squaresTall - 1)));
                bottomPlatform.setMainBox(120 + 1920 * width, 120, Anchor.topLeft);
                platforms.Add(bottomPlatform);
                for (int i = 0; i < squaresWide; i++)
                {
                    topPlatform.addVisual(new BitmapVisual(TCM_Graphics.loadPNG(wallImage)));
                    topPlatform.visuals[i].boundingBox = new SharpDX.Mathematics.Interop.RawRectangleF(i * 120, 0, 120 * (i + 1), 120);


                    bottomPlatform.addVisual(new BitmapVisual(TCM_Graphics.loadPNG(wallImage)));
                    bottomPlatform.visuals[i].boundingBox = new SharpDX.Mathematics.Interop.RawRectangleF(i * 120, 0, 120 * (i + 1), 120);
                }

                Platform leftPlatform = new Platform();
                leftPlatform.applyTransform(TCM_Matrix3x2.translate(-60, 60));
                leftPlatform.setMainBox(120, 120 + height * 1080, Anchor.topLeft);
                platforms.Add(leftPlatform);

                Platform rightPlatform = new Platform();
                rightPlatform.applyTransform(TCM_Matrix3x2.translate(-60 + 120 * (squaresWide - 1), 60));
                rightPlatform.setMainBox(120, 120 + height * 1080, Anchor.topLeft);
                platforms.Add(rightPlatform);
                for (int i = 0; i < squaresTall - 2; i++)
                {
                    leftPlatform.addVisual(new BitmapVisual(TCM_Graphics.loadPNG(wallImage)));
                    leftPlatform.visuals[i].boundingBox = new SharpDX.Mathematics.Interop.RawRectangleF(0, 120 * i, 120, 120 * (i + 1));

                    rightPlatform.addVisual(new BitmapVisual(TCM_Graphics.loadPNG(wallImage)));
                    rightPlatform.visuals[i].boundingBox = new SharpDX.Mathematics.Interop.RawRectangleF(0, 120 * i, 120, 120 * (i + 1));
                }
            }
            else
            {
                for (int i = 0; i < squaresWide; i++)
                {
                    Frame bottomPlatform = new Frame();
                    bottomPlatform.applyTransform(TCM_Matrix3x2.translate(-60 + 120 * i, -60 + 120 * (squaresTall - 1)));
                    bottomPlatform.addVisual(new BitmapVisual(TCM_Graphics.loadPNG(wallImage)));
                    bottomPlatform.visuals[0].boundingBox = new SharpDX.Mathematics.Interop.RawRectangleF(0, 0, 120, 120);
                    platformLayer.addChild(bottomPlatform, false);
                }
            }


            //makes the floating platform
            Platform middlePlatform = new Platform(false, false, true, false);

            middlePlatform.applyTransform(TCM_Matrix3x2.translate(360, 540));
            middlePlatform.setMainBox(120, 15, Anchor.topLeft);
            middlePlatform.addVisual(new BitmapVisual(TCM_Graphics.loadPNG(wallImage)));
            middlePlatform.visuals[0].boundingBox = new SharpDX.Mathematics.Interop.RawRectangleF(0, 0, 120, 15);
            platforms.Add(middlePlatform);

            //puts the platforms into a layer
            foreach (Platform p in platforms)
            {
                platformLayer.addChild(p, false);
            }
        }