⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 direct3dproject.xpt

📁 SharpDevelop2.0.0 c#开发免费工具
💻 XPT
字号:
<?xml version="1.0"?>
<Template originator   = "Markus Palme"
          created      = "07/03/2004"
          lastModified = "07/20/2005">
	
	<!-- Template Header -->
	<TemplateConfiguration>
		<Name>${res:Templates.Project.Direct3DApplication.Name}</Name>
		<Category>VBNet</Category>
		<Subcategory>${res:Templates.File.Categories.WindowsApplications}</Subcategory>
		<Icon>VBNet.Project.FullProject</Icon>
		<LanguageName>VBNet</LanguageName>
		<Description>${res:Templates.Project.Direct3DApplication.Description}</Description>
	</TemplateConfiguration>
	
	<!-- Actions -->
	<Actions>
		<Open filename = "MainClass.vb"/>
	</Actions>
	
	<!-- Template Content -->
	<Combine name = "${ProjectName}" directory = ".">
		<Options>
			<StartupProject>${ProjectName}</StartupProject>
		</Options>
		
		<Project name = "${ProjectName}" directory = ".">
			<Options OutputType = "WinExe" />
			
			<ProjectItems>
				<Reference Include="System" />
				<Reference Include="System.Data" />
				<Reference Include="System.Drawing" />
				<Reference Include="System.Windows.Forms" />
				<Reference Include="System.Xml" />
				<Reference Include="Microsoft.DirectX" />
				<Reference Include="Microsoft.DirectX.Direct3D" />
				
				<Import Include="Microsoft.VisualBasic" />
				<Import Include="System" />
				<Import Include="System.Collections" />
				<Import Include="System.Collections.Generic" />
				<Import Include="System.Drawing" />
				<Import Include="System.Diagnostics" />
				<Import Include="System.Windows.Forms" />
				<Import Include="Microsoft.DirectX" />
				<Import Include="Microsoft.DirectX.Direct3D" />
			</ProjectItems>
			
			<Files>
				<File name="MainClass.vb"><![CDATA[${StandardHeader.VBNET}

' This is the main class of my Direct3D application
Public Class MainClass
	Inherits Form
	
	' The rendering device
	Private device As Device
	
	Public Sub New()
		Me.ClientSize = new System.Drawing.Size(640, 480)
		Me.Text = "Direct3D Project"
	End Sub
	
	Public Function InitializeGraphics() As Boolean
	
		Try
			' Now let's setup the Direct3D stuff
			Dim presentParams As New PresentParameters()
			presentParams.Windowed   = true
			presentParams.SwapEffect = SwapEffect.Discard
			
			' Create the device
			device = new Device(0, DeviceType.Hardware, Me, CreateFlags.SoftwareVertexProcessing, presentParams)
			
			' Setup the event handlers for the device
			AddHandler device.DeviceLost, AddressOf InvalidateDeviceObjects
			AddHandler device.DeviceReset, AddressOf RestoreDeviceObjects
			AddHandler device.Disposing, AddressOf DeleteDeviceObjects
			AddHandler device.DeviceResizing, AddressOf EnvironmentResizing
			
			return True
		Catch ex As DirectXException
			Return False
		End Try
	End Function
	
	Protected Overridable Sub InvalidateDeviceObjects(sender As Object, e As EventArgs)
	
	End Sub
	
	Protected Overridable Sub RestoreDeviceObjects(sender As Object, e As EventArgs)
	
	End Sub
	
	Protected Overridable Sub DeleteDeviceObjects(sender As Object, e As EventArgs)
	
	End Sub
	
	Protected Overridable Sub EnvironmentResizing(sender As Object, e As CancelEventArgs)
	
	End Sub
	
	' This method moves the scene
	Protected Overridable Sub FrameMove()
		' TODO : Frame movement
	End Sub
	
	' This method renders the scene
	Protected Overridable Sub Render()
		If Not device Is Nothing
			device.Clear(ClearFlags.Target, Color.Blue, 1.0f, 0)
			device.BeginScene()
			
			' TODO : Scene rendering
			
			device.EndScene()
			device.Present()
		End If
	End Sub
	
	' Our mainloop
	Public Sub Run()
		' While the form is still valid, render and process messages
		Do While Created
			FrameMove()
			Render()
			Application.DoEvents()
		Loop
	End Sub
	
	Protected Overrides Sub OnPaint(e As PaintEventArgs)
		Me.Render()
	End Sub
	
	Protected Overrides Sub OnKeyPress(e As KeyPressEventArgs)
		MyBase.OnKeyPress(e)
		If AscW(e.KeyChar) = CInt(Keys.Escape)
			Close()
		End If
	End Sub
	
	' The main entry point for the application
	Shared Sub Main()
		Dim mainClass As New MainClass()
		
		If Not mainClass.InitializeGraphics()
			MessageBox.Show("Error while initializing Direct3D")
			Return
		End If
		
		mainClass.Show()
		mainClass.Run()
	End Sub
End Class
]]></File>
			<File name="AssemblyInfo.vb"><![CDATA[Imports System.Reflection
Imports System.Runtime.CompilerServices

' Information about this assembly is defined by the following
' attributes.
'	<ProjectOptions Target = "WinExe" PauseConsoleOutput = "False" />
' change them to the information which is associated with the assembly
' you compile.

<assembly: AssemblyTitle("")>
<assembly: AssemblyDescription("")>
<assembly: AssemblyConfiguration("")>
<assembly: AssemblyCompany("")>
<assembly: AssemblyProduct("")>
<assembly: AssemblyCopyright("")>
<assembly: AssemblyTrademark("")>
<assembly: AssemblyCulture("")>

' The assembly version has following format :
'
' Major.Minor.Build.Revision
'
' You can specify all values by your own or you can build default build and revision
' numbers with the '*' character (the default):

<assembly: AssemblyVersion("1.0.*")>
]]></File>
			</Files>
		</Project>
	</Combine>
</Template>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -