Example #1
0
        /// <summary>
        /// Application constructor. Sets attributes for the app.
        /// </summary>
        public MyGraphicsSample()
        {
            // Set the window text
            this.Text = "VertexBlend: Surface Skinning Example";
            try
            {
                // Load the icon from our resources
                System.Resources.ResourceManager resources = new System.Resources.ResourceManager(this.GetType());
                this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            }
            catch
            {
                // It's no big deal if we can't load our icons, but try to load the embedded one
                try { this.Icon = new System.Drawing.Icon(this.GetType(), "directx.ico"); }
                catch {}
            }

            drawingFont = new GraphicsFont("Arial", System.Drawing.FontStyle.Bold);
            enumerationSettings.AppUsesDepthBuffer = true;

            // Add our new menu options
            this.mnuOptions = new System.Windows.Forms.MenuItem();
            this.mnuUseVS   = new System.Windows.Forms.MenuItem();
            // Add the Options menu to the main menu
            this.mnuMain.MenuItems.Add(this.mnuOptions);
            this.mnuOptions.Index = 1;
            this.mnuOptions.Text  = "&Options";

            this.mnuOptions.MenuItems.Add(this.mnuUseVS);
            this.mnuUseVS.Text         = "Use custom &vertex shader";
            this.mnuUseVS.Shortcut     = System.Windows.Forms.Shortcut.CtrlV;
            this.mnuUseVS.ShowShortcut = true;
            this.mnuUseVS.Click       += new System.EventHandler(this.UseCustomShaderClick);
        }
    public GameClass(bool startFullScreen, Size size, bool enableNetwork)
    {
        this.startFullscreen = startFullScreen;
        this.Size = size;
        this.networkEnabled = enableNetwork;
        this.Text = "SpaceWar3D-Step12";
        statusMessageTimer = Constants.StatusMessageDisplayTime;

        drawingFont = new GraphicsFont( "Verdana", System.Drawing.FontStyle.Regular);

        input = new InputClass(this);
        mouseInput = new MouseInput(this);
        this.MouseMove +=new MouseEventHandler(GameClass_MouseMove);
        this.Cursor = Cursors.NoMove2D;

        camera = new Camera();
        soundHandler = new SoundHandler(this);

        if (networkEnabled) {
            peer = new PlayClass(this);
            if (peer.IsHost) {
                hullColor = HullColors.Red;
            }
        }
    }
Example #3
0
        /// <summary>
        /// Application constructor. Sets attributes for the app.
        /// </summary>
        public MyGraphicsSample()
        {
            // Set the window text
            this.Text = "Vertex Shader";
            try
            {
                // Load the icon from our resources
                System.Resources.ResourceManager resources = new System.Resources.ResourceManager(this.GetType());
                this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            }
            catch
            {
                // It's no big deal if we can't load our icons, but try to load the embedded one
                try { this.Icon = new System.Drawing.Icon(this.GetType(), "directx.ico"); }
                catch {}
            }

            drawingFont      = new GraphicsFont("Arial", System.Drawing.FontStyle.Bold);
            drawingFontSmall = new GraphicsFont("Arial", System.Drawing.FontStyle.Bold, 9);
            enumerationSettings.AppUsesDepthBuffer = true;

            m_Size         = 32;
            numberIndices  = (m_Size - 1) * (m_Size - 1) * 6;
            numberVertices = m_Size * m_Size;
            ourShader      = null;

            speed        = 5.0f;
            angularSpeed = 1.0f;
            doShowHelp   = false;

            this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.OnPrivateKeyDown);
            this.KeyUp   += new System.Windows.Forms.KeyEventHandler(this.OnPrivateKeyUp);
        }
    public GameClass(bool startFullScreen, Size size, bool enableNetwork)
    {
        this.startFullscreen = startFullScreen;
        this.Size            = size;
        this.networkEnabled  = enableNetwork;
        this.Text            = "SpaceWar3D-Step11";
        statusMessageTimer   = Constants.StatusMessageDisplayTime;

        drawingFont = new GraphicsFont("Verdana", System.Drawing.FontStyle.Regular);

        input           = new InputClass(this);
        mouseInput      = new MouseInput(this);
        this.MouseMove += new MouseEventHandler(GameClass_MouseMove);
        this.Cursor     = Cursors.NoMove2D;

        camera       = new Camera();
        soundHandler = new SoundHandler(this);

        if (networkEnabled)
        {
            peer = new PlayClass(this);
            if (peer.IsHost)
            {
                hullColor = HullColors.Red;
            }
        }
    }
