/// <summary> /// The device has been created. Resources that are not lost on /// Reset() can be created here. /// </summary> public void InitializeDeviceObjects() { // a little different than desktop, on device we make use of a // FontDescription structure to hold all the font parameters FontDescription fontDesc = new FontDescription(); fontDesc.CharSet = CharacterSet.Default; fontDesc.FaceName = fontName; fontDesc.Height = fontSize1; fontDesc.OutputPrecision = Precision.Default; fontDesc.PitchAndFamily = PitchAndFamily.DefaultPitch | PitchAndFamily.FamilyDoNotCare; fontDesc.Quality = FontQuality.Default; fontDesc.Weight = FontWeight.Bold; fontDesc.Width = 0; // initialize our sample fonts font1 = new Microsoft.WindowsMobile.DirectX.Direct3D.Font( device, fontDesc); fontDesc.Height = fontSize2; font2 = new Microsoft.WindowsMobile.DirectX.Direct3D.Font( device, fontDesc); // make the sprite object which can batch and sort multiple // DrawText() calls textDrawerSprite = new Sprite(device); fpsTimer = new FpsTimerTool(device); }
/// <summary> /// The device has been created. Resources that are not lost on /// Reset() can be created here. /// </summary> public void InitializeDeviceObjects() { Pool indexBufferPool; Pool vertexBufferPool; Caps caps; drawingFont = new Microsoft.WindowsMobile.DirectX.Direct3D.Font(device, new System.Drawing.Font("Arial", 12.0f, System.Drawing.FontStyle.Bold)); fpsTimer = new FpsTimerTool(device); FractSetup(); // Get the device capabilities caps = device.DeviceCaps; // create the vertex buffer if (caps.SurfaceCaps.SupportsVidVertexBuffer) { vertexBufferPool = Pool.VideoMemory; } else { vertexBufferPool = Pool.SystemMemory; } vertexBuffer = new VertexBuffer( typeof(CustomVertex.PositionNormalColored), bufferSize * bufferSize, device, Usage.WriteOnly, CustomVertex.PositionNormalColored.Format, vertexBufferPool); vertexBuffer.Created += new System.EventHandler( this.OnCreateVertexBuffer); this.OnCreateVertexBuffer(vertexBuffer, null); //create the indices buffer if (caps.SurfaceCaps.SupportsVidIndexBuffer) { indexBufferPool = Pool.VideoMemory; } else { indexBufferPool = Pool.SystemMemory; } indexBuffer = new IndexBuffer(typeof(short), vert_size, device, Usage.WriteOnly, indexBufferPool); indices = new short[(bufferSize * 6) * bufferSize]; indexBuffer.Created += new System.EventHandler( this.OnCreateIndexBuffer); this.OnCreateIndexBuffer(indexBuffer, null); }