예제 #1
0
        public override void InitWindow()
        {
            SetParameters(nameof(MainWindow), "EnigmaGame", 798, 640, false);
            SetAntiAliasingQuality(MSAA.MSAA8x);
            SetBackground(Common.Background);
            SetPadding(1, 1, 1, 1);
            SetMinSize(GetWidth(), GetHeight());

            //icons
            var big   = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream("EnigmaGame.icon.png"));
            var small = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream("EnigmaGame.icon.png"));

            SetIcon(big, small);

            TitleBar title = new TitleBar("EnigmaGame");

            title.SetIcon(small, 20, 20);
            title.SetShadow(5, 0, 2, Color.Black);

            VerticalStack layout = new VerticalStack();

            layout.SetBackground(GetBackground());
            layout.SetPadding(30, 30, 30, 30);
            layout.SetMargin(10, title.GetHeight() + 10, 10, 10);
            layout.SetSpacing(0, 10);
            layout.SetBorder(new Border(Common.Selected, new CornerRadius(10), 4));
            layout.SetShadow(10, 0, 0, Color.Black);


            //adding
            AddItems(
                layout,
                title,
                menu
                );

            layout.AddItems(
                header,
                time_limit,
                cards_board,
                hand
                );

            //events
            EventKeyPress += OnKeyPress;

            wrong = new SoundPlayer(Assembly.GetExecutingAssembly().GetManifestResourceStream("EnigmaGame.wrong.wav"));
            key   = new SoundPlayer(Assembly.GetExecutingAssembly().GetManifestResourceStream("EnigmaGame.switch.wav"));
            next  = new SoundPlayer(Assembly.GetExecutingAssembly().GetManifestResourceStream("EnigmaGame.next.wav"));
        }