Code:
Imports Microsoft.DirectX
Imports Microsoft.DirectX.Direct3D
Imports System.Windows.Forms
Imports System.Drawing
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(400, 300)
Me.Text = "D3D Tutorial 01: CreateDevice"
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
#End Region
Dim device As device
Public Function InitializeGraphics() As Boolean
' Try
Dim PresentParamns As New Direct3D.PresentParameters()
PresentParams.Windowed = True
PresentParams.SwapEffect = SwapEffect.Discard
device = New Device(0, DeviceType.Software, Me, CreateFlags.SoftwareVertexProcessing, PresentParams)
Return True
' Catch e As DirectXException
' MsgBox(e.Message, MsgBoxStyle.Critical, "Error")
' Return False
'End Try
End Function
Imports Microsoft.DirectX
Imports Microsoft.DirectX.Direct3D
Imports System.Windows.Forms
Imports System.Drawing
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(400, 300)
Me.Text = "D3D Tutorial 01: CreateDevice"
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
#End Region
Dim device As device
Public Function InitializeGraphics() As Boolean
' Try
Dim PresentParamns As New Direct3D.PresentParameters()
PresentParams.Windowed = True
PresentParams.SwapEffect = SwapEffect.Discard
device = New Device(0, DeviceType.Software, Me, CreateFlags.SoftwareVertexProcessing, PresentParams)
Return True
' Catch e As DirectXException
' MsgBox(e.Message, MsgBoxStyle.Critical, "Error")
' Return False
'End Try
End Function
Greška se javi u funkciji InitializeGraphics() i to kad se pokuša napraviti objekat device. Može li mi neko reći gde je problem.
Unaprijed Hvala!
Dođite na http://www.yoyogames.com/games/show/74141 i pogledajte moje igrice i isto tako ocjenite ;)