Example #5
0
        /// <summary>
        /// Application constructor. Sets attributes for the app.
        /// </summary>
        public MyGraphicsSample()
        {
            this.Text = "CubeMap: Environment cube-mapping";
            try
            {
                // Load the icon from our resources
                System.Resources.ResourceManager resources = new System.Resources.ResourceManager(this.GetType());
                this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            }
            catch
            {
                // It's no big deal if we can't load our icons, but try to load the embedded one
                try { this.Icon = new System.Drawing.Icon(this.GetType(), "directx.ico"); }
                catch {}
            }

            enumerationSettings.AppUsesDepthBuffer = true;

            drawingFont     = new GraphicsFont("Arial", FontStyle.Bold);
            shinyTeapotMesh = new GraphicsMesh();
            skyBoxMesh      = new GraphicsMesh();
            airplaneMesh    = new GraphicsMesh();

            worldMatrix = Matrix.Identity;

            trackBallMatrix = Matrix.Identity;
            viewMatrix      = Matrix.Translation(0.0f, 0.0f, 3.0f);
        }
Example #6
0
        /// <summary>
        /// Application constructor. Sets attributes for the app.
        /// </summary>
        public MyGraphicsSample()
        {
            this.Text = "SphereMap: Environment Mapping Technique";
            try
            {
                // Load the icon from our resources
                System.Resources.ResourceManager resources = new System.Resources.ResourceManager(this.GetType());
                this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            }
            catch
            {
                // It's no big deal if we can't load our icons, but try to load the embedded one
                try { this.Icon = new System.Drawing.Icon(this.GetType(), "directx.ico"); }
                catch {}
            }
            enumerationSettings.AppUsesDepthBuffer = true;

            font        = new GraphicsFont("Arial", FontStyle.Bold);
            shinyTeapot = new GraphicsMesh();
            skyBox      = new GraphicsMesh();

            matWorld = Matrix.Identity;

            matTrackBall = Matrix.Identity;
            matView      = Matrix.Translation(0.0f, 0.0f, 3.0f);
        }
Example #7
0
 public GraphicsClass()
 {
     this.Text   = "Step1";
     play        = new PlayClass(this);
     input       = new InputClass(this, play);
     drawingFont = new GraphicsFont("Arial", System.Drawing.FontStyle.Bold);
 }
Example #8
0
        private System.Windows.Forms.MenuItem mnuPick      = null;            // Pick object to draw



        /// <summary>
        /// Application constructor. Sets attributes for the app.
        /// </summary>
        public MyGraphicsSample()
        {
            // Set the window text
            this.Text = "StencilDepth: Displaying Depth Complexity";
            try
            {
                // Load the icon from our resources
                System.Resources.ResourceManager resources = new System.Resources.ResourceManager(this.GetType());
                this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            }
            catch
            {
                // It's no big deal if we can't load our icons, but try to load the embedded one
                try { this.Icon = new System.Drawing.Icon(this.GetType(), "directx.ico"); }
                catch {}
            }

            font = new GraphicsFont("Arial", System.Drawing.FontStyle.Bold);
            enumerationSettings.AppUsesDepthBuffer = true;
            MinDepthBits   = 16;
            MinStencilBits = 4;

            mnuShowDepth          = new MenuItem("Show &Depth Complexity");
            mnuShowDepth.Shortcut = Shortcut.CtrlD;
            mnuShowDepth.Checked  = showDepthComplexity;
            mnuShowDepth.Click   += new System.EventHandler(this.DepthClicked);

            mnuPick          = new MenuItem();
            mnuPick.Text     = drawHelicopter ? "&Show Airplane" : "&Show Helicopter";
            mnuPick.Shortcut = Shortcut.CtrlS;
            mnuPick.Click   += new System.EventHandler(this.PickClicked);

            mnuOptions = new MenuItem("&Options", new MenuItem[] { mnuShowDepth, mnuPick });
            mnuMain.MenuItems.Add(mnuOptions);
        }
Example #9
0
        /// <summary>
        /// Application constructor. Sets attributes for the app.
        /// </summary>
        public MyGraphicsSample()
        {
            // Set the window text
            this.Text = "Emboss: BumpMapping Technique";
            try
            {
                // Load the icon from our resources
                System.Resources.ResourceManager resources = new System.Resources.ResourceManager(this.GetType());
                this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            }
            catch
            {
                // It's no big deal if we can't load our icons
            }

            drawingFont = new GraphicsFont("Arial", System.Drawing.FontStyle.Bold);
            enumerationSettings.AppUsesDepthBuffer = true;


            // Add our new menu options
            mnuOptions = new System.Windows.Forms.MenuItem("&Options");
            mnuEmboss  = new System.Windows.Forms.MenuItem("Toggle &emboss mode");
            // Add to the main menu screen
            mnuMain.MenuItems.Add(this.mnuOptions);
            mnuOptions.MenuItems.Add(mnuEmboss);
            mnuEmboss.Shortcut     = System.Windows.Forms.Shortcut.CtrlE;
            mnuEmboss.ShowShortcut = true;
            mnuEmboss.Click       += new System.EventHandler(this.EmbossModeChanged);
        }
Example #10
0
 public GraphicsClass()
 {
     this.Text   = "Direct3DTest";
     audio       = new AudioClass(this);
     play        = new PlayClass(this);
     input       = new InputClass(this, audio, play);
     drawingFont = new GraphicsFont("Arial", System.Drawing.FontStyle.Bold);
 }
Example #11
0
        /// <summary>
        /// Application constructor. Sets attributes for the app.
        /// </summary>
        public CGameApplication()
        {
            // Initialize the Game state for the Developer Splash Screen
            m_State = GameState.DevSplash;

            // create a copy of the game engine
            m_pFont  = new GraphicsFont("Aerial", System.Drawing.FontStyle.Bold);
            windowed = false;

            m_opponents = new ArrayList();
        }
Example #12
0
        bool initDone = false;                    // hold off on any reaction to messages until fully inited



        /// <summary>
        /// Application constructor. Sets attributes for the app.
        /// </summary>
        public MyGraphicsSample()
        {
            // Set the window text
            this.Text = "ProgressiveMesh: Using Progressive Meshes in D3D";
            try
            {
                // Load the icon from our resources
                System.Resources.ResourceManager resources = new System.Resources.ResourceManager(this.GetType());
                this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            }
            catch
            {
                // It's no big deal if we can't load our icons, but try to load the embedded one
                try { this.Icon = new System.Drawing.Icon(this.GetType(), "directx.ico"); }
                catch {}
            }

            arcBall          = new GraphicsArcBall(this);
            initialDirectory = DXUtil.SdkMediaPath;
            font             = new GraphicsFont("Arial", System.Drawing.FontStyle.Bold);
            enumerationSettings.AppUsesDepthBuffer = true;

            // Add our new menu options
            this.mnuOptions   = new MenuItem();
            this.mnuOptimize  = new MenuItem();
            this.mnuOpenMesh  = new MenuItem();
            this.mnuMeshBreak = new MenuItem();

            // Add the Options menu to the main menu
            this.mnuMain.MenuItems.Add(this.mnuOptions);
            this.mnuOptions.Index = 1;
            this.mnuOptions.Text  = "&Options";

            // Add the optimize menu to the options menu
            this.mnuOptions.MenuItems.Add(this.mnuOptimize);
            this.mnuOptimize.Text   = "Show Optimized PMeshes 'o'";
            this.mnuOptimize.Click += new System.EventHandler(this.OptimizeClick);

            // Add the 'Open Mesh' dialog to the file menu.
            this.mnuFile.MenuItems.Add(0, mnuMeshBreak);
            this.mnuFile.MenuItems.Add(0, mnuOpenMesh);
            this.mnuMeshBreak.Text        = "-";
            this.mnuOpenMesh.Text         = "Open File...";
            this.mnuOpenMesh.Shortcut     = System.Windows.Forms.Shortcut.CtrlO;
            this.mnuOpenMesh.ShowShortcut = true;
            this.mnuOpenMesh.Click       += new System.EventHandler(this.OpenMesh);

            mnuOptimize.Checked = showOptimized;

            // Set up our event handlers
            this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.OnPrivateKeyDown);
            this.KeyUp   += new System.Windows.Forms.KeyEventHandler(this.OnPrivateKeyUp);
        }
