예제 #1
0
        public void InitializeDevice()
        {
            PresentParameters presentParams = new PresentParameters();

            if (usefullscreen)
            {
                presentParams.BackBufferWidth  = this.ClientSize.Width;
                presentParams.BackBufferHeight = this.ClientSize.Height;
                presentParams.BackBufferFormat = Format.R5G6B5;
                presentParams.Windowed         = false;
            }
            else
            {
                presentParams.Windowed = true;
            }
            presentParams.SwapEffect = SwapEffect.Discard;

            device              = new Device(0, DeviceType.Hardware, this, CreateFlags.SoftwareVertexProcessing, presentParams);
            UI.Device           = device;
            device.DeviceReset += new EventHandler(OnDeviceReset);

            hud           = new HUD("hud1", new Size(SCREEN_WIDTH, SCREEN_HEIGHT));
            UI.CurrentHud = hud;
            UI.CurrentHud.CanRaiseEvents = true;
            LoadAssets();
            mainMenu                       = new MainMenu(hud);
            mainMenu.ButtonPress          += new MainMenu.ButtonEventHandler(mainMenu_ButtonPress);
            newGameMenu                    = new NewGameMenu(hud);
            newGameMenu.ButtonPress       += new NewGameMenu.ButtonEventHandler(mainMenu_ButtonPress);
            newCampaignScreen              = new NewCampaignScreen(hud);
            newCampaignScreen.ButtonPress += new BaseScreen.ButtonEventHandler(mainMenu_ButtonPress);
            moduleLoadScreen               = new ModuleLoadScreen(hud);

            pbMain = new PictureBox("main_background", new Vector2(0f, 0f), new Size(1024, 768), mainBackground);

            hud.BeginDesign();
            hud.Add(pbMain);
            hud.EndDesign();

            creditsMovies          = new Movies(device, this.ClientSize.Width, this.ClientSize.Height, @"C:\Users\0100010\Documents\Visual Studio 2010\Projects\NWN2CC\NWN2CC\Assets\Credits_NX2.avi");
            creditsMovies.Stopped += new Movies.StoppedEventHandler(creditsMovies_Stopped);
        }