Пример #1
0
        public Settings()
        {
            Shader plainShader = new Shader.Plain(new Color8(0, 0, 0), new Color8(0, 0, 0), ' ');
            Image  plainImage  = new Image.Rectangle(plainShader, new Vector2d16(600, 300), 0);

            Shader logoShader = new Shader.TextureSymbol(ResourceLoader.LoadResource <Atlas16>(@"Textures\mainMenu.bms"), new Vector2d16(0, 6), new Vector2d16(47, 11));
            Image  logo       = new Image.Rectangle(logoShader, new Vector2d16(51, 5), 1);

            Image decoration = new Image.Rectangle(new Shader.RichText(new string[] { "|", "|", "|", "|", "|" }, new Color8(255, 255, 255)), new Vector2d16(1, 5), 200);

            Shader cursorShader = new Shader.RichText("> |", new Color8(0, 0, 255));
            Image  cursor       = new Image.Rectangle(cursorShader, new Vector2d16(3, 1), 127);

            Shape circle = new Shape.Circle(1);

            var tmp = new GameObject[]
            {
                new VisualObject(new Vector2d16(-100, -50), plainImage),

                new VisualObject(new Vector2d16(Config.screenWidth / 2 - 25, Config.screenHeight / 5), logo),
                new VisualObject(new Vector2d16(Config.screenWidth / 2 - 25, Config.screenHeight / 5 + 8), decoration),
                new VisualObject(new Vector2d16(Config.screenWidth / 2 - 24, Config.screenHeight / 5 + 8), graphics),
                new VisualObject(new Vector2d16(Config.screenWidth / 2 - 24, Config.screenHeight / 5 + 10), controls),
                new VisualObject(new Vector2d16(Config.screenWidth / 2 - 24, Config.screenHeight / 5 + 12), back)
            };

            map  = new Map("Test", Renderer.Dimensions, 0, tmp);
            hero = new KinematicObject(new Vector2d16(Config.screenWidth / 2 - 27, Config.screenHeight / 5 + 8), circle, cursor);
        }
Пример #2
0
        public Menu()
        {
            Shader plainShader = new Shader.Plain(new Color8(0, 0, 0), new Color8(0, 0, 0), ' ');
            Image  plainImage  = new Image.Rectangle(plainShader, new Vector2d16(600, 300), 0);

            Shader logoShader = new Shader.TextureSymbol(ResourceLoader.LoadResource <Atlas16>(@"Textures\mainMenu.bms"), new Vector2d16(0, 0), new Vector2d16(51, 5));
            Image  logo       = new Image.Rectangle(logoShader, new Vector2d16(51, 5), 1);

            //Image mainMenuImage = new Image.Rectangle(mainMenu, new Vector2d16(30, 15), 126);

            Image team = new Image.Rectangle(new Shader.RichText("Made by Code0", new Color8(60, 60, 60)), new Vector2d16(14, 1), 200);

            Shader cursorShader = new Shader.Plain(new Color8(0, 0, 255), Color8.GetNull(), '>');
            Image  cursor       = new Image.Rectangle(cursorShader, new Vector2d16(1, 1), 127);

            Shape circle = new Shape.Circle(1);

            var tmp = new GameObject[]
            {
                new VisualObject(new Vector2d16(-100, -50), plainImage),

                new VisualObject(new Vector2d16(Config.screenWidth / 2 - 25, Config.screenHeight / 5), logo),
                new VisualObject(new Vector2d16(Config.screenWidth / 2 - 8, Config.screenHeight / 5 + 8), newGame),
                new VisualObject(new Vector2d16(Config.screenWidth / 2 - 4, Config.screenHeight / 5 + 10), loadGame),
                new VisualObject(new Vector2d16(Config.screenWidth / 2 - 4, Config.screenHeight / 5 + 12), test),
                new VisualObject(new Vector2d16(Config.screenWidth / 2 - 5, Config.screenHeight / 5 + 14), mapEditor),
                new VisualObject(new Vector2d16(Config.screenWidth / 2 - 4, Config.screenHeight / 5 + 16), settings),
                new VisualObject(new Vector2d16(Config.screenWidth / 2 - 3, Config.screenHeight / 5 + 18), credits),
                new VisualObject(new Vector2d16(Config.screenWidth / 2 - 2, Config.screenHeight / 5 + 20), exit),
                new VisualObject(new Vector2d16(Config.screenWidth / 2 - 7, Config.screenHeight / 5 * 4), team)
            };

            map  = new Map("Test", Renderer.Dimensions, 0, tmp);
            hero = new KinematicObject(new Vector2d16(Config.screenWidth / 2 - 10, Config.screenHeight / 5 + 8), circle, cursor);
        }
Пример #3
0
        public Credits()
        {
            Shader plainShader = new Shader.Plain(new Color8(0, 0, 0), new Color8(0, 0, 0), ' ');
            Image  plainImage  = new Image.Rectangle(plainShader, new Vector2d16(600, 300), 0);

            Shader logoShader = new Shader.TextureSymbol(ResourceLoader.LoadResource <Atlas16>(@"Textures\mainMenu.bms"), new Vector2d16(0, 12), new Vector2d16(53, 16));
            Image  logo       = new Image.Rectangle(logoShader, new Vector2d16(54, 4), 1);


            Shader cursorShader = new Shader.Plain(new Color8(0, 0, 255), Color8.GetNull(), ' ');
            Image  cursor       = new Image.Rectangle(cursorShader, new Vector2d16(1, 1), 127);

            Shape circle = new Shape.Circle(1);

            var tmp = new GameObject[]
            {
                new VisualObject(new Vector2d16(-100, -50), plainImage),

                new VisualObject(new Vector2d16(Config.screenWidth / 2 - 25, Config.screenHeight / 5), logo),
                new VisualObject(new Vector2d16(Config.screenWidth / 2 - 28, Config.screenHeight / 2.5), credits)
            };

            map  = new Map("Test", Renderer.Dimensions, 0, tmp);
            hero = new KinematicObject(new Vector2d16(0, 0), circle, cursor);
        }
Пример #4
0
    public static void Main()
    {
        var circle    = new Shape.Circle(5);
        var rectangle = new Shape.Rectangle(4, 8);
        var a1        = Shape.Area(circle);
        var a2        = Shape.Area(rectangle);

        Console.WriteLine(a1);
        Console.WriteLine(a2);
    }
Пример #5
0
        public SettingsControlls()
        {
            Shader plainShader = new Shader.Plain(new Color8(0, 0, 0), new Color8(0, 0, 0), ' ');
            Image  plainImage  = new Image.Rectangle(plainShader, new Vector2d16(600, 300), 0);

            Shader logoShader = new Shader.TextureSymbol(ResourceLoader.LoadResource <Atlas16>(@"Textures\mainMenu.bms"), new Vector2d16(0, 6), new Vector2d16(47, 11));
            Image  logo       = new Image.Rectangle(logoShader, new Vector2d16(51, 5), 1);

            Image graphics = new Image.Rectangle(new Shader.RichText("Graphics", new Color8(255, 255, 255)), new Vector2d16(8, 1), 200);
            Image controls = new Image.Rectangle(new Shader.RichText("Controls", new Color8(0, 0, 255)), new Vector2d16(8, 1), 200);
            Image backOld  = new Image.Rectangle(new Shader.RichText("Back", new Color8(255, 255, 255)), new Vector2d16(4, 1), 200);

            Image oldDecoration = new Image.Rectangle(new Shader.RichText(new string[] { "|", "|", "|", "|", "|" }, new Color8(255, 255, 255)), new Vector2d16(1, 5), 200);
            Image oldCursor     = new Image.Rectangle(new Shader.RichText(new string[] { "> |" }, new Color8(0, 0, 255)), new Vector2d16(3, 1), 200);

            Image decoration  = new Image.Rectangle(new Shader.RichText(new string[] { "|", "|", "|", "|", "|", "|", "|", "•", "•", "•", "|", "|", "|" }, new Color8(255, 255, 255)), new Vector2d16(1, 14), 200);
            Image decoration2 = new Image.Rectangle(new Shader.RichText(new string[] { "|", "|", "|", "|", "|", "|", "|" }, new Color8(255, 255, 255)), new Vector2d16(1, 7), 200);

            Shader cursorShader = new Shader.RichText("> |", new Color8(0, 0, 255));
            Image  cursor       = new Image.Rectangle(cursorShader, new Vector2d16(3, 1), 127);
            Image  cursorOld    = new Image.Rectangle(cursorShader, new Vector2d16(3, 1), 201);

            Shape circle = new Shape.Circle(1);

            var tmp = new GameObject[]
            {
                new VisualObject(new Vector2d16(-100, -50), plainImage),

                new VisualObject(new Vector2d16(Config.screenWidth / 2 - 25, Config.screenHeight / 5), logo),
                new VisualObject(new Vector2d16(Config.screenWidth / 2 - 25, Config.screenHeight / 5 + 8), oldDecoration),
                new VisualObject(new Vector2d16(Config.screenWidth / 2 - 24, Config.screenHeight / 5 + 8), graphics),
                new VisualObject(new Vector2d16(Config.screenWidth / 2 - 24, Config.screenHeight / 5 + 10), controls),
                new VisualObject(new Vector2d16(Config.screenWidth / 2 - 24, Config.screenHeight / 5 + 12), backOld),
                new VisualObject(new Vector2d16(Config.screenWidth / 2 - 27, Config.screenHeight / 5 + 10), cursorOld),

                new VisualObject(new Vector2d16(Config.screenWidth / 2 - 5, Config.screenHeight / 5 + 8), decoration),
                new VisualObject(new Vector2d16(Config.screenWidth / 2 + 13, Config.screenHeight / 5 + 8), decoration2),

                new VisualObject(new Vector2d16(Config.screenWidth / 2 - 4, Config.screenHeight / 5 + 8), moveUp),
                new VisualObject(new Vector2d16(Config.screenWidth / 2 + 7, Config.screenHeight / 5 + 8), moveUpValue),

                new VisualObject(new Vector2d16(Config.screenWidth / 2 - 4, Config.screenHeight / 5 + 10), moveDown),
                new VisualObject(new Vector2d16(Config.screenWidth / 2 + 7, Config.screenHeight / 5 + 10), moveDownValue),

                new VisualObject(new Vector2d16(Config.screenWidth / 2 - 4, Config.screenHeight / 5 + 12), moveLeft),
                new VisualObject(new Vector2d16(Config.screenWidth / 2 + 7, Config.screenHeight / 5 + 12), moveLeftValue),

                new VisualObject(new Vector2d16(Config.screenWidth / 2 - 4, Config.screenHeight / 5 + 14), moveRight),
                new VisualObject(new Vector2d16(Config.screenWidth / 2 + 7, Config.screenHeight / 5 + 14), moveRightValue),

                new VisualObject(new Vector2d16(Config.screenWidth / 2 + 14, Config.screenHeight / 5 + 8), moveAltUp),
                new VisualObject(new Vector2d16(Config.screenWidth / 2 + 35, Config.screenHeight / 5 + 8), moveAltUpValue),

                new VisualObject(new Vector2d16(Config.screenWidth / 2 + 14, Config.screenHeight / 5 + 10), moveAltDown),
                new VisualObject(new Vector2d16(Config.screenWidth / 2 + 35, Config.screenHeight / 5 + 10), moveAltDownValue),

                new VisualObject(new Vector2d16(Config.screenWidth / 2 + 14, Config.screenHeight / 5 + 12), moveAltLeft),
                new VisualObject(new Vector2d16(Config.screenWidth / 2 + 35, Config.screenHeight / 5 + 12), moveAltLeftValue),

                new VisualObject(new Vector2d16(Config.screenWidth / 2 + 14, Config.screenHeight / 5 + 14), moveAltRight),
                new VisualObject(new Vector2d16(Config.screenWidth / 2 + 35, Config.screenHeight / 5 + 14), moveAltRightValue),


                new VisualObject(new Vector2d16(Config.screenWidth / 2 - 4, Config.screenHeight / 5 + 18), save),
                new VisualObject(new Vector2d16(Config.screenWidth / 2 - 4, Config.screenHeight / 5 + 20), back)
            };

            map  = new Map("Test", Renderer.Dimensions, 0, tmp);
            hero = new KinematicObject(new Vector2d16(Config.screenWidth / 2 - 7, Config.screenHeight / 5 + 8), circle, cursor);
        }