Example #13
0
        /// <summary>
        /// constructor uses the font to print text with as well as the background image
        /// </summary>
        public Console(GraphicsFont pFont, string sFilename)
        {
            m_pFont = pFont;
            m_Image = new Image(sFilename);

            Reset();

            AddCommand("SET", "Set a paramter to a value", new CommandFunction(Set));
            AddCommand("HELP", "Display command and Parameter help", new CommandFunction(Help));
            AddParameter("CONSOLESIZE", "The percentage of the screen covered by the console from 1.0 to 100.0",
                         new CommandFunction(SetScreenSize));
        }
Example #14
0
        /// <summary>
        /// constructor uses the font to print text with as well as the background image
        /// </summary>
        public Console(GraphicsFont pFont, string sFilename)
        {
            m_pFont = pFont;
            m_Image = new Image(sFilename);
            engine  = Engine.Instance;

            Reset();

            AddCommand("SET", "Set a paramter to a value", new CommandFunction(Set));
            AddCommand("HELP", "Display command and Parameter help", new CommandFunction(Help));
            AddParameter("CONSOLESIZE", "The percentage of the screen covered by the console from 1.0 to 100.0", new CommandFunction(SetScreenSize));
            AddCommand("SYSTEM", "Display graphic device setup", new CommandFunction(ShowSystem));

            AddCommand("QUIT", "Exit the show", new CommandFunction(ApplicationExit));
        }
    public GameClass(bool startFullScreen, Size size, bool enableNetwork)
    {
        this.startFullscreen = startFullScreen;
        this.Size = size;
        this.networkEnabled = enableNetwork;
        this.Text = "SpaceWar3D-Step02";

        drawingFont = new GraphicsFont( "Verdana", System.Drawing.FontStyle.Regular);

        input = new InputClass(this, play);

        if (networkEnabled) {
            peer = new PlayClass(this);
        }
    }
Example #16
0
    public GameClass(bool startFullScreen, Size size, bool enableNetwork)
    {
        this.startFullscreen = startFullScreen;
        this.Size            = size;
        this.networkEnabled  = enableNetwork;
        this.Text            = "SpaceWar3D-Step02";

        drawingFont = new GraphicsFont("Verdana", System.Drawing.FontStyle.Regular);

        input = new InputClass(this, play);

        if (networkEnabled)
        {
            peer = new PlayClass(this);
        }
    }
Example #17
0
        /// <summary>
        /// Application constructor. Sets attributes for the app.
        /// </summary>
        public MyGraphicsSample()
        {
            // Add our new menu options
            this.mnuOpenMesh  = new MenuItem();
            this.mnuMeshBreak = new MenuItem();

            // Add the Open File menu to the file menu
            this.mnuFile.MenuItems.Add(0, this.mnuMeshBreak);
            this.mnuMeshBreak.Text = "-";
            this.mnuFile.MenuItems.Add(0, this.mnuOpenMesh);
            this.mnuOpenMesh.Text         = "Open File...";
            this.mnuOpenMesh.Shortcut     = System.Windows.Forms.Shortcut.CtrlO;
            this.mnuOpenMesh.ShowShortcut = true;
            this.mnuOpenMesh.Click       += new System.EventHandler(this.OpenMesh);

            InitializeComponent();
            this.RenderTarget = target;

            // Set the window text
            this.Text = "Allegiance MDL Viewer";
            try
            {
                // Load the icon from our resources
                System.Resources.ResourceManager resources = new System.Resources.ResourceManager(this.GetType());
                this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            }
            catch
            {
                // It's no big deal if we can't load our icons, but try to load the embedded one
                try { this.Icon = new System.Drawing.Icon(this.GetType(), "directx.ico"); }
                catch {}
            }

            arcBall             = new GraphicsArcBall(this.target);
            initialDirectory    = DXUtil.SdkMediaPath;
            driveListBox1.Drive = System.IO.Path.GetPathRoot(initialDirectory);
            dirListBox1.Path    = initialDirectory;
            fileListBox1.Path   = initialDirectory;

            drawingFont = new GraphicsFont("Arial", System.Drawing.FontStyle.Bold);
            enumerationSettings.AppUsesDepthBuffer = true;
            numberSegments = 2;

            // Set up our event handlers
            //this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.OnPrivateKeyDown);
        }
Example #18
0
        /// <summary>
        /// Application constructor. Sets attributes for the app.
        /// </summary>
        public MyGraphicsSample()
        {
            // Set the window text
            this.Text = "BumpUnderWater: Effect Using BumpMapping";
            try
            {
                // Load the icon from our resources
                System.Resources.ResourceManager resources = new System.Resources.ResourceManager(this.GetType());
                this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            }
            catch
            {
                // It's no big deal if we can't load our icons
            }

            font = new GraphicsFont("Arial", System.Drawing.FontStyle.Bold);
            enumerationSettings.AppUsesDepthBuffer = true;
        }
Example #19
0
        /// <summary>
        /// Application constructor. Sets attributes for the app.
        /// </summary>
        public MyGraphicsSample()
        {
            // Set the window text
            this.Text = "DotProduct3: BumpMapping Technique";
            try
            {
                // Load the icon from our resources
                System.Resources.ResourceManager resources = new System.Resources.ResourceManager(this.GetType());
                this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            }
            catch
            {
                // It's no big deal if we can't load our icons, but try to load the embedded one
                try { this.Icon = new System.Drawing.Icon(this.GetType(), "directx.ico"); }
                catch {}
            }

            drawingFont = new GraphicsFont("Arial", System.Drawing.FontStyle.Bold);
            enumerationSettings.AppUsesDepthBuffer = false;

            // Add the options menu to the main menu
            mnuOptions = new MenuItem("&Options");
            this.mnuMain.MenuItems.Add(mnuOptions);

            // Now create the rest of the menu items
            mnuFileTexture              = new MenuItem("Use file-based texture");
            mnuFileTexture.Shortcut     = Shortcut.CtrlF;
            mnuFileTexture.ShowShortcut = true;
            mnuFileTexture.Click       += new System.EventHandler(this.FileTextureClicked);

            mnuCustomTexture              = new MenuItem("Use custom texture");
            mnuCustomTexture.Shortcut     = Shortcut.CtrlC;
            mnuCustomTexture.ShowShortcut = true;
            mnuCustomTexture.Click       += new System.EventHandler(this.CustomTextureClicked);

            mnuBreak                   = new MenuItem("-");
            mnuShowNormal              = new MenuItem("Show normal map");
            mnuShowNormal.Shortcut     = Shortcut.CtrlN;
            mnuShowNormal.ShowShortcut = true;
            mnuShowNormal.Click       += new System.EventHandler(this.ShowNormalClicked);

            // Now add the new items to the option menu
            mnuOptions.MenuItems.AddRange(new MenuItem[] { mnuFileTexture, mnuCustomTexture, mnuBreak, mnuShowNormal });
        }
    public GameClass(bool startFullScreen, Size size, bool enableNetwork)
    {
        this.startFullscreen = startFullScreen;
        this.Size = size;
        this.networkEnabled = enableNetwork;
        this.Text = "SpaceWar3D-Step06";

        drawingFont = new GraphicsFont( "Verdana", System.Drawing.FontStyle.Regular);

        input = new InputClass(this);
        mouseInput = new MouseInput(this);
        this.MouseMove +=new MouseEventHandler(GameClass_MouseMove);
        camera = new Camera();
        soundHandler = new SoundHandler(this);

        if (networkEnabled) {
            peer = new PlayClass(this);
        }
    }