Пример #6
0
        public Game()
        {
            Image tip = new Image.Rectangle(new Shader.RichText(new string[] {
                "/cPress _space_ to stop and resume continious walking.",
                "When it's stopped, press any movement or controll buttons to walk one frame.",
                "/cPress _esc_ to leave test."
            }, new Color8(255, 255, 255)), new Vector2d16(76, 3), 126);

            hud = new IRenderable[]
            {
                new VisualObject(new Vector2d16(Config.screenWidth / 2 - 33, Config.screenHeight / 5 * 4), tip) //new Vector2d16(Config.screenWidth / 2, Config.screenHeight / 5 * 4)
            };

            Shader plainShader = new Shader.Plain(new Color8(0, 0, 0), new Color8(0, 0, 0), ' ');
            Image  plainImage  = new Image.Rectangle(plainShader, new Vector2d16(600, 300), 0);

            Shader gradientShader = new Shader.Gradient(new Color8(255, 0, 0), new Color8(255, 255, 255), new Color8(255, 0, 0), new Color8(0, 0, 255), ' ');
            Image  gradientImage  = new Image.Rectangle(gradientShader, new Vector2d16(20, 10));

            Shader characterShader     = new Shader.TextureSymbol(ResourceLoader.LoadResource <Atlas16>(@"Textures\Textures_test.txt"), new Vector2d32(0, 95), new Vector2d32(2, 97));
            Shader buildingSmallShader = new Shader.TextureSymbol(ResourceLoader.LoadResource <Atlas16>(@"Textures\Textures_test.txt"), new Vector2d32(0, 42), new Vector2d32(33, 60));
            Shader buildingBigShader   = new Shader.TextureSymbol(ResourceLoader.LoadResource <Atlas16>(@"Textures\Textures_test.txt"), new Vector2d32(0, 63), new Vector2d32(58, 81));
            Shader truckShader         = new Shader.TextureSymbol(ResourceLoader.LoadResource <Atlas16>(@"Textures\Textures_test.txt"), new Vector2d32(0, 30), new Vector2d32(15, 39));

            Image characterImage     = new Image.Rectangle(characterShader, new Vector2d16(3, 3), 128);
            Image buildingSmallImage = new Image.Rectangle(buildingSmallShader, new Vector2d16(33, 20), 127);
            Image buildingBigImage   = new Image.Rectangle(buildingBigShader, new Vector2d16(81, 20), 127);
            Image truckImage         = new Image.Rectangle(truckShader, new Vector2d16(15, 10), 127);

            //Shader earthShader = new Shader.TextureBackground(ResourceLoader.LoadResource<AtlasPNG>(@"Textures\earth.png"), new Vector2d32(0, 0), new Vector2d32(15, 15));
            //Image earthImage = new Image.Rectangle(earthShader, new Vector2d16(30, 15), 126);

            Shape circle = new Shape.Circle(1);
            Shape border = new Shape.Rectangle(new Vector2d16(31, 15));

            /*Shape carBorder = new Shape.Polygon(
             *  new Vector2d16(6,6),
             *  new Vector2d16(12,0),
             *  new Vector2d16(-4,2),
             *  //new Vector2d16(-2, 2),
             *  new Vector2d16(2,6)
             * );*/

            Shape carBorder = new Shape.Polygon(
                new Vector2d16(0, 7),
                new Vector2d16(0, 9),
                new Vector2d16(8, 9),

                new Vector2d16(6, 0),
                new Vector2d16(14, 0),
                new Vector2d16(14, 3)
                );

            PhysicalObject character = new PhysicalObject(new Vector2d16(98, 16), circle, characterImage);

            var tmp = new GameObject[]
            {
                //new VisualObject(new Vector2d16(-100, -50), plainImage),
                //new PhysicalObject(new Vector2d16(50,10), circle, gradientImage),

                new TactileObject(new Vector2d16(70, 13), border),
                new TactileObject(new Vector2d16(109, 13), border),
                new TactileObject(new Vector2d16(134, 13), border),
                //new TactileObject(new Vector2d16(50,70), border),

                new TactileObject(new Vector2d16(40, 20), carBorder),

                new VisualObject(new Vector2d16(40, 0), buildingSmallImage),
                new VisualObject(new Vector2d16(80, 0), buildingBigImage),
                new VisualObject(new Vector2d16(24, 14), truckImage),

                new PhysicalObject(new Vector2d16(98, 16), circle, characterImage)
                //new PhysicalObject(new Vector2d16(98, 16), circle, characterImage),
            };

            //Console.WriteLine(s.Value);
            events.Add(new Animation(hud[0]).
                       SetProperties((object x, object y) => { ((GameObject)x).Position = (Vector2d16)y; }).
                       AddFrame(new Vector2d16(20, 24)).
                       AddFrame(new Vector2d16(40, 24)).
                       AddFrame(new Vector2d16(40, 30)).
                       AddFrame(new Vector2d16(20, 30)).
                       AddFrame(new Vector2d16(20, 24)).
                       AddFunctions(Animation.square).
                       AddFunctions(Animation.square).
                       AddFunctions(Animation.square).
                       AddFunctions(Animation.square).
                       AddFunctions(Animation.square).
                       AddTimespan(1).
                       AddTimespan(2).
                       AddTimespan(3).
                       AddTimespan(4).
                       AddTimespan(4).
                       SetActive(true));

            events.Add(new Animation(tmp[7]).
                       SetProperties((object x, object y) => { ((GameObject)x).Position = (Vector2d16)y; }).
                       AddFrame(new Vector2d16(98, 20)).
                       AddFrame(new Vector2d16(40, 20)).
                       AddFrame(new Vector2d16(40, 20)).
                       AddFrame(new Vector2d16(98, 20)).
                       AddFrame(new Vector2d16(98, 20)).
                       AddFunctions(Animation.liniar).
                       AddFunctions(Animation.liniar).
                       AddFunctions(Animation.liniar).
                       AddFunctions(Animation.liniar).
                       AddFunctions(Animation.liniar).
                       AddTimespan(2).
                       AddTimespan(4).
                       AddTimespan(6).
                       AddTimespan(8).
                       AddTimespan(8).
                       SetActive(true));

            map  = new Map("Test", new Vector2d16(2000, 1000), 1, tmp);
            hero = new KinematicObject(new Vector2d16(Config.screenWidth / 2, Config.screenHeight / 2), circle, characterImage);
            Renderer.SetObjects(map.GetVisuals());
        }