Example #21
0
        /// <summary>
        /// Application constructor. Sets attributes for the app.
        /// </summary>
        public MyGraphicsSample()
        {
            // Set the window text
            this.Text = "PointSprites: Using particle effects";
            try
            {
                // Load the icon from our resources
                System.Resources.ResourceManager resources = new System.Resources.ResourceManager(this.GetType());
                this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            }
            catch
            {
                // It's no big deal if we can't load our icons, but try to load the embedded one
                try { this.Icon = new System.Drawing.Icon(this.GetType(), "directx.ico"); }
                catch {}
            }

            drawingFont      = new GraphicsFont("Arial", System.Drawing.FontStyle.Bold);
            drawingFontSmall = new GraphicsFont("Arial", System.Drawing.FontStyle.Bold, 9);
            enumerationSettings.AppUsesDepthBuffer = true;

            particleSystem        = new ParticleSystem(512, 2048, 0.03f);
            numberParticlesToEmit = 10;
            animateEmitter        = false;

            numGroundVertices = (GroundGridSize + 1) * (GroundGridSize + 1);
            numGroundIndices  = (GroundGridSize * GroundGridSize) * 6;
            planeGround       = new Plane(0.0f, 1.0f, 0.0f, 0.0f);

            position          = new Vector3(0.0f, 3.0f, -4.0f);
            velocity          = new Vector3(0.0f, 0.0f, 0.0f);
            yaw               = 0.03f;
            yawVelocity       = 0.0f;
            pitch             = 0.5f;
            pitchVelocity     = 0.0f;
            viewMatrix        = Matrix.Translation(0.0f, 0.0f, 10.0f);
            orientationMatrix = Matrix.Translation(0.0f, 0.0f, 0.0f);

            // Set up our event handlers
            this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.OnPrivateKeyDown);
            this.KeyUp   += new System.Windows.Forms.KeyEventHandler(this.OnPrivateKeyUp);
        }
Example #22
0
        /// <summary>
        /// Application constructor. Sets attributes for the app.
        /// </summary>
        public MyGraphicsSample()
        {
            this.Text = "FishEye: Environment mapping";
            try
            {
                // Load the icon from our resources
                System.Resources.ResourceManager resources = new System.Resources.ResourceManager(this.GetType());
                this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            }
            catch
            {
                // It's no big deal if we can't load our icons, but try to load the embedded one
                try { this.Icon = new System.Drawing.Icon(this.GetType(), "directx.ico"); }
                catch {}
            }
            enumerationSettings.AppUsesDepthBuffer = true;

            drawingFont = new GraphicsFont("Arial", FontStyle.Bold);
            skyBox      = new GraphicsMesh();
        }
Example #23
0
        /// <summary>
        /// Application constructor. Sets attributes for the app.
        /// </summary>
        public MyGraphicsSample()
        {
            // Set the window text
            this.Text = "DolphinVS: Tweening Vertex Shader";
            try
            {
                // Load the icon from our resources
                System.Resources.ResourceManager resources = new System.Resources.ResourceManager(this.GetType());
                this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            }
            catch
            {
                // It's no big deal if we can't load our icons, but try to load the embedded one
                try { this.Icon = new System.Drawing.Icon(this.GetType(), "directx.ico"); }
                catch {}
            }

            drawingFont = new GraphicsFont("Arial", System.Drawing.FontStyle.Bold);
            enumerationSettings.AppUsesDepthBuffer = true;
        }
Example #24
0
        /// <summary>
        /// Application constructor. Sets attributes for the app.
        /// </summary>
        public MyGraphicsSample()
        {
            // Set the window text
            this.Text = "BumpLens: Lens Effect Using BumpMapping";
            try
            {
                // Load the icon from our resources
                System.Resources.ResourceManager resources = new System.Resources.ResourceManager(this.GetType());
                this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            }
            catch
            {
                // It's no big deal if we can't load our icons, but try to load the embedded one
                try { this.Icon = new System.Drawing.Icon(this.GetType(), "directx.ico"); }
                catch {}
            }

            font = new GraphicsFont("Arial", System.Drawing.FontStyle.Bold);
            enumerationSettings.AppUsesDepthBuffer = false;
        }
Example #25
0
    public GameClass(bool startFullScreen, Size size, bool enableNetwork)
    {
        this.startFullscreen = startFullScreen;
        this.Size            = size;
        this.networkEnabled  = enableNetwork;
        this.Text            = "SpaceWar3D";

        drawingFont = new GraphicsFont("Verdana", System.Drawing.FontStyle.Regular);

        input           = new InputClass(this);
        mouseInput      = new MouseInput(this);
        this.MouseMove += new MouseEventHandler(GameClass_MouseMove);
        camera          = new Camera();
        soundHandler    = new SoundHandler(this);

        if (networkEnabled)
        {
            peer = new PlayClass(this);
        }
    }
Example #26
0
        /// <summary>
        /// Application constructor. Sets attributes for the app.
        /// </summary>
        public MyGraphicsSample()
        {
            // Set the window text
            this.Text = "Fractal";
            try
            {
                // Load the icon from our resources
                System.Resources.ResourceManager resources = new System.Resources.ResourceManager(this.GetType());
                this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            }
            catch
            {
                // It's no big deal if we can't load our icons, but try to load the embedded one
                try { this.Icon = new System.Drawing.Icon(this.GetType(), "directx.ico"); }
                catch {}
            }

            drawingFont = new GraphicsFont("Arial", System.Drawing.FontStyle.Bold);
            enumerationSettings.AppUsesDepthBuffer = true;
            this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.OnPrivateKeyUp);
        }
Example #27
0
        /// <summary>
        /// Application constructor. Sets attributes for the app.
        /// </summary>
        public MyGraphicsSample()
        {
            // Set the window text
            this.Text = "ClipMirror: Using D3D Clip Planes";
            try
            {
                // Load the icon from our resources
                System.Resources.ResourceManager resources = new System.Resources.ResourceManager(this.GetType());
                this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            }
            catch
            {
                // It's no big deal if we can't load our icons, but try to load the embedded one
                try { this.Icon = new System.Drawing.Icon(this.GetType(), "directx.ico"); }
                catch {}
            }

            this.ClientSize = new System.Drawing.Size(400, 300);

            drawingFont = new GraphicsFont("Arial", System.Drawing.FontStyle.Bold);
            enumerationSettings.AppUsesDepthBuffer = true;
        }
Example #28
0
        /// <summary>
        /// Application constructor. Sets attributes for the app.
        /// </summary>
        public MyGraphicsSample()
        {
            // Set the window text
            this.Text = "ShadowVolume: RealTime Shadows Using The StencilBuffer";
            try
            {
                // Load the icon from our resources
                System.Resources.ResourceManager resources = new System.Resources.ResourceManager(this.GetType());
                this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            }
            catch
            {
                // It's no big deal if we can't load our icons, but try to load the embedded one
                try { this.Icon = new System.Drawing.Icon(this.GetType(), "directx.ico"); }
                catch {}
            }

            arcBall = new GraphicsArcBall(this);
            font    = new GraphicsFont("Arial", System.Drawing.FontStyle.Bold);
            enumerationSettings.AppUsesDepthBuffer = true;
            MinDepthBits   = 16;
            MinStencilBits = 4;
        }
Example #29
0
        Matrix helicopterMatrix     = Matrix.Identity;              // Matrix to animate X file object



        /// <summary>
        /// Application constructor. Sets attributes for the app.
        /// </summary>
        public MyGraphicsSample()
        {
            // Set the window text
            this.Text = "StencilMirror: Doing Reflections with Stencils";
            try
            {
                // Load the icon from our resources
                System.Resources.ResourceManager resources = new System.Resources.ResourceManager(this.GetType());
                this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            }
            catch
            {
                // It's no big deal if we can't load our icons, but try to load the embedded one
                try { this.Icon = new System.Drawing.Icon(this.GetType(), "directx.ico"); }
                catch {}
            }

            drawingFont = new GraphicsFont("Arial", System.Drawing.FontStyle.Bold);
            enumerationSettings.AppUsesDepthBuffer = true;
            MinDepthBits   = 16;
            MinStencilBits = 4;
            terrainMesh    = new GraphicsMesh();
            helicopterMesh = new GraphicsMesh();
        }