Пример #7
0
        public LoadGame()
        {
            //Shader plainShader = new Shader.Plain(new Color8fg(0, 0, 0), new Color8bg(0, 0, 0), ' ');
            //Image plainImage = new Image.Rectangle(plainShader, new Vector2d16(600, 300), 0);
            //list.Add(new VisualObject(new Vector2d16() - Renderer.Dimensions * 0.5, plainImage));
            list.Add(null);


            Shader.TextureSymbol logo = new Shader.TextureSymbol(ResourceLoader.LoadResource <Atlas16>(@"Textures\mainMenu.bms"), new Vector2d32(0, 17), new Vector2d32(59, 20));
            list.Add(new VisualObject(new Vector2d16(Config.screenWidth / 2 - 30, Config.screenHeight / 5), new Image.Rectangle(logo, new Vector2d16(59, 4))));

            Shader cursorShaderLeft  = new Shader.Text(new string[] { "  _", " / ", " ) ", "(  ", " ) ", " \\_" });
            Shader cursorShaderRight = new Shader.Text(new string[] { "_  ", " \\ ", " ( ", "  )", " ( ", "_/ " });

            Image cursorLeft  = new Image.Rectangle(cursorShaderLeft, new Vector2d16(3, 7));
            Image cursorRight = new Image.Rectangle(cursorShaderRight, new Vector2d16(3, 7));

            list.Add(new VisualObject(new Vector2d16(Config.screenWidth / 2 + 14, Config.screenHeight / 5 + 14), cursorRight));

            Shader.TextureSymbol frame = new Shader.TextureSymbol(ResourceLoader.LoadResource <Atlas16>(@"Textures\mainMenu.bms"), new Vector2d32(53, 0), new Vector2d32(77, 5));

            DirectoryInfo info = new DirectoryInfo(ResourceLoader.root + "\\Data\\Saves");

            FileInfo[] files = info.GetFiles().OrderByDescending(p => p.LastWriteTime).ToArray();
            for (int i = 0; i < files.Length; ++i)
            {
                StringBuilder sb = new StringBuilder();

                DateTime dateTime = files[i].LastWriteTime;

                if (dateTime.Hour < 10)
                {
                    sb.Append(' ');
                }
                sb.Append(dateTime.Hour);
                sb.Append(':');
                sb.Append(dateTime.Minute);
                sb.Append(' ');
                sb.Append(dateTime.Day);
                sb.Append('.');
                sb.Append(dateTime.Month);
                sb.Append('.');
                sb.Append(dateTime.Year);

                string date = sb.ToString();

                string name = files[i].Name.Split('.')[0];

                sb = new StringBuilder();
                sb.Append(new string(' ', 11 - name.Length / 2));
                sb.Append(name);
                sb.Append(new string(' ', 11 - name.Length / 2));
                name = sb.ToString();

                list.Add(new VisualObject(new Vector2d16(Config.screenWidth / 2 - 12, Config.screenHeight / 5 + 8 + i * 6), new Image.Rectangle(frame, new Vector2d16(24, 6))));
                list.Add(new VisualObject(new Vector2d16(Config.screenWidth / 2 - 6, Config.screenHeight / 5 + 12 + i * 6), new Image.Rectangle(
                                              new Shader.Text(date), new Vector2d16(16, 1), 128)));
                list.Add(new VisualObject(new Vector2d16(Config.screenWidth / 2 - 11, Config.screenHeight / 5 + 10 + i * 6), new Image.Rectangle(
                                              new Shader.Text(name), new Vector2d16(22, 1), 128)));
            }
            Image.ScrollBarV progressBarV = new Image.ScrollBarV(19)
            {
                zIndex = 128
            };
            progressBarV.SetPreset(0);

            hud = new IRenderable[]
            {
                new VisualObject(new Vector2d16(Config.screenWidth / 2 + 22, Config.screenHeight / 2 - 4), progressBarV)
            };

            SetSelection();

            Shape circle = new Shape.Circle(1);

            map  = new Map("Test", Renderer.Dimensions, 0, list.ToArray());
            hero = new KinematicObject(new Vector2d16(Config.screenWidth / 2 - 17, Config.screenHeight / 5 + 14), circle, cursorLeft);
        }