Example #30
0
        /// <summary>
        /// Event Handler to handle a request by a surface to rendered by the device
        /// </summary>
        /// <param name="sender">The object that made the request</param>
        /// <param name="e">The arguments for the event</param>
        public void OnRenderSingleView(Object sender, RenderSingleViewEventArgs e)
        {
            // if the device has been lost, check it's state
            if( base.Device != null && this.isDeviceLost)
            {
                try
                {
                    // test co-operation level to make sure it is ok to render
                    base.Device.TestCooperativeLevel();
                }
                catch (DeviceLostException)
                {
                    // don't do anything if the device has been lost
                    return;
                }
                catch (DeviceNotResetException)
                {
                    base.RefreshPresentParameters();
                    // device can be resest so do so
                    base.Device.Reset(base.PresentParameters);
                }
                // ok to move on
                this.isDeviceLost = false;
            }

            IRenderSurface renderSurface = (IRenderSurface)sender;

            // render to the surface
            if( base.Device != null)
            {
                this.SetupLights();
                // set the render target
                base.Device.SetRenderTarget(0,renderSurface.RenderTarget);

                // set the depth stencil
                base.Device.DepthStencilSurface = renderSurface.DepthStencil;

                // set the camera
                base.Device.Transform.View = renderSurface.Camera.ViewMatrix;
                base.Device.Transform.Projection = renderSurface.Camera.ProjectionMatrix;

                // clear the backBuffer
                base.Device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, renderSurface.BackColor, 1.0f, 0);

                // setup the render quality for the viewport
                SetupDrawMode(renderSurface.DrawMode);

                // begin the scene
                base.Device.BeginScene();

                // render the scene
                e.Scene.Render(base.Device,renderSurface.Camera.WorldMatrix, e.FrameNumber);

                // render viewport descriptive text
                if(renderSurface.NameVisible)
                {
                    if (drawingFont == null)
                    {
                        drawingFont = new GraphicsFont(arialFont);
                        drawingFont.InitializeDeviceObjects(base.Device);
                    }

                    // draw GraphicsFont in 2D
                    drawingFont.DrawText(4, 4, Color.Black, renderSurface.Camera.Name);
                    drawingFont.DrawText(6, 6, Color.White, renderSurface.Camera.Name);
                }

                base.Device.EndScene();

                // if the their is a window to render too do so
                if( renderSurface.SwapChain != null)
                {
                    renderSurface.SwapChain.Present();
                }
            }
        }
Example #31
0
        /// <summary>
        /// Event Handler to handle a request by a surface to rendered by the device
        /// </summary>
        /// <param name="sender">The object that made the request</param>
        /// <param name="e">The arguments for the event</param>
        public void OnRenderSingleView(Object sender, RenderSingleViewEventArgs e)
        {
            // if the device has been lost, check it's state
            if (base.Device != null && this.isDeviceLost)
            {
                try
                {
                    // test co-operation level to make sure it is ok to render
                    base.Device.TestCooperativeLevel();
                }
                catch (DeviceLostException)
                {
                    // don't do anything if the device has been lost
                    return;
                }
                catch (DeviceNotResetException)
                {
                    base.RefreshPresentParameters();
                    // device can be resest so do so
                    base.Device.Reset(base.PresentParameters);
                }
                // ok to move on
                this.isDeviceLost = false;
            }

            IRenderSurface renderSurface = (IRenderSurface)sender;

            // render to the surface
            if (base.Device != null)
            {
                this.SetupLights();
                // set the render target
                base.Device.SetRenderTarget(0, renderSurface.RenderTarget);

                // set the depth stencil
                base.Device.DepthStencilSurface = renderSurface.DepthStencil;

                // set the camera
                base.Device.Transform.View       = renderSurface.Camera.ViewMatrix;
                base.Device.Transform.Projection = renderSurface.Camera.ProjectionMatrix;

                // clear the backBuffer
                base.Device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, renderSurface.BackColor, 1.0f, 0);

                // setup the render quality for the viewport
                SetupDrawMode(renderSurface.DrawMode);

                // begin the scene
                base.Device.BeginScene();

                // render the scene
                e.Scene.Render(base.Device, renderSurface.Camera.WorldMatrix, e.FrameNumber);

                // render viewport descriptive text
                if (renderSurface.NameVisible)
                {
                    if (drawingFont == null)
                    {
                        drawingFont = new GraphicsFont(arialFont);
                        drawingFont.InitializeDeviceObjects(base.Device);
                    }

                    // draw GraphicsFont in 2D
                    drawingFont.DrawText(4, 4, Color.Black, renderSurface.Camera.Name);
                    drawingFont.DrawText(6, 6, Color.White, renderSurface.Camera.Name);
                }


                base.Device.EndScene();

                // if the their is a window to render too do so
                if (renderSurface.SwapChain != null)
                {
                    renderSurface.SwapChain.Present();
                }
            }
        }
 public GraphicsClass()
 {
     this.Text = "Step01";
     input = new InputClass(this);
     drawingFont = new GraphicsFont( "Arial", System.Drawing.FontStyle.Bold );
 }