Moved everything to /trunk
git-svn-id: http://svn.code.sf.net/p/irrlicht/code/trunk@643 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
commit
30b56d2ec5
4
bin/Linux/readme.txt
Normal file
4
bin/Linux/readme.txt
Normal file
@ -0,0 +1,4 @@
|
||||
If you wish to compile the engine in linux yourself,
|
||||
goto the \source directory. Run a 'make' in the subfolder 'Irrlicht'.
|
||||
After this, you should be able to make all example applications in \examples.
|
||||
Then just start an X Server and run them, from the directory where they are.
|
5
bin/MacOSX/readme.txt
Normal file
5
bin/MacOSX/readme.txt
Normal file
@ -0,0 +1,5 @@
|
||||
The Irrlicht Engine is staticly compiled together with the application under MacOSX.
|
||||
|
||||
If you wish to compile the engine in MacOSX yourself, use the source in the \source directory.
|
||||
|
||||
Please note that this SDK has not been tested on MacOSX. Get a SDK especially for MacOSX on http://irrlicht.sf.net
|
BIN
bin/Win32-VisualStudio/irrlicht.ico
Normal file
BIN
bin/Win32-VisualStudio/irrlicht.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
BIN
bin/Win32-gcc/irrlicht.ico
Normal file
BIN
bin/Win32-gcc/irrlicht.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
3
bin/Win64-VisualStudio/readme.txt
Normal file
3
bin/Win64-VisualStudio/readme.txt
Normal file
@ -0,0 +1,3 @@
|
||||
Sorry, I cannot provide procompiled binaries for Win64.
|
||||
Please goto the \source directory, unzip the source.zip file
|
||||
and compile them yourself, it will cost you about 3 minutes. :)
|
2458
changes.txt
Normal file
2458
changes.txt
Normal file
File diff suppressed because it is too large
Load Diff
2
doc/readme.txt
Normal file
2
doc/readme.txt
Normal file
@ -0,0 +1,2 @@
|
||||
Linux Users: There are some tools at the web for reading .chm files (try http://xchm.sourceforge.net/).
|
||||
You can find a html version of this documentation at http://irrlicht.sourceforge.net/docu/index.html
|
107
examples.net/01.HelloWorld_cs/01.HelloWorld_7.0.csproj
Normal file
107
examples.net/01.HelloWorld_cs/01.HelloWorld_7.0.csproj
Normal file
@ -0,0 +1,107 @@
|
||||
<VisualStudioProject>
|
||||
<CSHARP
|
||||
ProjectType = "Local"
|
||||
ProductVersion = "7.0.9466"
|
||||
SchemaVersion = "1.0"
|
||||
ProjectGuid = "{04123B67-C0DB-4BD7-86C9-CCCA17503D04}"
|
||||
>
|
||||
<Build>
|
||||
<Settings
|
||||
ApplicationIcon = "App.ico"
|
||||
AssemblyKeyContainerName = ""
|
||||
AssemblyName = "01.HelloWorld_7.0"
|
||||
AssemblyOriginatorKeyFile = ""
|
||||
DefaultClientScript = "JScript"
|
||||
DefaultHTMLPageLayout = "Grid"
|
||||
DefaultTargetSchema = "IE50"
|
||||
DelaySign = "false"
|
||||
OutputType = "Exe"
|
||||
RootNamespace = "_01.HelloWorld_7._0"
|
||||
StartupObject = ""
|
||||
>
|
||||
<Config
|
||||
Name = "Debug"
|
||||
AllowUnsafeBlocks = "false"
|
||||
BaseAddress = "285212672"
|
||||
CheckForOverflowUnderflow = "false"
|
||||
ConfigurationOverrideFile = ""
|
||||
DefineConstants = "DEBUG;TRACE"
|
||||
DocumentationFile = ""
|
||||
DebugSymbols = "true"
|
||||
FileAlignment = "4096"
|
||||
IncrementalBuild = "true"
|
||||
Optimize = "false"
|
||||
OutputPath = "bin\Debug\"
|
||||
RegisterForComInterop = "false"
|
||||
RemoveIntegerChecks = "false"
|
||||
TreatWarningsAsErrors = "false"
|
||||
WarningLevel = "4"
|
||||
/>
|
||||
<Config
|
||||
Name = "Release"
|
||||
AllowUnsafeBlocks = "false"
|
||||
BaseAddress = "285212672"
|
||||
CheckForOverflowUnderflow = "false"
|
||||
ConfigurationOverrideFile = ""
|
||||
DefineConstants = "TRACE"
|
||||
DocumentationFile = ""
|
||||
DebugSymbols = "false"
|
||||
FileAlignment = "4096"
|
||||
IncrementalBuild = "false"
|
||||
Optimize = "true"
|
||||
OutputPath = "bin\Release\"
|
||||
RegisterForComInterop = "false"
|
||||
RemoveIntegerChecks = "false"
|
||||
TreatWarningsAsErrors = "false"
|
||||
WarningLevel = "4"
|
||||
/>
|
||||
</Settings>
|
||||
<References>
|
||||
<Reference
|
||||
Name = "System"
|
||||
AssemblyName = "System"
|
||||
HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.Data"
|
||||
AssemblyName = "System.Data"
|
||||
HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.XML"
|
||||
AssemblyName = "System.XML"
|
||||
HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.Windows.Forms"
|
||||
AssemblyName = "System.Windows.Forms"
|
||||
HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Windows.Forms.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "Irrlicht.NET"
|
||||
AssemblyName = "Irrlicht.NET"
|
||||
HintPath = "..\..\bin\Win32-VisualStudio\Irrlicht.NET.dll"
|
||||
/>
|
||||
</References>
|
||||
</Build>
|
||||
<Files>
|
||||
<Include>
|
||||
<File
|
||||
RelPath = "App.ico"
|
||||
BuildAction = "Content"
|
||||
/>
|
||||
<File
|
||||
RelPath = "AssemblyInfo.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Example.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
</Include>
|
||||
</Files>
|
||||
</CSHARP>
|
||||
</VisualStudioProject>
|
||||
|
21
examples.net/01.HelloWorld_cs/01.HelloWorld_7.0.sln
Normal file
21
examples.net/01.HelloWorld_cs/01.HelloWorld_7.0.sln
Normal file
@ -0,0 +1,21 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 7.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "01.HelloWorld_7.0", "01.HelloWorld_7.0.csproj", "{04123B67-C0DB-4BD7-86C9-CCCA17503D04}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
ConfigName.0 = Debug
|
||||
ConfigName.1 = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectDependencies) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{04123B67-C0DB-4BD7-86C9-CCCA17503D04}.Debug.ActiveCfg = Debug|.NET
|
||||
{04123B67-C0DB-4BD7-86C9-CCCA17503D04}.Debug.Build.0 = Debug|.NET
|
||||
{04123B67-C0DB-4BD7-86C9-CCCA17503D04}.Release.ActiveCfg = Release|.NET
|
||||
{04123B67-C0DB-4BD7-86C9-CCCA17503D04}.Release.Build.0 = Release|.NET
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
BIN
examples.net/01.HelloWorld_cs/App.ico
Normal file
BIN
examples.net/01.HelloWorld_cs/App.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
58
examples.net/01.HelloWorld_cs/AssemblyInfo.cs
Normal file
58
examples.net/01.HelloWorld_cs/AssemblyInfo.cs
Normal file
@ -0,0 +1,58 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
//
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
//
|
||||
[assembly: AssemblyTitle("")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
//
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
//
|
||||
// In order to sign your assembly you must specify a key to use. Refer to the
|
||||
// Microsoft .NET Framework documentation for more information on assembly signing.
|
||||
//
|
||||
// Use the attributes below to control which key is used for signing.
|
||||
//
|
||||
// Notes:
|
||||
// (*) If no key is specified, the assembly is not signed.
|
||||
// (*) KeyName refers to a key that has been installed in the Crypto Service
|
||||
// Provider (CSP) on your machine. KeyFile refers to a file which contains
|
||||
// a key.
|
||||
// (*) If the KeyFile and the KeyName values are both specified, the
|
||||
// following processing occurs:
|
||||
// (1) If the KeyName can be found in the CSP, that key is used.
|
||||
// (2) If the KeyName does not exist and the KeyFile does exist, the key
|
||||
// in the KeyFile is installed into the CSP and used.
|
||||
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
|
||||
// When specifying the KeyFile, the location of the KeyFile should be
|
||||
// relative to the project output directory which is
|
||||
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
|
||||
// located in the project directory, you would specify the AssemblyKeyFile
|
||||
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
|
||||
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
|
||||
// documentation for more information on this.
|
||||
//
|
||||
[assembly: AssemblyDelaySign(false)]
|
||||
[assembly: AssemblyKeyFile("")]
|
||||
[assembly: AssemblyKeyName("")]
|
115
examples.net/01.HelloWorld_cs/Example.cs
Normal file
115
examples.net/01.HelloWorld_cs/Example.cs
Normal file
@ -0,0 +1,115 @@
|
||||
using System;
|
||||
using Irrlicht; // compiler error here? Look at the next comment
|
||||
using Irrlicht.Video;
|
||||
using Irrlicht.Core;
|
||||
using Irrlicht.Scene;
|
||||
|
||||
// PROBLEMS with this source?
|
||||
// Some solutions wich might help:
|
||||
//
|
||||
// - If your compiler complains that 'Irrlicht' cannot be found,
|
||||
// add the Irrlicht.NET.dll file (in bin\win32-VisualStudio) as Reference
|
||||
// in the solution browser.
|
||||
//
|
||||
// - It compiles, but your program throws an exception like this:
|
||||
// "An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module.
|
||||
// Additional information: File or assembly name Irrlicht.NET, or one of its dependencies,
|
||||
// was not found."
|
||||
// Solution: You are missing the file Irrlicht.DLL. Copy it where Visual studio can find it.
|
||||
// For example where this program is.
|
||||
|
||||
namespace _01.HelloWorld
|
||||
{
|
||||
/// <summary>
|
||||
/// Example application using Irrlicht.NET
|
||||
/// A little bit more complicated than the C++ hello world example,
|
||||
/// but hey, its the only one yet. Give me some time.
|
||||
/// </summary>
|
||||
class Example
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main(string[] args)
|
||||
{
|
||||
// start up the engine
|
||||
|
||||
IrrlichtDevice device = new IrrlichtDevice(DriverType.OPENGL);
|
||||
|
||||
device.ResizeAble = true;
|
||||
device.WindowCaption = "Irrlicht.NET C# example 01 - Hello World";
|
||||
|
||||
// load some textures
|
||||
|
||||
ITexture texSydney = device.VideoDriver.GetTexture(@"..\..\media\sydney.bmp");
|
||||
ITexture texWall = device.VideoDriver.GetTexture(@"..\..\media\wall.bmp");
|
||||
ITexture texLogo = device.VideoDriver.GetTexture(@"..\..\media\irrlichtlogoaligned.jpg");
|
||||
|
||||
// load the animated mesh of sydney
|
||||
|
||||
Irrlicht.Scene.IAnimatedMesh mesh =
|
||||
device.SceneManager.GetMesh(@"..\..\media\sydney.md2");
|
||||
|
||||
if (mesh == null)
|
||||
{
|
||||
System.Windows.Forms.MessageBox.Show(
|
||||
@"Could not load mesh ..\..\media\sydney.md2, exiting.",
|
||||
"Problem starting program");
|
||||
return;
|
||||
}
|
||||
|
||||
// add a camera, a test scene node and the animated mesh to the scene
|
||||
|
||||
ICameraSceneNode cam =
|
||||
device.SceneManager.AddCameraSceneNodeFPS(null, 100, 100, -1);
|
||||
cam.Position = new Vector3D(20,0,-50);
|
||||
|
||||
|
||||
ISceneNode node = device.SceneManager.AddCubeSceneNode(15,
|
||||
null, -1, new Vector3D(30,-15,0));
|
||||
node.SetMaterialTexture(0, texWall);
|
||||
|
||||
node = device.SceneManager.AddAnimatedMeshSceneNode(mesh, null, -1);
|
||||
node.SetMaterialTexture(0, texSydney);
|
||||
node.SetMaterialFlag(MaterialFlag.LIGHTING, false);
|
||||
|
||||
// make cursor invisible
|
||||
device.CursorControl.Visible = false;
|
||||
|
||||
// start drawing loop
|
||||
|
||||
int fps = 0;
|
||||
|
||||
while(device.Run())
|
||||
{
|
||||
if (device.WindowActive)
|
||||
{
|
||||
device.VideoDriver.BeginScene(true, true, new Color(0,100,100,100));
|
||||
|
||||
device.SceneManager.DrawAll();
|
||||
|
||||
// draw the logo
|
||||
device.VideoDriver.Draw2DImage(
|
||||
texLogo, new Position2D(10,10),
|
||||
new Rect(0,0,88,31),
|
||||
new Rect(new Position2D(0,0),device.VideoDriver.ScreenSize),
|
||||
new Color(0xffffff), false);
|
||||
|
||||
device.VideoDriver.EndScene();
|
||||
|
||||
if (fps != device.VideoDriver.FPS)
|
||||
{
|
||||
fps = device.VideoDriver.FPS;
|
||||
device.WindowCaption = "Irrlicht.NET C# example 01 - Hello World ["+
|
||||
device.VideoDriver.Name + "] fps:" + fps;
|
||||
}
|
||||
}
|
||||
} // end drawing-loop
|
||||
|
||||
|
||||
} // end main()
|
||||
|
||||
} // end class
|
||||
|
||||
} // end namespace
|
21
examples.net/01.HelloWorld_vb/01.HelloWorld_vb_7.0.sln
Normal file
21
examples.net/01.HelloWorld_vb/01.HelloWorld_vb_7.0.sln
Normal file
@ -0,0 +1,21 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 7.00
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "01.HelloWorld_vb_7.0", "01.HelloWorld_vb_7.0.vbproj", "{751D6701-0FA4-4963-936C-B75D046686F4}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
ConfigName.0 = Debug
|
||||
ConfigName.1 = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectDependencies) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{751D6701-0FA4-4963-936C-B75D046686F4}.Debug.ActiveCfg = Debug|.NET
|
||||
{751D6701-0FA4-4963-936C-B75D046686F4}.Debug.Build.0 = Debug|.NET
|
||||
{751D6701-0FA4-4963-936C-B75D046686F4}.Release.ActiveCfg = Release|.NET
|
||||
{751D6701-0FA4-4963-936C-B75D046686F4}.Release.Build.0 = Release|.NET
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
107
examples.net/01.HelloWorld_vb/01.HelloWorld_vb_7.0.vbproj
Normal file
107
examples.net/01.HelloWorld_vb/01.HelloWorld_vb_7.0.vbproj
Normal file
@ -0,0 +1,107 @@
|
||||
<VisualStudioProject>
|
||||
<VisualBasic
|
||||
ProjectType = "Local"
|
||||
ProductVersion = "7.0.9466"
|
||||
SchemaVersion = "1.0"
|
||||
ProjectGuid = "{751D6701-0FA4-4963-936C-B75D046686F4}"
|
||||
>
|
||||
<Build>
|
||||
<Settings
|
||||
ApplicationIcon = ""
|
||||
AssemblyKeyContainerName = ""
|
||||
AssemblyName = "01.HelloWorld_vb_7.0"
|
||||
AssemblyOriginatorKeyFile = ""
|
||||
AssemblyOriginatorKeyMode = "None"
|
||||
DefaultClientScript = "JScript"
|
||||
DefaultHTMLPageLayout = "Grid"
|
||||
DefaultTargetSchema = "IE50"
|
||||
DelaySign = "false"
|
||||
OutputType = "Exe"
|
||||
OptionCompare = "Binary"
|
||||
OptionExplicit = "On"
|
||||
OptionStrict = "Off"
|
||||
RootNamespace = "_01.HelloWorld_vb_7._0"
|
||||
StartupObject = "_01.HelloWorld_vb_7._0.Module1"
|
||||
>
|
||||
<Config
|
||||
Name = "Debug"
|
||||
BaseAddress = "285212672"
|
||||
ConfigurationOverrideFile = ""
|
||||
DefineConstants = ""
|
||||
DefineDebug = "true"
|
||||
DefineTrace = "true"
|
||||
DebugSymbols = "true"
|
||||
IncrementalBuild = "true"
|
||||
Optimize = "false"
|
||||
OutputPath = "bin\"
|
||||
RegisterForComInterop = "false"
|
||||
RemoveIntegerChecks = "false"
|
||||
TreatWarningsAsErrors = "false"
|
||||
WarningLevel = "1"
|
||||
/>
|
||||
<Config
|
||||
Name = "Release"
|
||||
BaseAddress = "285212672"
|
||||
ConfigurationOverrideFile = ""
|
||||
DefineConstants = ""
|
||||
DefineDebug = "false"
|
||||
DefineTrace = "true"
|
||||
DebugSymbols = "false"
|
||||
IncrementalBuild = "false"
|
||||
Optimize = "true"
|
||||
OutputPath = "bin\"
|
||||
RegisterForComInterop = "false"
|
||||
RemoveIntegerChecks = "false"
|
||||
TreatWarningsAsErrors = "false"
|
||||
WarningLevel = "1"
|
||||
/>
|
||||
</Settings>
|
||||
<References>
|
||||
<Reference
|
||||
Name = "System"
|
||||
AssemblyName = "System"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.Data"
|
||||
AssemblyName = "System.Data"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.XML"
|
||||
AssemblyName = "System.Xml"
|
||||
/>
|
||||
<Reference
|
||||
Name = "Irrlicht.NET"
|
||||
AssemblyName = "Irrlicht.NET"
|
||||
HintPath = "..\..\bin\Win32-VisualStudio\Irrlicht.NET.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.Windows.Forms"
|
||||
AssemblyName = "System.Windows.Forms"
|
||||
HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Windows.Forms.dll"
|
||||
/>
|
||||
</References>
|
||||
<Imports>
|
||||
<Import Namespace = "Microsoft.VisualBasic" />
|
||||
<Import Namespace = "System" />
|
||||
<Import Namespace = "System.Collections" />
|
||||
<Import Namespace = "System.Data" />
|
||||
<Import Namespace = "System.Diagnostics" />
|
||||
</Imports>
|
||||
</Build>
|
||||
<Files>
|
||||
<Include>
|
||||
<File
|
||||
RelPath = "AssemblyInfo.vb"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Module1.vb"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
</Include>
|
||||
</Files>
|
||||
</VisualBasic>
|
||||
</VisualStudioProject>
|
||||
|
32
examples.net/01.HelloWorld_vb/AssemblyInfo.vb
Normal file
32
examples.net/01.HelloWorld_vb/AssemblyInfo.vb
Normal file
@ -0,0 +1,32 @@
|
||||
Imports System
|
||||
Imports System.Reflection
|
||||
Imports System.Runtime.InteropServices
|
||||
|
||||
' General Information about an assembly is controlled through the following
|
||||
' set of attributes. Change these attribute values to modify the information
|
||||
' associated with an assembly.
|
||||
|
||||
' Review the values of the assembly attributes
|
||||
|
||||
<Assembly: AssemblyTitle("")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("")>
|
||||
<Assembly: AssemblyProduct("")>
|
||||
<Assembly: AssemblyCopyright("")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
<Assembly: CLSCompliant(True)>
|
||||
|
||||
'The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
<Assembly: Guid("2D372EBD-0DB9-4E7D-8142-21575E75AE79")>
|
||||
|
||||
' Version information for an assembly consists of the following four values:
|
||||
'
|
||||
' Major Version
|
||||
' Minor Version
|
||||
' Build Number
|
||||
' Revision
|
||||
'
|
||||
' You can specify all the values or you can default the Build and Revision Numbers
|
||||
' by using the '*' as shown below:
|
||||
|
||||
<Assembly: AssemblyVersion("1.0.*")>
|
92
examples.net/01.HelloWorld_vb/Module1.vb
Normal file
92
examples.net/01.HelloWorld_vb/Module1.vb
Normal file
@ -0,0 +1,92 @@
|
||||
Imports Irrlicht ' compiler error here? Look at the next comment
|
||||
Imports Irrlicht.Video
|
||||
Imports Irrlicht.Core
|
||||
Imports Irrlicht.Scene
|
||||
|
||||
' PROBLEMS with this source?
|
||||
' Some solutions wich might help:
|
||||
'
|
||||
' - If your compiler complains that 'Irrlicht' cannot be found,
|
||||
' add the Irrlicht.NET.dll file (in bin\Win32-VisualStudio) as Reference
|
||||
' in the solution browser.
|
||||
'
|
||||
' - It compiles, but your program throws an exception like this:
|
||||
' "An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module.
|
||||
' Additional information: File or assembly name Irrlicht.NET, or one of its dependencies,
|
||||
' was not found."
|
||||
' Solution: You are missing the file Irrlicht.DLL. Copy it where Visual studio can find it.
|
||||
' For example where this program is.
|
||||
|
||||
|
||||
' Example application using Irrlicht.NET
|
||||
' A little bit more complicated than the C++ hello world example,
|
||||
' but hey, its the only one yet. Give me some time.
|
||||
Module Module1
|
||||
|
||||
' The main entry point for the application.
|
||||
Sub Main()
|
||||
|
||||
' start up the engine
|
||||
|
||||
Dim device As New IrrlichtDevice(Irrlicht.Video.DriverType.OPENGL)
|
||||
|
||||
device.ResizeAble = True
|
||||
device.WindowCaption = "Irrlicht.NET VisualBasic example 01 - Hello World"
|
||||
|
||||
' load some textures
|
||||
|
||||
Dim texSydney As ITexture = device.VideoDriver.GetTexture("..\..\media\sydney.bmp")
|
||||
Dim texWall As ITexture = device.VideoDriver.GetTexture("..\..\media\wall.bmp")
|
||||
Dim texLogo As ITexture = device.VideoDriver.GetTexture("..\..\media\irrlichtlogoaligned.jpg")
|
||||
|
||||
' load the animated mesh of sydney
|
||||
|
||||
Dim mesh As Irrlicht.Scene.IAnimatedMesh = device.SceneManager.GetMesh("..\..\media\sydney.md2")
|
||||
|
||||
If mesh Is Nothing Then
|
||||
System.Windows.Forms.MessageBox.Show("Could not load mesh ..\..\media\sydney.md2, exiting.", "Problem starting program")
|
||||
Return
|
||||
End If
|
||||
|
||||
' add a camera, a test scene node and the animated mesh to the scene
|
||||
|
||||
Dim cam As ICameraSceneNode = device.SceneManager.AddCameraSceneNodeFPS(Nothing, 100, 100, -1)
|
||||
cam.Position = New Vector3D(20, 0, -50)
|
||||
|
||||
Dim node As ISceneNode = device.SceneManager.AddCubeSceneNode(15, Nothing, -1, New Vector3D(30, -15, 0))
|
||||
node.SetMaterialTexture(0, texWall)
|
||||
|
||||
node = device.SceneManager.AddAnimatedMeshSceneNode(mesh, Nothing, -1)
|
||||
node.SetMaterialTexture(0, texSydney)
|
||||
node.SetMaterialFlag(MaterialFlag.LIGHTING, False)
|
||||
|
||||
' disable mouse cursor
|
||||
device.CursorControl.Visible = False
|
||||
|
||||
' start drawing loop
|
||||
|
||||
Dim fps As Integer = 0
|
||||
|
||||
While device.Run() = True
|
||||
If device.WindowActive Then
|
||||
|
||||
device.VideoDriver.BeginScene(True, True, New Color(0, 100, 100, 100))
|
||||
|
||||
device.SceneManager.DrawAll()
|
||||
|
||||
' draw the logo
|
||||
|
||||
device.VideoDriver.Draw2DImage(texLogo, New Position2D(10, 10), New Rect(0, 0, 88, 31), New Rect(New Position2D(0, 0), device.VideoDriver.ScreenSize), New Color(255, 255, 255, 255), False)
|
||||
device.VideoDriver.EndScene()
|
||||
|
||||
If (fps <> device.VideoDriver.FPS) Then
|
||||
fps = device.VideoDriver.FPS
|
||||
device.WindowCaption = "Irrlicht.NET Visual Basic example 01 - Hello World [" + device.VideoDriver.Name + "] fps:" + fps.ToString
|
||||
End If
|
||||
|
||||
End If
|
||||
End While
|
||||
|
||||
End Sub
|
||||
|
||||
End Module
|
32
examples.net/Examples_Boo/example01.boo
Normal file
32
examples.net/Examples_Boo/example01.boo
Normal file
@ -0,0 +1,32 @@
|
||||
namespace HelloWorld
|
||||
import System
|
||||
import Irrlicht
|
||||
import Irrlicht.Video
|
||||
import Irrlicht.Core
|
||||
import Irrlicht.Scene
|
||||
|
||||
[Module]
|
||||
class Example:
|
||||
[STAThread()]
|
||||
static def Main(args as (string)):
|
||||
device as IrrlichtDevice = IrrlichtDevice(DriverType.OPENGL)
|
||||
device.WindowCaption = 'Irrlicht.NET Boo example 01 - Hello World'
|
||||
texSydney as ITexture = device.VideoDriver.GetTexture('sydney.bmp')
|
||||
mesh as Irrlicht.Scene.IAnimatedMesh = device.SceneManager.GetMesh('sydney.md2')
|
||||
cam as ICameraSceneNode = device.SceneManager.AddCameraSceneNodeFPS(null, 100, 100, -1)
|
||||
cam.Position = Vector3D(20, 0, -50)
|
||||
node as ISceneNode = device.SceneManager.AddAnimatedMeshSceneNode(mesh, null, -1)
|
||||
node.SetMaterialTexture(0, texSydney)
|
||||
node.SetMaterialFlag(MaterialFlag.LIGHTING, false)
|
||||
device.CursorControl.Visible = false
|
||||
fps as int = 0
|
||||
while device.Run():
|
||||
if device.WindowActive:
|
||||
device.VideoDriver.BeginScene(true, true, Color(0, 100, 100, 100))
|
||||
device.SceneManager.DrawAll()
|
||||
device.VideoDriver.EndScene()
|
||||
if fps != device.VideoDriver.FPS:
|
||||
fps = device.VideoDriver.FPS
|
||||
device.WindowCaption = 'Irrlicht.NET Boo example 01 - Hello World [' + device.VideoDriver.Name + '] fps:' + fps
|
||||
|
||||
|
5
examples.net/Examples_Boo/readme.txt
Normal file
5
examples.net/Examples_Boo/readme.txt
Normal file
@ -0,0 +1,5 @@
|
||||
These Tutorials have simply been copied from the Irrlicht Wiki at http://www.irrforge.org
|
||||
They are written by different authors, and not guaranteed to work, they simply should provide
|
||||
the c++ examples ported the Irrlicht.NET.
|
||||
Please see the wiki for updates and more info.
|
||||
A lot of thanks go to the people who wrote these examples.
|
196
examples.net/Examples_CSharp/example02.cs
Normal file
196
examples.net/Examples_CSharp/example02.cs
Normal file
@ -0,0 +1,196 @@
|
||||
/*
|
||||
This Tutorial shows how to load a Quake 3 map into the
|
||||
engine, create a SceneNode for optimizing the speed of
|
||||
rendering and how to create a user controlled camera.
|
||||
|
||||
Lets start like the HelloWorld example: We include
|
||||
the irrlicht header files and an additional file to be able
|
||||
to ask the user for a driver type using the console.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
|
||||
using Irrlicht;
|
||||
using Irrlicht.Video;
|
||||
using Irrlicht.Core;
|
||||
using Irrlicht.Scene;
|
||||
|
||||
namespace _02.Quake3Map
|
||||
{
|
||||
class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// Main entry point for the program.
|
||||
/// </summary>
|
||||
/// <param name="args">Arguments to pass the software.</param>
|
||||
[STAThread]
|
||||
static void Main(string[] args)
|
||||
{
|
||||
/*
|
||||
Like in the HelloWorld example, we create an IrrlichtDevice with
|
||||
createDevice(). The difference now is that we ask the user to select
|
||||
which hardware accelerated driver to use. The Software device would be
|
||||
too slow to draw a huge Quake 3 map, but just for the fun of it, we make
|
||||
this decision possible too.
|
||||
*/
|
||||
|
||||
// ask user for driver
|
||||
DriverType driverType;
|
||||
|
||||
// Ask user to select driver:
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine("Please select the driver you want for this example:");
|
||||
sb.AppendLine("(a) Direct3D 9.0c\n(b) Direct3D 8.1\n(c) OpenGL 1.5");
|
||||
sb.AppendLine("(d) Software Renderer\nApfelbaum Software Renderer");
|
||||
sb.AppendLine("(f) Null Device\n(otherKey) exit\n\n");
|
||||
|
||||
// Get the user's input:
|
||||
TextReader tIn = Console.In;
|
||||
TextWriter tOut = Console.Out;
|
||||
tOut.Write(sb.ToString());
|
||||
string input = tIn.ReadLine();
|
||||
|
||||
// Select device based on user's input:
|
||||
switch (input)
|
||||
{
|
||||
case "a":
|
||||
driverType = DriverType.DIRECT3D9;
|
||||
break;
|
||||
case "b":
|
||||
driverType = DriverType.DIRECT3D8;
|
||||
break;
|
||||
case "c":
|
||||
driverType = DriverType.OPENGL;
|
||||
break;
|
||||
case "d":
|
||||
driverType = DriverType.SOFTWARE;
|
||||
break;
|
||||
case "e":
|
||||
driverType = DriverType.SOFTWARE2;
|
||||
break;
|
||||
case "f":
|
||||
driverType = DriverType.NULL_DRIVER;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
// Create device and exit if creation fails:
|
||||
IrrlichtDevice device = new IrrlichtDevice(driverType, new Dimension2D(1024, 768), 32, true, true, true);
|
||||
|
||||
if (device == null)
|
||||
{
|
||||
tOut.Write("Device creation failed.");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
Get a pointer to the video driver and the SceneManager so that
|
||||
we do not always have to write device->getVideoDriver() and
|
||||
device->getSceneManager().
|
||||
*/
|
||||
// I just left these lines here for example purposes:
|
||||
//irrv.IVideoDriver driver = device.VideoDriver;
|
||||
//irrs.ISceneManager smgr = device.SceneManager;
|
||||
|
||||
/*
|
||||
To display the Quake 3 map, we first need to load it. Quake 3 maps
|
||||
are packed into .pk3 files wich are nothing other than .zip files.
|
||||
So we add the .pk3 file to our FileSystem. After it was added,
|
||||
we are able to read from the files in that archive as they would
|
||||
directly be stored on disk.
|
||||
*/
|
||||
// I changed this to make it more obvious where to put the media files.
|
||||
device.FileSystem.AddZipFileArchive(Application.StartupPath + "\\map-20kdm2.pk3");
|
||||
|
||||
/*
|
||||
Now we can load the mesh by calling getMesh(). We get a pointer returned
|
||||
to a IAnimatedMesh. As you know, Quake 3 maps are not really animated,
|
||||
they are only a huge chunk of static geometry with some materials
|
||||
attached. Hence the IAnimated mesh consists of only one frame,
|
||||
so we get the "first frame" of the "animation", which is our quake level
|
||||
and create an OctTree scene node with it, using addOctTreeSceneNode().
|
||||
The OctTree optimizes the scene a little bit, trying to draw only geometry
|
||||
which is currently visible. An alternative to the OctTree would be a
|
||||
AnimatedMeshSceneNode, which would draw always the complete geometry of
|
||||
the mesh, without optimization. Try it out: Write addAnimatedMeshSceneNode
|
||||
instead of addOctTreeSceneNode and compare the primitives drawed by the
|
||||
video driver. (There is a getPrimitiveCountDrawed() method in the
|
||||
IVideoDriver class). Note that this optimization with the Octree is only
|
||||
useful when drawing huge meshes consiting of lots of geometry.
|
||||
*/
|
||||
// I changed this to make it more obvious where to put the media files.
|
||||
IAnimatedMesh mesh = device.SceneManager.GetMesh("20kdm2.bsp");
|
||||
ISceneNode node = null;
|
||||
|
||||
if (mesh != null)
|
||||
node = device.SceneManager.AddOctTreeSceneNode(mesh, null, 0);
|
||||
|
||||
/*
|
||||
Because the level was modelled not around the origin (0,0,0), we translate
|
||||
the whole level a little bit.
|
||||
*/
|
||||
if (node != null)
|
||||
node.Position = (new Vector3D(-1300, -144, -1249));
|
||||
|
||||
/*
|
||||
Now we only need a Camera to look at the Quake 3 map.
|
||||
And we want to create a user controlled camera. There are some
|
||||
different cameras available in the Irrlicht engine. For example the
|
||||
Maya Camera which can be controlled compareable to the camera in Maya:
|
||||
Rotate with left mouse button pressed, Zoom with both buttons pressed,
|
||||
translate with right mouse button pressed. This could be created with
|
||||
addCameraSceneNodeMaya(). But for this example, we want to create a
|
||||
camera which behaves like the ones in first person shooter games (FPS).
|
||||
*/
|
||||
device.SceneManager.AddCameraSceneNodeFPS();
|
||||
|
||||
/*
|
||||
The mouse cursor needs not to be visible, so we make it invisible.
|
||||
*/
|
||||
device.CursorControl.Visible = false;
|
||||
|
||||
/*
|
||||
We have done everything, so lets draw it. We also write the current
|
||||
frames per second and the drawn primitives to the caption of the
|
||||
window. The 'if (device->isWindowActive())' line is optional, but
|
||||
prevents the engine render to set the position of the mouse cursor
|
||||
after task switching when other program are active.
|
||||
*/
|
||||
int lastFPS = -1;
|
||||
|
||||
while (device.Run())
|
||||
{
|
||||
if (device.WindowActive)
|
||||
{
|
||||
device.VideoDriver.BeginScene(true, true, new Color(0, 200, 200, 200));
|
||||
device.SceneManager.DrawAll();
|
||||
device.VideoDriver.EndScene();
|
||||
|
||||
int fps = device.VideoDriver.FPS;
|
||||
if (lastFPS != fps)
|
||||
{
|
||||
device.WindowCaption = "Irrlicht Engine - Quake 3 Map example [" +
|
||||
device.VideoDriver.Name + "] FPS:" + fps.ToString();
|
||||
lastFPS = fps;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
In the end, delete the Irrlicht device.
|
||||
*/
|
||||
// Instead of device->drop, we'll use:
|
||||
GC.Collect();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Retrieved from "http://www.irrforge.org/index.php/CS_Tutorial_2"
|
||||
// This page has been accessed 237 times. This page was last modified 19:19, 20 Jan 2006.
|
||||
|
1
examples.net/Examples_CSharp/example03.cs
Normal file
1
examples.net/Examples_CSharp/example03.cs
Normal file
@ -0,0 +1 @@
|
||||
// empty
|
217
examples.net/Examples_CSharp/example04.cs
Normal file
217
examples.net/Examples_CSharp/example04.cs
Normal file
@ -0,0 +1,217 @@
|
||||
/*
|
||||
This Tutorial shows how to move and animate SceneNodes. The
|
||||
basic concept of SceneNodeAnimators is shown as well as manual
|
||||
movement of nodes using the keyboard.
|
||||
*/
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using Irrlicht;
|
||||
using Irrlicht.Video;
|
||||
using Irrlicht.Core;
|
||||
using Irrlicht.Scene;
|
||||
namespace _04.Movement
|
||||
{
|
||||
/*
|
||||
In this tutorial, one of our goals is to move a scene node using some
|
||||
keys on the keyboard. We store a pointer to the scene node we want to
|
||||
move with the keys here.
|
||||
The other pointer is a pointer to the Irrlicht Device, which we need
|
||||
int the EventReceiver to manipulate the scene node and to get the
|
||||
active camera.
|
||||
*/
|
||||
/*
|
||||
To get events like mouse and keyboard input, or GUI events like
|
||||
"the OK button has been clicked", we need an object wich is derived from the
|
||||
IEventReceiver object. There is only one method to override: OnEvent.
|
||||
This method will be called by the engine when an event happened.
|
||||
We will use this input to move the scene node with the keys W and S.
|
||||
*/
|
||||
class Program : IEventReceiver
|
||||
{
|
||||
// Use this line for the default path to the Irrlicht standard media.
|
||||
//string path = "../../../../media/";
|
||||
// the_bob just puts the media in the executable folder, so I'm using this:
|
||||
string path = string.Empty;
|
||||
ISceneNode node = null;
|
||||
IrrlichtDevice device = null;
|
||||
/// <summary>
|
||||
/// Main entry point for the program.
|
||||
/// </summary>
|
||||
/// <param name="args">Arguments to pass the software.</param>
|
||||
[STAThread]
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Program prog = new Program();
|
||||
prog.run();
|
||||
}
|
||||
public bool OnEvent(Event p_e)
|
||||
{
|
||||
if (node != null && p_e.Type == EventType.KeyInput &&
|
||||
!p_e.KeyPressedDown)
|
||||
{
|
||||
switch (p_e.Key)
|
||||
{
|
||||
case KeyCode.KEY_ESCAPE:
|
||||
device.CloseDevice();
|
||||
break;
|
||||
case KeyCode.KEY_KEY_W:
|
||||
case KeyCode.KEY_KEY_S:
|
||||
{
|
||||
Vector3D v = node.Position;
|
||||
v.Y += p_e.Key == KeyCode.KEY_KEY_W ? 2.0f : -2.0f;
|
||||
node.Position = v;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public void run()
|
||||
{
|
||||
/* Like in the HelloWorld example, we create an IrrlichtDevice with
|
||||
new(). The difference now is that we ask the user to select
|
||||
which hardware accelerated driver to use. The Software device would be
|
||||
too slow to draw a huge Quake 3 map, but just for the fun of it, we make
|
||||
this decision possible too.
|
||||
*/
|
||||
// ask user for driver
|
||||
DriverType driverType;
|
||||
// Ask user to select driver:
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("Please select the driver you want for this example:\n");
|
||||
sb.Append("\n(a) Direct3D 9.0c\n(b) Direct3D 8.1\n(c) OpenGL 1.5");
|
||||
sb.Append("\n(d) Software Renderer\n(e)Apfelbaum Software Renderer");
|
||||
sb.Append("\n(f) Null Device\n(otherKey) exit\n\n");
|
||||
// Get the user's input:
|
||||
TextReader tIn = Console.In;
|
||||
TextWriter tOut = Console.Out;
|
||||
tOut.Write(sb.ToString());
|
||||
string input = tIn.ReadLine();
|
||||
// Select device based on user's input:
|
||||
switch (input)
|
||||
{
|
||||
case "a":
|
||||
driverType = DriverType.DIRECT3D9;
|
||||
break;
|
||||
case "b":
|
||||
driverType = DriverType.DIRECT3D8;
|
||||
break;
|
||||
case "c":
|
||||
driverType = DriverType.OPENGL;
|
||||
break;
|
||||
case "d":
|
||||
driverType = DriverType.SOFTWARE;
|
||||
break;
|
||||
case "e":
|
||||
driverType = DriverType.SOFTWARE2;
|
||||
break;
|
||||
case "f":
|
||||
driverType = DriverType.NULL_DRIVER;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
// Create device and exit if creation fails:
|
||||
device = new IrrlichtDevice(driverType, new Dimension2D(1024, 768), 32, true, true, true); // Bob changed this.
|
||||
if (device == null)
|
||||
{
|
||||
tOut.Write("Device creation failed.");
|
||||
return;
|
||||
}
|
||||
/* set this as event receiver*/
|
||||
device.EventReceiver = this;
|
||||
/*
|
||||
Get a reference to the video driver and the SceneManager so that
|
||||
we do not always have to write device.VideoDriver and
|
||||
device.SceneManager.
|
||||
*/
|
||||
ISceneManager smgr = device.SceneManager;
|
||||
IVideoDriver driver = device.VideoDriver;
|
||||
/*Create the node for moving it with the 'W' and 'S' key. We create a
|
||||
'test node', which is a cube built in into the engine for testing purposes.
|
||||
We place the node a (0,0,30) and we assign a texture to it to let it look a
|
||||
little bit more interesting.*/
|
||||
node = smgr.AddCubeSceneNode(10, null, 0, new Vector3D(0, 0, 30), new Vector3D(), new Vector3D(1, 1, 1));
|
||||
node.SetMaterialTexture(0, driver.GetTexture(path + "wall.bmp"));
|
||||
node.SetMaterialFlag(MaterialFlag.LIGHTING, false);
|
||||
/* Now we create another node, moving using a scene node animator. Scene
|
||||
node animators modify scene nodes and can be attached to any scene node
|
||||
like mesh scene nodes, billboards, lights and even camera scene nodes.
|
||||
Scene node animators are not only able to modify the position of a scene
|
||||
node, they can also animate the textures of an object for example. We create
|
||||
a test scene node again an attach a 'fly circle' scene node to it, letting
|
||||
this node fly around our first test scene node.*/
|
||||
ISceneNode n = smgr.AddTestSceneNode(10, null, 0, new Vector3D(), new Vector3D(), new Vector3D(1, 1, 1));
|
||||
n.SetMaterialTexture(0, driver.GetTexture(path + "t351sml.jpg"));
|
||||
ISceneNodeAnimator anim = smgr.CreateFlyCircleAnimator(new Vector3D(0, 0, 30), 20, 0.001f);
|
||||
n.AddAnimator(anim);
|
||||
//is this really necessary?
|
||||
anim.__dtor();
|
||||
/*The last scene node we add to show possibilities of scene node animators
|
||||
is a md2 model, which uses a 'fly straight' animator to run between two
|
||||
points.*/
|
||||
IAnimatedMeshSceneNode anms = smgr.AddAnimatedMeshSceneNode(
|
||||
smgr.GetMesh(path + "sydney.md2"), null, 0);
|
||||
if (anms != null)
|
||||
{
|
||||
anim = smgr.CreateFlyStraightAnimator(new Vector3D(100, 0, 60), new Vector3D(-100, 0, 60), 10000, true);
|
||||
anms.AddAnimator(anim);
|
||||
anim.__dtor();
|
||||
/*To make to model look better, we disable lighting (we have created no lights,
|
||||
and so the model would be black), set the frames between which the animation
|
||||
should loop, rotate the model around 180 degrees, and adjust the animation
|
||||
speed and the texture.
|
||||
To set the right animation (frames and speed), we would also be able to just
|
||||
call "anms->setMD2Animation(scene::EMAT_RUN)" for the 'run' animation
|
||||
instead of "setFrameLoop" and "setAnimationSpeed", but this only works with
|
||||
MD2 animations, and so you know how to start other animations.*/
|
||||
anms.Position = new Vector3D(0, 0, 40);
|
||||
anms.SetMaterialFlag(MaterialFlag.LIGHTING, false);
|
||||
anms.SetFrameLoop(320, 360);
|
||||
anms.AnimationSpeed = 30;
|
||||
anms.Rotation = new Vector3D(0, 180, 0);
|
||||
anms.SetMaterialTexture(0, driver.GetTexture(path + "sydney.BMP"));
|
||||
}
|
||||
/*To be able to look at and move around in this scene, we create a first person
|
||||
* shooter style camera and make the mouse cursor invisible.*/
|
||||
ICameraSceneNode camera = smgr.AddCameraSceneNodeFPS(null, 100, 100, 0);
|
||||
camera.Position = new Vector3D(0, 0, 0);
|
||||
device.CursorControl.Visible = false;
|
||||
/*
|
||||
We have done everything, so lets draw it. We also write the current
|
||||
frames per second and the drawn primitives to the caption of the
|
||||
window.
|
||||
*/
|
||||
int lastFPS = -1;
|
||||
while (device.Run())
|
||||
{
|
||||
if (device.WindowActive)
|
||||
{
|
||||
device.VideoDriver.BeginScene(true, true, new Color(0, 200, 200, 200));
|
||||
device.SceneManager.DrawAll();
|
||||
device.VideoDriver.EndScene();
|
||||
int fps = device.VideoDriver.FPS;
|
||||
if (lastFPS != fps)
|
||||
{
|
||||
device.WindowCaption = "Irrlicht Engine - Movement example [" +
|
||||
device.VideoDriver.Name + "] FPS:" + fps.ToString();
|
||||
lastFPS = fps;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
In the end, delete the Irrlicht device.
|
||||
*/
|
||||
// Instead of device->drop, we'll use:
|
||||
GC.Collect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Retrieved from "http://www.irrforge.org/index.php/CS_Tutorial_4"
|
||||
// This page has been accessed 243 times. This page was last modified 06:03, 20 Jan 2006.
|
||||
|
215
examples.net/Examples_CSharp/example05.cs
Normal file
215
examples.net/Examples_CSharp/example05.cs
Normal file
@ -0,0 +1,215 @@
|
||||
/* This tutorial shows how to use the built in User Interface
|
||||
of the Irrlicht Engine. It will give a brief overview and show
|
||||
how to create and use windows, buttons, scroll bars, static texts
|
||||
and list boxes.
|
||||
Lets start like the HelloWorld example: We include
|
||||
the irrlicht header files and an additional file to be able
|
||||
to ask the user for a driver type using the console.
|
||||
*/
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using Irrlicht;
|
||||
using Irrlicht.Video;
|
||||
using Irrlicht.GUI;
|
||||
using Irrlicht.Core;
|
||||
using Irrlicht.Scene;
|
||||
namespace _05.UserInterface
|
||||
{
|
||||
class Program : IEventReceiver
|
||||
{
|
||||
// path to standard Irrlicht media folder
|
||||
//string path = "../../../../media/";
|
||||
// empty path for executable folder:
|
||||
string path = string.Empty;
|
||||
IrrlichtDevice device;
|
||||
int cnt = 0;
|
||||
IGUIListBox listbox;
|
||||
/// <summary>
|
||||
/// Main entry point for the program.
|
||||
/// </summary>
|
||||
/// <param name="args">Arguments to pass the software.</param>
|
||||
[STAThread]
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Program prog = new Program();
|
||||
prog.run();
|
||||
}
|
||||
/*The Event Receiver is not only capable of getting keyboard and mouse input events,
|
||||
but also events of the graphical user interface (gui). There are events for almost
|
||||
everything: Button click, Listbox selection change, events that say that a element
|
||||
was hovered and so on. To be able to react to some of these events, we create an
|
||||
event receiver. We only react to gui events, and if it's such an event, we get the
|
||||
id of the caller (the gui element which caused the event) and get the pointer to the
|
||||
gui environment.*/
|
||||
public bool OnEvent(Event p_e)
|
||||
{
|
||||
if (p_e.Type == EventType.GUIEvent)
|
||||
{
|
||||
int id = p_e.GUIEventCaller.ID;
|
||||
IGUIEnvironment env = device.GUIEnvironment;
|
||||
switch (p_e.GUIEventType)
|
||||
{
|
||||
case (GUIEvent.SCROLL_BAR_CHANGED):
|
||||
if (id == 104)
|
||||
{
|
||||
// I think this is still not implemented
|
||||
//int pos=p_e.GUIEventCaller.Position;
|
||||
}
|
||||
break;
|
||||
/*If a button was clicked, it could be one of 'our' three buttons.
|
||||
If it is the first, we shut down the engine. If it is the second,
|
||||
we create a little window with some text on it. We also add a string
|
||||
to the list box to log what happened. And if it is the third button,
|
||||
we create a file open dialog, and add also this as string to the list
|
||||
box. That's all for the event receiver.*/
|
||||
case (GUIEvent.BUTTON_CLICKED):
|
||||
if (id == 101)
|
||||
{
|
||||
device.CloseDevice();
|
||||
return true;
|
||||
}
|
||||
if (id == 102)
|
||||
{
|
||||
listbox.AddItem("Window Created");
|
||||
cnt += 30;
|
||||
if (cnt > 200)
|
||||
cnt = 0;
|
||||
IGUIElement window = env.AddWindow(
|
||||
new Rect(100 + cnt, 100 + cnt, 300 + cnt, 200 + cnt),
|
||||
false, //modal?
|
||||
"Test Window",
|
||||
null, //parent
|
||||
0); // id
|
||||
env.AddStaticText("Please close me",
|
||||
new Rect(35, 35, 140, 50),
|
||||
true, //border
|
||||
false, //wordwrap
|
||||
window, //parent
|
||||
0); //id
|
||||
return true;
|
||||
}
|
||||
if (id == 103)
|
||||
{
|
||||
listbox.AddItem("File open");
|
||||
env.AddFileOpenDialog("Please choose a file", false, null, 0);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public void run()
|
||||
{
|
||||
// ask user for driver
|
||||
DriverType driverType;
|
||||
// Ask user to select driver:
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("Please select the driver you want for this example:\n");
|
||||
sb.Append("\n(a) Direct3D 9.0c\n(b) Direct3D 8.1\n(c) OpenGL 1.5");
|
||||
sb.Append("\n(d) Software Renderer\n(e) Apfelbaum Software Renderer");
|
||||
sb.Append("\n(f) Null Device\n(otherKey) exit\n\n");
|
||||
// Get the user's input:
|
||||
TextReader tIn = Console.In;
|
||||
TextWriter tOut = Console.Out;
|
||||
tOut.Write(sb.ToString());
|
||||
string input = tIn.ReadLine();
|
||||
// Select device based on user's input:
|
||||
switch (input)
|
||||
{
|
||||
case "a":
|
||||
driverType = DriverType.DIRECT3D9;
|
||||
break;
|
||||
case "b":
|
||||
driverType = DriverType.DIRECT3D8;
|
||||
break;
|
||||
case "c":
|
||||
driverType = DriverType.OPENGL;
|
||||
break;
|
||||
case "d":
|
||||
driverType = DriverType.SOFTWARE;
|
||||
break;
|
||||
case "e":
|
||||
driverType = DriverType.SOFTWARE2;
|
||||
break;
|
||||
case "f":
|
||||
driverType = DriverType.NULL_DRIVER;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
// Create device and exit if creation fails:
|
||||
device = new IrrlichtDevice(driverType, new Dimension2D(1024, 768), 32, false, true, true);
|
||||
if (device == null)
|
||||
{
|
||||
tOut.Write("Device creation failed.");
|
||||
return;
|
||||
}
|
||||
/* set this as event receiver*/
|
||||
device.EventReceiver = this;
|
||||
/*
|
||||
Get a pointer to the video driver and the SceneManager so that
|
||||
we do not always have to write device.VideoDriver and
|
||||
device.SceneManager and device.GUIEnvironment.
|
||||
*/
|
||||
ISceneManager smgr = device.SceneManager;
|
||||
IVideoDriver driver = device.VideoDriver;
|
||||
IGUIEnvironment env = device.GUIEnvironment;
|
||||
/*We add three buttons. The first one closes the engine. The second creates
|
||||
a window and the third opens a file open dialog. The third parameter is
|
||||
the id of the button, with which we can easily identify the button in the
|
||||
event receiver.*/
|
||||
env.AddButton(new Rect(10, 210, 100, 240), null, 101, "Quit");
|
||||
env.AddButton(new Rect(10, 250, 100, 290), null, 102, "New Window");
|
||||
env.AddButton(new Rect(10, 300, 100, 340), null, 103, "File Open");
|
||||
/*Now, we add a static text and a scrollbar, which modifies the transparency
|
||||
of all gui elements. We set the maximum value of the scrollbar to 255,
|
||||
because that's the maximal value for a color value. Then we create an other
|
||||
static text and a list box.*/
|
||||
env.AddStaticText("Transparent Control:", new Rect(150, 20, 350, 40), true, false, null, 0);
|
||||
IGUIElement scrollbar = env.AddScrollBar(true, new Rect(150, 45, 350, 60), null, 104);
|
||||
//nopt implemented yet
|
||||
//scrollbar.Max=255;
|
||||
env.AddStaticText("Logging Listbox:", new Rect(50, 80, 250, 100), true, false, null, 0);
|
||||
listbox = env.AddListBox(new Rect(50, 110, 250, 180), null, 0, true);
|
||||
/*To make the font a little bit nicer, we load an external font and set it as
|
||||
new font in the skin. An at last, we create a nice Irrlicht Engine logo in the
|
||||
top left corner. */
|
||||
IGUISkin skin = env.Skin;
|
||||
IGUIFont font = env.GetFont(path + "fonthaettenschweiler.bmp");
|
||||
if (font != null)
|
||||
{
|
||||
skin.Font = font;
|
||||
}
|
||||
IGUIElement img = env.AddImage(driver.GetTexture(path + "irrlichtlogoalpha.tga"),
|
||||
new Position2D(10, 10),
|
||||
false, //UseAlphaChannel
|
||||
null, //Parent
|
||||
0, //ID
|
||||
""); //Text
|
||||
/*
|
||||
We have done everything, so lets draw it.
|
||||
*/
|
||||
while (device.Run())
|
||||
{
|
||||
if (device.WindowActive)
|
||||
{
|
||||
device.VideoDriver.BeginScene(true, true, new Color(0, 122, 65, 171));
|
||||
device.SceneManager.DrawAll();
|
||||
device.GUIEnvironment.DrawAll();
|
||||
device.VideoDriver.EndScene();
|
||||
}
|
||||
}
|
||||
/*
|
||||
In the end, delete the Irrlicht device.
|
||||
*/
|
||||
// Instead of device->drop, we'll use:
|
||||
GC.Collect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Retrieved from "http://www.irrforge.org/index.php/CS_Tutorial_5"
|
||||
// This page has been accessed 221 times. This page was last modified 06:10, 20 Jan 2006.
|
||||
|
182
examples.net/Examples_CSharp/example06.cs
Normal file
182
examples.net/Examples_CSharp/example06.cs
Normal file
@ -0,0 +1,182 @@
|
||||
/* This Tutorial shows how to do 2d graphics with the Irrlicht
|
||||
Engine. It shows how to draw images, keycolor based sprites,
|
||||
transparent rectangles and different fonts. You will may
|
||||
consider this useful if you want to make a 2d game with the
|
||||
engine, or if you want to draw a cool interface or head up
|
||||
display for your 3d game. */
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using Irrlicht;
|
||||
using Irrlicht.Video;
|
||||
using Irrlicht.GUI;
|
||||
using Irrlicht.Core;
|
||||
using Irrlicht.Scene;
|
||||
namespace _06._2DGraphics
|
||||
{
|
||||
class Program
|
||||
{
|
||||
// Path to default irrlicht media folder
|
||||
// string path = "../../../../media/";
|
||||
// Empty path - media in executable folder
|
||||
string path = string.Empty;
|
||||
IrrlichtDevice device;
|
||||
/// <summary>
|
||||
/// Main entry point for the program.
|
||||
/// </summary>
|
||||
/// <param name="args">Arguments to pass the software.</param>
|
||||
[STAThread]
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Program prog = new Program();
|
||||
prog.run();
|
||||
}
|
||||
public void run()
|
||||
{
|
||||
/* At first, we let the user select the driver type,
|
||||
then start up the engine, set a caption, and get a
|
||||
pointer to the video driver.
|
||||
*/
|
||||
// ask user for driver
|
||||
DriverType driverType;
|
||||
// Ask user to select driver:
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("Please select the driver you want for this example:\n");
|
||||
sb.Append("\n(a) Direct3D 9.0c\n(b) Direct3D 8.1\n(c) OpenGL 1.5");
|
||||
sb.Append("\n(d) Software Renderer\n(e) Apfelbaum Software Renderer");
|
||||
sb.Append("\n(f) Null Device\n(otherKey) exit\n\n");
|
||||
// Get the user's input:
|
||||
TextReader tIn = Console.In;
|
||||
TextWriter tOut = Console.Out;
|
||||
tOut.Write(sb.ToString());
|
||||
string input = tIn.ReadLine();
|
||||
// Select device based on user's input:
|
||||
switch (input)
|
||||
{
|
||||
case "a":
|
||||
driverType = DriverType.DIRECT3D9;
|
||||
break;
|
||||
case "b":
|
||||
driverType = DriverType.DIRECT3D8;
|
||||
break;
|
||||
case "c":
|
||||
driverType = DriverType.OPENGL;
|
||||
break;
|
||||
case "d":
|
||||
driverType = DriverType.SOFTWARE;
|
||||
break;
|
||||
case "e":
|
||||
driverType = DriverType.SOFTWARE2;
|
||||
break;
|
||||
case "f":
|
||||
driverType = DriverType.NULL_DRIVER;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
// Create device and exit if creation fails:
|
||||
device = new IrrlichtDevice(driverType, new Dimension2D(1024, 768), 32, false, true, true);
|
||||
if (device == null)
|
||||
{
|
||||
tOut.Write("Device creation failed.");
|
||||
return;
|
||||
}
|
||||
/*
|
||||
Get a pointer to the video driver and the SceneManager so that
|
||||
we do not always have to write device.VideoDriver()
|
||||
*/
|
||||
IVideoDriver driver = device.VideoDriver;
|
||||
/*All 2d graphics in this example are put together into one texture,
|
||||
2ddemo.bmp. Because we want to draw colorkey based sprites, we need
|
||||
to load this texture and tell the engine, which part of it should be
|
||||
transparent based on a colorkey. In this example, we don't tell it
|
||||
the color directly, we just say "Hey Irrlicht Engine, you'll find the
|
||||
color I want at position (0,0) on the texture.". Instead, it would be
|
||||
also possible to call driver.MakeColorKeyTexture(images, Color)
|
||||
to make e.g. all black pixels transparent. Please note, that
|
||||
makeColorKeyTexture just creates an alpha channel based on the color.*/
|
||||
ITexture images = driver.GetTexture(path + "2ddemo.bmp");
|
||||
driver.MakeColorKeyTexture(images, new Position2D(0, 0));
|
||||
/*
|
||||
To be able to draw some text with two different fonts,
|
||||
we load them. Ok, we load just one, as first font we just
|
||||
use the default font which is built into the engine.
|
||||
Also, we define two rectangles, which specify the position
|
||||
of the images of the red imps (little flying creatures) in
|
||||
the texture.
|
||||
*/
|
||||
IGUIFont font = device.GUIEnvironment.BuiltInFont;
|
||||
IGUIFont font2 = device.GUIEnvironment.GetFont(path + "fonthaettenschweiler.bmp");
|
||||
Rect imp1 = new Rect(349, 15, 385, 78);
|
||||
Rect imp2 = new Rect(387, 15, 423, 78);
|
||||
/*
|
||||
Everything is prepared, now we can draw everything in the draw loop,
|
||||
between the begin scene and end scene calls. In this example, we are just
|
||||
doing 2d graphics, but it would be no problem to mix them with 3d graphics.
|
||||
Just try it out, and draw some 3d vertices or set up a scene with the scene
|
||||
manager and draw it.
|
||||
*/
|
||||
while (device.Run() && driver != null)
|
||||
{
|
||||
if (device.WindowActive)
|
||||
{
|
||||
uint time = device.Timer.Time;
|
||||
driver.BeginScene(true, true, new Color(0, 120, 102, 136));
|
||||
/*
|
||||
First, we draw 3 sprites, using the alpha channel we created with
|
||||
makeColorKeyTexture. The last parameter specifiys that the drawing
|
||||
method should use thiw alpha channel. The parameter before the last
|
||||
one specifies a color, with which the sprite should be colored.
|
||||
(255,255,255,255) is full white, so the sprite will look like the
|
||||
original. The third sprite is drawed colored based on the time.*/
|
||||
// draw fire & dragons background world
|
||||
driver.Draw2DImage(images, new Position2D(50, 50),
|
||||
new Rect(0, 0, 342, 224),
|
||||
new Color(255, 255, 255, 255), true);
|
||||
// draw flying imp
|
||||
driver.Draw2DImage(images, new Position2D(164, 125),
|
||||
(time / 500 % 2) == 0 ? imp1 : imp2,
|
||||
new Color(255, 255, 255, 255), true);
|
||||
// draw second flying imp with colorcylce
|
||||
driver.Draw2DImage(images, new Position2D(270, 105),
|
||||
(time / 500 % 2) == 0 ? imp1 : imp2,
|
||||
new Color(255, ((int)(time) % 255), 255, 255), true);
|
||||
// Drawing text is really simple. The code should be self explanatory.
|
||||
if (font != null)
|
||||
{
|
||||
font.Draw("This is some text",
|
||||
new Rect(130, 10, 300, 50),
|
||||
new Color(255, 255, 255, 255), false, false);
|
||||
}
|
||||
if (font2 != null)
|
||||
{
|
||||
font2.Draw("This is some text",
|
||||
new Rect(130, 20, 300, 60),
|
||||
new Color(255, (int)time % 255, (int)time % 255, 255),
|
||||
false, false);
|
||||
}
|
||||
/*At last, we draw the Irrlicht Engine logo (without using
|
||||
a color or an alpha channel) and a transparent 2d Rectangle
|
||||
at the position of the mouse cursor.*/
|
||||
// draw logo
|
||||
driver.Draw2DImage(images, new Position2D(10, 10),
|
||||
new Rect(354, 87, 442, 118), new Color(255, 255, 255, 255), false);
|
||||
// draw transparent rect under cursor
|
||||
Position2D m = device.CursorControl.Position;
|
||||
driver.Draw2DRectangle(new Color(100, 255, 255, 255),
|
||||
new Rect(m.X - 20, m.Y - 20, m.X + 20, m.Y + 20));
|
||||
driver.EndScene();
|
||||
}
|
||||
}
|
||||
/*
|
||||
In the end, delete the Irrlicht device.
|
||||
*/
|
||||
// Instead of device->drop, we'll use:
|
||||
GC.Collect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Retrieved from "http://www.irrforge.org/index.php/CS_Tutorial_6"
|
||||
// This page has been accessed 220 times. This page was last modified 06:10, 20 Jan 2006.
|
||||
|
300
examples.net/Examples_CSharp/example07.cs
Normal file
300
examples.net/Examples_CSharp/example07.cs
Normal file
@ -0,0 +1,300 @@
|
||||
/*
|
||||
In this tutorial, I will show how to collision detection with the Irrlicht Engine.
|
||||
I will describe 3 methods: Automatic collision detection for moving through 3d
|
||||
worlds with sliding, stair climbing and sliding, manual triangle picking and manual
|
||||
scene node picking.
|
||||
*/
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
|
||||
using Irrlicht;
|
||||
using Irrlicht.Video;
|
||||
using Irrlicht.GUI;
|
||||
using Irrlicht.Core;
|
||||
using Irrlicht.Scene;
|
||||
|
||||
namespace _07._Collisions
|
||||
{
|
||||
class Program
|
||||
{
|
||||
string path="../../../../media/";
|
||||
IrrlichtDevice device;
|
||||
/// <summary>
|
||||
/// Main entry point for the program.
|
||||
/// </summary>
|
||||
/// <param name="args">Arguments to pass the software.</param>
|
||||
[STAThread]
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Program prog = new Program();
|
||||
prog.run();
|
||||
}
|
||||
|
||||
public void run()
|
||||
{
|
||||
/* At first, we let the user select the driver type,
|
||||
then start up the engine, set a caption, and get a
|
||||
pointer to the video driver.
|
||||
*/
|
||||
|
||||
// ask user for driver
|
||||
DriverType driverType;
|
||||
|
||||
// Ask user to select driver:
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("Please select the driver you want for this example:\n");
|
||||
sb.Append("\n(a) Direct3D 9.0c\n(b) Direct3D 8.1\n(c) OpenGL 1.5");
|
||||
sb.Append("\n(d) Software Renderer\n(e) Apfelbaum Software Renderer");
|
||||
sb.Append("\n(f) Null Device\n(otherKey) exit\n\n");
|
||||
|
||||
// Get the user's input:
|
||||
TextReader tIn = Console.In;
|
||||
TextWriter tOut = Console.Out;
|
||||
tOut.Write(sb.ToString());
|
||||
string input = tIn.ReadLine();
|
||||
|
||||
// Select device based on user's input:
|
||||
switch (input)
|
||||
{
|
||||
case "a":
|
||||
driverType = DriverType.DIRECT3D9;
|
||||
break;
|
||||
case "b":
|
||||
driverType = DriverType.DIRECT3D8;
|
||||
break;
|
||||
case "c":
|
||||
driverType = DriverType.OPENGL;
|
||||
break;
|
||||
case "d":
|
||||
driverType = DriverType.SOFTWARE;
|
||||
break;
|
||||
case "e":
|
||||
driverType = DriverType.SOFTWARE2;
|
||||
break;
|
||||
case "f":
|
||||
driverType = DriverType.NULL_DRIVER;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
// Create device and exit if creation fails:
|
||||
device = new IrrlichtDevice(driverType, new Dimension2D(1024, 768), 32, false, true, true);
|
||||
|
||||
if (device == null)
|
||||
{
|
||||
tOut.Write("Device creation failed.");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
Get a pointer to the video driver and the SceneManager so that
|
||||
we do not always have to write device->getVideoDriver() and
|
||||
device->getSceneManager().
|
||||
*/
|
||||
|
||||
ISceneManager smgr=device.SceneManager;
|
||||
IVideoDriver driver=device.VideoDriver;
|
||||
|
||||
device.FileSystem.AddZipFileArchive(path+"map-20kdm2.pk3");
|
||||
|
||||
IAnimatedMesh q3levelmesh = smgr.GetMesh("20kdm2.bsp");
|
||||
ISceneNode q3node = null;
|
||||
if (q3levelmesh!=null)
|
||||
q3node=smgr.AddOctTreeSceneNode(q3levelmesh.GetMesh(0),null,0);
|
||||
|
||||
/*So far so good, we've loaded the quake 3 level like in tutorial 2.
|
||||
Now, here comes something different: We create a triangle selector. A
|
||||
triangle selector is a class which can fetch the triangles from scene
|
||||
nodes for doing different things with them, for example collision
|
||||
detection. There are different triangle selectors, and all can be
|
||||
created with the ISceneManager. In this example, we create an
|
||||
OctTreeTriangleSelector, which optimizes the triangle output a little
|
||||
bit by reducing it like an octree. This is very useful for huge meshes
|
||||
like quake 3 levels.
|
||||
After we created the triangle selector, we attach it to the q3node.
|
||||
This is not necessary, but in this way, we do not need to care for the
|
||||
selector, for example dropping it after we do not need it anymore.*/
|
||||
|
||||
ITriangleSelector selector = null;
|
||||
if (q3node!=null)
|
||||
{
|
||||
q3node.Position= new Vector3D(-1370,-130,-1400);
|
||||
selector=smgr.CreateOctTreeTriangleSelector(
|
||||
q3levelmesh.GetMesh(0),q3node,128);
|
||||
// not implemented but not necessary
|
||||
//q3node.TriangleSelector=selector;
|
||||
}
|
||||
|
||||
/*We add a first person shooter camera to the scene for being able to move in
|
||||
the quake 3 level like in tutorial 2. But this, time, we add a special
|
||||
animator to the camera: A Collision Response animator. This thing modifies
|
||||
the scene node to which it is attached to in that way, that it may no
|
||||
more move through walls and is affected by gravity. The only thing we have
|
||||
to tell the animator is how the world looks like, how big the scene node is,
|
||||
how gravity and so on. After the collision response animator is attached to
|
||||
the camera, we do not have to do anything more for collision detection,
|
||||
anything is done automaticly, all other collision detection code below is
|
||||
for picking. And please note another cool feature: The collsion response
|
||||
animator can be attached also to all other scene nodes, not only to cameras.
|
||||
And it can be mixed with other scene node animators. In this way, collision
|
||||
detection and response in the Irrlicht engine is really, really easy.
|
||||
Now we'll take a closer look on the parameters of
|
||||
createCollisionResponseAnimator(). The first parameter is the TriangleSelector,
|
||||
which specifies how the world, against collision detection is done looks like.
|
||||
The second parameter is the scene node, which is the object, which is affected
|
||||
by collision detection, in our case it is the camera. The third defines how big
|
||||
the object is, it is the radius of an ellipsoid. Try it out and change the radius
|
||||
to smaller values, the camera will be able to move closer to walls after this.
|
||||
The next parameter is the direction and speed of gravity. You could set it to
|
||||
(0,0,0) to disable gravity. And the last value is just a translation: Without
|
||||
this, the ellipsoid with which collision detection is done would be around
|
||||
the camera, and the camera would be in the middle of the ellipsoid. But as
|
||||
human beings, we are used to have our eyes on top of the body, with which
|
||||
we collide with our world, not in the middle of it. So we place the scene
|
||||
node 50 units over the center of the ellipsoid with this parameter. And
|
||||
that's it, collision detection works now.
|
||||
*/
|
||||
ICameraSceneNode camera = smgr.AddCameraSceneNodeFPS(null,100,300,0);
|
||||
camera.Position=new Vector3D(-100,50,-150);
|
||||
ISceneNodeAnimator anim = smgr.CreateCollisionResponseAnimator(
|
||||
selector,camera,new Vector3D(30,50,30),
|
||||
new Vector3D(0,-3,0),new Vector3D(0,50,0),0);
|
||||
camera.AddAnimator(anim);
|
||||
|
||||
/*Because collision detection is no big deal in irrlicht, I'll describe how
|
||||
to do two different types of picking in the next section. But before this,
|
||||
I'll prepare the scene a little. I need three animated characters which we
|
||||
could pick later, a dynamic light for lighting them, a billboard for drawing
|
||||
where we found an intersection, and, yes, I need to get rid of this mouse
|
||||
cursor. :)*/
|
||||
//disable mouse cursor
|
||||
device.CursorControl.Visible=false;
|
||||
|
||||
// add billboard
|
||||
IBillboardSceneNode bill = smgr.AddBillboardSceneNode(
|
||||
null,new Dimension2Df(20,20),new Vector3D(),0);
|
||||
bill.SetMaterialType(MaterialType.TRANSPARENT_ADD_COLOR);
|
||||
bill.SetMaterialTexture(0,driver.GetTexture(
|
||||
path+"particle.bmp"));
|
||||
bill.SetMaterialFlag(MaterialFlag.LIGHTING,false);
|
||||
bill.SetMaterialFlag(MaterialFlag.ZBUFFER,false);
|
||||
Material material = new Material();
|
||||
material.Texture1= driver.GetTexture(
|
||||
path+"faerie2.bmp");
|
||||
material.Lighting=true;
|
||||
|
||||
IAnimatedMeshSceneNode node = null;
|
||||
IAnimatedMesh faerie = smgr.GetMesh(
|
||||
path+"faerie.md2");
|
||||
if (faerie!=null)
|
||||
{
|
||||
node=smgr.AddAnimatedMeshSceneNode(faerie,null,0);
|
||||
node.Position=new Vector3D(-70,0,-90);
|
||||
node.SetMD2Animation(MD2AnimationType.RUN);
|
||||
node.SetMaterial(0,material);
|
||||
|
||||
node=smgr.AddAnimatedMeshSceneNode(faerie,null,0);
|
||||
node.Position=new Vector3D(-70,0,-30);
|
||||
node.SetMD2Animation(MD2AnimationType.SALUTE);
|
||||
node.SetMaterial(0,material);
|
||||
|
||||
node=smgr.AddAnimatedMeshSceneNode(faerie,null,0);
|
||||
node.Position=new Vector3D(-70,0,-60);
|
||||
node.SetMD2Animation(MD2AnimationType.JUMP);
|
||||
node.SetMaterial(0,material);
|
||||
}
|
||||
|
||||
material.Texture1=null;
|
||||
material.Lighting=false;
|
||||
|
||||
//Add a light
|
||||
smgr.AddLightSceneNode(null,new Vector3D(-60,100,400),
|
||||
new Colorf(1.0f,1.0f,1.0f,1.0f),600,0);
|
||||
|
||||
/*For not making it too complicated, I'm doing picking inside the drawing
|
||||
loop. We take two pointers for storing the current and the last selected
|
||||
scene node and start the loop.*/
|
||||
ISceneNode selectedSceneNode =null;
|
||||
ISceneNode lastSelectedSceneNode =null;
|
||||
|
||||
int lastFPS=-1;
|
||||
|
||||
while (device.Run())
|
||||
{
|
||||
if (device.WindowActive)
|
||||
{
|
||||
device.VideoDriver.BeginScene(true, true, new Color(0, 200, 200, 200));
|
||||
device.SceneManager.DrawAll();
|
||||
/*After we've drawn the whole scene whit smgr->drawAll(), we'll do the
|
||||
first picking: We want to know which triangle of the world we are
|
||||
looking at. In addition, we want the exact point of the quake 3
|
||||
level we are looking at. For this, we create a 3d line starting at
|
||||
the position of the camera and going through the lookAt-target of it.
|
||||
Then we ask the collision manager if this line collides with a
|
||||
triangle of the world stored in the triangle selector. If yes, we draw
|
||||
the 3d triangle and set the position of the billboard to the intersection
|
||||
point.*/
|
||||
Line3D line = new Line3D();
|
||||
line.start=camera.Position;
|
||||
line.end=line.start+
|
||||
(camera.Target - line.start).Normalize() * 1000;
|
||||
Vector3D intersection;
|
||||
Triangle3D tri;
|
||||
if (smgr.SceneCollisionManager.GetCollisionPoint(
|
||||
line,selector,out intersection, out tri))
|
||||
{
|
||||
bill.Position=intersection;
|
||||
|
||||
driver.SetTransform(TransformationState.WORLD, new Matrix4());
|
||||
driver.SetMaterial(material);
|
||||
driver.Draw3DTriangle(tri,new Color(0,255,0,0));
|
||||
}
|
||||
/*Another type of picking supported by the Irrlicht Engine is scene node
|
||||
picking based on bouding boxes. Every scene node has got a bounding box,
|
||||
and because of that, it's very fast for example to get the scene node
|
||||
which the camera looks at. Again, we ask the collision manager for this,
|
||||
and if we've got a scene node, we highlight it by disabling Lighting in
|
||||
its material, if it is not the billboard or the quake 3 level.*/
|
||||
selectedSceneNode=smgr.SceneCollisionManager.
|
||||
GetSceneNodeFromCameraBB(camera,0);
|
||||
|
||||
if (lastSelectedSceneNode!=null)
|
||||
lastSelectedSceneNode.SetMaterialFlag(
|
||||
MaterialFlag.LIGHTING, true);
|
||||
|
||||
if (selectedSceneNode==q3node||
|
||||
selectedSceneNode==bill)
|
||||
selectedSceneNode=null;
|
||||
|
||||
if(selectedSceneNode!=null)
|
||||
selectedSceneNode.SetMaterialFlag(
|
||||
MaterialFlag.LIGHTING,false);
|
||||
lastSelectedSceneNode=selectedSceneNode;
|
||||
|
||||
/*That's it, we just have to finish drawing.*/
|
||||
|
||||
driver.EndScene();
|
||||
|
||||
int fps = device.VideoDriver.FPS;
|
||||
if (lastFPS != fps)
|
||||
{
|
||||
device.WindowCaption = "Irrlicht Engine - Quake 3 Map example [" +
|
||||
device.VideoDriver.Name + "] FPS:" + fps.ToString();
|
||||
lastFPS = fps;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
In the end, delete the Irrlicht device.
|
||||
*/
|
||||
// Instead of device->drop, we'll use:
|
||||
GC.Collect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Retrieved from "http://www.irrforge.org/index.php/CS_Tutorial_7"
|
||||
// This page has been accessed 220 times. This page was last modified 06:51, 20 Jan 2006.
|
||||
|
289
examples.net/Examples_CSharp/example08.cs
Normal file
289
examples.net/Examples_CSharp/example08.cs
Normal file
@ -0,0 +1,289 @@
|
||||
/*
|
||||
In this tutorial, we explore some of the special effects that are possible with Irrlicht.
|
||||
*/
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
|
||||
using Irrlicht;
|
||||
using Irrlicht.Video;
|
||||
using Irrlicht.GUI;
|
||||
using Irrlicht.Core;
|
||||
using Irrlicht.Scene;
|
||||
|
||||
namespace _08._SpecialFX
|
||||
{
|
||||
class Program
|
||||
{
|
||||
string path="../../../../media/";
|
||||
IrrlichtDevice device;
|
||||
/// <summary>
|
||||
/// Main entry point for the program.
|
||||
/// </summary>
|
||||
/// <param name="args">Arguments to pass the software.</param>
|
||||
[STAThread]
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Program prog = new Program();
|
||||
prog.run();
|
||||
}
|
||||
|
||||
public void run()
|
||||
{
|
||||
/* At first, we let the user select the driver type,
|
||||
then start up the engine, set a caption, and get a
|
||||
pointer to the video driver.
|
||||
*/
|
||||
|
||||
// ask user for driver
|
||||
DriverType driverType;
|
||||
|
||||
// Ask user to select driver:
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("Please select the driver you want for this example:\n");
|
||||
sb.Append("\n(a) Direct3D 9.0c\n(b) Direct3D 8.1\n(c) OpenGL 1.5");
|
||||
sb.Append("\n(d) Software Renderer\n(e) Apfelbaum Software Renderer");
|
||||
sb.Append("\n(f) Null Device\n(otherKey) exit\n\n");
|
||||
|
||||
// Get the user's input:
|
||||
TextReader tIn = Console.In;
|
||||
TextWriter tOut = Console.Out;
|
||||
string input = string.Empty;
|
||||
bool shadows = false;
|
||||
tOut.Write("Do you want to use realtime shadows? (y/n)");
|
||||
input = tIn.ReadLine();
|
||||
if (input == "y") shadows = true;
|
||||
tOut.Write(sb.ToString());
|
||||
input = tIn.ReadLine();
|
||||
|
||||
// Select device based on user's input:
|
||||
switch (input)
|
||||
{
|
||||
case "a":
|
||||
driverType = DriverType.DIRECT3D9;
|
||||
break;
|
||||
case "b":
|
||||
driverType = DriverType.DIRECT3D8;
|
||||
break;
|
||||
case "c":
|
||||
driverType = DriverType.OPENGL;
|
||||
break;
|
||||
case "d":
|
||||
driverType = DriverType.SOFTWARE;
|
||||
break;
|
||||
case "e":
|
||||
driverType = DriverType.SOFTWARE2;
|
||||
break;
|
||||
case "f":
|
||||
driverType = DriverType.NULL_DRIVER;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
/* We start like in some tutorials before. Please note that this time, the
|
||||
'shadows' flag in createDevice() is set to true, for we want to have a
|
||||
dynamic shadow casted from an animated character. If your this example
|
||||
runs to slow, set it to false. The Irrlicht Engine checks if your hardware
|
||||
doesn't support the stencil buffer, and disables shadows by itself, but
|
||||
just in case the demo runs slow on your hardware.*/
|
||||
/*
|
||||
* From the unmanaged API documentation:
|
||||
* stencilbuffer:
|
||||
* Specifies if the stencil buffer should be enabled.
|
||||
* Set this to true, if you want the engine be able to draw stencil buffer shadows.
|
||||
* Note that not all devices are able to use the stencil buffer.
|
||||
* If they don't no shadows will be drawn.
|
||||
*/
|
||||
device = new IrrlichtDevice(driverType, new Dimension2D(1024, 768), 32, false, shadows, true);
|
||||
if (device == null)
|
||||
{
|
||||
tOut.Write("Device creation failed.");
|
||||
return;
|
||||
}
|
||||
|
||||
ISceneManager smgr=device.SceneManager;
|
||||
IVideoDriver driver=device.VideoDriver;
|
||||
|
||||
/* For our environment, we load a .3ds file. It is a small room I modelled with
|
||||
Anim8or and exported it into the 3ds format because the Irrlicht Engine did
|
||||
not support the .an8 format when I wrote this tutorial. I am a very bad 3d
|
||||
graphic artist, and so the texture mapping is not very nice in this model.
|
||||
Luckily I am a better programmer than artist, and so the Irrlicht Engine is
|
||||
able to create a cool texture mapping for me: Just use the mesh manipulator
|
||||
and create a planar texture mapping for the mesh. If you want to see the
|
||||
mapping I made with Anim8or, uncomment this line. I also did not figure out
|
||||
how to set the material right in Anim8or, it has an emissive light color
|
||||
which I don't really like. I'll switch it off too with this code.*/
|
||||
IAnimatedMesh mesh= smgr.GetMesh(
|
||||
path+"room.3ds");
|
||||
|
||||
smgr.MeshManipulator.MakePlanarTextureMapping(
|
||||
mesh.GetMesh(0), 0.008f);
|
||||
|
||||
ISceneNode node = smgr.AddAnimatedMeshSceneNode(mesh, null, 0);
|
||||
node.SetMaterialTexture(
|
||||
0,driver.GetTexture(path+"wall.jpg"));
|
||||
node.GetMaterial(0).EmissiveColor.Set(0,0,0,0);
|
||||
|
||||
// Add a shadow to the room if it is not dark enough
|
||||
/* The result is interesting but not exactly what I was expecting!
|
||||
Try for yourself... I think this could be a little problem in the
|
||||
Irrlicht.NET wrapper but I promise I will investigate further to see
|
||||
if I can make it work as intended
|
||||
Forum Article (http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=10584)
|
||||
*/
|
||||
// IAnimatedMeshSceneNode xnode = (IAnimatedMeshSceneNode)node;
|
||||
// xnode.AddShadowVolumeSceneNode();
|
||||
//
|
||||
/*Now, for the first special effect: Animated water. It works like this: The
|
||||
WaterSurfaceSceneNode takes a mesh as input and makes it wave like a water
|
||||
surface. And if we let this scene node use a nice material like the
|
||||
MT_REFLECTION_2_LAYER, it looks really cool. We are doing this with the
|
||||
next few lines of code. As input mesh, we create a hill plane mesh, without
|
||||
hills. But any other mesh could be used for this, you could even use the
|
||||
room.3ds (which would look really strange) if you wanted to.*/
|
||||
mesh = smgr.AddHillPlaneMesh("myHill",
|
||||
new Dimension2Df(20,20),
|
||||
new Dimension2D(40,40),new Material(),0,
|
||||
new Dimension2Df(0,0),
|
||||
new Dimension2Df(10,10));
|
||||
|
||||
node = smgr.AddWaterSurfaceSceneNode(mesh.GetMesh(0),3.0f,300.0f,30.0f,null,0);
|
||||
node.Position=new Vector3D(0,7,0);
|
||||
|
||||
node.SetMaterialTexture(0, driver.GetTexture(path+"water.jpg"));
|
||||
node.SetMaterialTexture(1, driver.GetTexture(path+"stones.jpg"));
|
||||
|
||||
node.SetMaterialType(MaterialType.REFLECTION_2_LAYER);
|
||||
|
||||
/*The second special effect is very basic, I bet you saw it already in some
|
||||
Irrlicht Engine demos: A transparent billboard combined with a dynamic light.
|
||||
We simply create a light scene node, let it fly around, an to make it look
|
||||
more cool, we attach a billboard scene node to it.*/
|
||||
// create light
|
||||
|
||||
node = smgr.AddLightSceneNode(null, new Vector3D(0,0,0),
|
||||
new Colorf(1.0f, 0.6f, 0.7f, 1.0f), 600.0f,0);
|
||||
ISceneNodeAnimator anim = smgr.CreateFlyCircleAnimator(new Vector3D(0,150,0),250.0f,0.0005f);
|
||||
node.AddAnimator(anim);
|
||||
|
||||
// attach billboard to light
|
||||
node = smgr.AddBillboardSceneNode(node, new Dimension2Df(50, 50),new Vector3D(),0);
|
||||
node.SetMaterialFlag(MaterialFlag.LIGHTING, false);
|
||||
node.SetMaterialType(MaterialType.TRANSPARENT_ADD_COLOR);
|
||||
node.SetMaterialTexture(0,
|
||||
driver.GetTexture(path+"particlewhite.bmp"));
|
||||
|
||||
/* The next special effect is a lot more interesting: A particle system. The
|
||||
particle system in the Irrlicht Engine is quit modular and extensible and
|
||||
yet easy to use. There is a particle system scene node into which you can
|
||||
put particle emitters, which make particles come out of nothing. These
|
||||
emitters are quite flexible and usually have lots of parameters like
|
||||
direction, amount and color of the particles they should create.
|
||||
There are different emitters, for example a point emitter which lets
|
||||
particles pop out at a fixed point. If the particle emitters available
|
||||
in the engine are not enough for you, you can easily create your own ones,
|
||||
you'll simply have to create a class derived from the IParticleEmitter
|
||||
interface and attach it to the particle system using setEmitter().
|
||||
In this example we create a box particle emitter, which creates particles
|
||||
randomly inside a box. The parameters define the box, direction of the
|
||||
articles, minimal and maximal new particles per second, color and minimal
|
||||
and maximal livetime of the particles. Because only with emitters particle
|
||||
system would be a little bit boring, there are particle affectors, which
|
||||
modify particles during they fly around. They can be added to the particle
|
||||
system, simulating additional effects like gravity or wind. The particle
|
||||
affector we use in this example is an affector, which modifies the color
|
||||
of the particles: It lets them fade out. Like the particle emitters,
|
||||
additional particle affectors can also be implemented by you, simply derive
|
||||
a class from IParticleAffector and add it with addAffector(). After we set
|
||||
a nice material to the particle system, we have a cool looking camp fire.
|
||||
By adjusting material, texture, particle emitter and affector parameters,
|
||||
it is also easily possible to create smoke, rain, explosions, snow, and
|
||||
so on.*/
|
||||
IParticleSystemSceneNode ps = smgr.AddParticleSystemSceneNode(
|
||||
false,null,0,new Vector3D(-70,60,40),new Vector3D(),new Vector3D(2,2,2));
|
||||
|
||||
ps.ParticleSize= new Dimension2Df(20,10);
|
||||
|
||||
IParticleEmitter em = ps.CreateBoxEmitter(
|
||||
new Box3D(-7,0,-7,7,1,7),new Vector3D(0.0f,0.03f,0.0f),
|
||||
80,100,
|
||||
new Color(0,255,255,255),new Color(0,255,255,255),
|
||||
800,2000,0);
|
||||
|
||||
ps.SetEmitter(em);
|
||||
|
||||
IParticleAffector paf=
|
||||
ps.CreateFadeOutParticleAffector(new Color(),1500);
|
||||
|
||||
ps.AddAffector(paf);
|
||||
|
||||
ps.SetMaterialFlag(MaterialFlag.LIGHTING, false);
|
||||
ps.SetMaterialTexture(0,
|
||||
driver.GetTexture(path+"particle.bmp"));
|
||||
ps.SetMaterialType(MaterialType.TRANSPARENT_VERTEX_ALPHA);
|
||||
|
||||
/*As our last special effect, we want a dynamic shadow be casted from an animated
|
||||
character. For this we load a quake 2 .md2 model and place it into our world.
|
||||
For creating the shadow, we simply need to call addShadowVolumeSceneNode(). The
|
||||
color of shadows is only adjustable globally for all shadows, by calling
|
||||
ISceneManager::setShadowColor(). Voila, here is our dynamic shadow. Because
|
||||
the character is a little bit too small for this scene, we make it bigger
|
||||
using setScale(). And because the character is lighted by a dynamic light,
|
||||
we need to normalize the normals to make the lighting on it correct. This
|
||||
is always necessary if the scale of a dynamic lighted model is not (1,1,1).
|
||||
Otherwise it would get too dark or too bright because the normals will be
|
||||
scaled too.*/
|
||||
mesh = smgr.GetMesh(path+"faerie.md2");
|
||||
IAnimatedMeshSceneNode anode = smgr.AddAnimatedMeshSceneNode(mesh,null,0);
|
||||
anode.Position = new Vector3D(-50,45,-60);
|
||||
anode.SetMD2Animation(MD2AnimationType.STAND);
|
||||
anode.SetMaterialTexture(0,
|
||||
driver.GetTexture(path+"Faerie5.BMP"));
|
||||
|
||||
// add shadow
|
||||
anode.AddShadowVolumeSceneNode();
|
||||
smgr.ShadowColor=new Color(220,0,0,0);
|
||||
|
||||
// make the model a little bit bigger and normalize its normals
|
||||
// because of this for correct lighting
|
||||
anode.Scale= new Vector3D(2,2,2);
|
||||
anode.SetMaterialFlag(MaterialFlag.NORMALIZE_NORMALS, true);
|
||||
|
||||
/*Finally we simply have to draw everything, that's all.*/
|
||||
ICameraSceneNode camera = smgr.AddCameraSceneNodeFPS();
|
||||
camera.Position=new Vector3D(-50,50,-150);
|
||||
// Remove the mouse cursor:
|
||||
device.CursorControl.Visible = false;
|
||||
int lastFPS=-1;
|
||||
|
||||
while (device.Run())
|
||||
{
|
||||
if (device.WindowActive)
|
||||
{
|
||||
device.VideoDriver.BeginScene(true, true, new Color(0, 200, 200, 200));
|
||||
device.SceneManager.DrawAll();
|
||||
device.VideoDriver.EndScene();
|
||||
|
||||
int fps = device.VideoDriver.FPS;
|
||||
if (lastFPS != fps)
|
||||
{
|
||||
device.WindowCaption = "Irrlicht Engine - SpecialFX tutorial [" +
|
||||
device.VideoDriver.Name + "] FPS:" + fps.ToString();
|
||||
lastFPS = fps;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
In the end, delete the Irrlicht device.
|
||||
*/
|
||||
// Instead of device->drop, we'll use:
|
||||
GC.Collect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Retrieved from "http://www.irrforge.org/index.php/CS_Tutorial_8"
|
||||
// This page has been accessed 247 times. This page was last modified 19:28, 23 Jan 2006.
|
||||
|
1079
examples.net/Examples_CSharp/example09.cs
Normal file
1079
examples.net/Examples_CSharp/example09.cs
Normal file
File diff suppressed because it is too large
Load Diff
391
examples.net/Examples_CSharp/example10.cs
Normal file
391
examples.net/Examples_CSharp/example10.cs
Normal file
@ -0,0 +1,391 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
|
||||
using Irrlicht;
|
||||
using Irrlicht.Video;
|
||||
using Irrlicht.GUI;
|
||||
using Irrlicht.Core;
|
||||
using Irrlicht.Scene;
|
||||
|
||||
namespace _10._Shaders
|
||||
{
|
||||
/*Because we want to use some interesting shaders in this tutorials, we need to set
|
||||
some data for them to make them able to compute nice colors. In this example,
|
||||
we'll use a simple vertex shader which will calculate the color of the vertex based
|
||||
on the position of the camera. For this, the shader needs the following data:
|
||||
The inverted world matrix for transforming the normal, the clip matrix for
|
||||
transforming the position, the camera position and the world position of the object
|
||||
for the calculation of the angle of light, and the color of the light. To be able
|
||||
to tell the shader all this data every frame, we have to derive a class from the
|
||||
IShaderConstantSetCallBack interface and override its only method, namely
|
||||
OnSetConstants(). This method will be called every time the material is set.
|
||||
The method setVertexShaderConstant() of the IMaterialRendererServices interface is
|
||||
used to set the data the shader needs. If the user chose to use a High Level shader
|
||||
language like HLSL instead of Assembler in this example, you have to set the
|
||||
variable name as parameter instead of the register index.*/
|
||||
class Program: IShaderConstantSetCallBack
|
||||
{
|
||||
string path="../../../../media/";
|
||||
IrrlichtDevice device;
|
||||
bool UseHighLevelShaders = false;
|
||||
|
||||
public virtual void OnSetConstants(IMaterialRendererServices services)
|
||||
{
|
||||
IVideoDriver driver = services.VideoDriver;
|
||||
|
||||
// set inverted world matrix
|
||||
// if we are using highlevel shaders (the user can select this when
|
||||
// starting the program), we must set the constants by name.
|
||||
Matrix4 invWorld = driver.GetTransform(TransformationState.WORLD);
|
||||
invWorld.MakeInverse();
|
||||
|
||||
if (UseHighLevelShaders)
|
||||
services.SetVertexShaderConstant("mInvWorld", invWorld.GetFloats(), 16);
|
||||
else
|
||||
services.SetVertexShaderConstant(invWorld.GetFloats(), 0, 4);
|
||||
|
||||
// set clip matrix
|
||||
Matrix4 worldViewProj;
|
||||
worldViewProj = driver.GetTransform(TransformationState.PROJECTION);
|
||||
worldViewProj *= driver.GetTransform(TransformationState.VIEW);
|
||||
worldViewProj *= driver.GetTransform(TransformationState.WORLD);
|
||||
|
||||
if (UseHighLevelShaders)
|
||||
services.SetVertexShaderConstant("mWorldViewProj", worldViewProj.GetFloats(), 16);
|
||||
else
|
||||
services.SetVertexShaderConstant(worldViewProj.GetFloats(), 4, 4);
|
||||
|
||||
// set camera position
|
||||
Vector3D pos = device.SceneManager.ActiveCamera.Position;
|
||||
|
||||
if (UseHighLevelShaders)
|
||||
services.SetVertexShaderConstant("mLightPos",vectorToArray(pos), 3);
|
||||
else
|
||||
services.SetVertexShaderConstant(vectorToArray(pos), 8, 1);
|
||||
|
||||
// set light color
|
||||
Colorf col= new Colorf(0.0f,1.0f,1.0f,0.0f);
|
||||
|
||||
if (UseHighLevelShaders)
|
||||
services.SetVertexShaderConstant("mLightColor", colorToArray(col), 4);
|
||||
else
|
||||
services.SetVertexShaderConstant(colorToArray(col), 9, 1);
|
||||
|
||||
// set transposed world matrix
|
||||
Matrix4 world = driver.GetTransform(TransformationState.WORLD);
|
||||
world = world.GetTransposed();
|
||||
|
||||
if (UseHighLevelShaders)
|
||||
services.SetVertexShaderConstant("mTransWorld", world.GetFloats(), 16);
|
||||
else
|
||||
services.SetVertexShaderConstant(world.GetFloats(), 10, 4);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Main entry point for the program.
|
||||
/// </summary>
|
||||
/// <param name="args">Arguments to pass the software.</param>
|
||||
[STAThread]
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Program prog = new Program();
|
||||
prog.run();
|
||||
}
|
||||
|
||||
public void run()
|
||||
{
|
||||
/* The next few lines start up the engine. Just like in most other tutorials
|
||||
before. But in addition, we ask the user if he wants this example to use
|
||||
high level shaders if he selected a driver which is capable of doing so.
|
||||
*/
|
||||
|
||||
// ask user for driver
|
||||
DriverType driverType;
|
||||
|
||||
// Ask user to select driver:
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("Please select the driver you want for this example:\n");
|
||||
sb.Append("\n(a) Direct3D 9.0c\n(b) Direct3D 8.1\n(c) OpenGL 1.5");
|
||||
sb.Append("\n(d) Software Renderer\n(e) Apfelbaum Software Renderer");
|
||||
sb.Append("\n(f) Null Device\n(otherKey) exit\n\n");
|
||||
|
||||
// Get the user's input:
|
||||
TextReader tIn = Console.In;
|
||||
TextWriter tOut = Console.Out;
|
||||
tOut.Write(sb.ToString());
|
||||
string input = tIn.ReadLine();
|
||||
|
||||
// Select device based on user's input:
|
||||
switch (input)
|
||||
{
|
||||
case "a":
|
||||
driverType = DriverType.DIRECT3D9;
|
||||
break;
|
||||
case "b":
|
||||
driverType = DriverType.DIRECT3D8;
|
||||
break;
|
||||
case "c":
|
||||
driverType = DriverType.OPENGL;
|
||||
break;
|
||||
case "d":
|
||||
driverType = DriverType.SOFTWARE;
|
||||
break;
|
||||
case "e":
|
||||
driverType = DriverType.SOFTWARE2;
|
||||
break;
|
||||
case "f":
|
||||
driverType = DriverType.NULL_DRIVER;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
// ask the user if we should use high level shaders for this example
|
||||
if (driverType == DriverType.DIRECT3D9 ||
|
||||
driverType == DriverType.OPENGL)
|
||||
{
|
||||
tOut.Write("Please press 'y' if you want to use high level shaders.\n");
|
||||
input=tIn.ReadLine();
|
||||
if (input.ToLower()=="y")
|
||||
UseHighLevelShaders=true;
|
||||
}
|
||||
|
||||
// create device
|
||||
device = new IrrlichtDevice(driverType, new Dimension2D(1024, 768), 32, false, true, true);
|
||||
if (device == null)
|
||||
{
|
||||
tOut.Write("Device creation failed.");
|
||||
return;
|
||||
}
|
||||
|
||||
ISceneManager smgr=device.SceneManager;
|
||||
IVideoDriver driver=device.VideoDriver;
|
||||
IGUIEnvironment gui = device.GUIEnvironment;
|
||||
|
||||
/*Now for the more interesting parts. If we are using Direct3D, we want to
|
||||
load vertex and pixel shader programs, if we have OpenGL, we want to use ARB
|
||||
fragment and vertex programs. I wrote the corresponding programs down into the
|
||||
files d3d8.ps, d3d8.vs, d3d9.ps, d3d9.vs, opengl.ps and opengl.vs. We only
|
||||
need the right filenames now. This is done in the following switch. Note,
|
||||
that it is not necessary to write the shaders into text files, like in this
|
||||
example. You can even write the shaders directly as strings into the cpp source
|
||||
file, and use later addShaderMaterial() instead of addShaderMaterialFromFiles().*/
|
||||
string vsFileName="" ;
|
||||
string psFileName="" ;
|
||||
|
||||
switch (driverType)
|
||||
{
|
||||
case DriverType.DIRECT3D8:
|
||||
psFileName = path+"d3d8.psh";
|
||||
vsFileName = path+"d3d8.vsh";
|
||||
break;
|
||||
case DriverType.DIRECT3D9:
|
||||
if (UseHighLevelShaders)
|
||||
{
|
||||
psFileName = path+"d3d9.hlsl";
|
||||
vsFileName = psFileName; // both shaders are in the same file
|
||||
}
|
||||
else
|
||||
{
|
||||
psFileName = path+"d3d9.psh";
|
||||
vsFileName = path+"d3d9.vsh";
|
||||
}
|
||||
break;
|
||||
case DriverType.OPENGL:
|
||||
if (UseHighLevelShaders)
|
||||
{
|
||||
psFileName = path+"opengl.frag";
|
||||
vsFileName = path+"opengl.vert";
|
||||
}
|
||||
else
|
||||
{
|
||||
psFileName = path+"opengl.psh";
|
||||
vsFileName = path+"opengl.vsh";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/*In addition, we check if the hardware and the selected renderer is capable
|
||||
of executing the shaders we want. If not, we simply set the filename string
|
||||
to 0. This is not necessary, but useful in this example: For example, if the
|
||||
hardware is able to execute vertex shaders but not pixel shaders, we create a
|
||||
new material which only uses the vertex shader, and no pixel shader. Otherwise,
|
||||
if we would tell the engine to create this material and the engine sees that
|
||||
the hardware wouldn't be able to fullfill the request completely, it would not
|
||||
create any new material at all. So in this example you would see at least the
|
||||
vertex shader in action, without the pixel shader.*/
|
||||
if(!driver.QueryFeature(VideoDriverFeature.PIXEL_SHADER_1_1)&&
|
||||
!driver.QueryFeature(VideoDriverFeature.ARB_FRAGMENT_PROGRAM_1))
|
||||
{
|
||||
// still unimplemented
|
||||
//device.Logger.log("WARNING: Pixel shaders disabled \n"+
|
||||
// "because of missing driver/hardware support.");
|
||||
psFileName = null;
|
||||
}
|
||||
if(!driver.QueryFeature(VideoDriverFeature.VERTEX_SHADER_1_1)&&
|
||||
!driver.QueryFeature(VideoDriverFeature.ARB_FRAGMENT_PROGRAM_1))
|
||||
{
|
||||
// still unimplemented
|
||||
//device.Logger.log("WARNING: Vertex shaders disabled \n"+
|
||||
// "because of missing driver/hardware support.");
|
||||
vsFileName = null;
|
||||
}
|
||||
|
||||
/*Now lets create the new materials. As you maybe know from previous examples,
|
||||
a material type in the Irrlicht engine is set by simply changing the
|
||||
MaterialType value in the SMaterial struct. And this value is just a simple
|
||||
32 bit value, like video::EMT_SOLID. So we only need the engine to create a
|
||||
new value for us which we can set there. To do this, we get a pointer to the
|
||||
IGPUProgrammingServices and call addShaderMaterialFromFiles(), which returns
|
||||
such a new 32 bit value. That's all. The parameters to this method are the
|
||||
following: First, the names of the files containing the code of the vertex
|
||||
and the pixel shader. If you would use addShaderMaterial() instead, you would
|
||||
not need file names, then you could write the code of the shader directly as
|
||||
string. The following parameter is a pointer to the IShaderConstantSetCallBack
|
||||
class we wrote at the beginning of this tutorial. If you don't want to set
|
||||
constants, set this to 0. The last paramter tells the engine which material
|
||||
it should use as base material. To demonstrate this, we create two materials
|
||||
with a different base material, one with EMT_SOLID and one with
|
||||
EMT_TRANSPARENT_ADD_COLOR.*/
|
||||
// create materials
|
||||
|
||||
IGPUProgrammingServices gpu = driver.GPUProgrammingServices;
|
||||
|
||||
int newMaterialType1 = 0;
|
||||
int newMaterialType2 = 0;
|
||||
|
||||
if(gpu!=null)
|
||||
{
|
||||
IShaderConstantSetCallBack callBack = this;
|
||||
// create the shaders depending on if the user wanted high level
|
||||
// or low level shaders:
|
||||
if(UseHighLevelShaders)
|
||||
{
|
||||
// create material from high level shaders (hlsl or glsl)
|
||||
newMaterialType1=gpu.AddHighLevelShaderMaterialFromFiles(
|
||||
vsFileName,"vertexMain",VertexShaderType.VST_VS_1_1,
|
||||
psFileName,"pixelMain",PixelShaderType.PST_PS_1_1,
|
||||
callBack,MaterialType.SOLID);
|
||||
newMaterialType2=gpu.AddHighLevelShaderMaterialFromFiles(
|
||||
vsFileName,"vertexMain",VertexShaderType.VST_VS_1_1,
|
||||
psFileName,"pixelMain",PixelShaderType.PST_PS_1_1,
|
||||
callBack,MaterialType.TRANSPARENT_ADD_COLOR);
|
||||
}
|
||||
else
|
||||
{
|
||||
newMaterialType1=gpu.AddShaderMaterialFromFiles(vsFileName,
|
||||
psFileName,callBack,MaterialType.SOLID);
|
||||
newMaterialType2=gpu.AddShaderMaterialFromFiles(vsFileName,
|
||||
psFileName,callBack,MaterialType.TRANSPARENT_ADD_COLOR);
|
||||
}
|
||||
}
|
||||
|
||||
/*Now its time for testing out the materials. We create a test cube and set the
|
||||
material we created. In addition, we add a text scene node to the cube and a
|
||||
rotatation animator, to make it look more interesting and important.*/
|
||||
|
||||
// create test scene node 1, with the new created material type 1
|
||||
ISceneNode node = smgr.AddTestSceneNode(50,null,0,new Vector3D(0,0,0));
|
||||
node.SetMaterialTexture(0,driver.GetTexture(path+"wall.bmp"));
|
||||
node.SetMaterialType((MaterialType)newMaterialType1);
|
||||
|
||||
smgr.AddTextSceneNode(gui.BuiltInFont,"PS & VS & EMT_SOLID",
|
||||
new Color(255,255,255,255),node,new Vector3D(),0);
|
||||
|
||||
ISceneNodeAnimator anim= smgr.CreateRotationAnimator(
|
||||
new Vector3D(0,0.3f,0));
|
||||
node.AddAnimator(anim);
|
||||
|
||||
//Same for the second cube, but with the second material we created.
|
||||
node = smgr.AddTestSceneNode(50,null,0,new Vector3D(0,-10,50));
|
||||
node.SetMaterialTexture(0,driver.GetTexture(path+"wall.bmp"));
|
||||
node.SetMaterialType((MaterialType)newMaterialType2);
|
||||
|
||||
smgr.AddTextSceneNode(gui.BuiltInFont,"PS & VS & EMT_TRANSPARENT",
|
||||
new Color(255,255,255,255),node,new Vector3D(),0);
|
||||
|
||||
anim= smgr.CreateRotationAnimator(
|
||||
new Vector3D(0,0.3f,0));
|
||||
node.AddAnimator(anim);
|
||||
|
||||
// Then we add a third cube without a shader on it, to be able to compare the cubes.
|
||||
node = smgr.AddTestSceneNode(50,null,0,new Vector3D(0,50,25));
|
||||
node.SetMaterialTexture(0,driver.GetTexture(path+"wall.bmp"));
|
||||
smgr.AddTextSceneNode(gui.BuiltInFont,"NO SHADER",
|
||||
new Color(255,255,255,255),node,new Vector3D(),0);
|
||||
|
||||
//And last, we add a skybox and a user controlled camera to the scene. For the
|
||||
//skybox textures, we disable mipmap generation, because we don't need mipmaps on it.
|
||||
|
||||
// add a nice skybox
|
||||
driver.SetTextureCreationFlag(TextureCreationFlag.CREATE_MIP_MAPS,false);
|
||||
smgr.AddSkyBoxSceneNode(
|
||||
driver.GetTexture(path+"irrlicht2_up.jpg"),
|
||||
driver.GetTexture(path+"irrlicht2_dn.jpg"),
|
||||
driver.GetTexture(path+"irrlicht2_lf.jpg"),
|
||||
driver.GetTexture(path+"irrlicht2_rt.jpg"),
|
||||
driver.GetTexture(path+"irrlicht2_ft.jpg"),
|
||||
driver.GetTexture(path+"irrlicht2_bk.jpg"),
|
||||
null,0);
|
||||
driver.SetTextureCreationFlag(TextureCreationFlag.CREATE_MIP_MAPS,true);
|
||||
|
||||
// add a camera and disable the mouse cursor
|
||||
ICameraSceneNode cam = smgr.AddCameraSceneNodeFPS(null,100,100,0);
|
||||
cam.Position=new Vector3D(-100,50,100);
|
||||
cam.Target=new Vector3D();
|
||||
device.CursorControl.Visible=false;
|
||||
|
||||
/*Finally we simply have to draw everything, that's all.*/
|
||||
int lastFPS=-1;
|
||||
|
||||
while (device.Run())
|
||||
{
|
||||
if (device.WindowActive)
|
||||
{
|
||||
device.VideoDriver.BeginScene(true, true, new Color(0, 200, 200, 200));
|
||||
device.SceneManager.DrawAll();
|
||||
device.VideoDriver.EndScene();
|
||||
|
||||
int fps = device.VideoDriver.FPS;
|
||||
if (lastFPS != fps)
|
||||
{
|
||||
device.WindowCaption = "Irrlicht Engine - Quake 3 Map example [" +
|
||||
device.VideoDriver.Name + "] FPS:" + fps.ToString();
|
||||
lastFPS = fps;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
In the end, delete the Irrlicht device.
|
||||
*/
|
||||
// Instead of device->drop, we'll use:
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
float[] colorToArray (Colorf p_m)
|
||||
{
|
||||
float[] t_a=new float[4];
|
||||
t_a[0]=p_m.r;
|
||||
t_a[1]=p_m.g;
|
||||
t_a[2]=p_m.b;
|
||||
t_a[3]=p_m.a;
|
||||
return t_a;
|
||||
}
|
||||
|
||||
float[] vectorToArray (Vector3D p_m)
|
||||
{
|
||||
float[] t_a=new float[4];
|
||||
t_a[0]=p_m.X;
|
||||
t_a[1]=p_m.Y;
|
||||
t_a[2]=p_m.Z;
|
||||
t_a[3]=0;
|
||||
return t_a;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Retrieved from "http://www.irrforge.org/index.php/CS_Tutorial_10"
|
||||
// This page has been accessed 185 times. This page was last modified 06:57, 20 Jan 2006.
|
||||
|
249
examples.net/Examples_CSharp/example12.cs
Normal file
249
examples.net/Examples_CSharp/example12.cs
Normal file
@ -0,0 +1,249 @@
|
||||
/*
|
||||
Lets start like the HelloWorld example: We include
|
||||
the irrlicht header files and an additional file to be able
|
||||
to ask the user for a driver type using the console.
|
||||
*/
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
|
||||
using Irrlicht;
|
||||
using Irrlicht.Video;
|
||||
using Irrlicht.Core;
|
||||
using Irrlicht.Scene;
|
||||
using Irrlicht.GUI;
|
||||
|
||||
namespace _12.TerrainRendering
|
||||
{
|
||||
class Program: IEventReceiver
|
||||
{
|
||||
string path="../../../../media/";
|
||||
ITerrainSceneNode terrain;
|
||||
bool isWireframe=false;
|
||||
|
||||
//ISceneNode node=null;
|
||||
/// <summary>
|
||||
/// Main entry point for the program.
|
||||
/// </summary>
|
||||
/// <param name="args">Arguments to pass the software.</param>
|
||||
[STAThread]
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Program prog = new Program();
|
||||
prog.run();
|
||||
}
|
||||
|
||||
/* In the beginning there is nothing special. We include the needed header files
|
||||
and create an event listener to listen if the user presses the 'W' key so we
|
||||
can switch to wireframe mode and if he presses 'D' we toggle to material
|
||||
between solid and detail mapped.
|
||||
*/
|
||||
public bool OnEvent(Event p_event)
|
||||
{
|
||||
// check if user presses the key 'W' or 'D'
|
||||
if (p_event.Type == EventType.KeyInput &&
|
||||
!p_event.KeyPressedDown)
|
||||
{
|
||||
switch(p_event.Key)
|
||||
{
|
||||
case KeyCode.KEY_KEY_W:
|
||||
isWireframe=!isWireframe;
|
||||
terrain.SetMaterialFlag(MaterialFlag.WIREFRAME,isWireframe);
|
||||
break;
|
||||
case KeyCode.KEY_KEY_D:
|
||||
terrain.SetMaterialType(
|
||||
terrain.GetMaterial(0).Type==MaterialType.SOLID?
|
||||
MaterialType.DETAIL_MAP : MaterialType.SOLID);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void run()
|
||||
{
|
||||
/* The start of the main function starts like in most other example.
|
||||
We ask the user for the desired renderer and start it up.
|
||||
*/
|
||||
|
||||
// ask user for driver
|
||||
DriverType driverType;
|
||||
|
||||
// Ask user to select driver:
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("Please select the driver you want for this example:\n");
|
||||
sb.Append("\n(a) Direct3D 9.0c\n(b) Direct3D 8.1\n(c) OpenGL 1.5");
|
||||
sb.Append("\n(d) Software Renderer\n(e)Apfelbaum Software Renderer");
|
||||
sb.Append("\n(f) Null Device\n(otherKey) exit\n\n");
|
||||
|
||||
// Get the user's input:
|
||||
TextReader tIn = Console.In;
|
||||
TextWriter tOut = Console.Out;
|
||||
tOut.Write(sb.ToString());
|
||||
string input = tIn.ReadLine();
|
||||
|
||||
// Select device based on user's input:
|
||||
switch (input)
|
||||
{
|
||||
case "a":
|
||||
driverType = DriverType.DIRECT3D9;
|
||||
break;
|
||||
case "b":
|
||||
driverType = DriverType.DIRECT3D8;
|
||||
break;
|
||||
case "c":
|
||||
driverType = DriverType.OPENGL;
|
||||
break;
|
||||
case "d":
|
||||
driverType = DriverType.SOFTWARE;
|
||||
break;
|
||||
case "e":
|
||||
driverType = DriverType.SOFTWARE2;
|
||||
break;
|
||||
case "f":
|
||||
driverType = DriverType.NULL_DRIVER;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
// Create device and exit if creation fails:
|
||||
IrrlichtDevice device = new IrrlichtDevice(
|
||||
driverType, new Dimension2D(640, 480), 32, false, true, true);
|
||||
if (device == null)
|
||||
{
|
||||
tOut.Write("Device creation failed.");
|
||||
return;
|
||||
}
|
||||
|
||||
/* set this as event receiver*/
|
||||
device.EventReceiver=this;
|
||||
/*************************************************/
|
||||
/* First, we add standard stuff to the scene: A nice irrlicht engine logo,
|
||||
a small help text, a user controlled camera, and we disable the mouse
|
||||
cursor.*/
|
||||
ISceneManager smgr=device.SceneManager;
|
||||
IVideoDriver driver=device.VideoDriver;
|
||||
IGUIEnvironment env= device.GUIEnvironment;
|
||||
|
||||
driver.SetTextureCreationFlag(TextureCreationFlag.ALWAYS_32_BIT,true);
|
||||
|
||||
// add irrlicht logo
|
||||
env.AddImage(driver.GetTexture(path+"irrlichtlogoalpha.tga"),
|
||||
new Position2D(10,10),true,null,0,"");
|
||||
|
||||
// add some help text
|
||||
IGUIStaticText text = env.AddStaticText(
|
||||
"Press 'W' to change wireframe mode\nPress 'D' to toggle detail map",
|
||||
new Rect(10,453,200,475), true, true, null, -1);
|
||||
|
||||
// add camera
|
||||
ICameraSceneNode camera =
|
||||
smgr.AddCameraSceneNodeFPS(null,100.0f,1200.0f,-1);
|
||||
camera.Position=new Vector3D(1900*2,255*2,3700*2);
|
||||
camera.Target= new Vector3D(2397*2,343*2,2700*2);
|
||||
camera.FarValue=12000.0f;
|
||||
|
||||
// disable mouse cursor
|
||||
device.CursorControl.Visible=false;
|
||||
/* Here comes the terrain renderer scene node: We add it just like any other scene
|
||||
node to the scene using ISceneManager::addTerrainSceneNode(). The only parameter
|
||||
we use is a file name to the heightmap we use. A heightmap is simply a gray
|
||||
scale texture. The terrain renderer loads it and creates the 3D terrain
|
||||
from it.
|
||||
To make the terrain look more big, we change the scale factor of it to
|
||||
(40, 4.4, 40). Because we don't have any dynamic lights in the scene, we
|
||||
switch off the lighting, and we set the file terrain-texture.jpg as texture
|
||||
for the terrain and detailmap3.jpg as second texture, called detail map.
|
||||
At last, we set the scale values for the texture: The first texture will be
|
||||
repeated only one time over the whole terrain, and the second one (detail map)
|
||||
20 times.
|
||||
*/
|
||||
// add terrain scene node
|
||||
terrain = smgr.AddTerrainSceneNode(
|
||||
path+"terrain-heightmap.bmp",null,-1,
|
||||
new Vector3D(),new Vector3D(40, 4.4f, 40), new Color(255,255,255,255));
|
||||
|
||||
terrain.SetMaterialFlag(MaterialFlag.LIGHTING, false);
|
||||
terrain.SetMaterialType(MaterialType.DETAIL_MAP);
|
||||
terrain.SetMaterialTexture(0, driver.GetTexture(path+"terrain-texture.jpg"));
|
||||
terrain.SetMaterialTexture(1, driver.GetTexture(path+"detailmap3.jpg"));
|
||||
|
||||
|
||||
terrain.ScaleTexture(1.0f, 20.0f);
|
||||
|
||||
/* To be able to do collision with the terrain, we create a triangle selector.
|
||||
If you want to know what triangle selectors do, just take a look into the
|
||||
collision tutorial. The terrain triangle selector works together with the
|
||||
terrain. To demonstrate this, we create a collision response animator and
|
||||
attach it to the camera, so that the camera will not be able to fly through
|
||||
the terrain.*/
|
||||
// create triangle selector for the terrain
|
||||
ITriangleSelector selector =
|
||||
smgr.CreateTerrainTriangleSelector(terrain, 0);
|
||||
|
||||
// create collision response animator and attach it to the camera
|
||||
ISceneNodeAnimator anim = smgr.CreateCollisionResponseAnimator(
|
||||
selector, camera, new Vector3D(60,100,60),
|
||||
new Vector3D(0,0,0),
|
||||
new Vector3D(0,50,0),0.0005f);
|
||||
camera.AddAnimator(anim);
|
||||
|
||||
//we add the skybox which we already used in lots of Irrlicht examples.
|
||||
driver.SetTextureCreationFlag(TextureCreationFlag.CREATE_MIP_MAPS, false);
|
||||
|
||||
smgr.AddSkyBoxSceneNode(
|
||||
driver.GetTexture(path+"irrlicht2_up.jpg"),
|
||||
driver.GetTexture(path+"irrlicht2_dn.jpg"),
|
||||
driver.GetTexture(path+"irrlicht2_lf.jpg"),
|
||||
driver.GetTexture(path+"irrlicht2_rt.jpg"),
|
||||
driver.GetTexture(path+"irrlicht2_ft.jpg"),
|
||||
driver.GetTexture(path+"irrlicht2_bk.jpg"),null,0);
|
||||
|
||||
driver.SetTextureCreationFlag(TextureCreationFlag.CREATE_MIP_MAPS, true);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* That's it, draw everything. Now you know how to use terrain
|
||||
in Irrlicht.
|
||||
*/
|
||||
int lastFPS = -1;
|
||||
|
||||
while (device.Run())
|
||||
{
|
||||
if (device.WindowActive)
|
||||
{
|
||||
device.VideoDriver.BeginScene(true, true, new Color(0, 200, 200, 200));
|
||||
device.SceneManager.DrawAll();
|
||||
device.VideoDriver.EndScene();
|
||||
|
||||
int fps = device.VideoDriver.FPS;
|
||||
if (lastFPS != fps)
|
||||
{
|
||||
device.WindowCaption = "Irrlicht Engine - Terrain example [" +
|
||||
device.VideoDriver.Name + "] FPS:" + fps.ToString();
|
||||
lastFPS = fps;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
In the end, delete the Irrlicht device.
|
||||
*/
|
||||
// Instead of device.drop, we'll use:
|
||||
GC.Collect();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
// Retrieved from "http://www.irrforge.org/index.php/CS_Tutorial_12"
|
||||
// This page has been accessed 228 times. This page was last modified 06:58, 20 Jan 2006.
|
||||
|
166
examples.net/Examples_CSharp/example14.cs
Normal file
166
examples.net/Examples_CSharp/example14.cs
Normal file
@ -0,0 +1,166 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Irrlicht;
|
||||
using Irrlicht.Core;
|
||||
using Irrlicht.Scene;
|
||||
|
||||
namespace _14.WindowsForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Shows irrlicht running in a windows .net form
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Create as a normal windows application, add the usual irrlicht refs and dll's..
|
||||
/// This has been collapsed from 3 files into one for posting.
|
||||
/// </remarks>
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
IrrlichtDevice device;
|
||||
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Form1_Load(object sender, EventArgs e)
|
||||
{
|
||||
// this is not necessarily the best place to load and
|
||||
// initialise Irrlicht, however, it does work.
|
||||
this.Show();
|
||||
runIrrlichtInWindowsFormTest(pictureBox1);
|
||||
}
|
||||
|
||||
void runIrrlichtInWindowsFormTest(Control c)
|
||||
{
|
||||
device = new IrrlichtDevice(Irrlicht.Video.DriverType.DIRECT3D9,
|
||||
new Dimension2D(c.Width, c.Height),
|
||||
32, false, false, false, true, c.Handle);
|
||||
ICameraSceneNode cam = device.SceneManager.AddCameraSceneNode(null, new Vector3D(), new Vector3D(), -1);
|
||||
ISceneNodeAnimator anim = device.SceneManager.CreateFlyCircleAnimator(new Vector3D(0, 10, 0), 30.0f, 0.003f);
|
||||
cam.AddAnimator(anim);
|
||||
ISceneNode cube = device.SceneManager.AddTestSceneNode(25, null, -1, new Vector3D());
|
||||
cube.SetMaterialTexture(0, device.VideoDriver.GetTexture("../../../media/rockwall.bmp"));
|
||||
cube.SetMaterialFlag(MaterialFlag.LIGHTING, false);
|
||||
// draw everything
|
||||
// Note, using device.WindowActive will not work on a control, since we don't
|
||||
// really activate controls..
|
||||
while (device.Run() && c.Enabled)
|
||||
{
|
||||
device.VideoDriver.BeginScene(true, true, new Irrlicht.Video.Color(255, 0, 0, 50));
|
||||
device.SceneManager.DrawAll();
|
||||
device.GUIEnvironment.DrawAll();
|
||||
device.VideoDriver.EndScene();
|
||||
}
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
pictureBox1.Enabled = false;
|
||||
this.Close();
|
||||
}
|
||||
#region Ripped from the Form1.Designer.cs
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.pictureBox1.Location = new System.Drawing.Point(12, 37);
|
||||
this.pictureBox1.Name = "pictureBox1";
|
||||
this.pictureBox1.Size = new System.Drawing.Size(267, 207);
|
||||
this.pictureBox1.TabIndex = 0;
|
||||
this.pictureBox1.TabStop = false;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(206, 250);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(75, 23);
|
||||
this.button1.TabIndex = 1;
|
||||
this.button1.Text = "Quit";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(12, 13);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(94, 13);
|
||||
this.label1.TabIndex = 2;
|
||||
this.label1.Text = "Irrlicht in a window";
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(292, 293);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.pictureBox1);
|
||||
this.Name = "Form1";
|
||||
this.Text = "Form1";
|
||||
this.Load += new System.EventHandler(this.Form1_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.PictureBox pictureBox1;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
#endregion
|
||||
#region ripped from Program.cs
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new Form1());
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
// Retrieved from "http://www.irrforge.org/index.php/CS_Tutorial_14"
|
||||
// This page has been accessed 299 times. This page was last modified 17:29, 22 Jan 2006.
|
||||
|
5
examples.net/Examples_CSharp/readme.txt
Normal file
5
examples.net/Examples_CSharp/readme.txt
Normal file
@ -0,0 +1,5 @@
|
||||
These Tutorials have simply been copied from the Irrlicht Wiki at http://www.irrforge.org
|
||||
They are written by different authors, and not guaranteed to work, they simply should provide
|
||||
the c++ examples ported the Irrlicht.NET.
|
||||
Please see the wiki for updates and more info.
|
||||
A lot of thanks go to the people who wrote these examples.
|
95
examples.net/Examples_Delphi/example01.pas
Normal file
95
examples.net/Examples_Delphi/example01.pas
Normal file
@ -0,0 +1,95 @@
|
||||
program HelloWorld_pas;
|
||||
|
||||
{$APPTYPE CONSOLE}
|
||||
|
||||
{%DelphiDotNetAssemblyCompiler '$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.dll'} {%DelphiDotNetAssemblyCompiler '$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.Data.dll'} {%DelphiDotNetAssemblyCompiler '$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.Windows.Forms.dll'} {%DelphiDotNetAssemblyCompiler '..\..\bin\visualstudio\Irrlicht.NET.dll'}
|
||||
|
||||
|
||||
uses
|
||||
|
||||
System.Windows.Forms,
|
||||
Irrlicht,
|
||||
Irrlicht.Video,
|
||||
Irrlicht.Core,
|
||||
Irrlicht.Scene;
|
||||
var
|
||||
|
||||
device : IrrlichtDevice;
|
||||
texSydney, texWall, texLogo : ITexture;
|
||||
mesh : Irrlicht.Scene.IAnimatedMesh;
|
||||
cam : ICameraSceneNode;
|
||||
node : ISceneNode;
|
||||
fps : integer;
|
||||
s : char;
|
||||
begin
|
||||
|
||||
WriteLn( 'Please select the driver you want for this example :' );
|
||||
WriteLn( ' (a) Direct3D 9.0c' );
|
||||
WriteLn( ' (b) Direct3D 8.1' );
|
||||
WriteLn( ' (c) OpenGL 1.2' );
|
||||
WriteLn( ' (d) Software Renderer' );
|
||||
WriteLn( ' (e) NullDevice' );
|
||||
WriteLn( ' (otherKey) exit' );
|
||||
WriteLn( );
|
||||
ReadLn( s );
|
||||
// start up the engine
|
||||
case s of
|
||||
'a' : device := IrrlichtDevice.Create(DriverType.DIRECTX9);
|
||||
'b' : device := IrrlichtDevice.Create(DriverType.DIRECTX8);
|
||||
'c' : device := IrrlichtDevice.Create(DriverType.OPENGL);
|
||||
'd' : device := IrrlichtDevice.Create(DriverType.SOFTWARE);
|
||||
'e' : device := IrrlichtDevice.Create(DriverType.NULL_DRIVER);
|
||||
else
|
||||
exit;
|
||||
end;
|
||||
device.ResizeAble := true;
|
||||
device.WindowCaption := 'Irrlicht.NET via Delphi.NET example 01 - Hello World [ '+ device.VideoDriver.Name + ' ] fps : ' + fps.ToString;
|
||||
// load some textures
|
||||
texSydney := device.VideoDriver.GetTexture('..\..\media\sydney.bmp');
|
||||
texWall := device.VideoDriver.GetTexture('..\..\media\wall.bmp');
|
||||
texLogo := device.VideoDriver.GetTexture('..\..\media\irrlichtlogoaligned.jpg');
|
||||
// load the animated mesh of sydney
|
||||
mesh := device.SceneManager.GetMesh('..\..\media\sydney.md2');
|
||||
if (mesh = nil) then
|
||||
begin
|
||||
System.Windows.Forms.MessageBox.Show(
|
||||
'Could not load mesh ..\..\media\sydney.md2, exiting.',
|
||||
'Problem starting program');
|
||||
exit;
|
||||
end;
|
||||
// add a camera, a test scene node and the animated mesh to the scene
|
||||
cam := device.SceneManager.AddCameraSceneNodeFPS(nil, 100, 100, -1);
|
||||
cam.Position := Vector3D.Create(20,0,-50);
|
||||
|
||||
|
||||
|
||||
node := device.SceneManager.AddTestSceneNode(15, nil, -1, Vector3D.Create(30,-15,0));
|
||||
node.SetMaterialTexture(0, texWall);
|
||||
node := device.SceneManager.AddAnimatedMeshSceneNode(mesh, nil, -1);
|
||||
node.SetMaterialTexture(0, texSydney);
|
||||
node.SetMaterialFlag(MaterialFlag.LIGHTING, false);
|
||||
// make cursor invisible
|
||||
device.CursorControl.Visible := false;
|
||||
// start drawing loop
|
||||
fps := 0;
|
||||
while( device.Run ) do
|
||||
begin
|
||||
if (device.WindowActive) then
|
||||
begin
|
||||
device.VideoDriver.BeginScene( true, true, Color.Create( 0, 100, 100, 100 ) );
|
||||
device.SceneManager.DrawAll();
|
||||
// draw the logo
|
||||
device.VideoDriver.Draw2DImage(
|
||||
texLogo, Position2D.Create( 10, 10 ),
|
||||
Rect.Create( 0,0,88,31 ),
|
||||
Rect.Create( Position2D.Create( 0, 0 ),device.VideoDriver.ScreenSize),
|
||||
Color.Create($ffffff), false);
|
||||
device.VideoDriver.EndScene();
|
||||
if (fps <> device.VideoDriver.FPS) then
|
||||
begin
|
||||
fps := device.VideoDriver.FPS;
|
||||
device.WindowCaption := 'Irrlicht.NET via Delphi.NET example 01 - Hello World [ '+ device.VideoDriver.Name + ' ] fps : ' + fps.ToString;
|
||||
end;
|
||||
end;
|
||||
end; // end drawing-loop
|
||||
end.
|
102
examples.net/Examples_Delphi/example02.pas
Normal file
102
examples.net/Examples_Delphi/example02.pas
Normal file
@ -0,0 +1,102 @@
|
||||
program Quake3Map_pas;
|
||||
|
||||
{$APPTYPE CONSOLE}
|
||||
|
||||
{%DelphiDotNetAssemblyCompiler '$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.dll'} {%DelphiDotNetAssemblyCompiler '$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.Data.dll'} {%DelphiDotNetAssemblyCompiler '$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.Windows.Forms.dll'} {%DelphiDotNetAssemblyCompiler '$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.Drawing.dll'} {%DelphiDotNetAssemblyCompiler '..\..\bin\win32-visualstudio\Irrlicht.NET.dll'}
|
||||
|
||||
|
||||
uses
|
||||
|
||||
System.Windows.Forms,
|
||||
Irrlicht,
|
||||
Irrlicht.Video,
|
||||
Irrlicht.Core,
|
||||
Irrlicht.Scene;
|
||||
var
|
||||
|
||||
device : IrrlichtDevice;
|
||||
texLogo : ITexture;
|
||||
mesh : Irrlicht.Scene.IAnimatedMesh;
|
||||
node : ISceneNode;
|
||||
fps : integer;
|
||||
s : char;
|
||||
driver : IVideoDriver;
|
||||
smgr :ISceneManager;
|
||||
begin
|
||||
|
||||
WriteLn( 'Please select the driver you want for this example :' );
|
||||
WriteLn( ' (a) Direct3D 9.0c' );
|
||||
WriteLn( ' (b) Direct3D 8.1' );
|
||||
WriteLn( ' (c) OpenGL 1.2' );
|
||||
WriteLn( ' (d) Software Renderer' );
|
||||
WriteLn( ' (e) NullDevice' );
|
||||
WriteLn( ' (otherKey) exit' );
|
||||
WriteLn( );
|
||||
ReadLn( s );
|
||||
// start up the engine
|
||||
case s of
|
||||
'a' : device := IrrlichtDevice.Create(DriverType.DIRECTX9);
|
||||
'b' : device := IrrlichtDevice.Create(DriverType.DIRECTX8);
|
||||
'c' : device := IrrlichtDevice.Create(DriverType.OPENGL);
|
||||
'd' : device := IrrlichtDevice.Create(DriverType.SOFTWARE);
|
||||
'e' : device := IrrlichtDevice.Create(DriverType.NULL_DRIVER);
|
||||
else
|
||||
exit;
|
||||
end;
|
||||
device.ResizeAble := true;
|
||||
device.WindowCaption := 'Irrlicht.NET via Delphi.NET example 02 - Quake3Map [ '+ device.VideoDriver.Name + ' ] fps : ' + fps.ToString;
|
||||
driver := device.VideoDriver;
|
||||
smgr := device.SceneManager;
|
||||
{*
|
||||
To display the Quake 3 map, we first need to load it. Quake 3 maps are packed into .pk3 files wich are nothing other than .zip files. So we add the .pk3 file to our FileSystem. After it was added, we are able to read from the files in that archive as they would directly be stored on disk. *}
|
||||
|
||||
device.FileSystem.AddZipFileArchive('../../media/map-20kdm2.pk3');
|
||||
{*
|
||||
Now we can load the mesh by calling getMesh(). We get a pointer returned to a IAnimatedMesh. As you know, Quake 3 maps are not really animated, they are only a huge chunk of static geometry with some materials attached. Hence the IAnimated mesh consists of only one frame, so we get the "first frame" of the "animation", which is our quake level and create an OctTree scene node with it, using addOctTreeSceneNode(). The OctTree optimizes the scene a little bit, trying to draw only geometry which is currently visible. An alternative to the OctTree would be a AnimatedMeshSceneNode, which would draw always the complete geometry of the mesh, without optimization. Try it out: Write addAnimatedMeshSceneNode instead of addOctTreeSceneNode and compare the primitives drawed by the video driver. (There is a getPrimitiveCountDrawed() method in the IVideoDriver class). Note that this optimization with the Octree is only useful when drawing huge meshes consiting of lots of geometry. *}
|
||||
|
||||
// load the animated mesh of sydney
|
||||
mesh := smgr.GetMesh('20kdm2.bsp');
|
||||
node := nil;
|
||||
if (mesh <> nil) then
|
||||
begin
|
||||
node := smgr.addOctTreeSceneNode( mesh.GetMesh( 0 ), nil, 0 );
|
||||
end;
|
||||
{*
|
||||
Because the level was modelled not around the origin (0,0,0), we translate the whole level a little bit. *} if (node <> nil) then node.Position := Vector3D.Create( -1300,-144,-1249 );
|
||||
|
||||
{*
|
||||
Now we only need a Camera to look at the Quake 3 map. And we want to create a user controlled camera. There are some different cameras available in the Irrlicht engine. For example the Maya Camera which can be controlled compareable to the camera in Maya: Rotate with left mouse button pressed, Zoom with both buttons pressed, translate with right mouse button pressed. This could be created with addCameraSceneNodeMaya(). But for this example, we want to create a camera which behaves like the ones in first person shooter games (FPS). *} smgr.AddCameraSceneNodeFPS();
|
||||
|
||||
texLogo := driver.GetTexture('../../media/irrlichtlogoaligned.jpg');
|
||||
|
||||
|
||||
|
||||
// make cursor invisible
|
||||
device.CursorControl.Visible := false;
|
||||
// start drawing loop
|
||||
fps := 0;
|
||||
while( device.Run ) do
|
||||
begin
|
||||
if (device.WindowActive) then
|
||||
begin
|
||||
driver.BeginScene( true, true, Color.Create( 0, 200, 200, 200 ) );
|
||||
smgr.DrawAll();
|
||||
// draw the logo
|
||||
driver.Draw2DImage(
|
||||
texLogo, Position2D.Create( 10, 10 ),
|
||||
Rect.Create( 0,0,88,31 ),
|
||||
Rect.Create( Position2D.Create( 0, 0 ),device.VideoDriver.ScreenSize),
|
||||
Color.Create($ffffff), false);
|
||||
driver.EndScene();
|
||||
if (fps <> driver.FPS) then
|
||||
begin
|
||||
fps := driver.FPS;
|
||||
device.WindowCaption := 'Irrlicht.NET via Delphi.NET example 02 - Quake3Map [ '+ device.VideoDriver.Name + ' ] fps : ' + fps.ToString;
|
||||
end;
|
||||
end;
|
||||
end; // end drawing-loop
|
||||
end.
|
||||
|
||||
// Retrieved from "http://www.irrforge.org/index.php/Delphi.NET_version_of_Quake3Map"
|
||||
// This page has been accessed 364 times. This page was last modified 07:00, 20 Jan 2006.
|
||||
|
127
examples.net/Examples_Delphi/example06.pas
Normal file
127
examples.net/Examples_Delphi/example06.pas
Normal file
@ -0,0 +1,127 @@
|
||||
program Graphics2D_pas;
|
||||
|
||||
{$APPTYPE CONSOLE}
|
||||
|
||||
{%DelphiDotNetAssemblyCompiler '$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.dll'} {%DelphiDotNetAssemblyCompiler '$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.Data.dll'} {%DelphiDotNetAssemblyCompiler '$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.Windows.Forms.dll'} {%DelphiDotNetAssemblyCompiler '$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.Drawing.dll'} {%DelphiDotNetAssemblyCompiler '..\..\bin\win32-visualstudio\Irrlicht.NET.dll'} {%TogetherDiagram 'ModelSupport\default.txaPackage'}
|
||||
|
||||
|
||||
uses
|
||||
|
||||
System.Windows.Forms,
|
||||
Irrlicht,
|
||||
Irrlicht.Video,
|
||||
Irrlicht.Core,
|
||||
Irrlicht.Scene,
|
||||
Irrlicht.GUI;
|
||||
var
|
||||
|
||||
device : IrrlichtDevice;
|
||||
texLogo : ITexture;
|
||||
fps : integer;
|
||||
s : char;
|
||||
driver : IVideoDriver;
|
||||
smgr :ISceneManager;
|
||||
images : ITexture;
|
||||
font, font2 : IGUIFont;
|
||||
imp1, imp2 : rect;
|
||||
time : Cardinal;
|
||||
m : Position2D;
|
||||
begin
|
||||
|
||||
WriteLn( 'Please select the driver you want for this example :' );
|
||||
WriteLn( ' (a) Direct3D 9.0c' );
|
||||
WriteLn( ' (b) Direct3D 8.1' );
|
||||
WriteLn( ' (c) OpenGL 1.2' );
|
||||
WriteLn( ' (d) Software Renderer' );
|
||||
WriteLn( ' (e) NullDevice' );
|
||||
WriteLn( ' (otherKey) exit' );
|
||||
WriteLn( );
|
||||
ReadLn( s );
|
||||
// start up the engine
|
||||
case s of
|
||||
'a' : device := IrrlichtDevice.Create(DriverType.DIRECTX9);
|
||||
'b' : device := IrrlichtDevice.Create(DriverType.DIRECTX8);
|
||||
'c' : device := IrrlichtDevice.Create(DriverType.OPENGL);
|
||||
'd' : device := IrrlichtDevice.Create(DriverType.SOFTWARE);
|
||||
'e' : device := IrrlichtDevice.Create(DriverType.NULL_DRIVER);
|
||||
else
|
||||
exit;
|
||||
end;
|
||||
device.ResizeAble := true;
|
||||
device.WindowCaption := 'Irrlicht.NET via Delphi.NET example 06 - - 2D Graphics Demo [ '+ device.VideoDriver.Name + ' ] fps : ' + fps.ToString;
|
||||
driver := device.VideoDriver;
|
||||
smgr := device.SceneManager;
|
||||
images := driver.GetTexture( '../../media/2ddemo.bmp' );
|
||||
driver.MakeColorKeyTexture(images, position2d.Create( 0, 0 ) );
|
||||
font := device.GUIEnvironment.BuiltInFont;
|
||||
font2 := device.GUIEnvironment.GetFont( '../../media/fonthaettenschweiler.bmp' );
|
||||
imp1 := rect.Create(349,15,385,78);
|
||||
imp2 := rect.Create(387,15,423,78);
|
||||
// The logo
|
||||
texLogo := driver.GetTexture('../../media/irrlichtlogoaligned.jpg');
|
||||
// make cursor invisible
|
||||
device.CursorControl.Visible := false;
|
||||
// start drawing loop
|
||||
fps := 0;
|
||||
while( device.Run ) do
|
||||
begin
|
||||
if (device.WindowActive) then
|
||||
begin
|
||||
//time := device.GetTimer().getTime();
|
||||
driver.BeginScene( true, true, Color.Create( 0, 120, 102, 136 ) );
|
||||
// draw fire & dragons background world
|
||||
driver.draw2DImage(images,
|
||||
position2d.Create(50,50),
|
||||
rect.Create(0,0,342,224),
|
||||
Irrlicht.Video.Color.Create(255,255,255,255), true);
|
||||
// draw flying imp
|
||||
if ((time div 500) mod 2) = 0 then
|
||||
driver.draw2DImage(images, position2d.Create(164,125),
|
||||
imp1,
|
||||
Irrlicht.Video.Color.Create(255,255,255,255), true)
|
||||
else
|
||||
driver.draw2DImage(images, position2d.Create(164,125),
|
||||
imp2, Irrlicht.Video.Color.Create(255,255,255,255), true);
|
||||
// draw second flying imp with colorcylce
|
||||
if ((time div 500) mod 2) = 0 then
|
||||
driver.draw2DImage(images, position2d.Create(270,105),
|
||||
imp1,
|
||||
Irrlicht.Video.Color.Create(255, time mod 255,255,255), true)
|
||||
else
|
||||
driver.draw2DImage(images, position2d.Create(270,105),
|
||||
imp2,
|
||||
Irrlicht.Video.Color.Create(255, time mod 255,255,255), true);
|
||||
// draw some text
|
||||
if (font <> nil )then
|
||||
font.draw('This is some text.',
|
||||
rect.Create(130,10,300,50),
|
||||
Irrlicht.Video.Color.Create(255,255,255,255), false, false );
|
||||
// draw some other text
|
||||
if (font2 <> nil) then
|
||||
font2.draw('This is some other text.',
|
||||
rect.Create(130,20,300,60),
|
||||
Irrlicht.Video.Color.Create(255,time mod 255,time mod 255,255), false, false );
|
||||
// draw the logo
|
||||
driver.Draw2DImage(
|
||||
texLogo, Position2D.Create( 10, 10 ),
|
||||
Rect.Create( 0,0,88,31 ),
|
||||
Rect.Create( Position2D.Create( 0, 0 ),device.VideoDriver.ScreenSize),
|
||||
Color.Create($ffffff), false);
|
||||
// draw transparent rect under cursor
|
||||
m := device.CursorControl.Position;
|
||||
driver.draw2DRectangle(Irrlicht.Video.Color.Create(100,255,255,255),
|
||||
rect.Create(m.X-20, m.Y-20, m.X+20, m.Y+20));
|
||||
driver.EndScene();
|
||||
if (fps <> driver.FPS) then
|
||||
begin
|
||||
fps := driver.FPS;
|
||||
device.WindowCaption := 'Irrlicht.NET via Delphi.NET example 06 - - 2D Graphics Demo [ '+ device.VideoDriver.Name + ' ] fps : ' + fps.ToString;
|
||||
end;
|
||||
end;
|
||||
end; // end drawing-loop
|
||||
end.
|
||||
|
||||
Retrieved from "http://www.irrforge.org/index.php/Delphi.NET_version_of_Graphics2D"
|
||||
|
||||
This page has been accessed 258 times. This page was last modified 07:01, 20 Jan 2006.
|
||||
|
5
examples.net/Examples_Delphi/readme.txt
Normal file
5
examples.net/Examples_Delphi/readme.txt
Normal file
@ -0,0 +1,5 @@
|
||||
These Tutorials have simply been copied from the Irrlicht Wiki at http://www.irrforge.org
|
||||
They are written by different authors, and not guaranteed to work, they simply should provide
|
||||
the c++ examples ported the Irrlicht.NET.
|
||||
Please see the wiki for updates and more info.
|
||||
A lot of thanks go to the people who wrote these examples.
|
953
examples.net/Examples_VisualBasic/example09.vb
Normal file
953
examples.net/Examples_VisualBasic/example09.vb
Normal file
@ -0,0 +1,953 @@
|
||||
' This code has been directly CONVERTED from C# into CV
|
||||
'
|
||||
'* This tutorial covers creating a mesh viewer.
|
||||
'*
|
||||
'* It is similar to the native tutorial, but different.
|
||||
'* Since much of the gui and xml stuff is not in the
|
||||
'* .NET wrapper yet, I decided to use winforms and
|
||||
'* the .NET xml mush for those portions of the tutorial.
|
||||
'*
|
||||
'* Some of this tutorial is based on the work Braneloc did
|
||||
'* on Tutorial 14.
|
||||
'*
|
||||
'* The tutorial also includes some other interesting stuff
|
||||
'* that I decided to play with.
|
||||
'*
|
||||
'* For instance, you can change the driver in the middle of
|
||||
'* looking at a mesh.
|
||||
'* Since I used .net 2.0 & VS2005, you can also move the
|
||||
'* toolbar around the form. (A new freebe in .net 2.0)
|
||||
'*
|
||||
'* DISCLAIMERS: This will not work with .net 1.1.
|
||||
'* The reason is that some of the controls I used in this
|
||||
'* tutorial are not available in .net 1.1.
|
||||
'* Most of the controls that I know have changed are the
|
||||
'* menu and toolbar stuff.
|
||||
'* The new stuff now has names like "MenuStrip",
|
||||
'* "ToolStrip", and "ToolStripMenuItem", etc.
|
||||
'* Seems kinda silly, I know, but I'm sure someone over
|
||||
'* in Redmond really thought they had a great idea.
|
||||
'*
|
||||
'* Also, MS changed their xml api in .net 2.0.
|
||||
'* The xml part of the tutorial might port to .net 1.1
|
||||
'* just fine, but I'm not sure and not ambitious enough
|
||||
'* to check it out myself.
|
||||
'*
|
||||
'* BUGS: Yeah, I'm sure there's a few in there.
|
||||
'* I notice when switching drivers, the app will
|
||||
'* sometimes lock. I haven't quite figured out why yet,
|
||||
'* but it seems to have something to do with Irrlicht
|
||||
'* having a null device.EventReceiver. Also, the
|
||||
'* debugger will sometimes point to a problem with fonts
|
||||
'* in this case.
|
||||
'*
|
||||
'* The winforms event responses are very doggy.
|
||||
'* I tried a couple of Application.DoEvents() in the render loop,
|
||||
'* but they didn't seem to help much. I may
|
||||
'* look at this in the future.
|
||||
'*
|
||||
'* FINAL NOTE: If you happen to find any fixes for any of the
|
||||
'* bugs listed above or any new ones you find, share them with
|
||||
'* the community. Post about them on the forum, and update
|
||||
'* the Wiki.
|
||||
'*
|
||||
'* Getting it working:
|
||||
'* Create project as windows form, and add the 2 Irrlicht DLL's to it.
|
||||
'* (This file is the only one needed in the project)
|
||||
'* Add open.bmp and help.bmp from the Irrlicht media directory to the
|
||||
'* resources.
|
||||
'* You'll probably need to rebind the images to the toolstrip, hint,
|
||||
'* open is the one on the left..
|
||||
'
|
||||
Imports System
|
||||
Imports System.Collections.Generic
|
||||
Imports System.Drawing
|
||||
Imports System.Windows.Forms
|
||||
Imports System.Text
|
||||
Imports System.IO
|
||||
Imports System.Xml
|
||||
Imports Irrlicht
|
||||
Imports core = Irrlicht.Core
|
||||
Imports scene = Irrlicht.Scene
|
||||
Imports video = Irrlicht.Video
|
||||
Imports gui = Irrlicht.GUI
|
||||
Namespace _09.WinFormMeshViewer
|
||||
<summary>
|
||||
Description of MainForm.
|
||||
</summary>
|
||||
Public Class MainForm
|
||||
Inherits System.Windows.Forms.Form
|
||||
' Path from tutorial binary to standard SDK media folder.
|
||||
Private path As String = "../../../../media/"
|
||||
Private messageText As String = String.Empty
|
||||
Private caption As String = String.Empty
|
||||
Private captBase As String = "Irrlicht.NET with WinForms - MeshViewer"
|
||||
Private configFile As String = "config.xml"
|
||||
Private startupModelFile As String = String.Empty
|
||||
Private currentModelFile As String = String.Empty
|
||||
Private quitting As Boolean = False
|
||||
Private paused As Boolean = False
|
||||
Private device As IrrlichtDevice
|
||||
Private model As scene.IAnimatedMeshSceneNode
|
||||
Private skyBox As scene.ISceneNode
|
||||
Private irrLogo As video.ITexture
|
||||
Private startDelay As Timer
|
||||
Private pnlIrrlicht As Panel
|
||||
Private panelMemory As Rectangle = Rectangle.Empty
|
||||
' Remembers the size & location of the panel
|
||||
Private mnuFile As ToolStripMenuItem
|
||||
Private mnuFileOpen As ToolStripMenuItem
|
||||
Private toolStripMenuItem1 As ToolStripSeparator
|
||||
Private mnuFileExit As ToolStripMenuItem
|
||||
Private mnuView As ToolStripMenuItem
|
||||
Private mnuHelp As ToolStripMenuItem
|
||||
Private toolStripContainer1 As ToolStripContainer
|
||||
Private toolStrip1 As ToolStrip
|
||||
Private btnOpen As ToolStripButton
|
||||
Private btnHelp As ToolStripButton
|
||||
Private mnuViewSkyBox As ToolStripMenuItem
|
||||
Private mnuViewDebug As ToolStripMenuItem
|
||||
Private mnuViewMaterial As ToolStripMenuItem
|
||||
Private mnuViewMatSolid As ToolStripMenuItem
|
||||
Private mnuViewMatTransp As ToolStripMenuItem
|
||||
Private mnuViewMatReflect As ToolStripMenuItem
|
||||
Private mnuHelpAbout As ToolStripMenuItem
|
||||
Private lblScaleZ As Label
|
||||
Private numScaleZ As NumericUpDown
|
||||
Private lblScaleY As Label
|
||||
Private numScaleY As NumericUpDown
|
||||
Private lblScaleX As Label
|
||||
Private numScaleX As NumericUpDown
|
||||
Private chkDebug As CheckBox
|
||||
Private chkSkyBox As CheckBox
|
||||
Private rbSoft1 As RadioButton
|
||||
Private rbOGL As RadioButton
|
||||
Private rbD3D8 As RadioButton
|
||||
Private rbD3D9 As RadioButton
|
||||
Private rbNull As RadioButton
|
||||
Private rbSoft2 As RadioButton
|
||||
Private gbDrivers As GroupBox
|
||||
Private txtFPS As ToolStripTextBox
|
||||
Private mnuMain As MenuStrip
|
||||
Public Sub New()
|
||||
'
|
||||
' The InitializeComponent() call is required for Windows Forms designer support.
|
||||
'
|
||||
InitializeComponent()
|
||||
'
|
||||
' Add constructor code after the InitializeComponent() call.
|
||||
'
|
||||
startDelay = New Timer()
|
||||
startDelay.Interval = 1000
|
||||
startDelay.Enabled = False
|
||||
AddHandler startDelay.Tick, AddressOf startDelay_Tick
|
||||
CreatePanel()
|
||||
End Sub
|
||||
<summary>
|
||||
The main entry point for the application.
|
||||
</summary>
|
||||
<STAThread()> _
|
||||
Private Shared Sub Main()
|
||||
Try
|
||||
' Create a new instance of our application
|
||||
Dim viewer As MainForm = New MainForm()
|
||||
'Show the window
|
||||
viewer.Show()
|
||||
' Initialize items
|
||||
viewer.LoadIrrConfig()
|
||||
If viewer.startupModelFile = String.Empty Then
|
||||
viewer.startupModelFile = "dwarf.x"
|
||||
End If
|
||||
viewer.currentModelFile = viewer.startupModelFile
|
||||
viewer.SetDevice(viewer.pnlIrrlicht, viewer.PickDriver())
|
||||
viewer.LoadModel(viewer.path + viewer.currentModelFile)
|
||||
viewer.LoadSkyBox()
|
||||
' Run the viewer
|
||||
System.Windows.Forms.Application.Run(viewer)
|
||||
Catch ex As Exception
|
||||
MessageBox.Show(ex.Message)
|
||||
Application.[Exit]()
|
||||
GC.Collect()
|
||||
End Try
|
||||
End Sub
|
||||
<summary>
|
||||
Required designer variable.
|
||||
</summary>
|
||||
Private components As System.ComponentModel.IContainer = Nothing
|
||||
<summary>
|
||||
Clean up any resources being used.
|
||||
</summary>
|
||||
<param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
|
||||
If disposing AndAlso (components IsNot Nothing) Then
|
||||
components.Dispose()
|
||||
End If
|
||||
MyBase.Dispose(disposing)
|
||||
End Sub
|
||||
#Region "Windows Forms Designer generated code"
|
||||
<summary>
|
||||
This method is required for Windows Forms designer support.
|
||||
Do not change the method contents inside the source code editor. The Forms designer might
|
||||
not be able to load this method if it was changed manually.
|
||||
</summary>
|
||||
Private Sub InitializeComponent()
|
||||
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(MainForm))
|
||||
Me.mnuMain = New System.Windows.Forms.MenuStrip()
|
||||
Me.mnuFile = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.mnuFileOpen = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.toolStripMenuItem1 = New System.Windows.Forms.ToolStripSeparator()
|
||||
Me.mnuFileExit = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.mnuView = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.mnuViewSkyBox = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.mnuViewDebug = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.mnuViewMaterial = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.mnuViewMatSolid = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.mnuViewMatTransp = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.mnuViewMatReflect = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.mnuHelp = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.mnuHelpAbout = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.toolStripContainer1 = New System.Windows.Forms.ToolStripContainer()
|
||||
Me.gbDrivers = New System.Windows.Forms.GroupBox()
|
||||
Me.rbNull = New System.Windows.Forms.RadioButton()
|
||||
Me.rbD3D9 = New System.Windows.Forms.RadioButton()
|
||||
Me.rbSoft2 = New System.Windows.Forms.RadioButton()
|
||||
Me.rbD3D8 = New System.Windows.Forms.RadioButton()
|
||||
Me.rbSoft1 = New System.Windows.Forms.RadioButton()
|
||||
Me.rbOGL = New System.Windows.Forms.RadioButton()
|
||||
Me.chkDebug = New System.Windows.Forms.CheckBox()
|
||||
Me.chkSkyBox = New System.Windows.Forms.CheckBox()
|
||||
Me.lblScaleZ = New System.Windows.Forms.Label()
|
||||
Me.numScaleZ = New System.Windows.Forms.NumericUpDown()
|
||||
Me.lblScaleY = New System.Windows.Forms.Label()
|
||||
Me.numScaleY = New System.Windows.Forms.NumericUpDown()
|
||||
Me.lblScaleX = New System.Windows.Forms.Label()
|
||||
Me.numScaleX = New System.Windows.Forms.NumericUpDown()
|
||||
Me.toolStrip1 = New System.Windows.Forms.ToolStrip()
|
||||
Me.btnOpen = New System.Windows.Forms.ToolStripButton()
|
||||
Me.btnHelp = New System.Windows.Forms.ToolStripButton()
|
||||
Me.txtFPS = New System.Windows.Forms.ToolStripTextBox()
|
||||
Me.mnuMain.SuspendLayout()
|
||||
Me.toolStripContainer1.ContentPanel.SuspendLayout()
|
||||
Me.toolStripContainer1.TopToolStripPanel.SuspendLayout()
|
||||
Me.toolStripContainer1.SuspendLayout()
|
||||
Me.gbDrivers.SuspendLayout()
|
||||
(DirectCast((Me.numScaleZ), System.ComponentModel.ISupportInitialize)).BeginInit()
|
||||
(DirectCast((Me.numScaleY), System.ComponentModel.ISupportInitialize)).BeginInit()
|
||||
(DirectCast((Me.numScaleX), System.ComponentModel.ISupportInitialize)).BeginInit()
|
||||
Me.toolStrip1.SuspendLayout()
|
||||
Me.SuspendLayout()
|
||||
'
|
||||
' mnuMain
|
||||
'
|
||||
Me.mnuMain.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuFile, Me.mnuView, Me.mnuHelp})
|
||||
Me.mnuMain.Location = New System.Drawing.Point(0, 0)
|
||||
Me.mnuMain.Name = "mnuMain"
|
||||
Me.mnuMain.Size = New System.Drawing.Size(632, 24)
|
||||
Me.mnuMain.TabIndex = 0
|
||||
Me.mnuMain.Text = "menuStrip1"
|
||||
'
|
||||
' mnuFile
|
||||
'
|
||||
Me.mnuFile.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuFileOpen, Me.toolStripMenuItem1, Me.mnuFileExit})
|
||||
Me.mnuFile.Name = "mnuFile"
|
||||
Me.mnuFile.Size = New System.Drawing.Size(35, 20)
|
||||
Me.mnuFile.Text = "&File"
|
||||
'
|
||||
' mnuFileOpen
|
||||
'
|
||||
Me.mnuFileOpen.Name = "mnuFileOpen"
|
||||
Me.mnuFileOpen.Size = New System.Drawing.Size(139, 22)
|
||||
Me.mnuFileOpen.Text = "&Open Mesh"
|
||||
AddHandler Me.mnuFileOpen.Click, AddressOf open_Click
|
||||
'
|
||||
' toolStripMenuItem1
|
||||
'
|
||||
Me.toolStripMenuItem1.Name = "toolStripMenuItem1"
|
||||
Me.toolStripMenuItem1.Size = New System.Drawing.Size(136, 6)
|
||||
'
|
||||
' mnuFileExit
|
||||
'
|
||||
Me.mnuFileExit.Name = "mnuFileExit"
|
||||
Me.mnuFileExit.Size = New System.Drawing.Size(139, 22)
|
||||
Me.mnuFileExit.Text = "E&xit"
|
||||
AddHandler Me.mnuFileExit.Click, AddressOf Exit_Click
|
||||
'
|
||||
' mnuView
|
||||
'
|
||||
Me.mnuView.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuViewSkyBox, Me.mnuViewDebug, Me.mnuViewMaterial})
|
||||
Me.mnuView.Name = "mnuView"
|
||||
Me.mnuView.Size = New System.Drawing.Size(41, 20)
|
||||
Me.mnuView.Text = "&View"
|
||||
'
|
||||
' mnuViewSkyBox
|
||||
'
|
||||
Me.mnuViewSkyBox.Checked = True
|
||||
Me.mnuViewSkyBox.CheckOnClick = True
|
||||
Me.mnuViewSkyBox.CheckState = System.Windows.Forms.CheckState.Checked
|
||||
Me.mnuViewSkyBox.Name = "mnuViewSkyBox"
|
||||
Me.mnuViewSkyBox.Size = New System.Drawing.Size(170, 22)
|
||||
Me.mnuViewSkyBox.Text = "&SkyBox Visibility"
|
||||
AddHandler Me.mnuViewSkyBox.CheckedChanged, AddressOf SkyBox_CheckedChanged
|
||||
'
|
||||
' mnuViewDebug
|
||||
'
|
||||
Me.mnuViewDebug.Checked = True
|
||||
Me.mnuViewDebug.CheckOnClick = True
|
||||
Me.mnuViewDebug.CheckState = System.Windows.Forms.CheckState.Checked
|
||||
Me.mnuViewDebug.Name = "mnuViewDebug"
|
||||
Me.mnuViewDebug.Size = New System.Drawing.Size(170, 22)
|
||||
Me.mnuViewDebug.Text = "Model &Debug Info"
|
||||
AddHandler Me.mnuViewDebug.CheckedChanged, AddressOf Debug_CheckedChanged
|
||||
'
|
||||
' mnuViewMaterial
|
||||
'
|
||||
Me.mnuViewMaterial.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuViewMatSolid, Me.mnuViewMatTransp, Me.mnuViewMatReflect})
|
||||
Me.mnuViewMaterial.Name = "mnuViewMaterial"
|
||||
Me.mnuViewMaterial.Size = New System.Drawing.Size(170, 22)
|
||||
Me.mnuViewMaterial.Text = "&Model Material"
|
||||
'
|
||||
' mnuViewMatSolid
|
||||
'
|
||||
Me.mnuViewMatSolid.Checked = True
|
||||
Me.mnuViewMatSolid.CheckState = System.Windows.Forms.CheckState.Checked
|
||||
Me.mnuViewMatSolid.Name = "mnuViewMatSolid"
|
||||
Me.mnuViewMatSolid.Size = New System.Drawing.Size(144, 22)
|
||||
Me.mnuViewMatSolid.Text = "S&olid"
|
||||
AddHandler Me.mnuViewMatSolid.Click, AddressOf mnuViewMatSolid_Click
|
||||
'
|
||||
' mnuViewMatTransp
|
||||
'
|
||||
Me.mnuViewMatTransp.Name = "mnuViewMatTransp"
|
||||
Me.mnuViewMatTransp.Size = New System.Drawing.Size(144, 22)
|
||||
Me.mnuViewMatTransp.Text = "&Transparent"
|
||||
AddHandler Me.mnuViewMatTransp.Click, AddressOf mnuViewMatTransp_Click
|
||||
'
|
||||
' mnuViewMatReflect
|
||||
'
|
||||
Me.mnuViewMatReflect.Name = "mnuViewMatReflect"
|
||||
Me.mnuViewMatReflect.Size = New System.Drawing.Size(144, 22)
|
||||
Me.mnuViewMatReflect.Text = "Reflection"
|
||||
AddHandler Me.mnuViewMatReflect.Click, AddressOf mnuViewMatReflect_Click
|
||||
'
|
||||
' mnuHelp
|
||||
'
|
||||
Me.mnuHelp.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuHelpAbout})
|
||||
Me.mnuHelp.Name = "mnuHelp"
|
||||
Me.mnuHelp.Size = New System.Drawing.Size(40, 20)
|
||||
Me.mnuHelp.Text = "&Help"
|
||||
'
|
||||
' mnuHelpAbout
|
||||
'
|
||||
Me.mnuHelpAbout.Name = "mnuHelpAbout"
|
||||
Me.mnuHelpAbout.Size = New System.Drawing.Size(114, 22)
|
||||
Me.mnuHelpAbout.Text = "&About"
|
||||
AddHandler Me.mnuHelpAbout.Click, AddressOf Help_Click
|
||||
'
|
||||
' toolStripContainer1
|
||||
'
|
||||
'
|
||||
' toolStripContainer1.ContentPanel
|
||||
'
|
||||
Me.toolStripContainer1.ContentPanel.Controls.Add(Me.gbDrivers)
|
||||
Me.toolStripContainer1.ContentPanel.Controls.Add(Me.chkDebug)
|
||||
Me.toolStripContainer1.ContentPanel.Controls.Add(Me.chkSkyBox)
|
||||
Me.toolStripContainer1.ContentPanel.Controls.Add(Me.lblScaleZ)
|
||||
Me.toolStripContainer1.ContentPanel.Controls.Add(Me.numScaleZ)
|
||||
Me.toolStripContainer1.ContentPanel.Controls.Add(Me.lblScaleY)
|
||||
Me.toolStripContainer1.ContentPanel.Controls.Add(Me.numScaleY)
|
||||
Me.toolStripContainer1.ContentPanel.Controls.Add(Me.lblScaleX)
|
||||
Me.toolStripContainer1.ContentPanel.Controls.Add(Me.numScaleX)
|
||||
Me.toolStripContainer1.ContentPanel.Size = New System.Drawing.Size(632, 397)
|
||||
Me.toolStripContainer1.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.toolStripContainer1.Location = New System.Drawing.Point(0, 24)
|
||||
Me.toolStripContainer1.Name = "toolStripContainer1"
|
||||
Me.toolStripContainer1.Size = New System.Drawing.Size(632, 422)
|
||||
Me.toolStripContainer1.TabIndex = 1
|
||||
Me.toolStripContainer1.Text = "toolStripContainer1"
|
||||
'
|
||||
' toolStripContainer1.TopToolStripPanel
|
||||
'
|
||||
Me.toolStripContainer1.TopToolStripPanel.Controls.Add(Me.toolStrip1)
|
||||
'
|
||||
' gbDrivers
|
||||
'
|
||||
Me.gbDrivers.Anchor = (DirectCast(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right)), System.Windows.Forms.AnchorStyles))
|
||||
Me.gbDrivers.Controls.Add(Me.rbNull)
|
||||
Me.gbDrivers.Controls.Add(Me.rbD3D9)
|
||||
Me.gbDrivers.Controls.Add(Me.rbSoft2)
|
||||
Me.gbDrivers.Controls.Add(Me.rbD3D8)
|
||||
Me.gbDrivers.Controls.Add(Me.rbSoft1)
|
||||
Me.gbDrivers.Controls.Add(Me.rbOGL)
|
||||
Me.gbDrivers.Location = New System.Drawing.Point(510, 223)
|
||||
Me.gbDrivers.Name = "gbDrivers"
|
||||
Me.gbDrivers.Size = New System.Drawing.Size(104, 162)
|
||||
Me.gbDrivers.TabIndex = 15
|
||||
Me.gbDrivers.TabStop = False
|
||||
Me.gbDrivers.Text = "Driver Selection:"
|
||||
'
|
||||
' rbNull
|
||||
'
|
||||
Me.rbNull.AutoSize = True
|
||||
Me.rbNull.Location = New System.Drawing.Point(6, 134)
|
||||
Me.rbNull.Name = "rbNull"
|
||||
Me.rbNull.Size = New System.Drawing.Size(72, 17)
|
||||
Me.rbNull.TabIndex = 14
|
||||
Me.rbNull.TabStop = True
|
||||
Me.rbNull.Text = "null Driver"
|
||||
Me.rbNull.UseVisualStyleBackColor = True
|
||||
AddHandler Me.rbNull.CheckedChanged, AddressOf rb_CheckedChanged
|
||||
'
|
||||
' rbD3D9
|
||||
'
|
||||
Me.rbD3D9.AutoSize = True
|
||||
Me.rbD3D9.Checked = True
|
||||
Me.rbD3D9.Location = New System.Drawing.Point(6, 19)
|
||||
Me.rbD3D9.Name = "rbD3D9"
|
||||
Me.rbD3D9.Size = New System.Drawing.Size(91, 17)
|
||||
Me.rbD3D9.TabIndex = 9
|
||||
Me.rbD3D9.TabStop = True
|
||||
Me.rbD3D9.Text = "Direct3D 9.0c"
|
||||
Me.rbD3D9.UseVisualStyleBackColor = True
|
||||
AddHandler Me.rbD3D9.CheckedChanged, AddressOf rb_CheckedChanged
|
||||
'
|
||||
' rbSoft2
|
||||
'
|
||||
Me.rbSoft2.AutoSize = True
|
||||
Me.rbSoft2.Location = New System.Drawing.Point(6, 111)
|
||||
Me.rbSoft2.Name = "rbSoft2"
|
||||
Me.rbSoft2.Size = New System.Drawing.Size(75, 17)
|
||||
Me.rbSoft2.TabIndex = 13
|
||||
Me.rbSoft2.TabStop = True
|
||||
Me.rbSoft2.Text = "Apfelbaum"
|
||||
Me.rbSoft2.UseVisualStyleBackColor = True
|
||||
AddHandler Me.rbSoft2.CheckedChanged, AddressOf rb_CheckedChanged
|
||||
'
|
||||
' rbD3D8
|
||||
'
|
||||
Me.rbD3D8.AutoSize = True
|
||||
Me.rbD3D8.Location = New System.Drawing.Point(6, 42)
|
||||
Me.rbD3D8.Name = "rbD3D8"
|
||||
Me.rbD3D8.Size = New System.Drawing.Size(85, 17)
|
||||
Me.rbD3D8.TabIndex = 10
|
||||
Me.rbD3D8.TabStop = True
|
||||
Me.rbD3D8.Text = "Direct3D 8.1"
|
||||
Me.rbD3D8.UseVisualStyleBackColor = True
|
||||
AddHandler Me.rbD3D8.CheckedChanged, AddressOf rb_CheckedChanged
|
||||
'
|
||||
' rbSoft1
|
||||
'
|
||||
Me.rbSoft1.AutoSize = True
|
||||
Me.rbSoft1.Location = New System.Drawing.Point(6, 88)
|
||||
Me.rbSoft1.Name = "rbSoft1"
|
||||
Me.rbSoft1.Size = New System.Drawing.Size(67, 17)
|
||||
Me.rbSoft1.TabIndex = 12
|
||||
Me.rbSoft1.TabStop = True
|
||||
Me.rbSoft1.Text = "Software"
|
||||
Me.rbSoft1.UseVisualStyleBackColor = True
|
||||
AddHandler Me.rbSoft1.CheckedChanged, AddressOf rb_CheckedChanged
|
||||
'
|
||||
' rbOGL
|
||||
'
|
||||
Me.rbOGL.AutoSize = True
|
||||
Me.rbOGL.Location = New System.Drawing.Point(6, 65)
|
||||
Me.rbOGL.Name = "rbOGL"
|
||||
Me.rbOGL.Size = New System.Drawing.Size(83, 17)
|
||||
Me.rbOGL.TabIndex = 11
|
||||
Me.rbOGL.TabStop = True
|
||||
Me.rbOGL.Text = "OpenGL 1.5"
|
||||
Me.rbOGL.UseVisualStyleBackColor = True
|
||||
AddHandler Me.rbOGL.CheckedChanged, AddressOf rb_CheckedChanged
|
||||
'
|
||||
' chkDebug
|
||||
'
|
||||
Me.chkDebug.Anchor = (DirectCast(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right)), System.Windows.Forms.AnchorStyles))
|
||||
Me.chkDebug.AutoSize = True
|
||||
Me.chkDebug.Checked = True
|
||||
Me.chkDebug.CheckState = System.Windows.Forms.CheckState.Checked
|
||||
Me.chkDebug.Location = New System.Drawing.Point(510, 193)
|
||||
Me.chkDebug.Name = "chkDebug"
|
||||
Me.chkDebug.Size = New System.Drawing.Size(113, 17)
|
||||
Me.chkDebug.TabIndex = 8
|
||||
Me.chkDebug.Text = "Debug Information"
|
||||
Me.chkDebug.UseVisualStyleBackColor = True
|
||||
AddHandler Me.chkDebug.CheckedChanged, AddressOf Debug_CheckedChanged
|
||||
'
|
||||
' chkSkyBox
|
||||
'
|
||||
Me.chkSkyBox.Anchor = (DirectCast(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right)), System.Windows.Forms.AnchorStyles))
|
||||
Me.chkSkyBox.AutoSize = True
|
||||
Me.chkSkyBox.Checked = True
|
||||
Me.chkSkyBox.CheckState = System.Windows.Forms.CheckState.Checked
|
||||
Me.chkSkyBox.Location = New System.Drawing.Point(510, 170)
|
||||
Me.chkSkyBox.Name = "chkSkyBox"
|
||||
Me.chkSkyBox.Size = New System.Drawing.Size(101, 17)
|
||||
Me.chkSkyBox.TabIndex = 7
|
||||
Me.chkSkyBox.Text = "SkyBox Visibility"
|
||||
Me.chkSkyBox.UseVisualStyleBackColor = True
|
||||
AddHandler Me.chkSkyBox.CheckedChanged, AddressOf SkyBox_CheckedChanged
|
||||
'
|
||||
' lblScaleZ
|
||||
'
|
||||
Me.lblScaleZ.Anchor = (DirectCast(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right)), System.Windows.Forms.AnchorStyles))
|
||||
Me.lblScaleZ.AutoSize = True
|
||||
Me.lblScaleZ.Location = New System.Drawing.Point(510, 116)
|
||||
Me.lblScaleZ.Name = "lblScaleZ"
|
||||
Me.lblScaleZ.Size = New System.Drawing.Size(55, 13)
|
||||
Me.lblScaleZ.TabIndex = 6
|
||||
Me.lblScaleZ.Text = "Z Scaling:"
|
||||
'
|
||||
' numScaleZ
|
||||
'
|
||||
Me.numScaleZ.Anchor = (DirectCast(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right)), System.Windows.Forms.AnchorStyles))
|
||||
Me.numScaleZ.DecimalPlaces = 1
|
||||
Me.numScaleZ.Increment = New Decimal(New Integer() {1, 0, 0, 65536})
|
||||
Me.numScaleZ.Location = New System.Drawing.Point(510, 135)
|
||||
Me.numScaleZ.Name = "numScaleZ"
|
||||
Me.numScaleZ.Size = New System.Drawing.Size(61, 20)
|
||||
Me.numScaleZ.TabIndex = 5
|
||||
Me.numScaleZ.Value = New Decimal(New Integer() {10, 0, 0, 65536})
|
||||
AddHandler Me.numScaleZ.ValueChanged, AddressOf Scale_ValueChanged
|
||||
'
|
||||
' lblScaleY
|
||||
'
|
||||
Me.lblScaleY.Anchor = (DirectCast(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right)), System.Windows.Forms.AnchorStyles))
|
||||
Me.lblScaleY.AutoSize = True
|
||||
Me.lblScaleY.Location = New System.Drawing.Point(510, 63)
|
||||
Me.lblScaleY.Name = "lblScaleY"
|
||||
Me.lblScaleY.Size = New System.Drawing.Size(55, 13)
|
||||
Me.lblScaleY.TabIndex = 4
|
||||
Me.lblScaleY.Text = "Y Scaling:"
|
||||
'
|
||||
' numScaleY
|
||||
'
|
||||
Me.numScaleY.Anchor = (DirectCast(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right)), System.Windows.Forms.AnchorStyles))
|
||||
Me.numScaleY.DecimalPlaces = 1
|
||||
Me.numScaleY.Increment = New Decimal(New Integer() {1, 0, 0, 65536})
|
||||
Me.numScaleY.Location = New System.Drawing.Point(510, 82)
|
||||
Me.numScaleY.Name = "numScaleY"
|
||||
Me.numScaleY.Size = New System.Drawing.Size(61, 20)
|
||||
Me.numScaleY.TabIndex = 3
|
||||
Me.numScaleY.Value = New Decimal(New Integer() {10, 0, 0, 65536})
|
||||
AddHandler Me.numScaleY.ValueChanged, AddressOf Scale_ValueChanged
|
||||
'
|
||||
' lblScaleX
|
||||
'
|
||||
Me.lblScaleX.Anchor = (DirectCast(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right)), System.Windows.Forms.AnchorStyles))
|
||||
Me.lblScaleX.AutoSize = True
|
||||
Me.lblScaleX.Location = New System.Drawing.Point(510, 12)
|
||||
Me.lblScaleX.Name = "lblScaleX"
|
||||
Me.lblScaleX.Size = New System.Drawing.Size(55, 13)
|
||||
Me.lblScaleX.TabIndex = 2
|
||||
Me.lblScaleX.Text = "X Scaling:"
|
||||
'
|
||||
' numScaleX
|
||||
'
|
||||
Me.numScaleX.Anchor = (DirectCast(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right)), System.Windows.Forms.AnchorStyles))
|
||||
Me.numScaleX.DecimalPlaces = 1
|
||||
Me.numScaleX.Increment = New Decimal(New Integer() {1, 0, 0, 65536})
|
||||
Me.numScaleX.Location = New System.Drawing.Point(510, 31)
|
||||
Me.numScaleX.Name = "numScaleX"
|
||||
Me.numScaleX.Size = New System.Drawing.Size(61, 20)
|
||||
Me.numScaleX.TabIndex = 1
|
||||
Me.numScaleX.Value = New Decimal(New Integer() {10, 0, 0, 65536})
|
||||
AddHandler Me.numScaleX.ValueChanged, AddressOf Scale_ValueChanged
|
||||
'
|
||||
' toolStrip1
|
||||
'
|
||||
Me.toolStrip1.Dock = System.Windows.Forms.DockStyle.None
|
||||
Me.toolStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.btnOpen, Me.btnHelp, Me.txtFPS})
|
||||
Me.toolStrip1.Location = New System.Drawing.Point(3, 0)
|
||||
Me.toolStrip1.Name = "toolStrip1"
|
||||
Me.toolStrip1.Size = New System.Drawing.Size(160, 25)
|
||||
Me.toolStrip1.TabIndex = 0
|
||||
'
|
||||
' btnOpen
|
||||
'
|
||||
Me.btnOpen.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
|
||||
Me.btnOpen.Image = (DirectCast((resources.GetObject("btnOpen.Image")), System.Drawing.Image))
|
||||
Me.btnOpen.ImageTransparentColor = System.Drawing.Color.Magenta
|
||||
Me.btnOpen.Name = "btnOpen"
|
||||
Me.btnOpen.Size = New System.Drawing.Size(23, 22)
|
||||
Me.btnOpen.Text = "toolStripButton1"
|
||||
AddHandler Me.btnOpen.Click, AddressOf open_Click
|
||||
'
|
||||
' btnHelp
|
||||
'
|
||||
Me.btnHelp.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
|
||||
Me.btnHelp.Image = (DirectCast((resources.GetObject("btnHelp.Image")), System.Drawing.Image))
|
||||
Me.btnHelp.ImageTransparentColor = System.Drawing.Color.Magenta
|
||||
Me.btnHelp.Name = "btnHelp"
|
||||
Me.btnHelp.Size = New System.Drawing.Size(23, 22)
|
||||
Me.btnHelp.Text = "btnHelp"
|
||||
'
|
||||
' txtFPS
|
||||
'
|
||||
Me.txtFPS.Name = "txtFPS"
|
||||
Me.txtFPS.Size = New System.Drawing.Size(100, 25)
|
||||
'
|
||||
' MainForm
|
||||
'
|
||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6F, 13F)
|
||||
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||
Me.ClientSize = New System.Drawing.Size(632, 446)
|
||||
Me.Controls.Add(Me.toolStripContainer1)
|
||||
Me.Controls.Add(Me.mnuMain)
|
||||
Me.Icon = (DirectCast((resources.GetObject("$this.Icon")), System.Drawing.Icon))
|
||||
Me.MainMenuStrip = Me.mnuMain
|
||||
Me.MinimumSize = New System.Drawing.Size(640, 480)
|
||||
Me.Name = "MainForm"
|
||||
Me.Text = "Irrlicht with WinForms MeshViewer"
|
||||
AddHandler Me.FormClosing, AddressOf MainForm_FormClosing
|
||||
AddHandler Me.Load, AddressOf MainForm_Load
|
||||
Me.mnuMain.ResumeLayout(False)
|
||||
Me.mnuMain.PerformLayout()
|
||||
Me.toolStripContainer1.ContentPanel.ResumeLayout(False)
|
||||
Me.toolStripContainer1.ContentPanel.PerformLayout()
|
||||
Me.toolStripContainer1.TopToolStripPanel.ResumeLayout(False)
|
||||
Me.toolStripContainer1.TopToolStripPanel.PerformLayout()
|
||||
Me.toolStripContainer1.ResumeLayout(False)
|
||||
Me.toolStripContainer1.PerformLayout()
|
||||
Me.gbDrivers.ResumeLayout(False)
|
||||
Me.gbDrivers.PerformLayout()
|
||||
(DirectCast((Me.numScaleZ), System.ComponentModel.ISupportInitialize)).EndInit()
|
||||
(DirectCast((Me.numScaleY), System.ComponentModel.ISupportInitialize)).EndInit()
|
||||
(DirectCast((Me.numScaleX), System.ComponentModel.ISupportInitialize)).EndInit()
|
||||
Me.toolStrip1.ResumeLayout(False)
|
||||
Me.toolStrip1.PerformLayout()
|
||||
Me.ResumeLayout(False)
|
||||
Me.PerformLayout()
|
||||
End Sub
|
||||
#End Region
|
||||
#Region "- Winforms Events -"
|
||||
Private Sub MainForm_Load(ByVal sender As Object, ByVal e As EventArgs)
|
||||
startDelay.Enabled = True
|
||||
End Sub
|
||||
Private Sub startDelay_Tick(ByVal sender As Object, ByVal e As EventArgs)
|
||||
startDelay.Enabled = False
|
||||
RunDevice(pnlIrrlicht)
|
||||
End Sub
|
||||
Private Sub open_Click(ByVal sender As Object, ByVal e As EventArgs)
|
||||
Dim filter As StringBuilder = New StringBuilder()
|
||||
filter.Append("3D Studio Mesh(*.3ds)|*.3ds")
|
||||
filter.Append("|Alias Wavefront Maya(*.obj)|*.obj")
|
||||
filter.Append("|Cartography Shop 4(*.csm)|*.csm")
|
||||
filter.Append("|COLLADA(*.xml;*.dae)|*.xml;*.dae")
|
||||
filter.Append("|DeleD(*.dmf)|*.dmf")
|
||||
filter.Append("|FSRad oct(*.oct)|*.oct")
|
||||
filter.Append("|Microsoft DirectX(*.x)|*.x")
|
||||
filter.Append("|Milkshape (*.ms3d)|*.ms3d")
|
||||
filter.Append("|My3DTools 3(*my3D)|*.my3D")
|
||||
filter.Append("|Pulsar LMTools(*.lmts)|*.lmts")
|
||||
filter.Append("|Quake 3 levels(*.bsp)|*.bsp")
|
||||
filter.Append("|Quake 2 models(*.md2)|*.md2")
|
||||
filter.Append("|Packed models(*.pk3)|*.pk3")
|
||||
Dim ofd As OpenFileDialog = New OpenFileDialog()
|
||||
ofd.Filter = filter.ToString()
|
||||
ofd.FilterIndex = 7
|
||||
If ofd.ShowDialog() = DialogResult.OK Then
|
||||
LoadModel(ofd.FileName)
|
||||
End If
|
||||
End Sub
|
||||
Private Sub Exit_Click(ByVal sender As Object, ByVal e As EventArgs)
|
||||
Me.Close()
|
||||
End Sub
|
||||
Private Sub MainForm_FormClosing(ByVal sender As Object, ByVal e As FormClosingEventArgs)
|
||||
quitting = True
|
||||
End Sub
|
||||
Private Sub Help_Click(ByVal sender As Object, ByVal e As EventArgs)
|
||||
caption = "Irrlicht.NET engine mesh viewer - "
|
||||
If device IsNot Nothing AndAlso device.VideoDriver IsNot Nothing Then
|
||||
caption += device.VideoDriver.Name
|
||||
End If
|
||||
MessageBox.Show(messageText, caption)
|
||||
End Sub
|
||||
Private Sub rb_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs)
|
||||
Try
|
||||
paused = True
|
||||
SetDevice(pnlIrrlicht, PickDriver())
|
||||
LoadModel(path + currentModelFile)
|
||||
LoadSkyBox()
|
||||
paused = False
|
||||
RunDevice(pnlIrrlicht)
|
||||
Catch ex As Exception
|
||||
MessageBox.Show(ex.Message, caption)
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub SkyBox_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs)
|
||||
If sender.[GetType]() = GetType(CheckBox) Then
|
||||
mnuViewSkyBox.Checked = chkSkyBox.Checked
|
||||
Else
|
||||
chkSkyBox.Checked = mnuViewSkyBox.Checked
|
||||
End If
|
||||
If skyBox IsNot Nothing Then
|
||||
skyBox.Visible = chkSkyBox.Checked
|
||||
End If
|
||||
End Sub
|
||||
Private Sub Debug_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs)
|
||||
If sender.[GetType]() = GetType(CheckBox) Then
|
||||
mnuViewDebug.Checked = chkDebug.Checked
|
||||
Else
|
||||
chkDebug.Checked = mnuViewDebug.Checked
|
||||
End If
|
||||
If model IsNot Nothing Then
|
||||
model.DebugDataVisible = chkDebug.Checked
|
||||
End If
|
||||
End Sub
|
||||
Private Sub mnuViewMatSolid_Click(ByVal sender As Object, ByVal e As EventArgs)
|
||||
mnuViewMatSolid.Checked = True
|
||||
mnuViewMatTransp.Checked = False
|
||||
mnuViewMatReflect.Checked = False
|
||||
If model IsNot Nothing Then
|
||||
model.SetMaterialType(video.MaterialType.SOLID)
|
||||
End If
|
||||
End Sub
|
||||
Private Sub mnuViewMatTransp_Click(ByVal sender As Object, ByVal e As EventArgs)
|
||||
mnuViewMatSolid.Checked = False
|
||||
mnuViewMatTransp.Checked = True
|
||||
mnuViewMatReflect.Checked = False
|
||||
If model IsNot Nothing Then
|
||||
model.SetMaterialType(video.MaterialType.TRANSPARENT_ADD_COLOR)
|
||||
End If
|
||||
End Sub
|
||||
Private Sub mnuViewMatReflect_Click(ByVal sender As Object, ByVal e As EventArgs)
|
||||
mnuViewMatSolid.Checked = False
|
||||
mnuViewMatTransp.Checked = False
|
||||
mnuViewMatReflect.Checked = True
|
||||
If model IsNot Nothing Then
|
||||
model.SetMaterialType(video.MaterialType.SPHERE_MAP)
|
||||
End If
|
||||
End Sub
|
||||
Private Sub Scale_ValueChanged(ByVal sender As Object, ByVal e As EventArgs)
|
||||
Dim scale As core.Vector3D
|
||||
scale.X = DirectCast(numScaleX.Value, Single)
|
||||
scale.Y = DirectCast(numScaleY.Value, Single)
|
||||
scale.Z = DirectCast(numScaleZ.Value, Single)
|
||||
If model IsNot Nothing Then
|
||||
model.Scale = scale
|
||||
End If
|
||||
End Sub
|
||||
#End Region
|
||||
#Region "- Resource Loading -"
|
||||
Private Sub LoadIrrConfig()
|
||||
If File.Exists(path + configFile) Then
|
||||
Dim xtr As XmlTextReader = New XmlTextReader(path + configFile)
|
||||
Try
|
||||
While xtr.Read()
|
||||
If (xtr.NodeType = XmlNodeType.Element) Then
|
||||
If xtr.LocalName = "startUpModel" Then
|
||||
xtr.MoveToFirstAttribute()
|
||||
startupModelFile = xtr.Value
|
||||
' Clean the leading stuff from the filename:
|
||||
Dim lastSlash As Integer = startupModelFile.LastIndexOf("/")
|
||||
startupModelFile = startupModelFile.Substring(lastSlash + 1)
|
||||
xtr.MoveToElement()
|
||||
ElseIf xtr.LocalName = "messageText" Then
|
||||
xtr.MoveToFirstAttribute()
|
||||
captBase = xtr.Value
|
||||
xtr.MoveToElement()
|
||||
messageText = xtr.ReadElementString()
|
||||
End If
|
||||
End If
|
||||
End While
|
||||
Catch ex As Exception
|
||||
MessageBox.Show(ex.Message)
|
||||
End Try
|
||||
xtr.Close()
|
||||
End If
|
||||
End Sub
|
||||
<summary>
|
||||
This method loads a model and displays it using an
|
||||
addAnimatedMeshSceneNode and the scene manager. Nothing difficult. It also
|
||||
displays a short message box, if the model could not be loaded.
|
||||
</summary>
|
||||
<param name="fileName">File name of the model to be loaded.</param>
|
||||
Private Sub LoadModel(ByVal fileName As String)
|
||||
' Check if we have a valid device to use.
|
||||
If device Is Nothing Then
|
||||
MessageBox.Show("Can't load model because the device is not created.", caption)
|
||||
Return
|
||||
End If
|
||||
Dim foundBSP As Boolean = False
|
||||
' modify the name if it a .pk3 file
|
||||
If fileName.EndsWith(".pk3") Then
|
||||
device.FileSystem.AddZipFileArchive(fileName)
|
||||
foundBSP = True
|
||||
End If
|
||||
' Clear the model if there was something loaded before.
|
||||
If model IsNot Nothing Then
|
||||
model.Remove()
|
||||
End If
|
||||
' Load a mesh from file.
|
||||
Dim m As scene.IAnimatedMesh = device.SceneManager.GetMesh(fileName)
|
||||
If m Is Nothing Then
|
||||
' Model could not be loaded
|
||||
If startupModelFile <> fileName Then
|
||||
Dim [error] As String = "The model could not be loaded." & Chr(10) & "Maybe it is not a supported file format."
|
||||
MessageBox.Show([error], caption)
|
||||
End If
|
||||
Return
|
||||
End If
|
||||
' load a model into the engine from the mesh
|
||||
model = device.SceneManager.AddAnimatedMeshSceneNode(m, Nothing, 0)
|
||||
' set default material properties
|
||||
If Not foundBSP Then
|
||||
If mnuViewMatSolid.Checked Then
|
||||
model.SetMaterialType(video.MaterialType.SOLID)
|
||||
ElseIf mnuViewMatTransp.Checked Then
|
||||
model.SetMaterialType(video.MaterialType.TRANSPARENT_ADD_COLOR)
|
||||
ElseIf mnuViewMatReflect.Checked Then
|
||||
model.SetMaterialType(video.MaterialType.SPHERE_MAP)
|
||||
End If
|
||||
End If
|
||||
model.SetMaterialFlag(video.MaterialFlag.LIGHTING, False)
|
||||
model.DebugDataVisible = True
|
||||
model.AnimationSpeed = 1000
|
||||
End Sub
|
||||
<summary>
|
||||
Loads the skybox using the device's driver & scene manager.
|
||||
</summary>
|
||||
Private Sub LoadSkyBox()
|
||||
If device Is Nothing Then
|
||||
MessageBox.Show("Couldn't load skybox because device was null.", caption)
|
||||
Return
|
||||
End If
|
||||
Dim driver As video.IVideoDriver = device.VideoDriver
|
||||
Dim smgr As scene.ISceneManager = device.SceneManager
|
||||
skyBox = smgr.AddSkyBoxSceneNode(driver.GetTexture(path + "irrlicht2_up.jpg"), driver.GetTexture(path + "irrlicht2_dn.jpg"), driver.GetTexture(path + "irrlicht2_lf.jpg"), driver.GetTexture(path + "irrlicht2_rt.jpg"), driver.GetTexture(path + "irrlicht2_ft.jpg"), driver.GetTexture(path + "irrlicht2_bk.jpg"), _
|
||||
Nothing, - 1)
|
||||
' null & -1 are the defaults in the native engine.
|
||||
If skyBox IsNot Nothing Then
|
||||
skyBox.Visible = chkSkyBox.Checked
|
||||
End If
|
||||
End Sub
|
||||
#End Region
|
||||
#Region "- Device selection & setup -"
|
||||
<summary>
|
||||
Gets the <see cref="Irrlicht.Video.DriverType"/> that the user selected.
|
||||
</summary>
|
||||
<returns><see cref="Irrlicht.Video.DriverType"/> the user selected.</returns>
|
||||
Private Function PickDriver() As video.DriverType
|
||||
If rbD3D9.Checked Then
|
||||
Return Irrlicht.Video.DriverType.DIRECT3D9
|
||||
End If
|
||||
If rbD3D8.Checked Then
|
||||
Return Irrlicht.Video.DriverType.DIRECT3D8
|
||||
End If
|
||||
If rbOGL.Checked Then
|
||||
Return Irrlicht.Video.DriverType.OPENGL
|
||||
End If
|
||||
If rbSoft1.Checked Then
|
||||
Return Irrlicht.Video.DriverType.SOFTWARE
|
||||
End If
|
||||
If rbSoft2.Checked Then
|
||||
Return Irrlicht.Video.DriverType.SOFTWARE2
|
||||
End If
|
||||
Return Irrlicht.Video.DriverType.NULL_DRIVER
|
||||
End Function
|
||||
<summary>
|
||||
Sets up the device to run in a <see cref="Control"/> with the specified <see cref="Irrlicht.Video.DriverType"/>.
|
||||
</summary>
|
||||
<param name="c">Winforms <see cref="Control"/> that Irrlicht is to render in.</param>
|
||||
<param name="driver"><see cref="Irrlicht.Video.DriverType"/> to use when setting up the IrrlichtDevice.</param>
|
||||
<returns>True if the setup went well, False otherwise.</returns>
|
||||
Private Function SetDevice(ByVal c As Control, ByVal driverType As video.DriverType) As Boolean
|
||||
If quitting Then
|
||||
Return False
|
||||
End If
|
||||
If device IsNot Nothing Then
|
||||
device.CloseDevice()
|
||||
End If
|
||||
CreatePanel()
|
||||
device = New IrrlichtDevice(driverType, New core.Dimension2D(c.ClientRectangle.Width, c.ClientRectangle.Height), 32, False, False, False, _
|
||||
True, c.Handle)
|
||||
If device Is Nothing Then
|
||||
Return False
|
||||
End If
|
||||
device.ResizeAble = True
|
||||
Dim env As gui.IGUIEnvironment = device.GUIEnvironment
|
||||
Dim driver As video.IVideoDriver = device.VideoDriver
|
||||
Dim smgr As scene.ISceneManager = device.SceneManager
|
||||
driver.SetTextureCreationFlag(video.TextureCreationFlag.ALWAYS_32_BIT, True)
|
||||
' This sets the gui font from a bmp file.
|
||||
Dim skin As gui.IGUISkin = env.Skin
|
||||
Dim font As gui.IGUIFont = env.GetFont(path + "fonthaettenschweiler.bmp")
|
||||
If font IsNot Nothing Then
|
||||
skin.Font = font
|
||||
End If
|
||||
' This is loaded with the default values for the native engine.
|
||||
smgr.AddCameraSceneNodeMaya(Nothing, - 1500, 500, 1500, - 1)
|
||||
irrLogo = driver.GetTexture(path + "irrlichtlogoaligned.jpg")
|
||||
caption = captBase + " (using " + driver.Name + " driver)"
|
||||
Me.Text = caption
|
||||
Return True
|
||||
End Function
|
||||
<summary>
|
||||
Since the panel gets destroyed with device.CloseDevice,
|
||||
we are creating it separately from the standard
|
||||
Visual Studio section.
|
||||
</summary>
|
||||
Private Sub CreatePanel()
|
||||
If panelMemory Is Nothing OrElse panelMemory = Rectangle.Empty Then
|
||||
panelMemory = New Rectangle(12, 12, 481, 373)
|
||||
End If
|
||||
Me.pnlIrrlicht = New System.Windows.Forms.Panel()
|
||||
'
|
||||
' pnlIrrlicht
|
||||
'
|
||||
Me.pnlIrrlicht.Anchor = (DirectCast(((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) Or System.Windows.Forms.AnchorStyles.Left) Or System.Windows.Forms.AnchorStyles.Right)), System.Windows.Forms.AnchorStyles))
|
||||
Me.pnlIrrlicht.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
|
||||
Me.pnlIrrlicht.Location = panelMemory.Location
|
||||
Me.pnlIrrlicht.Name = "pnlIrrlicht"
|
||||
Me.pnlIrrlicht.Size = panelMemory.Size
|
||||
Me.pnlIrrlicht.TabIndex = 0
|
||||
AddHandler Me.pnlIrrlicht.Resize, AddressOf pnlIrrlicht_Resize
|
||||
AddHandler Me.pnlIrrlicht.Move, AddressOf pnlIrrlicht_Move
|
||||
Me.toolStripContainer1.ContentPanel.Controls.Add(Me.pnlIrrlicht)
|
||||
Me.toolStripContainer1.ContentPanel.ResumeLayout(False)
|
||||
Me.toolStripContainer1.ContentPanel.PerformLayout()
|
||||
End Sub
|
||||
<summary>
|
||||
We are using this to rember the location / size of the Irrlicht panel.
|
||||
</summary>
|
||||
<param name="sender">Event's sender.</param>
|
||||
<param name="e">Event arguments.</param>
|
||||
Private Sub pnlIrrlicht_Move(ByVal sender As Object, ByVal e As EventArgs)
|
||||
panelMemory.Location = pnlIrrlicht.Location
|
||||
panelMemory.Size = pnlIrrlicht.Size
|
||||
End Sub
|
||||
<summary>
|
||||
We are using this to rember the location / size of the Irrlicht panel.
|
||||
</summary>
|
||||
<param name="sender">Event's sender.</param>
|
||||
<param name="e">Event arguments.</param>
|
||||
Private Sub pnlIrrlicht_Resize(ByVal sender As Object, ByVal e As EventArgs)
|
||||
panelMemory.Location = pnlIrrlicht.Location
|
||||
panelMemory.Size = pnlIrrlicht.Size
|
||||
End Sub
|
||||
#End Region
|
||||
<summary>
|
||||
Starts the Irrlicht rendering loop.
|
||||
</summary>
|
||||
<param name="c">The <see cref="Control"/> that Irrlicht is running in.</param>
|
||||
Private Sub RunDevice(ByVal c As Control)
|
||||
If model Is Nothing Then
|
||||
LoadModel(path + startupModelFile)
|
||||
End If
|
||||
While Not paused AndAlso Not quitting AndAlso device.Run() AndAlso device.VideoDriver IsNot Nothing
|
||||
device.VideoDriver.BeginScene(True, True, New Irrlicht.Video.Color(150, 50, 50, 50))
|
||||
device.SceneManager.DrawAll()
|
||||
device.GUIEnvironment.DrawAll()
|
||||
Dim logoLocation As core.Position2D = New core.Position2D(c.ClientRectangle.Left + 20, c.ClientRectangle.Bottom - 40)
|
||||
device.VideoDriver.Draw2DImage(irrLogo, logoLocation)
|
||||
device.VideoDriver.EndScene()
|
||||
If Not quitting AndAlso Not paused Then
|
||||
txtFPS.Text = device.VideoDriver.FPS + " FPS"
|
||||
End If
|
||||
End While
|
||||
End Sub
|
||||
End Class
|
||||
End Namespace
|
||||
|
||||
' Retrieved from "http://www.irrforge.org/index.php/VB_Tutorial_9"
|
||||
' This page has been accessed 99 times. This page was last modified 06:24, 25 Feb 2006.
|
||||
|
5
examples.net/Examples_VisualBasic/readme.txt
Normal file
5
examples.net/Examples_VisualBasic/readme.txt
Normal file
@ -0,0 +1,5 @@
|
||||
These Tutorials have simply been copied from the Irrlicht Wiki at http://www.irrforge.org
|
||||
They are written by different authors, and not guaranteed to work, they simply should provide
|
||||
the c++ examples ported the Irrlicht.NET.
|
||||
Please see the wiki for updates and more info.
|
||||
A lot of thanks go to the people who wrote these examples.
|
4
examples.net/whereAreTheBinaries.txt
Normal file
4
examples.net/whereAreTheBinaries.txt
Normal file
@ -0,0 +1,4 @@
|
||||
If you are searching for executeables of the examples and the techdemo,
|
||||
you'll find some for Windows in the directory
|
||||
/bin/Win32-VisualStudio.
|
||||
|
90
examples/01.HelloWorld/HelloWorld.dsp
Normal file
90
examples/01.HelloWorld/HelloWorld.dsp
Normal file
@ -0,0 +1,90 @@
|
||||
# Microsoft Developer Studio Project File - Name="HelloWorld" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** NICHT BEARBEITEN **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=HelloWorld - Win32 Debug
|
||||
!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE
|
||||
!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "HelloWorld.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben
|
||||
!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "HelloWorld.mak" CFG="HelloWorld - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Für die Konfiguration stehen zur Auswahl:
|
||||
!MESSAGE
|
||||
!MESSAGE "HelloWorld - Win32 Release" (basierend auf "Win32 (x86) Console Application")
|
||||
!MESSAGE "HelloWorld - Win32 Debug" (basierend auf "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "HelloWorld - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0xc07 /d "NDEBUG"
|
||||
# ADD RSC /l 0xc07 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"..\..\bin\Win32-VisualStudio\HelloWorld.exe" /libpath:"..\..\lib\Win32-visualstudio"
|
||||
|
||||
!ELSEIF "$(CFG)" == "HelloWorld - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0xc07 /d "_DEBUG"
|
||||
# ADD RSC /l 0xc07 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\..\bin\Win32-VisualStudio\HelloWorld.exe" /pdbtype:sept /libpath:"..\..\lib\Win32-visualstudio"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "HelloWorld - Win32 Release"
|
||||
# Name "HelloWorld - Win32 Debug"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\main.cpp
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
29
examples/01.HelloWorld/HelloWorld.dsw
Normal file
29
examples/01.HelloWorld/HelloWorld.dsw
Normal file
@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "HelloWorld"=.\HelloWorld.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
21
examples/01.HelloWorld/HelloWorld.sln
Normal file
21
examples/01.HelloWorld/HelloWorld.sln
Normal file
@ -0,0 +1,21 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloWorld", "HelloWorld.vcproj", "{A4D8C3B0-B3D2-4EC9-A2CC-FBC09C09DE12}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
Release = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{A4D8C3B0-B3D2-4EC9-A2CC-FBC09C09DE12}.Debug.ActiveCfg = Debug|Win32
|
||||
{A4D8C3B0-B3D2-4EC9-A2CC-FBC09C09DE12}.Debug.Build.0 = Debug|Win32
|
||||
{A4D8C3B0-B3D2-4EC9-A2CC-FBC09C09DE12}.Release.ActiveCfg = Release|Win32
|
||||
{A4D8C3B0-B3D2-4EC9-A2CC-FBC09C09DE12}.Release.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
163
examples/01.HelloWorld/HelloWorld.vcproj
Normal file
163
examples/01.HelloWorld/HelloWorld.vcproj
Normal file
@ -0,0 +1,163 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="01.HelloWorld"
|
||||
ProjectGUID="{265B57DD-0C6D-4CFD-A95E-0FCC3ECD0E90}"
|
||||
SccProjectName=""
|
||||
SccLocalPath="">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\Debug"
|
||||
IntermediateDirectory=".\Debug"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="5"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile=".\Debug/HelloWorld.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
ProgramDataBaseFileName=".\Debug/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\01.HelloWorld.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile=".\Debug/HelloWorld.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Debug/HelloWorld.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="3079"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\Release"
|
||||
IntermediateDirectory=".\Release"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="4"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile=".\Release/HelloWorld.pch"
|
||||
AssemblerListingLocation=".\Release/"
|
||||
ObjectFile=".\Release/"
|
||||
ProgramDataBaseFileName=".\Release/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\01.HelloWorld.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
ProgramDatabaseFile=".\Release/HelloWorld.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Release/HelloWorld.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="3079"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="main.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
231
examples/01.HelloWorld/HelloWorld_vc8.vcproj
Normal file
231
examples/01.HelloWorld/HelloWorld_vc8.vcproj
Normal file
@ -0,0 +1,231 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="01.HelloWorld_vc8"
|
||||
ProjectGUID="{5AD4C95C-BA38-4692-BA4B-8C25A86208F9}"
|
||||
RootNamespace="HelloWorld_vc8"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\Debug"
|
||||
IntermediateDirectory=".\Debug"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Debug/HelloWorld.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderFile=".\Debug/HelloWorld.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
ProgramDataBaseFileName=".\Debug/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="3079"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\01.HelloWorld.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile=".\Debug/HelloWorld.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\Release"
|
||||
IntermediateDirectory=".\Release"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Release/HelloWorld.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderFile=".\Release/HelloWorld.pch"
|
||||
AssemblerListingLocation=".\Release/"
|
||||
ObjectFile=".\Release/"
|
||||
ProgramDataBaseFileName=".\Release/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="3079"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\01.HelloWorld.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
ProgramDatabaseFile=".\Release/HelloWorld.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="main.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BasicRuntimeChecks="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
38
examples/01.HelloWorld/Makefile
Normal file
38
examples/01.HelloWorld/Makefile
Normal file
@ -0,0 +1,38 @@
|
||||
# Makefile for Irrlicht Examples
|
||||
# It's usually sufficient to change just the target name and source file list
|
||||
# and be sure that CXX is set to a valid compiler
|
||||
Target = 01.HelloWorld
|
||||
Sources = main.cpp
|
||||
|
||||
# general compiler settings
|
||||
CPPFLAGS = -I../../include -I/usr/X11R6/include
|
||||
CXXFLAGS = -O3 -ffast-math
|
||||
#CXXFLAGS = -g -Wall
|
||||
|
||||
#default target is Linux
|
||||
all: all_linux
|
||||
|
||||
ifeq ($(HOSTTYPE), x86_64)
|
||||
LIBSELECT=64
|
||||
endif
|
||||
|
||||
# target specific settings
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht -lGL -lGLU -lXxf86vm -lXext -lX11
|
||||
all_linux clean_linux: SYSTEM=Linux
|
||||
all_win32: LDFLAGS = -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lglu32 -lm
|
||||
all_win32 clean_win32: SYSTEM=Win32-gcc
|
||||
all_win32 clean_win32: SUF=.exe
|
||||
# name of the binary - only valid for targets which set SYSTEM
|
||||
DESTPATH = ../../bin/$(SYSTEM)/$(Target)$(SUF)
|
||||
|
||||
all_linux all_win32:
|
||||
$(warning Building...)
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(Sources) -o $(DESTPATH) $(LDFLAGS)
|
||||
|
||||
clean: clean_linux clean_win32
|
||||
$(warning Cleaning...)
|
||||
|
||||
clean_linux clean_win32:
|
||||
@$(RM) $(DESTPATH)
|
||||
|
||||
.PHONY: all all_win32 clean clean_linux clean_win32
|
32
examples/01.HelloWorld/example.cbp
Normal file
32
examples/01.HelloWorld/example.cbp
Normal file
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE CodeBlocks_project_file>
|
||||
<CodeBlocks_project_file>
|
||||
<FileVersion major="1" minor="1"/>
|
||||
<Project>
|
||||
<Option title="Irrlicht Example 01 Hello World"/>
|
||||
<Option makefile="Makefile"/>
|
||||
<Option makefile_is_custom="0"/>
|
||||
<Option compiler="0"/>
|
||||
<Build>
|
||||
<Target title="default">
|
||||
<Option output="..\..\bin\win32-gcc\01.HelloWorld.exe"/>
|
||||
<Option working_dir="."/>
|
||||
<Option object_output=".objs"/>
|
||||
<Option deps_output=".deps"/>
|
||||
<Option type="1"/>
|
||||
<Option compiler="0"/>
|
||||
<Option projectResourceIncludeDirsRelation="1"/>
|
||||
</Target>
|
||||
</Build>
|
||||
<Compiler>
|
||||
<Add directory="..\..\include"/>
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="../../lib/Win32-gcc/libIrrlicht.a"/>
|
||||
</Linker>
|
||||
<Unit filename="main.cpp">
|
||||
<Option compilerVar="CPP"/>
|
||||
<Option target="default"/>
|
||||
</Unit>
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
59
examples/01.HelloWorld/example.dev
Normal file
59
examples/01.HelloWorld/example.dev
Normal file
@ -0,0 +1,59 @@
|
||||
[Project]
|
||||
FileName=example.dev
|
||||
Name=Irrlicht Example 01 HelloWorld
|
||||
UnitCount=1
|
||||
Type=1
|
||||
Ver=1
|
||||
ObjFiles=
|
||||
Includes=..\..\include
|
||||
Libs=
|
||||
PrivateResource=
|
||||
ResourceIncludes=
|
||||
MakeIncludes=
|
||||
Compiler=
|
||||
CppCompiler=
|
||||
Linker=../../lib/Win32-gcc/libIrrlicht.a_@@_
|
||||
IsCpp=1
|
||||
Icon=
|
||||
ExeOutput=../../bin/Win32-gcc
|
||||
ObjectOutput=
|
||||
OverrideOutput=1
|
||||
OverrideOutputName=01.HelloWorld.exe
|
||||
HostApplication=
|
||||
Folders=
|
||||
CommandLine=
|
||||
IncludeVersionInfo=0
|
||||
SupportXPThemes=0
|
||||
CompilerSet=0
|
||||
CompilerSettings=0000000000000000000000
|
||||
UseCustomMakefile=0
|
||||
CustomMakefile=
|
||||
|
||||
[Unit1]
|
||||
FileName=main.cpp
|
||||
CompileCpp=1
|
||||
Folder=Projekt1
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[VersionInfo]
|
||||
Major=0
|
||||
Minor=1
|
||||
Release=1
|
||||
Build=1
|
||||
LanguageID=1033
|
||||
CharsetID=1252
|
||||
CompanyName=
|
||||
FileVersion=
|
||||
FileDescription=Irrlicht Engine example compiled using DevCpp and gcc
|
||||
InternalName=
|
||||
LegalCopyright=
|
||||
LegalTrademarks=
|
||||
OriginalFilename=
|
||||
ProductName=
|
||||
ProductVersion=
|
||||
AutoIncBuildNr=0
|
||||
|
209
examples/01.HelloWorld/main.cpp
Normal file
209
examples/01.HelloWorld/main.cpp
Normal file
@ -0,0 +1,209 @@
|
||||
|
||||
/*
|
||||
This Tutorial shows how to set up the IDE for using the
|
||||
Irrlicht Engine and how to write a simple HelloWorld
|
||||
program with it. The program will show how to use the
|
||||
basics of the VideoDriver, the GUIEnvironment and the
|
||||
SceneManager.
|
||||
Microsoft Visual C++ 6.0 and .NET is used as
|
||||
example IDE, but you will also be able to understand everything
|
||||
if you are using a different one or even another operating
|
||||
system than windows.
|
||||
|
||||
To use the engine, we will have to include the header file
|
||||
irrlicht.h, which can be found in the Irrlicht Engine SDK
|
||||
directory \include.
|
||||
To let the compiler find this header file, the directory where
|
||||
it is located should be specified somewhere. This is different
|
||||
for every IDE and compiler you use. I explain shortly how to
|
||||
do this in Microsift Visual Studio C++ 6.0 and .NET:
|
||||
|
||||
- If you use Version 6.0, select the Menu Extras -> Options.
|
||||
Select the directories tab, and select the 'Include' Item in the combo box.
|
||||
Add the \include directory of the irrlicht engine folder to the list of directories.
|
||||
Now the compiler will find the Irrlicht.h header file. We also
|
||||
need the irrlicht.lib to be found, so stay
|
||||
in that dialog, select 'Libraries' in the combo box and add the
|
||||
\lib\VisualStudio directory.
|
||||
|
||||
- If your IDE is Visual Studio .NET, select Tools -> Options.
|
||||
Select the projects entry and then select VC++ directories.
|
||||
Select 'show directories for include files' in the combo box, and
|
||||
add the \include directory of the irrlicht engine folder to the list of directories.
|
||||
Now the compiler will find the Irrlicht.h header file. We also
|
||||
need the irrlicht.lib to be found, so stay
|
||||
in that dialog, select 'show directories for Library files' and add the
|
||||
\lib\VisualStudio directory.
|
||||
|
||||
That's it, with your IDE set up like this, you will now be able to
|
||||
develop applications with the Irrlicht Engine.
|
||||
|
||||
*/
|
||||
#include <irrlicht.h>
|
||||
|
||||
/*
|
||||
In the Irrlicht Engine, everything can be found in the namespace
|
||||
'irr'. So if you want to use a class of the engine, you have to
|
||||
write an irr:: before the name of the class. For example to use
|
||||
the IrrlichtDevice write: irr::IrrlichtDevice. To get rid of the
|
||||
irr:: in front of the name of every class, we tell the compiler
|
||||
that we use that namespace from now on, and we will not have to
|
||||
write that 'irr::'.
|
||||
*/
|
||||
using namespace irr;
|
||||
|
||||
/*
|
||||
There are 5 sub namespaces in the Irrlicht Engine. Take a look
|
||||
at them, you can read a detailed description of them in the
|
||||
documentation by clicking on the top menu item 'Namespace List'
|
||||
or using this link: http://irrlicht.sourceforge.net/docu/namespaces.html.
|
||||
Like the irr Namespace, we do not want these 5 sub namespaces now,
|
||||
to keep this example simple. Hence we tell the compiler again
|
||||
that we do not want always to write their names:
|
||||
*/
|
||||
using namespace core;
|
||||
using namespace scene;
|
||||
using namespace video;
|
||||
using namespace io;
|
||||
using namespace gui;
|
||||
|
||||
/*
|
||||
To be able to use the Irrlicht.DLL file, we need to link with the
|
||||
Irrlicht.lib. We could set this option in the project settings, but
|
||||
to make it easy, we use a pragma comment lib:
|
||||
*/
|
||||
#ifdef _IRR_WINDOWS_
|
||||
#pragma comment(lib, "Irrlicht.lib")
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
This is the main method. We can use int main() on every platform.
|
||||
On Windows platforms, we could also use the WinMain method
|
||||
if we would want to get rid of the console window, which pops up when
|
||||
starting a program with main(), but to keep this example simple,
|
||||
we use main().
|
||||
*/
|
||||
int main()
|
||||
{
|
||||
/*
|
||||
The most important function of the engine is the 'createDevice'
|
||||
function. The Irrlicht Device can be created with it, which is the
|
||||
root object for doing everything with the engine.
|
||||
createDevice() has 7 paramters:
|
||||
deviceType: Type of the device. This can currently be the Null-device,
|
||||
the Software device, the second software renderer, D3D8, D3D9, or OpenGL.
|
||||
In this example we use EDT_SOFTWARE, but to try out, you might want to change it to
|
||||
EDT_BURNINGSVIDEO, EDT_NULL, EDT_DIRECT3D8 , EDT_DIRECT3D9, or EDT_OPENGL.
|
||||
windowSize: Size of the Window or FullscreenMode to be created. In this
|
||||
example we use 640x480.
|
||||
bits: Amount of bits per pixel when in fullscreen mode. This should
|
||||
be 16 or 32. This parameter is ignored when running in windowed mode.
|
||||
fullscreen: Specifies if we want the device to run in fullscreen mode
|
||||
or not.
|
||||
stencilbuffer: Specifies if we want to use the stencil buffer for drawing shadows.
|
||||
vsync: Specifies if we want to have vsync enabled, this is only useful in fullscreen
|
||||
mode.
|
||||
eventReceiver: An object to receive events. We do not want to use this
|
||||
parameter here, and set it to 0.
|
||||
*/
|
||||
|
||||
IrrlichtDevice *device =
|
||||
createDevice( video::EDT_SOFTWARE, dimension2d<s32>(640, 480), 16,
|
||||
false, false, false, 0);
|
||||
|
||||
/*
|
||||
Set the caption of the window to some nice text. Note that there is
|
||||
a 'L' in front of the string. The Irrlicht Engine uses wide character
|
||||
strings when displaying text.
|
||||
*/
|
||||
device->setWindowCaption(L"Hello World! - Irrlicht Engine Demo");
|
||||
|
||||
/*
|
||||
Get a pointer to the video driver, the SceneManager and the
|
||||
graphical user interface environment, so that
|
||||
we do not always have to write device->getVideoDriver(),
|
||||
device->getSceneManager() and device->getGUIEnvironment().
|
||||
*/
|
||||
IVideoDriver* driver = device->getVideoDriver();
|
||||
ISceneManager* smgr = device->getSceneManager();
|
||||
IGUIEnvironment* guienv = device->getGUIEnvironment();
|
||||
|
||||
/*
|
||||
We add a hello world label to the window, using the GUI environment.
|
||||
*/
|
||||
guienv->addStaticText(L"Hello World! This is the Irrlicht Software renderer!",
|
||||
rect<int>(10,10,260,22), true);
|
||||
|
||||
/*
|
||||
To display something interesting, we load a Quake 2 model
|
||||
and display it. We only have to get the Mesh from the Scene
|
||||
Manager (getMesh()) and add a SceneNode to display the mesh.
|
||||
(addAnimatedMeshSceneNode()). Instead of writing the filename
|
||||
sydney.md2, it would also be possible to load a Maya object file
|
||||
(.obj), a complete Quake3 map (.bsp) or a Milshape file (.ms3d).
|
||||
By the way, that cool Quake 2 model called sydney was modelled
|
||||
by Brian Collins.
|
||||
*/
|
||||
IAnimatedMesh* mesh = smgr->getMesh("../../media/sydney.md2");
|
||||
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
|
||||
|
||||
/*
|
||||
To let the mesh look a little bit nicer, we change its material a
|
||||
little bit: We disable lighting because we do not have a dynamic light
|
||||
in here, and the mesh would be totally black. Then we set the frame
|
||||
loop, so that the animation is looped between the frames 0 and 310.
|
||||
And at last, we apply a texture to the mesh. Without it the mesh
|
||||
would be drawn using only a color.
|
||||
*/
|
||||
if (node)
|
||||
{
|
||||
node->setMaterialFlag(EMF_LIGHTING, false);
|
||||
node->setMD2Animation ( scene::EMAT_STAND );
|
||||
node->setMaterialTexture( 0, driver->getTexture("../../media/sydney.bmp") );
|
||||
}
|
||||
|
||||
/*
|
||||
To look at the mesh, we place a camera into 3d space at the position
|
||||
(0, 30, -40). The camera looks from there to (0,5,0).
|
||||
*/
|
||||
smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));
|
||||
|
||||
/*
|
||||
Ok, now we have set up the scene, lets draw everything:
|
||||
We run the device in a while() loop, until the device does not
|
||||
want to run any more. This would be when the user closed the window
|
||||
or pressed ALT+F4 in windows.
|
||||
*/
|
||||
while(device->run())
|
||||
{
|
||||
/*
|
||||
Anything can be drawn between a beginScene() and an endScene()
|
||||
call. The beginScene clears the screen with a color and also the
|
||||
depth buffer if wanted. Then we let the Scene Manager and the
|
||||
GUI Environment draw their content. With the endScene() call
|
||||
everything is presented on the screen.
|
||||
*/
|
||||
driver->beginScene(true, true, SColor(255,100,101,140));
|
||||
|
||||
smgr->drawAll();
|
||||
guienv->drawAll();
|
||||
|
||||
driver->endScene();
|
||||
}
|
||||
|
||||
/*
|
||||
After we are finished, we have to delete the Irrlicht Device
|
||||
created before with createDevice(). In the Irrlicht Engine,
|
||||
you will have to delete all objects you created with a method or
|
||||
function which starts with 'create'. The object is simply deleted
|
||||
by calling ->drop().
|
||||
See the documentation at
|
||||
http://irrlicht.sourceforge.net//docu/classirr_1_1IUnknown.html#a3
|
||||
for more information.
|
||||
*/
|
||||
device->drop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
394
examples/01.HelloWorld/tutorial.html
Normal file
394
examples/01.HelloWorld/tutorial.html
Normal file
@ -0,0 +1,394 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Irrlicht Engine Tutorial</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
|
||||
<br>
|
||||
<table width="90%" border="0" cellspacing="0" cellpadding="2" align="center">
|
||||
<tr>
|
||||
<td bgcolor="#666699"> <b><font color="#FFFFFF">Tutorial 1.HelloWorld</font></b></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="90" bgcolor="#F7F3F7"> <div align="left">
|
||||
<p>This Tutorial shows how to set up the IDE for using the
|
||||
Irrlicht Engine and how to write a simple HelloWorld program
|
||||
with it. The program will show how to use the basics of
|
||||
the VideoDriver, the GUIEnvironment and the SceneManager.<br>
|
||||
The result of this example will look like this:</p>
|
||||
<p align="center"><img src="../../media/001shot.jpg" width="259" height="204"><br>
|
||||
</p>
|
||||
</div></td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
<br> <table width="90%" border="0" cellspacing="0" cellpadding="2" align="center">
|
||||
<tr> <a name="settingup"></a>
|
||||
<td bgcolor="#666699"> <b><font color="#FFFFFF">Setting up the
|
||||
IDE</font></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="90" bgcolor="#F7F3F7"> <div align="left">
|
||||
<div align="left">
|
||||
<p align="left">To use the engine, we will have to include
|
||||
the header file <irrlicht.h>, which can be found
|
||||
in the Irrlicht Engine SDK directory \include. To let
|
||||
the compiler find this header file, the directory where
|
||||
it is located should be specified somewhere. This is different
|
||||
for every IDE and compiler. I will explain how to do this
|
||||
in Microsoft Visual Studio C++ 6.0 and .NET:</p>
|
||||
|
||||
</div>
|
||||
<ul>
|
||||
<li>
|
||||
<div align="left">If you use Version 6.0, select the Menu
|
||||
Extras -> Options. Select the directories tab, and
|
||||
select the 'Include' Item in the combo box. Add the
|
||||
\include directory of the Irrlicht Engine folder to
|
||||
the list of directories. Now the compiler will find
|
||||
the Irrlicht.h header file. We also need the location
|
||||
of irrlicht.lib to be listed, so select the 'Libraries'
|
||||
tab and add the \lib\VisualStudio directory.<br>
|
||||
<br>
|
||||
<img src="../../media/vc6optionsdir.jpg" width="231" height="172" align="middle"> <img src="../../media/vc6include.jpg" width="231" height="159" align="middle"><br>
|
||||
<br>
|
||||
|
||||
</div>
|
||||
</li>
|
||||
<li>If your IDE is Visual Studio .NET, select Tools ->
|
||||
Options. Select the Projects entry and then select VC++
|
||||
directories. Select 'show directories for include files'
|
||||
in the combo box, and add the \include directory of the
|
||||
Irrlicht Engine folder to the list of directories so the
|
||||
compiler will find the Irrlicht.h header file. We also
|
||||
need the irrlicht.lib to be found, so select 'show directories
|
||||
for Library files' and add the \lib\VisualStudio directory.<br>
|
||||
<br>
|
||||
<img src="../../media/vcnetinclude.jpg" width="256" height="160">
|
||||
<br>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p> </p>
|
||||
</div></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br> <table width="90%" border="0" cellspacing="0" cellpadding="2" align="center">
|
||||
<tr>
|
||||
<td bgcolor="#666699"> <font color="#FFFFFF"><b>Lets start!</b></font></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td height="90" bgcolor="#F7F3F7" valign="top"> <div align="left">
|
||||
<div align="left">
|
||||
<div align="left">
|
||||
<div align="left">
|
||||
<p>After we have set up the IDE, the compiler will know
|
||||
where to find the Irrlicht Engine header files so
|
||||
we can include it now into our code.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>#include <irrlicht.h></pre> </td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
<p>In the Irrlicht Engine, everything can be found in
|
||||
the namespace 'irr'. So if you want to use a class
|
||||
of the engine, you'll have to type an irr:: before
|
||||
the name of the class. For example, to use the IrrlichtDevice,
|
||||
write: irr::IrrlichtDevice. To avoid having to put
|
||||
irr:: before of the name of every class, we tell the
|
||||
compiler that we use that namespace.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>using namespace irr;</pre> </td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<p>There are 5 sub-namespaces in the Irrlicht Engine.
|
||||
Take a look at them: you can read a detailed description
|
||||
of them in the documentation by clicking on the top
|
||||
menu item '<a href="http://irrlicht.sourceforge.net/docu/namespaces.html">Namespace
|
||||
List</a>'. To keep this example simple, we don't want
|
||||
to have to specify the name spaces, Hence:</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>using namespace core;<br>using namespace scene;<br>using namespace video;<br>using namespace io;<br>using namespace gui;</pre> </td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
<p>To be able to use the Irrlicht.DLL file, we need
|
||||
to link with the Irrlicht.lib. We could set this option
|
||||
in the project settings, but to make it easy we use
|
||||
a pragma comment:</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>#pragma comment(lib, "Irrlicht.lib")</pre> </td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
<p>Now the main method: to keep this example simple
|
||||
we use int main(), which can be used on any platform.
|
||||
However, on Windows platforms, we could also use the
|
||||
WinMain method if we would want to get rid of the
|
||||
console window which pops up when starting a program
|
||||
with main().</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>int main()<br>{</pre> </td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<p>The most important function of the engine is the
|
||||
'createDevice' function. The Irrlicht Device, which
|
||||
is the root object for doing everything with the engine,
|
||||
can be created with it. createDevice() has 7 parameters:</p>
|
||||
</div>
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
<div align="left"> deviceType: Type of the device. This can currently
|
||||
be the Null device, the Software device, Direct3D8, Direct3D9,
|
||||
or OpenGL. In this example we use EDT_SOFTWARE, but, to try
|
||||
them out, you might want to change it to EDT_NULL, EDT_DIRECT3D8,
|
||||
EDT_DIRECT3D9 or EDT_OPENGL. </div>
|
||||
</li>
|
||||
<li>
|
||||
<div align="left">windowSize: Size of the window or
|
||||
full screen mode to be created. In this example
|
||||
we use 512x384.</div>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<div align="left">bits: Number of bits per pixel when
|
||||
in full screen mode. This should be 16 or 32. This
|
||||
parameter is ignored when running in windowed mode.</div>
|
||||
</li>
|
||||
<li>
|
||||
<div align="left">fullscreen: Specifies if we want
|
||||
the device to run in full screen mode or not.</div>
|
||||
</li>
|
||||
<li>stencilbuffer: Specifies if we want to use the stencil
|
||||
buffer for drawing shadows.</li>
|
||||
|
||||
<li>vsync: Specifies if we want to have vsync enabled.
|
||||
This is only useful in full screen mode.</li>
|
||||
<li>
|
||||
<div align="left">eventReceiver: An object to receive
|
||||
events. We do not want to use this parameter here,
|
||||
and set it to 0.</div>
|
||||
</li>
|
||||
</ul>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>IrrlichtDevice *device =<br> createDevice(EDT_SOFTWARE, dimension2d<s32>(512, 384), 16,<br> false, false, false, 0);</pre> </td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
<p>Now we set the caption of the window to some nice text.
|
||||
Note that there is a 'L' in front of the string: the
|
||||
Irrlicht Engine uses wide character strings when displaying
|
||||
text.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>device->setWindowCaption(L"Hello World! - Irrlicht Engine Demo");</pre> </td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
<p>Now we store a pointer to the video driver, the SceneManager,
|
||||
and the graphical user interface environment so that
|
||||
we do not always have to write device->getVideoDriver(),
|
||||
device->getSceneManager(), and device->getGUIEnvironment().</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>IVideoDriver* driver = device->getVideoDriver();<br>ISceneManager* smgr = device->getSceneManager();<br>IGUIEnvironment* guienv = device->getGUIEnvironment();</pre> </td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
<p> We add a hello world label to the window using the
|
||||
GUI environment. The text is placed at the position
|
||||
(10,10) as top left corner and (200,22) as lower right
|
||||
corner.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>guienv->addStaticText(L"Hello World! This is the Irrlicht Software engine!",<br> rect<int>(10,10,200,22), true);</pre> </td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
<p>To display something interesting, we load a Quake 2
|
||||
model and display it. We only have to get the Mesh from
|
||||
the Scene Manager with getMesh() and add a SceneNode
|
||||
to display the mesh with addAnimatedMeshSceneNode().
|
||||
Instead of loading a Quake2 file (.md2), it is also
|
||||
possible to load a Maya object file (.obj), a complete
|
||||
Quake3 map (.bsp), or a Milshape file (.ms3d).<br>
|
||||
By the way, that cool Quake 2 model called sydney.md2
|
||||
was modelled by Brian Collins.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>IAnimatedMesh* mesh = smgr->getMesh("../../media/sydney.md2");<br>IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );</pre> </td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
<p>To make the mesh look a little bit nicer, we change
|
||||
its material a little bit: we disable lighting because
|
||||
we do not have a dynamic light in here and the mesh
|
||||
would be totally black. Then we set the frame loop so
|
||||
that the animation is looped between the frames 0 and
|
||||
310. Then, at last, we apply a texture to the mesh.
|
||||
Without it the mesh would be drawn using only a solid
|
||||
color.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>if (node)<br>{<br> node->setMaterialFlag(EMF_LIGHTING, false);<br> node->setFrameLoop(0, 310); <br> node->setMaterialTexture( 0, driver->getTexture("../../media/sydney.bmp") );<br>}</pre>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
<p>To look at the mesh, we place a camera into 3d space
|
||||
at the position (0, 10, -40). The camera looks from
|
||||
there to (0,5,0).</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));</pre> </td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<p>Ok. Now that we have set up the scene, let's draw everything:
|
||||
we run the device in a while() loop until the device
|
||||
does not want to run any more. This would be when the
|
||||
user closes the window or presses ALT+F4 in Windows.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>while(device->run())<br>{</pre> </td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<p> Everything must be drawn between a beginScene() and
|
||||
an endScene() call. The beginScene clears the screen
|
||||
with a color and also the depth buffer, if desired.
|
||||
Then we let the Scene Manager and the GUI environment
|
||||
draw their content. With the endScene() call, everything
|
||||
is presented on the screen.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
|
||||
<td> <pre> driver->beginScene(true, true, SColor(255,100,101,140));<br>
|
||||
smgr->drawAll();
|
||||
guienv->drawAll();</pre>
|
||||
<pre> driver->endScene();
|
||||
}</pre> </td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
<p>After we are finished, we have to delete the Irrlicht
|
||||
Device created earlier with createDevice(). With the
|
||||
Irrlicht Engine, you should delete all objects you created
|
||||
with a method or function that starts with 'create'.
|
||||
The object is deleted simply by calling ->drop().
|
||||
See the <a href="http://irrlicht.sourceforge.net/docu/classirr_1_1IUnknown.html#a3" target="_blank">documentation</a>
|
||||
for more information.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre> device->drop();<br> return 0;
|
||||
}</pre> </td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
<p>That's it. Compile and run. </p>
|
||||
<p> </p>
|
||||
</div>
|
||||
</div>
|
||||
</div></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<br>
|
||||
<table width="90%" border="0" cellspacing="0" cellpadding="2" align="center">
|
||||
<tr>
|
||||
<td bgcolor="#666699"> <b><font color="#FFFFFF">Possible Errors
|
||||
or Problems</font></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="90" bgcolor="#F7F3F7"> <div align="left">
|
||||
<div align="left">
|
||||
<div align="left">
|
||||
<p><strong>Visual Studio</strong><br>
|
||||
|
||||
While trying to compile the tutorial, if you get the
|
||||
error: </p>
|
||||
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td bgcolor="#CCCCCC"><font face="Courier New, Courier, mono">fatal
|
||||
error C1083: Cannot open include file: 'irrlicht.h':
|
||||
No such file or directory</font></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>Solution: You may have set the include directory improperly
|
||||
in the Visual Studio options. See <a href="#settingup">above</a>
|
||||
for information on setting it. </p>
|
||||
|
||||
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td bgcolor="#CCCCCC"><font face="Courier New, Courier, mono">LINK
|
||||
: LNK6004: HelloWorld.exe not found or not built
|
||||
by the last incremental link; performing full link<br>
|
||||
LINK : fatal error LNK1104: cannot open file "Irrlicht.lib"<br>
|
||||
Error executing link.exe</font></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p> Solution: You may have set the library directory improperly.
|
||||
See <a href="#settingup">above</a> for information on
|
||||
setting it. <br>
|
||||
|
||||
<br>
|
||||
</p>
|
||||
<p><strong>Compiler independent problems<br>
|
||||
</strong>If the tutorial compiles successfully but gives
|
||||
the error: </p>
|
||||
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td bgcolor="#CCCCCC"><font face="Courier New, Courier, mono">This
|
||||
application has failed to start because Irrlicht.dll
|
||||
was not found. Re-installing the application may
|
||||
fix this problem</font></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<p>Solution: You may have forgotten to copy the Irrlicht.dll
|
||||
file from Irrlicht\bin\VisualStudio to the directory
|
||||
the tutorial's project file is in. </p>
|
||||
If the tutorial compiles and runs successfully but produces
|
||||
errors in the console like:<br>
|
||||
<br>
|
||||
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td bgcolor="#CCCCCC"><font face="Courier New, Courier, mono">Could
|
||||
not load mesh, because file could not be opened.:
|
||||
../media/sydney.md2</font></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<p> Or:</p>
|
||||
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td bgcolor="#CCCCCC"><em><font face="Courier New, Courier, mono">Could
|
||||
not open file of texture: stones.jpg</font></em><font face="Courier New, Courier, mono"><b><br>
|
||||
</b><em>Could not load texture: stones.jpg </em></font></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<p>Solution: The file listed in the error message cannot
|
||||
be found. Ensure that the directory specified in the
|
||||
main.cpp exists and is where the file is located. <br>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p> </p>
|
||||
</body>
|
||||
</html>
|
38
examples/02.Quake3Map/Makefile
Normal file
38
examples/02.Quake3Map/Makefile
Normal file
@ -0,0 +1,38 @@
|
||||
# Makefile for Irrlicht Examples
|
||||
# It's usually sufficient to change just the target name and source file list
|
||||
# and be sure that CXX is set to a valid compiler
|
||||
Target = 02.Quake3Map
|
||||
Sources = main.cpp
|
||||
|
||||
# general compiler settings
|
||||
CPPFLAGS = -I../../include -I/usr/X11R6/include
|
||||
CXXFLAGS = -O3 -ffast-math
|
||||
#CXXFLAGS = -g -Wall
|
||||
|
||||
#default target is Linux
|
||||
all: all_linux
|
||||
|
||||
ifeq ($(HOSTTYPE), x86_64)
|
||||
LIBSELECT=64
|
||||
endif
|
||||
|
||||
# target specific settings
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht -lGL -lGLU -lXxf86vm -lXext -lX11
|
||||
all_linux clean_linux: SYSTEM=Linux
|
||||
all_win32: LDFLAGS = -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lglu32 -lm
|
||||
all_win32 clean_win32: SYSTEM=Win32-gcc
|
||||
all_win32 clean_win32: SUF=.exe
|
||||
# name of the binary - only valid for targets which set SYSTEM
|
||||
DESTPATH = ../../bin/$(SYSTEM)/$(Target)$(SUF)
|
||||
|
||||
all_linux all_win32:
|
||||
$(warning Building...)
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(Sources) -o $(DESTPATH) $(LDFLAGS)
|
||||
|
||||
clean: clean_linux clean_win32
|
||||
$(warning Cleaning...)
|
||||
|
||||
clean_linux clean_win32:
|
||||
@$(RM) $(DESTPATH)
|
||||
|
||||
.PHONY: all all_win32 clean clean_linux clean_win32
|
90
examples/02.Quake3Map/Quake3Map.dsp
Normal file
90
examples/02.Quake3Map/Quake3Map.dsp
Normal file
@ -0,0 +1,90 @@
|
||||
# Microsoft Developer Studio Project File - Name="Quake3Map" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** NICHT BEARBEITEN **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=Quake3Map - Win32 Debug
|
||||
!MESSAGE Dies ist kein g<>s Makefile. Zum Erstellen dieses Projekts mit NMAKE
|
||||
!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und f<>Sie den Befehl
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "Quake3Map.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE Sie k<>n beim Ausf<73>von NMAKE eine Konfiguration angeben
|
||||
!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "Quake3Map.mak" CFG="Quake3Map - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE F<> Konfiguration stehen zur Auswahl:
|
||||
!MESSAGE
|
||||
!MESSAGE "Quake3Map - Win32 Release" (basierend auf "Win32 (x86) Console Application")
|
||||
!MESSAGE "Quake3Map - Win32 Debug" (basierend auf "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "Quake3Map - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0xc07 /d "NDEBUG"
|
||||
# ADD RSC /l 0xc07 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"..\..\bin\Win32-VisualStudio\Quake3Map.exe" /libpath:"..\..\lib\Win32-visualstudio"
|
||||
|
||||
!ELSEIF "$(CFG)" == "Quake3Map - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0xc07 /d "_DEBUG"
|
||||
# ADD RSC /l 0xc07 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\..\bin\Win32-VisualStudio\Quake3Map.exe" /pdbtype:sept /libpath:"..\..\lib\Win32-visualstudio"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "Quake3Map - Win32 Release"
|
||||
# Name "Quake3Map - Win32 Debug"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\main.cpp
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
29
examples/02.Quake3Map/Quake3Map.dsw
Normal file
29
examples/02.Quake3Map/Quake3Map.dsw
Normal file
@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "Quake3Map"=.\Quake3Map.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
24
examples/02.Quake3Map/Quake3Map.sln
Normal file
24
examples/02.Quake3Map/Quake3Map.sln
Normal file
@ -0,0 +1,24 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Quake3Map", "Quake3Map.vcproj", "{AF8861FB-BB79-4562-9F17-34C72F94DCD1}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
Relase - Fast FPU = Relase - Fast FPU
|
||||
Release = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{AF8861FB-BB79-4562-9F17-34C72F94DCD1}.Debug.ActiveCfg = Debug|Win32
|
||||
{AF8861FB-BB79-4562-9F17-34C72F94DCD1}.Debug.Build.0 = Debug|Win32
|
||||
{AF8861FB-BB79-4562-9F17-34C72F94DCD1}.Relase - Fast FPU.ActiveCfg = Release|Win32
|
||||
{AF8861FB-BB79-4562-9F17-34C72F94DCD1}.Relase - Fast FPU.Build.0 = Release|Win32
|
||||
{AF8861FB-BB79-4562-9F17-34C72F94DCD1}.Release.ActiveCfg = Release|Win32
|
||||
{AF8861FB-BB79-4562-9F17-34C72F94DCD1}.Release.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
162
examples/02.Quake3Map/Quake3Map.vcproj
Normal file
162
examples/02.Quake3Map/Quake3Map.vcproj
Normal file
@ -0,0 +1,162 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="02.Quake3Map"
|
||||
SccProjectName=""
|
||||
SccLocalPath="">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\Debug"
|
||||
IntermediateDirectory=".\Debug"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="5"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile=".\Debug/Quake3Map.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
ProgramDataBaseFileName=".\Debug/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\02.Quake3Map.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile=".\Debug/Quake3Map.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Debug/Quake3Map.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="3079"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\Release"
|
||||
IntermediateDirectory=".\Release"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="4"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile=".\Release/Quake3Map.pch"
|
||||
AssemblerListingLocation=".\Release/"
|
||||
ObjectFile=".\Release/"
|
||||
ProgramDataBaseFileName=".\Release/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\02.Quake3Map.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
ProgramDatabaseFile=".\Release/Quake3Map.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Release/Quake3Map.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="3079"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="main.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
231
examples/02.Quake3Map/Quake3Map_vc8.vcproj
Normal file
231
examples/02.Quake3Map/Quake3Map_vc8.vcproj
Normal file
@ -0,0 +1,231 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="02.Quake3Map_vc8"
|
||||
ProjectGUID="{D1A464A2-D479-458C-98A2-60965D823CD1}"
|
||||
RootNamespace="Quake3Map_vc8"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\Debug"
|
||||
IntermediateDirectory=".\Debug"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Debug/Quake3Map.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderFile=".\Debug/Quake3Map.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
ProgramDataBaseFileName=".\Debug/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="3079"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\02.Quake3Map.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile=".\Debug/Quake3Map.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\Release"
|
||||
IntermediateDirectory=".\Release"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Release/Quake3Map.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderFile=".\Release/Quake3Map.pch"
|
||||
AssemblerListingLocation=".\Release/"
|
||||
ObjectFile=".\Release/"
|
||||
ProgramDataBaseFileName=".\Release/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="3079"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\02.Quake3Map.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
ProgramDatabaseFile=".\Release/Quake3Map.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="main.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BasicRuntimeChecks="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
32
examples/02.Quake3Map/example.cbp
Normal file
32
examples/02.Quake3Map/example.cbp
Normal file
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE CodeBlocks_project_file>
|
||||
<CodeBlocks_project_file>
|
||||
<FileVersion major="1" minor="1"/>
|
||||
<Project>
|
||||
<Option title="Irrlicht Example 02 Quake Map"/>
|
||||
<Option makefile="Makefile"/>
|
||||
<Option makefile_is_custom="0"/>
|
||||
<Option compiler="0"/>
|
||||
<Build>
|
||||
<Target title="default">
|
||||
<Option output="..\..\bin\Win32-gcc\02.Quake3Map.exe"/>
|
||||
<Option working_dir="."/>
|
||||
<Option object_output=".objs"/>
|
||||
<Option deps_output=".deps"/>
|
||||
<Option type="1"/>
|
||||
<Option compiler="0"/>
|
||||
<Option projectResourceIncludeDirsRelation="1"/>
|
||||
</Target>
|
||||
</Build>
|
||||
<Compiler>
|
||||
<Add directory="..\..\include"/>
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="../../lib/Win32-gcc/libIrrlicht.a"/>
|
||||
</Linker>
|
||||
<Unit filename="main.cpp">
|
||||
<Option compilerVar="CPP"/>
|
||||
<Option target="default"/>
|
||||
</Unit>
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
59
examples/02.Quake3Map/example.dev
Normal file
59
examples/02.Quake3Map/example.dev
Normal file
@ -0,0 +1,59 @@
|
||||
[Project]
|
||||
FileName=example.dev
|
||||
Name=Irrlicht Example 02 Quake3Map
|
||||
UnitCount=1
|
||||
Type=1
|
||||
Ver=1
|
||||
ObjFiles=
|
||||
Includes=..\..\include
|
||||
Libs=
|
||||
PrivateResource=
|
||||
ResourceIncludes=
|
||||
MakeIncludes=
|
||||
Compiler=
|
||||
CppCompiler=
|
||||
Linker=../../lib/Win32-gcc/libIrrlicht.a_@@_
|
||||
IsCpp=1
|
||||
Icon=
|
||||
ExeOutput=../../bin/Win32-gcc
|
||||
ObjectOutput=obj
|
||||
OverrideOutput=1
|
||||
OverrideOutputName=02.Quake3Map.exe
|
||||
HostApplication=
|
||||
Folders=
|
||||
CommandLine=
|
||||
IncludeVersionInfo=0
|
||||
SupportXPThemes=0
|
||||
CompilerSet=0
|
||||
CompilerSettings=0000000000000000000000
|
||||
UseCustomMakefile=0
|
||||
CustomMakefile=
|
||||
|
||||
[Unit1]
|
||||
FileName=main.cpp
|
||||
CompileCpp=1
|
||||
Folder=Projekt1
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[VersionInfo]
|
||||
Major=0
|
||||
Minor=1
|
||||
Release=1
|
||||
Build=1
|
||||
LanguageID=1033
|
||||
CharsetID=1252
|
||||
CompanyName=
|
||||
FileVersion=
|
||||
FileDescription=Irrlicht Engine example compiled using DevCpp and gcc
|
||||
InternalName=
|
||||
LegalCopyright=
|
||||
LegalTrademarks=
|
||||
OriginalFilename=
|
||||
ProductName=
|
||||
ProductVersion=
|
||||
AutoIncBuildNr=0
|
||||
|
180
examples/02.Quake3Map/main.cpp
Normal file
180
examples/02.Quake3Map/main.cpp
Normal file
@ -0,0 +1,180 @@
|
||||
/*
|
||||
This Tutorial shows how to load a Quake 3 map into the
|
||||
engine, create a SceneNode for optimizing the speed of
|
||||
rendering and how to create a user controlled camera.
|
||||
|
||||
Lets start like the HelloWorld example: We include
|
||||
the irrlicht header files and an additional file to be able
|
||||
to ask the user for a driver type using the console.
|
||||
*/
|
||||
#include <irrlicht.h>
|
||||
#include <iostream>
|
||||
|
||||
/*
|
||||
As already written in the HelloWorld example, in the Irrlicht
|
||||
Engine, everything can be found in the namespace 'irr'.
|
||||
To get rid of the irr:: in front of the name of every class,
|
||||
we tell the compiler that we use that namespace from now on,
|
||||
and we will not have to write that 'irr::'.
|
||||
There are 5 other sub namespaces 'core', 'scene', 'video',
|
||||
'io' and 'gui'. Unlike in the HelloWorld example,
|
||||
we do not a 'using namespace' for these 5 other namespaces
|
||||
because in this way you will see what can be found in which
|
||||
namespace. But if you like, you can also include the namespaces
|
||||
like in the previous example. Code just like you want to.
|
||||
*/
|
||||
using namespace irr;
|
||||
|
||||
/*
|
||||
Again, to be able to use the Irrlicht.DLL file, we need to link with the
|
||||
Irrlicht.lib. We could set this option in the project settings, but
|
||||
to make it easy, we use a pragma comment lib:
|
||||
*/
|
||||
#pragma comment(lib, "Irrlicht.lib")
|
||||
|
||||
/*
|
||||
Ok, lets start. Again, we use the main() method as start, not the
|
||||
WinMain(), because its shorter to write.
|
||||
*/
|
||||
int main()
|
||||
{
|
||||
/*
|
||||
Like in the HelloWorld example, we create an IrrlichtDevice with
|
||||
createDevice(). The difference now is that we ask the user to select
|
||||
which hardware accelerated driver to use. The Software device would be
|
||||
too slow to draw a huge Quake 3 map, but just for the fun of it, we make
|
||||
this decision possible too.
|
||||
*/
|
||||
|
||||
// ask user for driver
|
||||
|
||||
video::E_DRIVER_TYPE driverType;
|
||||
|
||||
printf("Please select the driver you want for this example:\n"\
|
||||
" (a) Direct3D 9.0c\n (b) Direct3D 8.1\n (c) OpenGL 1.5\n"\
|
||||
" (d) Software Renderer\n (e) Burning's Software Renderer\n"\
|
||||
" (f) NullDevice\n (otherKey) exit\n\n");
|
||||
|
||||
char i;
|
||||
std::cin >> i;
|
||||
|
||||
switch(i)
|
||||
{
|
||||
case 'a': driverType = video::EDT_DIRECT3D9;break;
|
||||
case 'b': driverType = video::EDT_DIRECT3D8;break;
|
||||
case 'c': driverType = video::EDT_OPENGL; break;
|
||||
case 'd': driverType = video::EDT_SOFTWARE; break;
|
||||
case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
|
||||
case 'f': driverType = video::EDT_NULL; break;
|
||||
default: return 1;
|
||||
}
|
||||
|
||||
// create device and exit if creation failed
|
||||
|
||||
IrrlichtDevice *device =
|
||||
createDevice(driverType, core::dimension2d<s32>(640, 480));
|
||||
|
||||
if (device == 0)
|
||||
return 1; // could not create selected driver.
|
||||
|
||||
/*
|
||||
Get a pointer to the video driver and the SceneManager so that
|
||||
we do not always have to write device->getVideoDriver() and
|
||||
device->getSceneManager().
|
||||
*/
|
||||
video::IVideoDriver* driver = device->getVideoDriver();
|
||||
scene::ISceneManager* smgr = device->getSceneManager();
|
||||
|
||||
/*
|
||||
To display the Quake 3 map, we first need to load it. Quake 3 maps
|
||||
are packed into .pk3 files wich are nothing other than .zip files.
|
||||
So we add the .pk3 file to our FileSystem. After it was added,
|
||||
we are able to read from the files in that archive as they would
|
||||
directly be stored on disk.
|
||||
*/
|
||||
device->getFileSystem()->addZipFileArchive("../../media/map-20kdm2.pk3");
|
||||
|
||||
/*
|
||||
Now we can load the mesh by calling getMesh(). We get a pointer returned
|
||||
to a IAnimatedMesh. As you know, Quake 3 maps are not really animated,
|
||||
they are only a huge chunk of static geometry with some materials
|
||||
attached. Hence the IAnimated mesh consists of only one frame,
|
||||
so we get the "first frame" of the "animation", which is our quake level
|
||||
and create an OctTree scene node with it, using addOctTreeSceneNode().
|
||||
The OctTree optimizes the scene a little bit, trying to draw only geometry
|
||||
which is currently visible. An alternative to the OctTree would be a
|
||||
AnimatedMeshSceneNode, which would draw always the complete geometry of
|
||||
the mesh, without optimization. Try it out: Write addAnimatedMeshSceneNode
|
||||
instead of addOctTreeSceneNode and compare the primitives drawed by the
|
||||
video driver. (There is a getPrimitiveCountDrawed() method in the
|
||||
IVideoDriver class). Note that this optimization with the Octree is only
|
||||
useful when drawing huge meshes consiting of lots of geometry.
|
||||
*/
|
||||
scene::IAnimatedMesh* mesh = smgr->getMesh("20kdm2.bsp");
|
||||
scene::ISceneNode* node = 0;
|
||||
|
||||
if (mesh)
|
||||
node = smgr->addOctTreeSceneNode(mesh->getMesh(0), 0, -1, 128);
|
||||
|
||||
/*
|
||||
Because the level was modelled not around the origin (0,0,0), we translate
|
||||
the whole level a little bit.
|
||||
*/
|
||||
if (node)
|
||||
node->setPosition(core::vector3df(-1300,-144,-1249));
|
||||
|
||||
/*
|
||||
Now we only need a Camera to look at the Quake 3 map.
|
||||
And we want to create a user controlled camera. There are some
|
||||
different cameras available in the Irrlicht engine. For example the
|
||||
Maya Camera which can be controlled compareable to the camera in Maya:
|
||||
Rotate with left mouse button pressed, Zoom with both buttons pressed,
|
||||
translate with right mouse button pressed. This could be created with
|
||||
addCameraSceneNodeMaya(). But for this example, we want to create a
|
||||
camera which behaves like the ones in first person shooter games (FPS).
|
||||
*/
|
||||
smgr->addCameraSceneNodeFPS();
|
||||
|
||||
/*
|
||||
The mouse cursor needs not to be visible, so we make it invisible.
|
||||
*/
|
||||
|
||||
device->getCursorControl()->setVisible(false);
|
||||
|
||||
/*
|
||||
We have done everything, so lets draw it. We also write the current
|
||||
frames per second and the drawn primitives to the caption of the
|
||||
window. The 'if (device->isWindowActive())' line is optional, but
|
||||
prevents the engine render to set the position of the mouse cursor
|
||||
after task switching when other program are active.
|
||||
*/
|
||||
int lastFPS = -1;
|
||||
|
||||
while(device->run())
|
||||
if (device->isWindowActive())
|
||||
{
|
||||
driver->beginScene(true, true, video::SColor(0,200,200,200));
|
||||
smgr->drawAll();
|
||||
driver->endScene();
|
||||
|
||||
int fps = driver->getFPS();
|
||||
|
||||
if (lastFPS != fps)
|
||||
{
|
||||
core::stringw str = L"Irrlicht Engine - Quake 3 Map example [";
|
||||
str += driver->getName();
|
||||
str += "] FPS:";
|
||||
str += fps;
|
||||
|
||||
device->setWindowCaption(str.c_str());
|
||||
lastFPS = fps;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
In the end, delete the Irrlicht device.
|
||||
*/
|
||||
device->drop();
|
||||
return 0;
|
||||
}
|
||||
|
181
examples/02.Quake3Map/tutorial.html
Normal file
181
examples/02.Quake3Map/tutorial.html
Normal file
@ -0,0 +1,181 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Irrlicht Engine Tutorial</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
|
||||
<br>
|
||||
<table width="95%" border="0" cellspacing="0" cellpadding="2" align="center">
|
||||
<tr>
|
||||
<td bgcolor="#666699" width="10"><b><a href="http://irrlicht.sourceforge.net" target="_blank"><img src="../../media/irrlichtlogo.jpg" width="88" height="31" border="0"></a></b></td>
|
||||
<td bgcolor="#666699" width="100%"> <div align="center"><b><font color="#FFFFFF"></font></b></div>
|
||||
<b><font color="#FFFFFF">Tutorial 2.Quake3Map</font></b></td>
|
||||
</tr>
|
||||
<tr bgcolor="#eeeeff">
|
||||
<td height="90" colspan="2"> <div align="left">
|
||||
<p>This Tutorial shows how to load a Quake 3 map into the engine, create
|
||||
a SceneNode for optimizing the speed of rendering and how to create
|
||||
a user controlled camera. Please note that you should know the basics
|
||||
of the engine before starting this tutorial, just take a short look
|
||||
at the first tutorial, 1.HelloWorld, if you haven't done this yet.<br>
|
||||
The result of this example will look like this:</p>
|
||||
<p align="center"><img src="../../media/002shot.jpg" width="259" height="202"><br>
|
||||
</p>
|
||||
</div></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<table width="95%" border="0" cellspacing="0" cellpadding="2" align="center">
|
||||
<tr>
|
||||
<td bgcolor="#666699"> <div align="center"><b><font color="#000000"></font></b></div>
|
||||
<font color="#FFFFFF"><b>Lets start!</b></font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="90" bgcolor="#eeeeff" valign="top"> <div align="left">
|
||||
<p>Lets start like the HelloWorld example: We include the irrlicht header
|
||||
files and an additional file to be able<br>
|
||||
to ask the user for a driver type using the console.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>#include <irrlicht.h><br>#include <iostream><br></pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>As already written in the HelloWorld example, in the Irrlicht Engine,
|
||||
everything can be found in the namespace 'irr'. To get rid of the irr::
|
||||
in front of the name of every class, we tell the compiler that we use
|
||||
that namespace from now on, and we will not have to write that 'irr::'.<br>
|
||||
There are 5 other sub namespaces 'core', 'scene', 'video', 'io' and
|
||||
'gui'. Unlike in the HelloWorld example, we do not a 'using namespace'
|
||||
for these 5 other namespaces because in this way you will see what can
|
||||
be found in which namespace. But if you like, you can also include the
|
||||
namespaces like in the previous example. Code just like you want to.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>using namespace irr;</pre> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>Again, to be able to use the Irrlicht.DLL file, we need to link with
|
||||
the Irrlicht.lib. We could set this option in the project settings,
|
||||
but to make it easy, we use a pragma comment lib:</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>#pragma comment(lib, "Irrlicht.lib")</pre> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<p>Ok, lets start. Again, we use the main() method as start, not the WinMain(),
|
||||
because its shorter to write.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>int main()<br>{</pre> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<p> Like in the HelloWorld example, we create an IrrlichtDevice with createDevice().
|
||||
The difference now is that we ask the user to select which hardware accelerated
|
||||
driver to use. The Software device would be too slow to draw a huge Quake
|
||||
3 map, but just for the fun of it, we make this decision possible too.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>// ask user for driver<br><br>video::E_DRIVER_TYPE driverType = video::EDT_DIRECT3D9;<br><br>printf("Please select the driver you want for this example:\n"\<br> " (a) Direct3D 9.0c\n (b) Direct3D 8.1\n (c) OpenGL 1.5\n"\<br> " (d) Software Renderer\n (e) Apfelbaum Software Renderer\n"\<br> " (f) NullDevice\n (otherKey) exit\n\n");<br>
|
||||
char i;<br>std::cin >> i;<br><br>switch(i)<br>{<br> case 'a': driverType = video::EDT_DIRECT3D9;break;<br> case 'b': driverType = video::EDT_DIRECT3D8;break;<br> case 'c': driverType = video::EDT_OPENGL; break;<br> case 'd': driverType = video::EDT_SOFTWARE; break;<br> case 'e': driverType = video::EDT_BURNINGSVIDEO;break;<br> case 'f': driverType = video::EDT_NULL; break;<br> default: return 1;<br>} <br><br>// create device and exit if creation failed<br><br>IrrlichtDevice *device =<br> createDevice(driverType, core::dimension2d<s32>(640, 480));<br><br>if (device == 0)<br> return 1;</pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>Get a pointer to the video driver and the SceneManager so that we do
|
||||
not always have to write device->getVideoDriver() and device->getSceneManager().</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>video::IVideoDriver* driver = device->getVideoDriver();
|
||||
scene::ISceneManager* smgr = device->getSceneManager();</pre> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>To display the Quake 3 map, we first need to load it. Quake 3 maps are
|
||||
packed into .pk3 files wich are nothing other than .zip files. So we add
|
||||
the .pk3 file to our FileSystem. After it was added, we are able to read
|
||||
from the files in that archive as they would directly be stored on disk.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>device->getFileSystem()->addZipFileArchive("../../media/map-20kdm2.pk3");</pre> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>Now we can load the mesh by calling getMesh(). We get a pointer returned
|
||||
to a IAnimatedMesh. As you know, Quake 3 maps are not really animated,
|
||||
they are only a huge chunk of static geometry with some materials attached.
|
||||
Hence the IAnimated mesh consists of only one frame,<br>
|
||||
so we get the "first frame" of the "animation", which
|
||||
is our quake level and create an OctTree scene node with it, using addOctTreeSceneNode().
|
||||
The OctTree optimizes the scene a little bit, trying to draw only geometry
|
||||
which is currently visible. An alternative to the OctTree would be a AnimatedMeshSceneNode,
|
||||
which would draw always the complete geometry of the mesh, without optimization.
|
||||
Try it out: Write addAnimatedMeshSceneNode instead of addOctTreeSceneNode
|
||||
and compare the primitives drawed by the video driver. (There is a getPrimitiveCountDrawed()
|
||||
method in the IVideoDriver class). Note that this optimization with the
|
||||
Octree is only useful when drawing huge meshes consiting of lots of geometry.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>scene::IAnimatedMesh* mesh = smgr->getMesh("20kdm2.bsp");<br>scene::ISceneNode* node = 0;
|
||||
|
||||
if (mesh)<br> node = smgr->addOctTreeSceneNode(mesh->getMesh(0));</pre> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>Because the level was modelled not around the origin (0,0,0), we translate
|
||||
the whole level a little bit.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>if (node)<br> node->setPosition(core::vector3df(-1300,-144,-1249));</pre> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>Now we only need a Camera to look at the Quake 3 map. And we want to
|
||||
create a user controlled camera. There are some different cameras available
|
||||
in the Irrlicht engine. For example the Maya Camera which can be controlled
|
||||
compareable to the camera in Maya: Rotate with left mouse button pressed,
|
||||
Zoom with both buttons pressed,<br>
|
||||
translate with right mouse button pressed. This could be created with
|
||||
addCameraSceneNodeMaya(). But for this example, we want to create a camera
|
||||
which behaves like the ones in first person shooter games (FPS):</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>smgr->addCameraSceneNodeFPS();</pre> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>The mouse cursor needs not to be visible, so we make it invisible. </p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>device->getCursorControl()->setVisible(false);</pre> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>We have done everything, so lets draw it. We also write the current frames
|
||||
per second and the drawn primitives to the caption of the window. The
|
||||
'if (device->isWindowActive())' line is optional, but prevents the
|
||||
engine render to set the position of the mouse cursor after task switching
|
||||
when other program are active.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>int lastFPS = -1;</pre>
|
||||
<pre>while(device->run())
|
||||
{
|
||||
driver->beginScene(true, true, video::SColor(0,200,200,200));
|
||||
smgr->drawAll();
|
||||
driver->endScene();</pre>
|
||||
<pre> int fps = driver->getFPS();</pre>
|
||||
<pre> if (lastFPS != fps)
|
||||
{
|
||||
core::stringw str = L"Irrlicht Engine - Quake 3 Map example [";<br> str += driver->getName();<br> str += "] FPS:";<br> str += fps;<br> device->setWindowCaption(str.c_str());<br> lastFPS = fps;
|
||||
}
|
||||
}</pre> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>In the end, delete the Irrlicht device.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre> device->drop();<br> return 0;<br>}</pre> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>That's it. Compile and play around with the program. </p></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
</body>
|
||||
</html>
|
90
examples/03.CustomSceneNode/CustomSceneNode.dsp
Normal file
90
examples/03.CustomSceneNode/CustomSceneNode.dsp
Normal file
@ -0,0 +1,90 @@
|
||||
# Microsoft Developer Studio Project File - Name="CustomSceneNode" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** NICHT BEARBEITEN **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=CustomSceneNode - Win32 Debug
|
||||
!MESSAGE Dies ist kein g<>s Makefile. Zum Erstellen dieses Projekts mit NMAKE
|
||||
!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und f<>Sie den Befehl
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "CustomSceneNode.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE Sie k<>n beim Ausf<73>von NMAKE eine Konfiguration angeben
|
||||
!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "CustomSceneNode.mak" CFG="CustomSceneNode - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE F<> Konfiguration stehen zur Auswahl:
|
||||
!MESSAGE
|
||||
!MESSAGE "CustomSceneNode - Win32 Release" (basierend auf "Win32 (x86) Console Application")
|
||||
!MESSAGE "CustomSceneNode - Win32 Debug" (basierend auf "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "CustomSceneNode - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0xc07 /d "NDEBUG"
|
||||
# ADD RSC /l 0xc07 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"..\..\bin\Win32-VisualStudio\CustomSceneNode.exe" /libpath:"..\..\lib\Win32-visualstudio"
|
||||
|
||||
!ELSEIF "$(CFG)" == "CustomSceneNode - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0xc07 /d "_DEBUG"
|
||||
# ADD RSC /l 0xc07 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\..\bin\Win32-VisualStudio\CustomSceneNode.exe" /pdbtype:sept /libpath:"..\..\lib\Win32-visualstudio"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "CustomSceneNode - Win32 Release"
|
||||
# Name "CustomSceneNode - Win32 Debug"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\main.cpp
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
29
examples/03.CustomSceneNode/CustomSceneNode.dsw
Normal file
29
examples/03.CustomSceneNode/CustomSceneNode.dsw
Normal file
@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "CustomSceneNode"=".\CustomSceneNode.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
21
examples/03.CustomSceneNode/CustomSceneNode.sln
Normal file
21
examples/03.CustomSceneNode/CustomSceneNode.sln
Normal file
@ -0,0 +1,21 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CustomSceneNode", "CustomSceneNode.vcproj", "{832A634E-7236-47DC-80C1-EDEF1012CC71}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
Release = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{832A634E-7236-47DC-80C1-EDEF1012CC71}.Debug.ActiveCfg = Debug|Win32
|
||||
{832A634E-7236-47DC-80C1-EDEF1012CC71}.Debug.Build.0 = Debug|Win32
|
||||
{832A634E-7236-47DC-80C1-EDEF1012CC71}.Release.ActiveCfg = Release|Win32
|
||||
{832A634E-7236-47DC-80C1-EDEF1012CC71}.Release.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
163
examples/03.CustomSceneNode/CustomSceneNode.vcproj
Normal file
163
examples/03.CustomSceneNode/CustomSceneNode.vcproj
Normal file
@ -0,0 +1,163 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="03.CustomSceneNode"
|
||||
ProjectGUID="{32078844-1903-47AB-AEAC-FC2E3415DB46}"
|
||||
SccProjectName=""
|
||||
SccLocalPath="">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\Debug"
|
||||
IntermediateDirectory=".\Debug"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="5"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile=".\Debug/CustomSceneNode.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
ProgramDataBaseFileName=".\Debug/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\03.CustomSceneNode.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile=".\Debug/CustomSceneNode.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Debug/CustomSceneNode.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="3079"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\Release"
|
||||
IntermediateDirectory=".\Release"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="4"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile=".\Release/CustomSceneNode.pch"
|
||||
AssemblerListingLocation=".\Release/"
|
||||
ObjectFile=".\Release/"
|
||||
ProgramDataBaseFileName=".\Release/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\03.CustomSceneNode.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
ProgramDatabaseFile=".\Release/CustomSceneNode.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Release/CustomSceneNode.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="3079"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="main.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
231
examples/03.CustomSceneNode/CustomSceneNode_vc8.vcproj
Normal file
231
examples/03.CustomSceneNode/CustomSceneNode_vc8.vcproj
Normal file
@ -0,0 +1,231 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="03.CustomSceneNode_vc8"
|
||||
ProjectGUID="{171CCDFA-C140-4956-8EB7-F0168F4521D3}"
|
||||
RootNamespace="CustomSceneNode_vc8"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\Debug"
|
||||
IntermediateDirectory=".\Debug"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Debug/CustomSceneNode.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderFile=".\Debug/CustomSceneNode.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
ProgramDataBaseFileName=".\Debug/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="3079"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\03.CustomSceneNode.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile=".\Debug/CustomSceneNode.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\Release"
|
||||
IntermediateDirectory=".\Release"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Release/CustomSceneNode.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderFile=".\Release/CustomSceneNode.pch"
|
||||
AssemblerListingLocation=".\Release/"
|
||||
ObjectFile=".\Release/"
|
||||
ProgramDataBaseFileName=".\Release/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="3079"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\03.CustomSceneNode.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
ProgramDatabaseFile=".\Release/CustomSceneNode.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="main.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BasicRuntimeChecks="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
38
examples/03.CustomSceneNode/Makefile
Normal file
38
examples/03.CustomSceneNode/Makefile
Normal file
@ -0,0 +1,38 @@
|
||||
# Makefile for Irrlicht Examples
|
||||
# It's usually sufficient to change just the target name and source file list
|
||||
# and be sure that CXX is set to a valid compiler
|
||||
Target = 03.CustomSceneNode
|
||||
Sources = main.cpp
|
||||
|
||||
# general compiler settings
|
||||
CPPFLAGS = -I../../include -I/usr/X11R6/include
|
||||
CXXFLAGS = -O3 -ffast-math
|
||||
#CXXFLAGS = -g -Wall
|
||||
|
||||
#default target is Linux
|
||||
all: all_linux
|
||||
|
||||
ifeq ($(HOSTTYPE), x86_64)
|
||||
LIBSELECT=64
|
||||
endif
|
||||
|
||||
# target specific settings
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht -lGL -lGLU -lXxf86vm -lXext -lX11
|
||||
all_linux clean_linux: SYSTEM=Linux
|
||||
all_win32: LDFLAGS = -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lglu32 -lm
|
||||
all_win32 clean_win32: SYSTEM=Win32-gcc
|
||||
all_win32 clean_win32: SUF=.exe
|
||||
# name of the binary - only valid for targets which set SYSTEM
|
||||
DESTPATH = ../../bin/$(SYSTEM)/$(Target)$(SUF)
|
||||
|
||||
all_linux all_win32:
|
||||
$(warning Building...)
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(Sources) -o $(DESTPATH) $(LDFLAGS)
|
||||
|
||||
clean: clean_linux clean_win32
|
||||
$(warning Cleaning...)
|
||||
|
||||
clean_linux clean_win32:
|
||||
@$(RM) $(DESTPATH)
|
||||
|
||||
.PHONY: all all_win32 clean clean_linux clean_win32
|
32
examples/03.CustomSceneNode/example.cbp
Normal file
32
examples/03.CustomSceneNode/example.cbp
Normal file
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE CodeBlocks_project_file>
|
||||
<CodeBlocks_project_file>
|
||||
<FileVersion major="1" minor="1"/>
|
||||
<Project>
|
||||
<Option title="Irrlicht Example 03 Custom Scene Node"/>
|
||||
<Option makefile="Makefile"/>
|
||||
<Option makefile_is_custom="0"/>
|
||||
<Option compiler="0"/>
|
||||
<Build>
|
||||
<Target title="default">
|
||||
<Option output="..\..\bin\Win32-gcc\03.CustomSceneNode.exe"/>
|
||||
<Option working_dir="."/>
|
||||
<Option object_output=".objs"/>
|
||||
<Option deps_output=".deps"/>
|
||||
<Option type="1"/>
|
||||
<Option compiler="0"/>
|
||||
<Option projectResourceIncludeDirsRelation="1"/>
|
||||
</Target>
|
||||
</Build>
|
||||
<Compiler>
|
||||
<Add directory="..\..\include"/>
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="../../lib/Win32-gcc/libIrrlicht.a"/>
|
||||
</Linker>
|
||||
<Unit filename="main.cpp">
|
||||
<Option compilerVar="CPP"/>
|
||||
<Option target="default"/>
|
||||
</Unit>
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
59
examples/03.CustomSceneNode/example.dev
Normal file
59
examples/03.CustomSceneNode/example.dev
Normal file
@ -0,0 +1,59 @@
|
||||
[Project]
|
||||
FileName=example.dev
|
||||
Name=Irrlicht Example 03 Custom Scene Node
|
||||
UnitCount=1
|
||||
Type=1
|
||||
Ver=1
|
||||
ObjFiles=
|
||||
Includes=..\..\include
|
||||
Libs=
|
||||
PrivateResource=
|
||||
ResourceIncludes=
|
||||
MakeIncludes=
|
||||
Compiler=
|
||||
CppCompiler=
|
||||
Linker=../../lib/Win32-gcc/libIrrlicht.a_@@_
|
||||
IsCpp=1
|
||||
Icon=
|
||||
ExeOutput=../../bin/Win32-gcc
|
||||
ObjectOutput=obj
|
||||
OverrideOutput=1
|
||||
OverrideOutputName=03.CustomSceneNode.exe
|
||||
HostApplication=
|
||||
Folders=
|
||||
CommandLine=
|
||||
IncludeVersionInfo=0
|
||||
SupportXPThemes=0
|
||||
CompilerSet=0
|
||||
CompilerSettings=0000000000000000000000
|
||||
UseCustomMakefile=0
|
||||
CustomMakefile=
|
||||
|
||||
[Unit1]
|
||||
FileName=main.cpp
|
||||
CompileCpp=1
|
||||
Folder=Projekt1
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[VersionInfo]
|
||||
Major=0
|
||||
Minor=1
|
||||
Release=1
|
||||
Build=1
|
||||
LanguageID=1033
|
||||
CharsetID=1252
|
||||
CompanyName=
|
||||
FileVersion=
|
||||
FileDescription=Irrlicht Engine example compiled using DevCpp and gcc
|
||||
InternalName=
|
||||
LegalCopyright=
|
||||
LegalTrademarks=
|
||||
OriginalFilename=
|
||||
ProductName=
|
||||
ProductVersion=
|
||||
AutoIncBuildNr=0
|
||||
|
250
examples/03.CustomSceneNode/main.cpp
Normal file
250
examples/03.CustomSceneNode/main.cpp
Normal file
@ -0,0 +1,250 @@
|
||||
/*
|
||||
This Tutorial is a tutorial for more advanced developers.
|
||||
If you are currently just playing around with the Irrlicht
|
||||
engine, please look at other examples first.
|
||||
This tutorials shows how to create a custom scene node and
|
||||
how to use it in the engine. A custom scene node is needed,
|
||||
if you want to implement a render technique, the Irrlicht
|
||||
Engine is currently not supporting. For example you can write
|
||||
a indoor portal based renderer or a advanced terrain scene
|
||||
node with it. With creating custom scene nodes, you can
|
||||
easily extend the Irrlicht Engine and adapt it to your
|
||||
needs.
|
||||
|
||||
I will keep the tutorial simple: Keep everything very
|
||||
short, everything in one .cpp file, and I'll use the engine
|
||||
here as in all other tutorials.
|
||||
|
||||
To start, I include the header files, use the irr namespace,
|
||||
and tell the linker to link with the .lib file.
|
||||
*/
|
||||
#include <irrlicht.h>
|
||||
#include <iostream>
|
||||
|
||||
using namespace irr;
|
||||
|
||||
#pragma comment(lib, "Irrlicht.lib")
|
||||
|
||||
/*
|
||||
Here comes the most sophisticated part of this tutorial:
|
||||
The class of our very own custom scene node. To keep it simple,
|
||||
our scene node will not be an indoor portal renderer nor a terrain
|
||||
scene node, but a simple tetraeder, a 3d object consiting of 4
|
||||
connected vertices, which only draws itself and does nothing more.
|
||||
|
||||
To let our scene node be able to be inserted into the Irrlicht
|
||||
Engine scene, the class we create needs only be derived from the
|
||||
ISceneNode class and has to override some methods.
|
||||
*/
|
||||
|
||||
class CSampleSceneNode : public scene::ISceneNode
|
||||
{
|
||||
|
||||
/*
|
||||
First, we declare some member variables. Some space to
|
||||
hold data for our tetraeder: The bounding box, 4 vertices, and
|
||||
the material of the tetraeder.
|
||||
*/
|
||||
core::aabbox3d<f32> Box;
|
||||
video::S3DVertex Vertices[4];
|
||||
video::SMaterial Material;
|
||||
|
||||
|
||||
/*
|
||||
The parameters of the constructor specify the parent of the scene node,
|
||||
a pointer to the scene manager, and an id of the scene node.
|
||||
In the constructor itself, we call the parent classes constructor,
|
||||
set some properties of the material we use to draw the scene nodem and
|
||||
create the 4 vertices of the tetraeder we will draw later.
|
||||
*/
|
||||
|
||||
public:
|
||||
|
||||
CSampleSceneNode(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id)
|
||||
: scene::ISceneNode(parent, mgr, id)
|
||||
{
|
||||
Material.Wireframe = false;
|
||||
Material.Lighting = false;
|
||||
|
||||
Vertices[0] = video::S3DVertex(0,0,10, 1,1,0, video::SColor(255,0,255,255), 0, 1);
|
||||
Vertices[1] = video::S3DVertex(10,0,-10, 1,0,0, video::SColor(255,255,0,255), 1, 1);
|
||||
Vertices[2] = video::S3DVertex(0,20,0, 0,1,1, video::SColor(255,255,255,0), 1, 0);
|
||||
Vertices[3] = video::S3DVertex(-10,0,-10, 0,0,1, video::SColor(255,0,255,0), 0, 0);
|
||||
|
||||
/*
|
||||
The Irrlicht Engine needs to know the bounding box of your scene node.
|
||||
It will use it for doing automatic culling and other things. Hence we
|
||||
need to create a bounding box from the 4 vertices we use.
|
||||
If you do not want the engine to use the box for automatic culling,
|
||||
and/or don't want to create the box, you could also write
|
||||
AutomaticCullingEnabled = false;.
|
||||
*/
|
||||
Box.reset(Vertices[0].Pos);
|
||||
for (s32 i=1; i<4; ++i)
|
||||
Box.addInternalPoint(Vertices[i].Pos);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Before it is drawn, the OnRegisterSceneNode() method of every scene node in the scene
|
||||
is called by the scene manager. If the scene node wishes to draw itself,
|
||||
it may register itself in the scene manager to be drawn. This is necessary to
|
||||
tell the scene manager when it should call the ::render method. For example
|
||||
normal scene nodes render their content one after another, while
|
||||
stencil buffer shadows would like to be drawn after all other scene nodes. And
|
||||
camera or light scene nodes need to be rendered before all other scene
|
||||
nodes (if at all).
|
||||
So here we simply register the scene node to get render normally. If we would like
|
||||
to let it be rendered like cameras or light, we would have to call
|
||||
SceneManager->registerNodeForRendering(this, SNRT_LIGHT_AND_CAMERA);
|
||||
After this, we call the OnRegisterSceneNode-method of the base class ISceneNode,
|
||||
which simply lets also all the child scene nodes of this node register themselves.
|
||||
*/
|
||||
virtual void OnRegisterSceneNode()
|
||||
{
|
||||
if (IsVisible)
|
||||
SceneManager->registerNodeForRendering(this);
|
||||
|
||||
ISceneNode::OnRegisterSceneNode();
|
||||
}
|
||||
|
||||
/*
|
||||
In the render() method most of the interesting stuff happenes: The
|
||||
Scene node renders itself. We override this method and draw the
|
||||
tetraeder.
|
||||
*/
|
||||
virtual void render()
|
||||
{
|
||||
u16 indices[] = { 0,2,3, 2,1,3, 1,0,3, 2,0,1 };
|
||||
video::IVideoDriver* driver = SceneManager->getVideoDriver();
|
||||
|
||||
driver->setMaterial(Material);
|
||||
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
|
||||
driver->drawIndexedTriangleList(&Vertices[0], 4, &indices[0], 4);
|
||||
}
|
||||
|
||||
/*
|
||||
At least, we create three small additional methods.
|
||||
GetBoundingBox() returns the bounding box of this scene node,
|
||||
GetMaterialCount() returns the amount of materials in this scene node
|
||||
(our tetraeder only has one material), and getMaterial() returns the
|
||||
material at an index. Because we have only one material here, we can
|
||||
return the only one meterial, assuming that no one ever calls getMaterial()
|
||||
with an index greater than 0.
|
||||
*/
|
||||
virtual const core::aabbox3d<f32>& getBoundingBox() const
|
||||
{
|
||||
return Box;
|
||||
}
|
||||
|
||||
virtual u32 getMaterialCount()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
virtual video::SMaterial& getMaterial(u32 i)
|
||||
{
|
||||
return Material;
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
That's it. The Scene node is done. Now we simply have to start
|
||||
the engine, create the scene node and a camera, and look at the result.
|
||||
*/
|
||||
int main()
|
||||
{
|
||||
// let user select driver type
|
||||
|
||||
video::E_DRIVER_TYPE driverType;
|
||||
|
||||
printf("Please select the driver you want for this example:\n"\
|
||||
" (a) Direct3D 9.0c\n (b) Direct3D 8.1\n (c) OpenGL 1.5\n"\
|
||||
" (d) Software Renderer\n (e) Burning's Software Renderer\n"\
|
||||
" (f) NullDevice\n (otherKey) exit\n\n");
|
||||
|
||||
char i;
|
||||
std::cin >> i;
|
||||
|
||||
switch(i)
|
||||
{
|
||||
case 'a': driverType = video::EDT_DIRECT3D9;break;
|
||||
case 'b': driverType = video::EDT_DIRECT3D8;break;
|
||||
case 'c': driverType = video::EDT_OPENGL; break;
|
||||
case 'd': driverType = video::EDT_SOFTWARE; break;
|
||||
case 'e': driverType = video::EDT_BURNINGSVIDEO; break;
|
||||
case 'f': driverType = video::EDT_NULL; break;
|
||||
default: return 0;
|
||||
}
|
||||
|
||||
// create device
|
||||
|
||||
IrrlichtDevice *device =
|
||||
createDevice(driverType, core::dimension2d<s32>(640, 480), 16, false);
|
||||
|
||||
if (device == 0)
|
||||
return 1; // could not create selected driver.
|
||||
|
||||
// create engine and camera
|
||||
|
||||
device->setWindowCaption(L"Custom Scene Node - Irrlicht Engine Demo");
|
||||
|
||||
video::IVideoDriver* driver = device->getVideoDriver();
|
||||
scene::ISceneManager* smgr = device->getSceneManager();
|
||||
|
||||
smgr->addCameraSceneNode(0, core::vector3df(0,-40,0), core::vector3df(0,0,0));
|
||||
|
||||
/*
|
||||
Create our scene node. Note that it is dropped (->drop()) instantly after
|
||||
we create it. This is possible because the scene manager now takes
|
||||
care of it. This is not nessecary, it would also be possible to drop it
|
||||
at the end of the program.
|
||||
*/
|
||||
|
||||
CSampleSceneNode *myNode =
|
||||
new CSampleSceneNode(smgr->getRootSceneNode(), smgr, 666);
|
||||
|
||||
myNode->drop();
|
||||
|
||||
/*
|
||||
To animate something in this boring scene consisting only of one tetraeder,
|
||||
and to show, that you now can use your scene node like any other scene
|
||||
node in the engine, we add an animator to the scene node, which rotates
|
||||
the node a little bit.
|
||||
*/
|
||||
|
||||
scene::ISceneNodeAnimator* anim =
|
||||
smgr->createRotationAnimator(core::vector3df(0.8f, 0, 0.8f));
|
||||
|
||||
myNode->addAnimator(anim);
|
||||
anim->drop();
|
||||
|
||||
/*
|
||||
Now draw everything and finish.
|
||||
*/
|
||||
|
||||
u32 frames=0;
|
||||
while(device->run())
|
||||
{
|
||||
driver->beginScene(true, true, video::SColor(0,100,100,100));
|
||||
|
||||
smgr->drawAll();
|
||||
|
||||
driver->endScene();
|
||||
if (++frames==100)
|
||||
{
|
||||
core::stringw str = L"Irrlicht Engine [";
|
||||
str += driver->getName();
|
||||
str += L"] FPS: ";
|
||||
str += (s32)driver->getFPS();
|
||||
|
||||
device->setWindowCaption(str.c_str());
|
||||
frames=0;
|
||||
}
|
||||
}
|
||||
|
||||
device->drop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
222
examples/03.CustomSceneNode/tutorial.html
Normal file
222
examples/03.CustomSceneNode/tutorial.html
Normal file
@ -0,0 +1,222 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Irrlicht Engine Tutorial</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
|
||||
<br>
|
||||
<table width="95%" border="0" cellspacing="0" cellpadding="2" align="center">
|
||||
<tr>
|
||||
<td bgcolor="#666699" width="10"><b><a href="http://irrlicht.sourceforge.net" target="_blank"><img src="../../media/irrlichtlogo.jpg" width="88" height="31" border="0"></a></b></td>
|
||||
<td bgcolor="#666699" width="100%">
|
||||
<div align="center">
|
||||
<div align="center"></div>
|
||||
<div align="left"><b><font color="#FFFFFF">Tutorial 3.CustomSceneNode</font></b></div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr bgcolor="#eeeeff">
|
||||
<td height="90" colspan="2">
|
||||
<div align="left">
|
||||
<p>This Tutorial is a tutorial for more advanced developers. If you are
|
||||
currently just playing around with the Irrlicht engine, please look
|
||||
at other examples first. This tutorial shows how to create a custom
|
||||
scene node and how to use it in the engine. A custom scene node is needed,
|
||||
if you want to implement a render technique, the Irrlicht Engine is
|
||||
currently not supporting. For example you can write a indoor portal
|
||||
based renderer or a advanced terrain scene node with it. With creating
|
||||
custom scene nodes, you can easily extend the Irrlicht Engine and adapt
|
||||
it to your needs.</p>
|
||||
<p>I will keep the tutorial simple: Keep everything very short, everything
|
||||
in one .cpp file, and I'll use the engine here as in all other tutorials.
|
||||
At the end of the tutorial, the result will look like the image below.
|
||||
This looks not very exciting, but it is a complete customized scene
|
||||
node and a good point to start from creating you own scene nodes.</p>
|
||||
<p align="center"><img src="../../media/003shot.jpg" width="259" height="204"><br>
|
||||
</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<table width="95%" border="0" cellspacing="0" cellpadding="2" align="center">
|
||||
<tr>
|
||||
<td bgcolor="#666699"> <div align="center"><b><font color="#FFFFFF"></font></b></div>
|
||||
<b><font color="#FFFFFF">Lets start!</font></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="90" bgcolor="#eeeeff" valign="top"> <div align="left">
|
||||
<p>To start, I include the header files, use the irr namespace, and tell
|
||||
the linker to link with the .lib file. </p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>#include <irrlicht.h></pre> <pre>using namespace irr;</pre> <pre>#pragma comment(lib, "Irrlicht.lib")</pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>Here comes the most sophisticated part of this tutorial: The class
|
||||
of our very own custom scene node. To keep it simple,<br>
|
||||
our scene node will not be an indoor portal renderer nor a terrain scene
|
||||
node, but a simple tetraeder, a 3d object consiting of 4 connected vertices,
|
||||
which only draws itself and does nothing more.</p>
|
||||
<p>To let our scene node be able to be inserted into the Irrlicht Engine
|
||||
scene, the class we create needs only be derived from the ISceneNode
|
||||
class and has to override some methods.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>class CSampleSceneNode : public scene::ISceneNode<br>{</pre> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>First, we declare some member variables, to hold data for our tetraeder:
|
||||
The bounding box, 4 vertices, and<br>
|
||||
the material of the tetraeder.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>core::aabbox3d<f32> Box;<br>video::S3DVertex Vertices[4];<br>video::SMaterial Material;</pre> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>The parameters of the constructor specify the parent of the scene node,
|
||||
a pointer to the scene manager, and an id of the scene node. In the
|
||||
constructor itself, we call the parent classes constructor, set some
|
||||
properties of the material we use to draw the scene node and create
|
||||
the 4 vertices of the tetraeder we will draw later. </p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>public:</pre> <pre>CSampleSceneNode(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id)
|
||||
: scene::ISceneNode(parent, mgr, id)
|
||||
{
|
||||
Material.Wireframe = false;
|
||||
Material.Lighting = false;</pre>
|
||||
<pre> Vertices[0] = video::S3DVertex(0,0,10, 1,1,0,video::SColor(255,0,255,255),0,1);
|
||||
Vertices[1] = video::S3DVertex(10,0,-10, 1,0,0,video::SColor(255,255,0,255),1,1);
|
||||
Vertices[2] = video::S3DVertex(0,20,0, 0,1,1,video::SColor(255,255,255,0),1,0);
|
||||
Vertices[3] = video::S3DVertex(-10,0,-10, 0,0,1,video::SColor(255,0,255,0),0,0);
|
||||
</pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
The Irrlicht Engine needs to know the bounding box of your scene node.
|
||||
It will use it for doing automatic culling and other things. Hence we
|
||||
need to create a bounding box from the 4 vertices we use. If you do not
|
||||
want the engine to use the box for automatic culling, and/or don't want
|
||||
to create the box, you could also write<br>
|
||||
<font face="Courier New, Courier, mono">AutomaticCullingEnabled = false;</font>.<br>
|
||||
<br>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre> Box.reset(Vertices[0].Pos);<br> for (s32 i=1; i<4; ++i)<br> Box.addInternalPoint(Vertices[i].Pos);
|
||||
}</pre> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<p>Before it is drawn, the OnPreRender() method of every scene node in
|
||||
the scene is called by the scene manager. If the scene node wishes to
|
||||
draw itself, it may register itself in the scene manager to be drawn.
|
||||
This is necessary to tell the scene manager when it should call the
|
||||
::render method. For example normal scene nodes render their content
|
||||
one after another, while stencil buffer shadows would like to be drawn
|
||||
after all other scene nodes. And camera or light scene nodes need to
|
||||
be rendered before all other scene nodes (if at all). <br>
|
||||
So here we simply register the scene node to get rendered normally.
|
||||
If we would like to let it be rendered like cameras or light, we would
|
||||
have to call SceneManager->registerNodeForRendering(this, SNRT_LIGHT_AND_CAMERA);
|
||||
<br>
|
||||
After this, we call the OnPreRender-method of the base class ISceneNode,
|
||||
which simply lets also all the child scene nodes of this node register
|
||||
themselves. </p>
|
||||
</div>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>virtual void OnPreRender()<br>{<br> if (IsVisible)<br> SceneManager->registerNodeForRendering(this);
|
||||
|
||||
ISceneNode::OnPreRender();
|
||||
}</pre> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>In the render() method most of the interresting stuff happenes: The Scene
|
||||
node renders itself. We override this method and draw the tetraeder.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>virtual void render()<br>{<br> u16 indices[] = { 0,2,3, 2,1,3, 1,0,3, 2,0,1 };
|
||||
video::IVideoDriver* driver = SceneManager->getVideoDriver();</pre>
|
||||
<pre> driver->setMaterial(Material);
|
||||
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
|
||||
driver->drawIndexedTriangleList(&Vertices[0], 4, &indices[0], 4);
|
||||
}</pre> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<p> At least, we create three small additional methods. GetBoundingBox()
|
||||
returns the bounding box of this scene node, <br>
|
||||
GetMaterialCount() returns the amount of materials in this scene node
|
||||
(our tetraeder only has one material), and getMaterial() returns the material
|
||||
at an index. Because we have only one material here, we can return the
|
||||
only one material, assuming that no one ever calls getMaterial() with
|
||||
an index greater than 0. </p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td><pre> virtual const core::aabbox3d<f32>& getBoundingBox() const<br> {<br> return Box;<br> }</pre> <pre> virtual u32 getMaterialCount()
|
||||
{
|
||||
return 1;
|
||||
}</pre> <pre> virtual video::SMaterial& getMaterial(u32 i)
|
||||
{
|
||||
return Material;
|
||||
}
|
||||
};</pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>That's it. The Scene node is done. Now we simply have to start the engine,
|
||||
create the scene node and a camera, and look at the result.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>int main()<br>{
|
||||
IrrlichtDevice *device =
|
||||
createDevice(video::EDT_OPENGL, core::dimension2d<s32>(640, 480), 16, false);</pre> <pre> device->setWindowCaption(L"Custom Scene Node - Irrlicht Engine Demo");</pre> <pre> video::IVideoDriver* driver = device->getVideoDriver();
|
||||
scene::ISceneManager* smgr = device->getSceneManager();</pre>
|
||||
<pre> smgr->addCameraSceneNode(0, core::vector3df(0,-40,0), core::vector3df(0,0,0));
|
||||
</pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>Create our scene node. Note that it is dropped (->drop()) instantly
|
||||
after we create it. This is possible because the scene manager now takes
|
||||
care of it. This is not nessecary, it would also be possible to drop it
|
||||
at the end of the program.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>CSampleSceneNode *myNode = <br> new CSampleSceneNode(smgr->getRootSceneNode(), smgr, 666);
|
||||
|
||||
myNode->drop();</pre> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>To animate something in this boring scene consisting only of one tetraeder,
|
||||
and to show, that you now can use your scene node like any other scene
|
||||
node in the engine, we add an animator to the scene node, which rotates
|
||||
the node a little bit. </p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>scene::ISceneNodeAnimator* anim = <br> smgr->createRotationAnimator(core::vector3df(0.8f, 0, 0.8f));
|
||||
|
||||
myNode->addAnimator(anim);
|
||||
anim->drop();</pre> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>Now draw everything and finish.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre> while(device->run())<br> {<br> driver->beginScene(true, true, video::SColor(0,100,100,100));
|
||||
|
||||
smgr->drawAll();
|
||||
|
||||
driver->endScene();
|
||||
}
|
||||
|
||||
device->drop();
|
||||
return 0;
|
||||
}</pre> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>That's it. Compile and play around with the program. </p></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p> </p>
|
||||
</body>
|
||||
</html>
|
39
examples/04.Movement/Makefile
Normal file
39
examples/04.Movement/Makefile
Normal file
@ -0,0 +1,39 @@
|
||||
# Makefile for Irrlicht Examples
|
||||
# It's usually sufficient to change just the target name and source file list
|
||||
# and be sure that CXX is set to a valid compiler
|
||||
Target = 04.Movement
|
||||
Sources = main.cpp
|
||||
|
||||
# general compiler settings
|
||||
CPPFLAGS = -I../../include -I/usr/X11R6/include
|
||||
CXXFLAGS = -O3 -ffast-math
|
||||
#CXXFLAGS = -g -Wall
|
||||
|
||||
#default target is Linux
|
||||
all: all_linux
|
||||
|
||||
ifeq ($(HOSTTYPE), x86_64)
|
||||
LIBSELECT=64
|
||||
endif
|
||||
|
||||
# target specific settings
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht -lGL -lGLU -lXxf86vm -lXext -lX11
|
||||
all_linux clean_linux: SYSTEM=Linux
|
||||
all_win32: LDFLAGS = -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lglu32 -lm
|
||||
all_win32: CPPFLAGS += -D__GNUWIN32__ -D_WIN32 -DWIN32 -D_WINDOWS -D_MBCS -D_USRDLL
|
||||
all_win32 clean_win32: SYSTEM=Win32-gcc
|
||||
all_win32 clean_win32: SUF=.exe
|
||||
# name of the binary - only valid for targets which set SYSTEM
|
||||
DESTPATH = ../../bin/$(SYSTEM)/$(Target)$(SUF)
|
||||
|
||||
all_linux all_win32:
|
||||
$(warning Building...)
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(Sources) -o $(DESTPATH) $(LDFLAGS)
|
||||
|
||||
clean: clean_linux clean_win32
|
||||
$(warning Cleaning...)
|
||||
|
||||
clean_linux clean_win32:
|
||||
@$(RM) $(DESTPATH)
|
||||
|
||||
.PHONY: all all_win32 clean clean_linux clean_win32
|
90
examples/04.Movement/Movement.dsp
Normal file
90
examples/04.Movement/Movement.dsp
Normal file
@ -0,0 +1,90 @@
|
||||
# Microsoft Developer Studio Project File - Name="Movement" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** NICHT BEARBEITEN **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=Movement - Win32 Debug
|
||||
!MESSAGE Dies ist kein g<>s Makefile. Zum Erstellen dieses Projekts mit NMAKE
|
||||
!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und f<>Sie den Befehl
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "Movement.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE Sie k<>n beim Ausf<73>von NMAKE eine Konfiguration angeben
|
||||
!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "Movement.mak" CFG="Movement - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE F<> Konfiguration stehen zur Auswahl:
|
||||
!MESSAGE
|
||||
!MESSAGE "Movement - Win32 Release" (basierend auf "Win32 (x86) Console Application")
|
||||
!MESSAGE "Movement - Win32 Debug" (basierend auf "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "Movement - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0xc07 /d "NDEBUG"
|
||||
# ADD RSC /l 0xc07 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"..\..\bin\Win32-VisualStudio\Movement.exe" /libpath:"..\..\lib\Win32-visualstudio"
|
||||
|
||||
!ELSEIF "$(CFG)" == "Movement - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0xc07 /d "_DEBUG"
|
||||
# ADD RSC /l 0xc07 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\..\bin\Win32-VisualStudio\Movement.exe" /pdbtype:sept /libpath:"..\..\lib\Win32-visualstudio"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "Movement - Win32 Release"
|
||||
# Name "Movement - Win32 Debug"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\main.cpp
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
29
examples/04.Movement/Movement.dsw
Normal file
29
examples/04.Movement/Movement.dsw
Normal file
@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "Movement"=".\Movement.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
21
examples/04.Movement/Movement.sln
Normal file
21
examples/04.Movement/Movement.sln
Normal file
@ -0,0 +1,21 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Movement", "Movement.vcproj", "{1A16BBE1-A49B-4406-8883-681E6EA8702C}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
Release = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{1A16BBE1-A49B-4406-8883-681E6EA8702C}.Debug.ActiveCfg = Debug|Win32
|
||||
{1A16BBE1-A49B-4406-8883-681E6EA8702C}.Debug.Build.0 = Debug|Win32
|
||||
{1A16BBE1-A49B-4406-8883-681E6EA8702C}.Release.ActiveCfg = Release|Win32
|
||||
{1A16BBE1-A49B-4406-8883-681E6EA8702C}.Release.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
163
examples/04.Movement/Movement.vcproj
Normal file
163
examples/04.Movement/Movement.vcproj
Normal file
@ -0,0 +1,163 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="04.Movement"
|
||||
ProjectGUID="{735B050B-1AC5-4602-B0BE-D2D2B5893E94}"
|
||||
SccProjectName=""
|
||||
SccLocalPath="">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\Debug"
|
||||
IntermediateDirectory=".\Debug"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="5"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile=".\Debug/Movement.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
ProgramDataBaseFileName=".\Debug/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\04.Movement.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile=".\Debug/Movement.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Debug/Movement.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="3079"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\Release"
|
||||
IntermediateDirectory=".\Release"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="4"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile=".\Release/Movement.pch"
|
||||
AssemblerListingLocation=".\Release/"
|
||||
ObjectFile=".\Release/"
|
||||
ProgramDataBaseFileName=".\Release/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\04.Movement.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
ProgramDatabaseFile=".\Release/Movement.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Release/Movement.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="3079"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="main.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
231
examples/04.Movement/Movement_vc8.vcproj
Normal file
231
examples/04.Movement/Movement_vc8.vcproj
Normal file
@ -0,0 +1,231 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="04.Movement_vc8"
|
||||
ProjectGUID="{7BDBB7E8-E0C9-4A0D-83C1-D389D6140FEF}"
|
||||
RootNamespace="Movement_vc8"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\Debug"
|
||||
IntermediateDirectory=".\Debug"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Debug/Movement.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderFile=".\Debug/Movement.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
ProgramDataBaseFileName=".\Debug/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="3079"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\04.Movement.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile=".\Debug/Movement.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\Release"
|
||||
IntermediateDirectory=".\Release"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Release/Movement.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderFile=".\Release/Movement.pch"
|
||||
AssemblerListingLocation=".\Release/"
|
||||
ObjectFile=".\Release/"
|
||||
ProgramDataBaseFileName=".\Release/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="3079"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\04.Movement.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
ProgramDatabaseFile=".\Release/Movement.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="main.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BasicRuntimeChecks="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
32
examples/04.Movement/example.cbp
Normal file
32
examples/04.Movement/example.cbp
Normal file
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE CodeBlocks_project_file>
|
||||
<CodeBlocks_project_file>
|
||||
<FileVersion major="1" minor="1"/>
|
||||
<Project>
|
||||
<Option title="Irrlicht Example 04 Movement"/>
|
||||
<Option makefile="Makefile"/>
|
||||
<Option makefile_is_custom="0"/>
|
||||
<Option compiler="0"/>
|
||||
<Build>
|
||||
<Target title="default">
|
||||
<Option output="..\..\bin\Win32-gcc\04.Movement.exe"/>
|
||||
<Option working_dir="."/>
|
||||
<Option object_output=".objs"/>
|
||||
<Option deps_output=".deps"/>
|
||||
<Option type="1"/>
|
||||
<Option compiler="0"/>
|
||||
<Option projectResourceIncludeDirsRelation="1"/>
|
||||
</Target>
|
||||
</Build>
|
||||
<Compiler>
|
||||
<Add directory="..\..\include"/>
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="../../lib/Win32-gcc/libIrrlicht.a"/>
|
||||
</Linker>
|
||||
<Unit filename="main.cpp">
|
||||
<Option compilerVar="CPP"/>
|
||||
<Option target="default"/>
|
||||
</Unit>
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
59
examples/04.Movement/example.dev
Normal file
59
examples/04.Movement/example.dev
Normal file
@ -0,0 +1,59 @@
|
||||
[Project]
|
||||
FileName=example.dev
|
||||
Name=Irrlicht Example 04 Movement
|
||||
UnitCount=1
|
||||
Type=1
|
||||
Ver=1
|
||||
ObjFiles=
|
||||
Includes=..\..\include
|
||||
Libs=
|
||||
PrivateResource=
|
||||
ResourceIncludes=
|
||||
MakeIncludes=
|
||||
Compiler=
|
||||
CppCompiler=
|
||||
Linker=../../lib/Win32-gcc/libIrrlicht.a_@@_
|
||||
IsCpp=1
|
||||
Icon=
|
||||
ExeOutput=../../bin/Win32-gcc
|
||||
ObjectOutput=obj
|
||||
OverrideOutput=1
|
||||
OverrideOutputName=04.Movement.exe
|
||||
HostApplication=
|
||||
Folders=
|
||||
CommandLine=
|
||||
IncludeVersionInfo=0
|
||||
SupportXPThemes=0
|
||||
CompilerSet=0
|
||||
CompilerSettings=0000000000000000000000
|
||||
UseCustomMakefile=0
|
||||
CustomMakefile=
|
||||
|
||||
[Unit1]
|
||||
FileName=main.cpp
|
||||
CompileCpp=1
|
||||
Folder=Projekt1
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[VersionInfo]
|
||||
Major=0
|
||||
Minor=1
|
||||
Release=1
|
||||
Build=1
|
||||
LanguageID=1033
|
||||
CharsetID=1252
|
||||
CompanyName=
|
||||
FileVersion=
|
||||
FileDescription=Irrlicht Engine example compiled using DevCpp and gcc
|
||||
InternalName=
|
||||
LegalCopyright=
|
||||
LegalTrademarks=
|
||||
OriginalFilename=
|
||||
ProductName=
|
||||
ProductVersion=
|
||||
AutoIncBuildNr=0
|
||||
|
235
examples/04.Movement/main.cpp
Normal file
235
examples/04.Movement/main.cpp
Normal file
@ -0,0 +1,235 @@
|
||||
/*
|
||||
This Tutorial shows how to move and animate SceneNodes. The
|
||||
basic concept of SceneNodeAnimators is shown as well as manual
|
||||
movement of nodes using the keyboard.
|
||||
|
||||
As always, I include the header files, use the irr namespace,
|
||||
and tell the linker to link with the .lib file.
|
||||
*/
|
||||
#include <irrlicht.h>
|
||||
#include <iostream>
|
||||
|
||||
using namespace irr;
|
||||
|
||||
#pragma comment(lib, "Irrlicht.lib")
|
||||
|
||||
/*
|
||||
In this tutorial, one of our goals is to move a scene node using some
|
||||
keys on the keyboard. We store a pointer to the scene node we want to
|
||||
move with the keys here.
|
||||
The other pointer is a pointer to the Irrlicht Device, which we need
|
||||
int the EventReceiver to manipulate the scene node and to get the
|
||||
active camera.
|
||||
*/
|
||||
|
||||
scene::ISceneNode* node = 0;
|
||||
IrrlichtDevice* device = 0;
|
||||
|
||||
|
||||
/*
|
||||
To get events like mouse and keyboard input, or GUI events like
|
||||
"the OK button has been clicked", we need an object wich is derived from the
|
||||
IEventReceiver object. There is only one method to override: OnEvent.
|
||||
This method will be called by the engine when an event happened.
|
||||
We will use this input to move the scene node with the keys W and S.
|
||||
*/
|
||||
class MyEventReceiver : public IEventReceiver
|
||||
{
|
||||
public:
|
||||
virtual bool OnEvent(SEvent event)
|
||||
{
|
||||
/*
|
||||
If the key 'W' or 'S' was left up, we get the position of the scene node,
|
||||
and modify the Y coordinate a little bit. So if you press 'W', the node
|
||||
moves up, and if you press 'S' it moves down.
|
||||
*/
|
||||
|
||||
if (node != 0 && event.EventType == irr::EET_KEY_INPUT_EVENT&&
|
||||
!event.KeyInput.PressedDown)
|
||||
{
|
||||
switch(event.KeyInput.Key)
|
||||
{
|
||||
case KEY_KEY_W:
|
||||
case KEY_KEY_S:
|
||||
{
|
||||
core::vector3df v = node->getPosition();
|
||||
v.Y += event.KeyInput.Key == KEY_KEY_W ? 2.0f : -2.0f;
|
||||
node->setPosition(v);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
The event receiver for moving a scene node is ready. So lets just create
|
||||
an Irrlicht Device and the scene node we want to move. We also create some
|
||||
other additional scene nodes, to show that there are also some different
|
||||
possibilities to move and animate scene nodes.
|
||||
*/
|
||||
int main()
|
||||
{
|
||||
// let user select driver type
|
||||
|
||||
video::E_DRIVER_TYPE driverType = video::EDT_DIRECT3D9;
|
||||
|
||||
printf("Please select the driver you want for this example:\n"\
|
||||
" (a) Direct3D 9.0c\n (b) Direct3D 8.1\n (c) OpenGL 1.5\n"\
|
||||
" (d) Software Renderer\n (e) Burning's Software Renderer\n"\
|
||||
" (f) NullDevice\n (otherKey) exit\n\n");
|
||||
|
||||
char i;
|
||||
std::cin >> i;
|
||||
|
||||
switch(i)
|
||||
{
|
||||
case 'a': driverType = video::EDT_DIRECT3D9;break;
|
||||
case 'b': driverType = video::EDT_DIRECT3D8;break;
|
||||
case 'c': driverType = video::EDT_OPENGL; break;
|
||||
case 'd': driverType = video::EDT_SOFTWARE; break;
|
||||
case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
|
||||
case 'f': driverType = video::EDT_NULL; break;
|
||||
default: return 0;
|
||||
}
|
||||
|
||||
// create device
|
||||
MyEventReceiver receiver;
|
||||
|
||||
IrrlichtDevice* device = createDevice( driverType, core::dimension2d<s32>(640, 480),
|
||||
16, false, false, false, &receiver);
|
||||
|
||||
if (device == 0)
|
||||
return 1; // could not create selected driver.
|
||||
|
||||
|
||||
video::IVideoDriver* driver = device->getVideoDriver();
|
||||
scene::ISceneManager* smgr = device->getSceneManager();
|
||||
|
||||
|
||||
/*
|
||||
Create the node for moving it with the 'W' and 'S' key. We create a
|
||||
sphere node, which is a built in geometry primitive. We place the node
|
||||
at (0,0,30) and assign a texture to it to let it look a little bit more
|
||||
interesting. Because we have no dynamic lights in this scene we disable
|
||||
lighting for each model (otherwise the models would be black).
|
||||
*/
|
||||
node = smgr->addSphereSceneNode();
|
||||
node->setPosition(core::vector3df(0,0,30));
|
||||
node->setMaterialTexture(0, driver->getTexture("../../media/wall.bmp"));
|
||||
node->setMaterialFlag(video::EMF_LIGHTING, false);
|
||||
|
||||
|
||||
/*
|
||||
Now we create another node, moving using a scene node animator. Scene node
|
||||
animators modify scene nodes and can be attached to any scene node like
|
||||
mesh scene nodes, billboards, lights and even camera scene nodes. Scene node
|
||||
animators are not only able to modify the position of a scene node, they can
|
||||
also animate the textures of an object for example.
|
||||
We create a cube scene node and attach a 'fly circle' scene node to it, letting
|
||||
this node fly around our sphere scene node.
|
||||
*/
|
||||
scene::ISceneNode* n = smgr->addCubeSceneNode();
|
||||
|
||||
if (n)
|
||||
{
|
||||
n->setMaterialTexture(0, driver->getTexture("../../media/t351sml.jpg"));
|
||||
n->setMaterialFlag(video::EMF_LIGHTING, false);
|
||||
scene::ISceneNodeAnimator* anim =
|
||||
smgr->createFlyCircleAnimator(core::vector3df(0,0,30), 20.0f);
|
||||
n->addAnimator(anim);
|
||||
anim->drop();
|
||||
}
|
||||
|
||||
/*
|
||||
The last scene node we add to show possibilities of scene node animators is
|
||||
a md2 model, which uses a 'fly straight' animator to run between to points.
|
||||
*/
|
||||
scene::IAnimatedMeshSceneNode* anms = smgr->addAnimatedMeshSceneNode(smgr->getMesh("../../media/sydney.md2"));
|
||||
|
||||
if (anms)
|
||||
{
|
||||
scene::ISceneNodeAnimator* anim =
|
||||
smgr->createFlyStraightAnimator(core::vector3df(100,0,60),
|
||||
core::vector3df(-100,0,60), 2500, true);
|
||||
anms->addAnimator(anim);
|
||||
anim->drop();
|
||||
|
||||
/*
|
||||
To make to model look right we set the frames between which the animation
|
||||
should loop, rotate the model around 180 degrees, and adjust the animation speed
|
||||
and the texture.
|
||||
To set the right animation (frames and speed), we would also be able to just
|
||||
call "anms->setMD2Animation(scene::EMAT_RUN)" for the 'run' animation
|
||||
instead of "setFrameLoop" and "setAnimationSpeed",
|
||||
but this only works with MD2 animations, and so you know how to start other animations.
|
||||
but it a good advice to use not hardcoded frame-numbers...
|
||||
*/
|
||||
anms->setMaterialFlag(video::EMF_LIGHTING, false);
|
||||
|
||||
anms->setFrameLoop(160, 183);
|
||||
anms->setAnimationSpeed(40);
|
||||
anms->setMD2Animation(scene::EMAT_RUN);
|
||||
|
||||
anms->setRotation(core::vector3df(0,180.0f,0));
|
||||
anms->setMaterialTexture(0, driver->getTexture("../../media/sydney.bmp"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
To be able to look at and move around in this scene,
|
||||
we create a first person shooter style camera and make the
|
||||
mouse cursor invisible.
|
||||
*/
|
||||
scene::ICameraSceneNode * cam = smgr->addCameraSceneNodeFPS(0, 100.0f, 100.0f);
|
||||
device->getCursorControl()->setVisible(false);
|
||||
|
||||
/*
|
||||
Add a colorful irrlicht logo
|
||||
*/
|
||||
device->getGUIEnvironment()->addImage(
|
||||
driver->getTexture("../../media/irrlichtlogoalpha2.tga"),
|
||||
core::position2d<s32>(10,10));
|
||||
|
||||
/*
|
||||
We have done everything, so lets draw it. We also write the current
|
||||
frames per second and the name of the driver to the caption of the
|
||||
window.
|
||||
*/
|
||||
int lastFPS = -1;
|
||||
|
||||
while(device->run())
|
||||
{
|
||||
driver->beginScene(true, true, video::SColor(255,113,113,133));
|
||||
|
||||
smgr->drawAll(); // draw the 3d scene
|
||||
device->getGUIEnvironment()->drawAll(); // draw the gui environment (the logo)
|
||||
|
||||
driver->endScene();
|
||||
|
||||
int fps = driver->getFPS();
|
||||
|
||||
if (lastFPS != fps)
|
||||
{
|
||||
core::stringw tmp(L"Movement Example - Irrlicht Engine [");
|
||||
tmp += driver->getName();
|
||||
tmp += L"] fps: ";
|
||||
tmp += fps;
|
||||
|
||||
device->setWindowCaption(tmp.c_str());
|
||||
lastFPS = fps;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
In the end, delete the Irrlicht device.
|
||||
*/
|
||||
device->drop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
188
examples/04.Movement/tutorial.html
Normal file
188
examples/04.Movement/tutorial.html
Normal file
@ -0,0 +1,188 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Irrlicht Engine Tutorial</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
|
||||
<br>
|
||||
<table width="95%" border="0" cellspacing="0" cellpadding="2" align="center">
|
||||
<tr>
|
||||
<td bgcolor="#666699" width="10"><b><a href="http://irrlicht.sourceforge.net" target="_blank"><img src="../../media/irrlichtlogo.jpg" width="88" height="31" border="0"></a></b></td>
|
||||
<td bgcolor="#666699" width="100%">
|
||||
<div align="center">
|
||||
<div align="center"></div>
|
||||
<div align="left"><b><font color="#FFFFFF">Tutorial 4.Movement</font></b></div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr bgcolor="#eeeeff">
|
||||
<td height="90" colspan="2">
|
||||
<div align="left">
|
||||
<p>This Tutorial shows how to move and animate SceneNodes. The basic concept
|
||||
of SceneNodeAnimators is shown as well as manual movement of nodes using
|
||||
the keyboard.</p>
|
||||
<p>The program which is described here will look like this:</p>
|
||||
<p align="center"><img src="../../media/004shot.jpg" width="259" height="204"><br>
|
||||
</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<table width="95%" border="0" cellspacing="0" cellpadding="2" align="center">
|
||||
<tr>
|
||||
<td bgcolor="#666699"> <div align="center"><b><font color="#FFFFFF"></font></b></div>
|
||||
<b><font color="#FFFFFF">Lets start!</font></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="90" bgcolor="#eeeeff" valign="top"> <div align="left">
|
||||
<p>As always, I include the header files, use the irr namespace, and tell
|
||||
the linker to link with the .lib file. </p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>#include <stdio.h><br>#include <wchar.h><br>#include <irrlicht.h></pre>
|
||||
<pre>using namespace irr;</pre>
|
||||
<pre>#pragma comment(lib, "Irrlicht.lib")</pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>In this tutorial, one of our goals is to move a scene node using some
|
||||
keys on the keyboard. We store a pointer to the scene node we want to
|
||||
move with the keys here.<br>
|
||||
The other pointer is a pointer to the Irrlicht Device, which we need
|
||||
int the EventReceiver to manipulate the scene node and to get the active
|
||||
camera.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>scene::ISceneNode* node = 0;<br>IrrlichtDevice* device = 0; </pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>To get events like mouse and keyboard input, or GUI events like "the
|
||||
OK button has been clicked", we need an object wich is derived
|
||||
from the IEventReceiver object. There is only one method to override:
|
||||
OnEvent. This method will be called by the engine when an event happened.
|
||||
We will use this input to move the scene node with the keys W and S.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>class MyEventReceiver : public IEventReceiver<br>{<br>public:<br> virtual bool OnEvent(SEvent event)<br> { </pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>If the key 'W' or 'S' was left up, we get the position of the scene
|
||||
node, and modify the Y coordinate a little bit. So if you press 'W',
|
||||
the node moves up, and if you press 'S' it moves down.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>if (node != 0 && event.EventType == irr::EET_KEY_INPUT_EVENT&&<br> !event.KeyInput.PressedDown)<br>{<br> switch(event.KeyInput.Key)<br> {<br> case KEY_KEY_W:<br> case KEY_KEY_S:<br> {<br> core::vector3df v = node->getPosition();<br> v.Y += event.KeyInput.Key == KEY_KEY_W ? 2.0f : -2.0f;<br> node->setPosition(v);<br> }<br> return true;<br> }<br>} return false; <br> } <br> };</pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<p>The event receiver for moving a scene node is ready. So lets just create
|
||||
an Irrlicht Device and the scene node we want to move. We also create
|
||||
some other additional scene nodes, to show that there are also some different
|
||||
possibilities to move and animate scene nodes.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td><pre>int main()<br>{<br> MyEventReceiver receiver;
|
||||
|
||||
device = createDevice(video::EDT_OPENGL, core::dimension2d<s32>(640, 480),
|
||||
16, false, false, false, &receiver);</pre>
|
||||
<pre> video::IVideoDriver* driver = device->getVideoDriver();
|
||||
scene::ISceneManager* smgr = device->getSceneManager();</pre>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p> Create the node for moving it with the 'W' and 'S' key. We create a
|
||||
sphere node, which is a built in geometric primitive scene node.
|
||||
We place the node at (0,0,30) and assign a texture to it to let it look
|
||||
a little bit more interesting.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td><pre>node = smgr->addSphereSceneNode();
|
||||
node->setPosition(core::vector3df(0,0,30));
|
||||
node->setMaterialFlag(video::EMF_LIGHTING, false);
|
||||
node->setMaterialTexture(0, driver->getTexture("../../media/wall.bmp"));</pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>Now we create another node, moving using a scene node animator. Scene
|
||||
node animators modify scene nodes and can be attached to any scene node
|
||||
like<br>
|
||||
mesh scene nodes, billboards, lights and even camera scene nodes. Scene
|
||||
node animators are not only able to modify the position of a scene node,
|
||||
they can<br>
|
||||
also animate the textures of an object for example. We create a test scene
|
||||
node again an attach a 'fly circle' scene node to it, letting this node
|
||||
fly around our first test scene node.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td><pre>scene::ISceneNode* n = smgr->addCubeSceneNode();
|
||||
n->setMaterialTexture(0, driver->getTexture("../../media/t351sml.jpg"));
|
||||
n->setMaterialFlag(video::EMF_LIGHTING, false);
|
||||
scene::ISceneNodeAnimator* anim =
|
||||
smgr->createFlyCircleAnimator(core::vector3df(0,0,30), 20.0f);
|
||||
n->addAnimator(anim);
|
||||
anim->drop();</pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>The last scene node we add to show possibilities of scene node animators
|
||||
is a md2 model, which uses a 'fly straight' animator to run between to
|
||||
points.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>scene::IAnimatedMeshSceneNode* anms = smgr->addAnimatedMeshSceneNode(<br> smgr->getMesh("../../media/sydney.md2"));
|
||||
|
||||
if (n)<br> {<br> anim = smgr->createFlyStraightAnimator(core::vector3df(100,0,60), <br> core::vector3df(-100,0,60), 10000, true);<br> anms->addAnimator(anim);<br> anim->drop();</pre>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>To make to model look right we set the frames between which
|
||||
the animation should loop, rotate the model around 180 degrees, and adjust
|
||||
the animation speed and the texture.<br>
|
||||
To set the right animation (frames and speed), we would also be able to
|
||||
just call "anms->setMD2Animation(scene::EMAT_RUN)" for the
|
||||
'run' animation instead of "setFrameLoop" and "setAnimationSpeed",
|
||||
but this only works with MD2 animations, and so you know how to start
|
||||
other animations.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre> anms->setMaterialFlag(video::EMF_LIGHTING, false);<br> anms->setFrameLoop(320, 360);
|
||||
anms->setAnimationSpeed(30);<br> anms->setRotation(core::vector3df(0,180.0f,0));<br> anms->setMaterialTexture(0, driver->getTexture("../../media/sydney.bmp"));<br>}<br></pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>To be able to look at and move around in this scene, we create a first
|
||||
person shooter style camera and make the mouse cursor invisible.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>smgr->addCameraSceneNodeFPS(0, 100.0f, 100.0f);<br>device->getCursorControl()->setVisible(false); </pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>We have done everything, so lets draw it. We also write the current frames
|
||||
per second and the name of the driver to the caption of the window.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>int lastFPS = -1;</pre>
|
||||
<pre>while(device->run())
|
||||
{
|
||||
driver->beginScene(true, true, video::SColor(255,90,90,156));
|
||||
smgr->drawAll();
|
||||
driver->endScene();</pre>
|
||||
<pre> int fps = driver->getFPS();</pre>
|
||||
<pre> if (lastFPS != fps)
|
||||
{
|
||||
wchar_t tmp[1024];
|
||||
swprintf(tmp, 1024, L"Movement Example - Irrlicht Engine (%ls)(fps:%d)",<br> driver->getName(), fps);</pre>
|
||||
<pre> device->setWindowCaption(tmp);
|
||||
lastFPS = fps;
|
||||
}
|
||||
}
|
||||
|
||||
device->drop();<br>return 0;<br>}</pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>That's it. Compile and play around with the program. </p>
|
||||
<p> </p></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p> </p>
|
||||
</body>
|
||||
</html>
|
38
examples/05.UserInterface/Makefile
Normal file
38
examples/05.UserInterface/Makefile
Normal file
@ -0,0 +1,38 @@
|
||||
# Makefile for Irrlicht Examples
|
||||
# It's usually sufficient to change just the target name and source file list
|
||||
# and be sure that CXX is set to a valid compiler
|
||||
Target = 05.UserInterface
|
||||
Sources = main.cpp
|
||||
|
||||
# general compiler settings
|
||||
CPPFLAGS = -I../../include -I/usr/X11R6/include
|
||||
CXXFLAGS = -O3 -ffast-math
|
||||
#CXXFLAGS = -g -Wall
|
||||
|
||||
#default target is Linux
|
||||
all: all_linux
|
||||
|
||||
ifeq ($(HOSTTYPE), x86_64)
|
||||
LIBSELECT=64
|
||||
endif
|
||||
|
||||
# target specific settings
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht -lGL -lGLU -lXxf86vm -lXext -lX11
|
||||
all_linux clean_linux: SYSTEM=Linux
|
||||
all_win32: LDFLAGS = -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lglu32 -lm
|
||||
all_win32 clean_win32: SYSTEM=Win32-gcc
|
||||
all_win32 clean_win32: SUF=.exe
|
||||
# name of the binary - only valid for targets which set SYSTEM
|
||||
DESTPATH = ../../bin/$(SYSTEM)/$(Target)$(SUF)
|
||||
|
||||
all_linux all_win32:
|
||||
$(warning Building...)
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(Sources) -o $(DESTPATH) $(LDFLAGS)
|
||||
|
||||
clean: clean_linux clean_win32
|
||||
$(warning Cleaning...)
|
||||
|
||||
clean_linux clean_win32:
|
||||
@$(RM) $(DESTPATH)
|
||||
|
||||
.PHONY: all all_win32 clean clean_linux clean_win32
|
90
examples/05.UserInterface/UserInterface.dsp
Normal file
90
examples/05.UserInterface/UserInterface.dsp
Normal file
@ -0,0 +1,90 @@
|
||||
# Microsoft Developer Studio Project File - Name="UserInterface" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** NICHT BEARBEITEN **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=UserInterface - Win32 Debug
|
||||
!MESSAGE Dies ist kein g<>s Makefile. Zum Erstellen dieses Projekts mit NMAKE
|
||||
!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und f<>Sie den Befehl
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "UserInterface.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE Sie k<>n beim Ausf<73>von NMAKE eine Konfiguration angeben
|
||||
!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "UserInterface.mak" CFG="UserInterface - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE F<> Konfiguration stehen zur Auswahl:
|
||||
!MESSAGE
|
||||
!MESSAGE "UserInterface - Win32 Release" (basierend auf "Win32 (x86) Console Application")
|
||||
!MESSAGE "UserInterface - Win32 Debug" (basierend auf "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "UserInterface - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0xc07 /d "NDEBUG"
|
||||
# ADD RSC /l 0xc07 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"..\..\bin\Win32-VisualStudio\UserInterface.exe" /libpath:"..\..\lib\Win32-visualstudio"
|
||||
|
||||
!ELSEIF "$(CFG)" == "UserInterface - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0xc07 /d "_DEBUG"
|
||||
# ADD RSC /l 0xc07 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\..\bin\Win32-VisualStudio\UserInterface.exe" /pdbtype:sept /libpath:"..\..\lib\Win32-visualstudio"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "UserInterface - Win32 Release"
|
||||
# Name "UserInterface - Win32 Debug"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\main.cpp
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
29
examples/05.UserInterface/UserInterface.dsw
Normal file
29
examples/05.UserInterface/UserInterface.dsw
Normal file
@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "UserInterface"=".\UserInterface.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
24
examples/05.UserInterface/UserInterface.sln
Normal file
24
examples/05.UserInterface/UserInterface.sln
Normal file
@ -0,0 +1,24 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UserInterface", "UserInterface.vcproj", "{7FD46B60-53A7-4634-A07C-95AA83BBE9F6}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
Relase - Fast FPU = Relase - Fast FPU
|
||||
Release = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{7FD46B60-53A7-4634-A07C-95AA83BBE9F6}.Debug.ActiveCfg = Debug|Win32
|
||||
{7FD46B60-53A7-4634-A07C-95AA83BBE9F6}.Debug.Build.0 = Debug|Win32
|
||||
{7FD46B60-53A7-4634-A07C-95AA83BBE9F6}.Relase - Fast FPU.ActiveCfg = Release|Win32
|
||||
{7FD46B60-53A7-4634-A07C-95AA83BBE9F6}.Relase - Fast FPU.Build.0 = Release|Win32
|
||||
{7FD46B60-53A7-4634-A07C-95AA83BBE9F6}.Release.ActiveCfg = Release|Win32
|
||||
{7FD46B60-53A7-4634-A07C-95AA83BBE9F6}.Release.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
163
examples/05.UserInterface/UserInterface.vcproj
Normal file
163
examples/05.UserInterface/UserInterface.vcproj
Normal file
@ -0,0 +1,163 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="05.UserInterface"
|
||||
ProjectGUID="{0294193E-12DE-4B24-91C0-419865BF7E33}"
|
||||
SccProjectName=""
|
||||
SccLocalPath="">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\Debug"
|
||||
IntermediateDirectory=".\Debug"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="5"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile=".\Debug/UserInterface.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
ProgramDataBaseFileName=".\Debug/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\05.UserInterface.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile=".\Debug/UserInterface.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Debug/UserInterface.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="3079"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\Release"
|
||||
IntermediateDirectory=".\Release"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="4"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile=".\Release/UserInterface.pch"
|
||||
AssemblerListingLocation=".\Release/"
|
||||
ObjectFile=".\Release/"
|
||||
ProgramDataBaseFileName=".\Release/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\05.UserInterface.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
ProgramDatabaseFile=".\Release/UserInterface.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Release/UserInterface.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="3079"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="main.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
231
examples/05.UserInterface/UserInterface_vc8.vcproj
Normal file
231
examples/05.UserInterface/UserInterface_vc8.vcproj
Normal file
@ -0,0 +1,231 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="05.UserInterface_vc8"
|
||||
ProjectGUID="{622C9DD7-0391-49FF-AF53-24F9D5A8EC53}"
|
||||
RootNamespace="UserInterface_vc8"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\Debug"
|
||||
IntermediateDirectory=".\Debug"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Debug/UserInterface.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderFile=".\Debug/UserInterface.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
ProgramDataBaseFileName=".\Debug/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="3079"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\05.UserInterface.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile=".\Debug/UserInterface.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\Release"
|
||||
IntermediateDirectory=".\Release"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Release/UserInterface.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderFile=".\Release/UserInterface.pch"
|
||||
AssemblerListingLocation=".\Release/"
|
||||
ObjectFile=".\Release/"
|
||||
ProgramDataBaseFileName=".\Release/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="3079"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\05.UserInterface.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
ProgramDatabaseFile=".\Release/UserInterface.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="main.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BasicRuntimeChecks="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
32
examples/05.UserInterface/example.cbp
Normal file
32
examples/05.UserInterface/example.cbp
Normal file
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE CodeBlocks_project_file>
|
||||
<CodeBlocks_project_file>
|
||||
<FileVersion major="1" minor="1"/>
|
||||
<Project>
|
||||
<Option title="Irrlicht Example 05 User Interface"/>
|
||||
<Option makefile="Makefile"/>
|
||||
<Option makefile_is_custom="0"/>
|
||||
<Option compiler="0"/>
|
||||
<Build>
|
||||
<Target title="default">
|
||||
<Option output="..\..\bin\Win32-gcc\05.UserInterface.exe"/>
|
||||
<Option working_dir="."/>
|
||||
<Option object_output=".objs"/>
|
||||
<Option deps_output=".deps"/>
|
||||
<Option type="1"/>
|
||||
<Option compiler="0"/>
|
||||
<Option projectResourceIncludeDirsRelation="1"/>
|
||||
</Target>
|
||||
</Build>
|
||||
<Compiler>
|
||||
<Add directory="..\..\include"/>
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="../../lib/Win32-gcc/libIrrlicht.a"/>
|
||||
</Linker>
|
||||
<Unit filename="main.cpp">
|
||||
<Option compilerVar="CPP"/>
|
||||
<Option target="default"/>
|
||||
</Unit>
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
59
examples/05.UserInterface/example.dev
Normal file
59
examples/05.UserInterface/example.dev
Normal file
@ -0,0 +1,59 @@
|
||||
[Project]
|
||||
FileName=example.dev
|
||||
Name=Irrlicht Example 05 User Interface
|
||||
UnitCount=1
|
||||
Type=1
|
||||
Ver=1
|
||||
ObjFiles=
|
||||
Includes=..\..\include
|
||||
Libs=
|
||||
PrivateResource=
|
||||
ResourceIncludes=
|
||||
MakeIncludes=
|
||||
Compiler=
|
||||
CppCompiler=
|
||||
Linker=../../lib/Win32-gcc/libIrrlicht.a_@@_
|
||||
IsCpp=1
|
||||
Icon=
|
||||
ExeOutput=../../bin/Win32-gcc
|
||||
ObjectOutput=obj
|
||||
OverrideOutput=1
|
||||
OverrideOutputName=05.UserInterface.exe
|
||||
HostApplication=
|
||||
Folders=
|
||||
CommandLine=
|
||||
IncludeVersionInfo=0
|
||||
SupportXPThemes=0
|
||||
CompilerSet=0
|
||||
CompilerSettings=0000000000000000000000
|
||||
UseCustomMakefile=0
|
||||
CustomMakefile=
|
||||
|
||||
[Unit1]
|
||||
FileName=main.cpp
|
||||
CompileCpp=1
|
||||
Folder=Projekt1
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[VersionInfo]
|
||||
Major=0
|
||||
Minor=1
|
||||
Release=1
|
||||
Build=1
|
||||
LanguageID=1033
|
||||
CharsetID=1252
|
||||
CompanyName=
|
||||
FileVersion=
|
||||
FileDescription=Irrlicht Engine example compiled using DevCpp and gcc
|
||||
InternalName=
|
||||
LegalCopyright=
|
||||
LegalTrademarks=
|
||||
OriginalFilename=
|
||||
ProductName=
|
||||
ProductVersion=
|
||||
AutoIncBuildNr=0
|
||||
|
246
examples/05.UserInterface/main.cpp
Normal file
246
examples/05.UserInterface/main.cpp
Normal file
@ -0,0 +1,246 @@
|
||||
/*
|
||||
This tutorial shows how to use the built in User Interface of
|
||||
the Irrlicht Engine. It will give a brief overview and show
|
||||
how to create and use windows, buttons, scroll bars, static
|
||||
texts and list boxes.
|
||||
|
||||
As always, we include the header files, and use the irrlicht
|
||||
namespaces. We also store a pointer to the Irrlicht device,
|
||||
a counter variable for changing the creation position of a window,
|
||||
and a pointer to a listbox.
|
||||
*/
|
||||
#include <irrlicht.h>
|
||||
#include <iostream>
|
||||
|
||||
using namespace irr;
|
||||
|
||||
using namespace core;
|
||||
using namespace scene;
|
||||
using namespace video;
|
||||
using namespace io;
|
||||
using namespace gui;
|
||||
|
||||
#ifdef _IRR_WINDOWS_
|
||||
#pragma comment(lib, "Irrlicht.lib")
|
||||
#endif
|
||||
|
||||
|
||||
IrrlichtDevice *device = 0;
|
||||
s32 cnt = 0;
|
||||
IGUIListBox* listbox = 0;
|
||||
|
||||
|
||||
/*
|
||||
The Event Receiver is not only capable of getting keyboard and
|
||||
mouse input events, but also events of the graphical user interface
|
||||
(gui). There are events for almost everything: Button click,
|
||||
Listbox selection change, events that say that a element was hovered
|
||||
and so on. To be able to react to some of these events, we create
|
||||
an event receiver.
|
||||
We only react to gui events, and if it's such an event, we get the
|
||||
id of the caller (the gui element which caused the event) and get
|
||||
the pointer to the gui environment.
|
||||
*/
|
||||
class MyEventReceiver : public IEventReceiver
|
||||
{
|
||||
public:
|
||||
virtual bool OnEvent(SEvent event)
|
||||
{
|
||||
if (event.EventType == EET_GUI_EVENT)
|
||||
{
|
||||
s32 id = event.GUIEvent.Caller->getID();
|
||||
IGUIEnvironment* env = device->getGUIEnvironment();
|
||||
|
||||
switch(event.GUIEvent.EventType)
|
||||
{
|
||||
|
||||
/*
|
||||
If a scrollbar changed its scroll position, and it is 'our'
|
||||
scrollbar (the one with id 104), then we change the
|
||||
transparency of all gui elements. This is a very easy task:
|
||||
There is a skin object, in which all color settings are stored.
|
||||
We simply go through all colors stored in the skin and change
|
||||
their alpha value.
|
||||
*/
|
||||
case EGET_SCROLL_BAR_CHANGED:
|
||||
if (id == 104)
|
||||
{
|
||||
s32 pos = ((IGUIScrollBar*)event.GUIEvent.Caller)->getPos();
|
||||
|
||||
for (u32 i=0; i<EGDC_COUNT ; ++i)
|
||||
{
|
||||
SColor col = env->getSkin()->getColor((EGUI_DEFAULT_COLOR)i);
|
||||
col.setAlpha(pos);
|
||||
env->getSkin()->setColor((EGUI_DEFAULT_COLOR)i, col);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
/*
|
||||
If a button was clicked, it could be one of 'our'
|
||||
three buttons. If it is the first, we shut down the engine.
|
||||
If it is the second, we create a little window with some
|
||||
text on it. We also add a string to the list box to log
|
||||
what happened. And if it is the third button, we create
|
||||
a file open dialog, and add also this as string to the list box.
|
||||
That's all for the event receiver.
|
||||
*/
|
||||
case EGET_BUTTON_CLICKED:
|
||||
|
||||
if (id == 101)
|
||||
{
|
||||
device->closeDevice();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (id == 102)
|
||||
{
|
||||
listbox->addItem(L"Window created");
|
||||
cnt += 30;
|
||||
if (cnt > 200)
|
||||
cnt = 0;
|
||||
|
||||
IGUIWindow* window = env->addWindow(
|
||||
rect<s32>(100 + cnt, 100 + cnt, 300 + cnt, 200 + cnt),
|
||||
false, // modal?
|
||||
L"Test window");
|
||||
|
||||
env->addStaticText(L"Please close me",
|
||||
rect<s32>(35,35,140,50),
|
||||
true, // border?
|
||||
false, // wordwrap?
|
||||
window);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (id == 103)
|
||||
{
|
||||
listbox->addItem(L"File open");
|
||||
env->addFileOpenDialog(L"Please choose a file.");
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
Ok, now for the more interesting part. First, create the
|
||||
Irrlicht device. As in some examples before, we ask the user which
|
||||
driver he wants to use for this example:
|
||||
*/
|
||||
int main()
|
||||
{
|
||||
// ask user for driver
|
||||
|
||||
video::E_DRIVER_TYPE driverType;
|
||||
|
||||
printf("Please select the driver you want for this example:\n"\
|
||||
" (a) Direct3D 9.0c\n (b) Direct3D 8.1\n (c) OpenGL 1.5\n"\
|
||||
" (d) Software Renderer\n (e) Burning's Software Renderer\n"\
|
||||
" (f) NullDevice\n (otherKey) exit\n\n");
|
||||
|
||||
char i;
|
||||
std::cin >> i;
|
||||
|
||||
switch(i)
|
||||
{
|
||||
case 'a': driverType = video::EDT_DIRECT3D9;break;
|
||||
case 'b': driverType = video::EDT_DIRECT3D8;break;
|
||||
case 'c': driverType = video::EDT_OPENGL; break;
|
||||
case 'd': driverType = video::EDT_SOFTWARE; break;
|
||||
case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
|
||||
case 'f': driverType = video::EDT_NULL; break;
|
||||
default: return 1;
|
||||
}
|
||||
|
||||
// create device and exit if creation failed
|
||||
|
||||
device = createDevice(driverType, core::dimension2d<s32>(640, 480));
|
||||
|
||||
if (device == 0)
|
||||
return 1; // could not create selected driver.
|
||||
|
||||
/* The creation was successful, now we set the event receiver and
|
||||
store pointers to the driver and to the gui environment. */
|
||||
|
||||
MyEventReceiver receiver;
|
||||
device->setEventReceiver(&receiver);
|
||||
device->setWindowCaption(L"Irrlicht Engine - User Interface Demo");
|
||||
|
||||
video::IVideoDriver* driver = device->getVideoDriver();
|
||||
IGUIEnvironment* env = device->getGUIEnvironment();
|
||||
|
||||
/*
|
||||
To make the font a little bit nicer, we load an external font
|
||||
and set it as new font in the skin. An at last, we create a
|
||||
nice Irrlicht Engine logo in the top left corner.
|
||||
*/
|
||||
|
||||
IGUISkin* skin = env->getSkin();
|
||||
IGUIFont* font = env->getFont("../../media/fonthaettenschweiler.bmp");
|
||||
if (font)
|
||||
skin->setFont(font);
|
||||
|
||||
/*
|
||||
We add three buttons. The first one closes the engine. The second
|
||||
creates a window and the third opens a file open dialog. The third
|
||||
parameter is the id of the button, with which we can easily identify
|
||||
the button in the event receiver.
|
||||
*/
|
||||
|
||||
env->addButton(rect<s32>(10,210,110,210 + 32), 0, 101, L"Quit", L"Exits Programm");
|
||||
env->addButton(rect<s32>(10,250,110,250 + 32), 0, 102, L"New Window", L"Launches a new Window");
|
||||
env->addButton(rect<s32>(10,290,110,290 + 32), 0, 103, L"File Open", L"Opens a file");
|
||||
|
||||
/*
|
||||
Now, we add a static text and a scrollbar, which modifies the
|
||||
transparency of all gui elements. We set the maximum value of
|
||||
the scrollbar to 255, because that's the maximal value for
|
||||
a color value.
|
||||
Then we create an other static text and a list box.
|
||||
*/
|
||||
|
||||
env->addStaticText(L"Transparent Control:", rect<s32>(150,20,350,40), true);
|
||||
IGUIScrollBar* scrollbar = env->addScrollBar(true, rect<s32>(150, 45, 350, 60), 0, 104);
|
||||
scrollbar->setMax(255);
|
||||
|
||||
// set scrollbar position to alpha value of an arbitrary element
|
||||
scrollbar->setPos(env->getSkin()->getColor(EGDC_WINDOW).getAlpha());
|
||||
|
||||
env->addStaticText(L"Logging ListBox:", rect<s32>(50,80,250,100), true);
|
||||
listbox = env->addListBox(rect<s32>(50, 110, 250, 180));
|
||||
env->addEditBox(L"Editable Text", rect<s32>(350, 80, 550, 100));
|
||||
|
||||
// add the engine logo
|
||||
env->addImage(driver->getTexture("../../media/irrlichtlogo2.png"),
|
||||
position2d<int>(10,10));
|
||||
|
||||
|
||||
/*
|
||||
That's all, we only have to draw everything.
|
||||
*/
|
||||
|
||||
while(device->run() && driver)
|
||||
if (device->isWindowActive())
|
||||
{
|
||||
driver->beginScene(true, true, SColor(0,200,200,200));
|
||||
|
||||
env->drawAll();
|
||||
|
||||
driver->endScene();
|
||||
}
|
||||
|
||||
device->drop();
|
||||
|
||||
return 0;
|
||||
}
|
225
examples/05.UserInterface/tutorial.html
Normal file
225
examples/05.UserInterface/tutorial.html
Normal file
@ -0,0 +1,225 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Irrlicht Engine Tutorial</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
|
||||
<br>
|
||||
<table width="95%" border="0" cellspacing="0" cellpadding="2" align="center">
|
||||
<tr>
|
||||
<td bgcolor="#666699" width="10"><b><a href="http://irrlicht.sourceforge.net" target="_blank"><img src="../../media/irrlichtlogo.jpg" width="88" height="31" border="0"></a></b></td>
|
||||
<td bgcolor="#666699" width="100%">
|
||||
<div align="center">
|
||||
<div align="center"></div>
|
||||
<div align="left"><b><font color="#FFFFFF">Tutorial 5.User Interface</font></b></div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr bgcolor="#eeeeff">
|
||||
<td height="90" colspan="2">
|
||||
<div align="left">
|
||||
<p>This tutorial shows how to use the built in User Interface of the Irrlicht
|
||||
Engine. It will give a brief overview and show how to create and use
|
||||
windows, buttons, scroll bars, static texts and list boxes. </p>
|
||||
<p>The program which is described here will look like this:</p>
|
||||
<p align="center"><img src="../../media/005shot.jpg" width="259" height="204"><br>
|
||||
</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<table width="95%" border="0" cellspacing="0" cellpadding="2" align="center">
|
||||
<tr>
|
||||
<td bgcolor="#666699"> <div align="center"><b><font color="#FFFFFF"></font></b></div>
|
||||
<b><font color="#FFFFFF">Lets start!</font></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="90" bgcolor="#eeeeff" valign="top"> <div align="left">
|
||||
<p>As always, we include the header files (conio and curses for getting
|
||||
user input from the console), and use the irrlicht namespaces. We also
|
||||
store a pointer to the Irrlicht device, a counter variable for changing
|
||||
the creation position of a window, and a pointer to a listbox.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>#include <irrlicht.h>
|
||||
#include <iostream><br>
|
||||
using namespace irr;</pre>
|
||||
<pre>using namespace core;
|
||||
using namespace scene;
|
||||
using namespace video;
|
||||
using namespace io;
|
||||
using namespace gui;</pre>
|
||||
<pre>#pragma comment(lib, "Irrlicht.lib")</pre>
|
||||
<pre>IrrlichtDevice *device = 0;
|
||||
s32 cnt = 0;
|
||||
IGUIListBox* listbox = 0;
|
||||
</pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>The Event Receiver is not only capable of getting keyboard and mouse
|
||||
input events, but also events of the graphical user interface (gui).
|
||||
There are events for almost everything: Button click, Listbox selection
|
||||
change, events that say that a element was hovered and so on. To be
|
||||
able to react to some of these events, we create <br>
|
||||
an event receiver. We only react to gui events, and if it's such an
|
||||
event, we get the id of the caller (the gui element which caused the
|
||||
event) and get the pointer to the gui environment. </p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>class MyEventReceiver : public IEventReceiver<br>{<br>public:<br> virtual bool OnEvent(SEvent event)<br> {<br> if (event.EventType == EET_GUI_EVENT)<br> {<br> s32 id = event.GUIEvent.Caller->getID();<br> IGUIEnvironment* env = device->getGUIEnvironment();</pre>
|
||||
<pre> switch(event.GUIEvent.EventType)
|
||||
{</pre>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p> If a scrollbar changed its scroll position, and it is 'our' scrollbar
|
||||
(the one with id 104), then we change the <br>
|
||||
transparency of all gui elements. This is a very easy task: There is
|
||||
a skin object, in which all color settings are stored. We simply go
|
||||
through all colors stored in the skin and change their alpha value.
|
||||
</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td height="80"> <pre>case EGET_SCROLL_BAR_CHANGED:<br> if (id == 104)<br> {<br> s32 pos = ((IGUIScrollBar*)event.GUIEvent.Caller)->getPos();<br> <br> for (s32 i=0; i<EGDC_COUNT ; ++i)<br> {<br> SColor col = env->getSkin()->getColor((EGUI_DEFAULT_COLOR)i);<br> col.setAlpha(pos);<br> env->getSkin()->setColor((EGUI_DEFAULT_COLOR)i, col);<br> }<br> }<br>break;</pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>If a button was clicked, it could be one of 'our' three buttons. If
|
||||
it is the first, we shut down the engine.<br>
|
||||
If it is the second, we create a little window with some text on it.
|
||||
We also add a string to the list box to log<br>
|
||||
what happened. And if it is the third button, we create a file open
|
||||
dialog, and add also this as string to the list box.<br>
|
||||
That's all for the event receiver.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td>
|
||||
<pre> case EGET_BUTTON_CLICKED:
|
||||
if (id == 101)
|
||||
{
|
||||
device->closeDevice();
|
||||
return true;
|
||||
}</pre>
|
||||
<pre> if (id == 102)
|
||||
{
|
||||
listbox->addItem(L"Window created");
|
||||
cnt += 30;
|
||||
if (cnt > 200)
|
||||
cnt = 0;</pre>
|
||||
<pre> IGUIWindow* window = env->addWindow(
|
||||
rect<s32>(100 + cnt, 100 + cnt, 300 + cnt, 200 + cnt), <br> false, // modal?
|
||||
L"Test window");</pre>
|
||||
<pre> env->addStaticText(L"Please close me",
|
||||
rect<s32>(35,35,140,50),
|
||||
true, // border?,
|
||||
false, // wordwrap?
|
||||
window);
|
||||
|
||||
return true;
|
||||
}</pre>
|
||||
<pre> if (id == 103)
|
||||
{
|
||||
listbox->addItem(L"File open");
|
||||
env->addFileOpenDialog(L"Please choose a file.");
|
||||
return true;
|
||||
}</pre>
|
||||
<pre> break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};</pre>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>Ok, now for the more interesting part. First, create the Irrlicht device.
|
||||
As in some examples before, we ask the user which driver he wants to
|
||||
use for this example:</p>
|
||||
</div>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>int main()
|
||||
{
|
||||
// ask user for driver
|
||||
video::E_DRIVER_TYPE driverType;
|
||||
|
||||
|
||||
printf("Please select the driver you want for this example:\n"\<br> " (a) Direct3D 9.0c\n (b) Direct3D 8.1\n (c) OpenGL 1.5\n"\<br> " (d) Software Renderer\n (e) Apfelbaum Software Renderer\n"\<br> " (f) NullDevice\n (otherKey) exit\n\n");<br><br> char i;<br> std::cin >> i;<br>
|
||||
switch(i)<br> {<br> case 'a': driverType = video::EDT_DIRECT3D9;break;<br> case 'b': driverType = video::EDT_DIRECT3D8;break;<br> case 'c': driverType = video::EDT_OPENGL; break;<br> case 'd': driverType = video::EDT_SOFTWARE; break;<br> case 'e': driverType = video::EDT_BURNINGSVIDEO;break;<br> case 'f': driverType = video::EDT_NULL; break;<br> default: return 1;<br> }
|
||||
|
||||
// create device and exit if creation failed
|
||||
device = createDevice(driverType, core::dimension2d<s32>(640, 480));<br>
|
||||
if (device == 0)
|
||||
return 1;
|
||||
</pre>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>The creation was successful, now we set the event receiver and store
|
||||
pointers to the driver and to the gui environment. </p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td><pre>MyEventReceiver receiver;
|
||||
device->setEventReceiver(&receiver);
|
||||
device->setWindowCaption(L"Irrlicht Engine - User Inferface Demo");</pre>
|
||||
<pre>video::IVideoDriver* driver = device->getVideoDriver();
|
||||
IGUIEnvironment* env = device->getGUIEnvironment();
|
||||
</pre>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>We add three buttons. The first one closes the engine. The second creates
|
||||
a window and the third opens a file open dialog. The third parameter is
|
||||
the id of the button, with which we can easily identify the button in
|
||||
the event receiver.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td><pre>env->addButton(rect<s32>(10,210,100,240), 0, 101, L"Quit");<br>env->addButton(rect<s32>(10,250,100,290), 0, 102, L"New Window");<br>env->addButton(rect<s32>(10,300,100,340), 0, 103, L"File Open");</pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p> Now, we add a static text and a scrollbar, which modifies the transparency
|
||||
of all gui elements. We set the maximum value of the scrollbar to 255,
|
||||
because that's the maximal value for a color value.<br>
|
||||
Then we create an other static text and a list box.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td><pre>env->addStaticText(L"Transparent Control:", rect<s32>(150,20,350,40), true);<br>IGUIScrollBar* scrollbar = env->addScrollBar(true,
|
||||
rect<s32>(150, 45, 350, 60), 0, 104);<br>scrollbar->setMax(255);</pre>
|
||||
<pre>env->addStaticText(L"Logging ListBox:", rect<s32>(50,80,250,100), true);
|
||||
listbox = env->addListBox(rect<s32>(50, 110, 250, 180));</pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
To make the font a little bit nicer, we load an external font and set it
|
||||
as new font in the skin. An at last, we create a nice Irrlicht Engine logo
|
||||
in the top left corner. <br>
|
||||
<br>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>IGUISkin* skin = env->getSkin();<br>IGUIFont* font = env->getFont("../../media/fonthaettenschweiler.bmp");<br>if (font)<br> skin->setFont(font);</pre>
|
||||
<pre>IGUIImage* img = env->addImage(<br> driver->getTexture("../../media/irrlichtlogoalpha.tga"),<br> position2d<int>(10,10));</pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>That's all, we only have to draw everything.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td>
|
||||
<pre> while(device->run() && driver)<br> if (device->isWindowActive()) <br> {<br> driver->beginScene(true, true, SColor(0,122,65,171));
|
||||
env->drawAll();
|
||||
driver->endScene();
|
||||
}
|
||||
|
||||
device->drop();</pre>
|
||||
<pre> return 0;
|
||||
}</pre>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p> </p>
|
||||
</body>
|
||||
</html>
|
90
examples/06.2DGraphics/2DGraphics.dsp
Normal file
90
examples/06.2DGraphics/2DGraphics.dsp
Normal file
@ -0,0 +1,90 @@
|
||||
# Microsoft Developer Studio Project File - Name="2DGraphics" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** NICHT BEARBEITEN **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=2DGraphics - Win32 Debug
|
||||
!MESSAGE Dies ist kein g<>s Makefile. Zum Erstellen dieses Projekts mit NMAKE
|
||||
!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und f<>Sie den Befehl
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "2DGraphics.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE Sie k<>n beim Ausf<73>von NMAKE eine Konfiguration angeben
|
||||
!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "2DGraphics.mak" CFG="2DGraphics - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE F<> Konfiguration stehen zur Auswahl:
|
||||
!MESSAGE
|
||||
!MESSAGE "2DGraphics - Win32 Release" (basierend auf "Win32 (x86) Console Application")
|
||||
!MESSAGE "2DGraphics - Win32 Debug" (basierend auf "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "2DGraphics - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0xc07 /d "NDEBUG"
|
||||
# ADD RSC /l 0xc07 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"..\..\bin\Win32-VisualStudio\2DGraphics.exe" /libpath:"..\..\lib\Win32-visualstudio"
|
||||
|
||||
!ELSEIF "$(CFG)" == "2DGraphics - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0xc07 /d "_DEBUG"
|
||||
# ADD RSC /l 0xc07 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\..\bin\Win32-VisualStudio\2DGraphics.exe" /pdbtype:sept /libpath:"..\..\lib\Win32-visualstudio"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "2DGraphics - Win32 Release"
|
||||
# Name "2DGraphics - Win32 Debug"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\main.cpp
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
29
examples/06.2DGraphics/2DGraphics.dsw
Normal file
29
examples/06.2DGraphics/2DGraphics.dsw
Normal file
@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "2DGraphics"=".\2DGraphics.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
21
examples/06.2DGraphics/2DGraphics.sln
Normal file
21
examples/06.2DGraphics/2DGraphics.sln
Normal file
@ -0,0 +1,21 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "2DGraphics", "2DGraphics.vcproj", "{E71B6F18-10DC-4101-A541-F6D33F71B2BD}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
Release = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{E71B6F18-10DC-4101-A541-F6D33F71B2BD}.Debug.ActiveCfg = Debug|Win32
|
||||
{E71B6F18-10DC-4101-A541-F6D33F71B2BD}.Debug.Build.0 = Debug|Win32
|
||||
{E71B6F18-10DC-4101-A541-F6D33F71B2BD}.Release.ActiveCfg = Release|Win32
|
||||
{E71B6F18-10DC-4101-A541-F6D33F71B2BD}.Release.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
163
examples/06.2DGraphics/2DGraphics.vcproj
Normal file
163
examples/06.2DGraphics/2DGraphics.vcproj
Normal file
@ -0,0 +1,163 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="06.2DGraphics"
|
||||
ProjectGUID="{E71B6F18-10DC-4101-A541-F6D33F71B2BD}"
|
||||
SccProjectName=""
|
||||
SccLocalPath="">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\Release"
|
||||
IntermediateDirectory=".\Release"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="4"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile=".\Release/2DGraphics.pch"
|
||||
AssemblerListingLocation=".\Release/"
|
||||
ObjectFile=".\Release/"
|
||||
ProgramDataBaseFileName=".\Release/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\06.2DGraphics.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
ProgramDatabaseFile=".\Release/2DGraphics.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Release/2DGraphics.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="3079"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\Debug"
|
||||
IntermediateDirectory=".\Debug"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="5"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile=".\Debug/2DGraphics.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
ProgramDataBaseFileName=".\Debug/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\06.2DGraphics.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile=".\Debug/2DGraphics.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Debug/2DGraphics.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="3079"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="main.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
231
examples/06.2DGraphics/2DGraphics_vc8.vcproj
Normal file
231
examples/06.2DGraphics/2DGraphics_vc8.vcproj
Normal file
@ -0,0 +1,231 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="06.2DGraphics_vc8"
|
||||
ProjectGUID="{E71B6F18-10DC-4101-A541-F6D33F71B2BD}"
|
||||
RootNamespace="2DGraphics_vc8"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\Release"
|
||||
IntermediateDirectory=".\Release"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Release/2DGraphics.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderFile=".\Release/2DGraphics.pch"
|
||||
AssemblerListingLocation=".\Release/"
|
||||
ObjectFile=".\Release/"
|
||||
ProgramDataBaseFileName=".\Release/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="3079"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\06.2DGraphics.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
ProgramDatabaseFile=".\Release/2DGraphics.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\Debug"
|
||||
IntermediateDirectory=".\Debug"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Debug/2DGraphics.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderFile=".\Debug/2DGraphics.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
ProgramDataBaseFileName=".\Debug/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="3079"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\06.2DGraphics.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile=".\Debug/2DGraphics.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="main.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BasicRuntimeChecks="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
38
examples/06.2DGraphics/Makefile
Normal file
38
examples/06.2DGraphics/Makefile
Normal file
@ -0,0 +1,38 @@
|
||||
# Makefile for Irrlicht Examples
|
||||
# It's usually sufficient to change just the target name and source file list
|
||||
# and be sure that CXX is set to a valid compiler
|
||||
Target = 06.2DGraphics
|
||||
Sources = main.cpp
|
||||
|
||||
# general compiler settings
|
||||
CPPFLAGS = -I../../include -I/usr/X11R6/include
|
||||
CXXFLAGS = -O3 -ffast-math
|
||||
#CXXFLAGS = -g -Wall
|
||||
|
||||
#default target is Linux
|
||||
all: all_linux
|
||||
|
||||
ifeq ($(HOSTTYPE), x86_64)
|
||||
LIBSELECT=64
|
||||
endif
|
||||
|
||||
# target specific settings
|
||||
all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht -lGL -lGLU -lXxf86vm -lXext -lX11
|
||||
all_linux clean_linux: SYSTEM=Linux
|
||||
all_win32: LDFLAGS = -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lglu32 -lm
|
||||
all_win32 clean_win32: SYSTEM=Win32-gcc
|
||||
all_win32 clean_win32: SUF=.exe
|
||||
# name of the binary - only valid for targets which set SYSTEM
|
||||
DESTPATH = ../../bin/$(SYSTEM)/$(Target)$(SUF)
|
||||
|
||||
all_linux all_win32:
|
||||
$(warning Building...)
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(Sources) -o $(DESTPATH) $(LDFLAGS)
|
||||
|
||||
clean: clean_linux clean_win32
|
||||
$(warning Cleaning...)
|
||||
|
||||
clean_linux clean_win32:
|
||||
@$(RM) $(DESTPATH)
|
||||
|
||||
.PHONY: all all_win32 clean clean_linux clean_win32
|
32
examples/06.2DGraphics/example.cbp
Normal file
32
examples/06.2DGraphics/example.cbp
Normal file
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE CodeBlocks_project_file>
|
||||
<CodeBlocks_project_file>
|
||||
<FileVersion major="1" minor="1"/>
|
||||
<Project>
|
||||
<Option title="Irrlicht Example 06 2D Graphics"/>
|
||||
<Option makefile="Makefile"/>
|
||||
<Option makefile_is_custom="0"/>
|
||||
<Option compiler="0"/>
|
||||
<Build>
|
||||
<Target title="default">
|
||||
<Option output="..\..\bin\Win32-gcc\06.2DGraphics.exe"/>
|
||||
<Option working_dir="."/>
|
||||
<Option object_output=".objs"/>
|
||||
<Option deps_output=".deps"/>
|
||||
<Option type="1"/>
|
||||
<Option compiler="0"/>
|
||||
<Option projectResourceIncludeDirsRelation="1"/>
|
||||
</Target>
|
||||
</Build>
|
||||
<Compiler>
|
||||
<Add directory="..\..\include"/>
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="../../lib/Win32-gcc/libIrrlicht.a"/>
|
||||
</Linker>
|
||||
<Unit filename="main.cpp">
|
||||
<Option compilerVar="CPP"/>
|
||||
<Option target="default"/>
|
||||
</Unit>
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
59
examples/06.2DGraphics/example.dev
Normal file
59
examples/06.2DGraphics/example.dev
Normal file
@ -0,0 +1,59 @@
|
||||
[Project]
|
||||
FileName=example.dev
|
||||
Name=Irrlicht Example 06 2D Graphics
|
||||
UnitCount=1
|
||||
Type=1
|
||||
Ver=1
|
||||
ObjFiles=
|
||||
Includes=..\..\include
|
||||
Libs=
|
||||
PrivateResource=
|
||||
ResourceIncludes=
|
||||
MakeIncludes=
|
||||
Compiler=
|
||||
CppCompiler=
|
||||
Linker=../../lib/Win32-gcc/libIrrlicht.a_@@_
|
||||
IsCpp=1
|
||||
Icon=
|
||||
ExeOutput=../../bin/Win32-gcc
|
||||
ObjectOutput=obj
|
||||
OverrideOutput=1
|
||||
OverrideOutputName=06.2DGraphics.exe
|
||||
HostApplication=
|
||||
Folders=
|
||||
CommandLine=
|
||||
IncludeVersionInfo=0
|
||||
SupportXPThemes=0
|
||||
CompilerSet=0
|
||||
CompilerSettings=0000000000000000000000
|
||||
UseCustomMakefile=0
|
||||
CustomMakefile=
|
||||
|
||||
[Unit1]
|
||||
FileName=main.cpp
|
||||
CompileCpp=1
|
||||
Folder=Projekt1
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[VersionInfo]
|
||||
Major=0
|
||||
Minor=1
|
||||
Release=1
|
||||
Build=1
|
||||
LanguageID=1033
|
||||
CharsetID=1252
|
||||
CompanyName=
|
||||
FileVersion=
|
||||
FileDescription=Irrlicht Engine example compiled using DevCpp and gcc
|
||||
InternalName=
|
||||
LegalCopyright=
|
||||
LegalTrademarks=
|
||||
OriginalFilename=
|
||||
ProductName=
|
||||
ProductVersion=
|
||||
AutoIncBuildNr=0
|
||||
|
171
examples/06.2DGraphics/main.cpp
Normal file
171
examples/06.2DGraphics/main.cpp
Normal file
@ -0,0 +1,171 @@
|
||||
/*
|
||||
This Tutorial shows how to do 2d graphics with the Irrlicht Engine.
|
||||
It shows how to draw images, keycolor based sprites,
|
||||
transparent rectangles and different fonts. You will may consider
|
||||
this useful if you want to make a 2d game with the engine, or if
|
||||
you want to draw a cool interface or head up display for your 3d game.
|
||||
|
||||
As always, I include the header files, use the irr namespace,
|
||||
and tell the linker to link with the .lib file.
|
||||
*/
|
||||
#include <irrlicht.h>
|
||||
#include <iostream>
|
||||
|
||||
using namespace irr;
|
||||
|
||||
#pragma comment(lib, "Irrlicht.lib")
|
||||
|
||||
/*
|
||||
At first, we let the user select the driver type, then
|
||||
start up the engine, set a caption, and get a pointer
|
||||
to the video driver.
|
||||
*/
|
||||
int main()
|
||||
{
|
||||
// let user select driver type
|
||||
|
||||
video::E_DRIVER_TYPE driverType;
|
||||
|
||||
printf("Please select the driver you want for this example:\n"\
|
||||
" (a) Direct3D 9.0c\n (b) Direct3D 8.1\n (c) OpenGL 1.5\n"\
|
||||
" (d) Software Renderer\n (e) Burning's Software Renderer\n"\
|
||||
" (f) NullDevice\n (otherKey) exit\n\n");
|
||||
|
||||
char i;
|
||||
std::cin >> i;
|
||||
|
||||
switch(i)
|
||||
{
|
||||
case 'a': driverType = video::EDT_DIRECT3D9;break;
|
||||
case 'b': driverType = video::EDT_DIRECT3D8;break;
|
||||
case 'c': driverType = video::EDT_OPENGL; break;
|
||||
case 'd': driverType = video::EDT_SOFTWARE; break;
|
||||
case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
|
||||
case 'f': driverType = video::EDT_NULL; break;
|
||||
default: return 0;
|
||||
}
|
||||
|
||||
// create device
|
||||
|
||||
IrrlichtDevice *device = createDevice(driverType,
|
||||
core::dimension2d<s32>(512, 384));
|
||||
|
||||
if (device == 0)
|
||||
return 1; // could not create selected driver.
|
||||
|
||||
device->setWindowCaption(L"Irrlicht Engine - 2D Graphics Demo");
|
||||
|
||||
video::IVideoDriver* driver = device->getVideoDriver();
|
||||
|
||||
/*
|
||||
All 2d graphics in this example are put together into one texture,
|
||||
2ddemo.bmp. Because we want to draw colorkey based sprites, we need
|
||||
to load this texture and tell the engine, which
|
||||
part of it should be transparent based on a colorkey. In this example,
|
||||
we don't tell it the color directly, we just say "Hey Irrlicht Engine,
|
||||
you'll find the color I want at position (0,0) on the texture.".
|
||||
Instead, it would be also possible to call
|
||||
driver->makeColorKeyTexture(images, video::SColor(0,0,0,0)), to make
|
||||
e.g. all black pixels transparent. Please note, that makeColorKeyTexture
|
||||
just creates an alpha channel based on the color.
|
||||
*/
|
||||
video::ITexture* images = driver->getTexture("../../media/2ddemo.bmp");
|
||||
driver->makeColorKeyTexture(images, core::position2d<s32>(0,0));
|
||||
|
||||
|
||||
/*
|
||||
To be able to draw some text with two different fonts, we load them.
|
||||
Ok, we load just one, as first font we just use the default font which is
|
||||
built into the engine.
|
||||
Also, we define two rectangles, which specify the position of the
|
||||
images of the red imps (little flying creatures) in the texture.
|
||||
*/
|
||||
gui::IGUIFont* font = device->getGUIEnvironment()->getBuiltInFont();
|
||||
gui::IGUIFont* font2 = device->getGUIEnvironment()->getFont("../../media/fonthaettenschweiler.bmp");
|
||||
|
||||
core::rect<s32> imp1(349,15,385,78);
|
||||
core::rect<s32> imp2(387,15,423,78);
|
||||
|
||||
|
||||
/*
|
||||
Everything is prepared, now we can draw everything in the draw loop,
|
||||
between the begin scene and end scene calls. In this example, we
|
||||
are just doing 2d graphics, but it would be no problem to mix them
|
||||
with 3d graphics. Just try it out, and draw some 3d vertices or set
|
||||
up a scene with the scene manager and draw it.
|
||||
*/
|
||||
while(device->run() && driver)
|
||||
{
|
||||
if (device->isWindowActive())
|
||||
{
|
||||
u32 time = device->getTimer()->getTime();
|
||||
|
||||
driver->beginScene(true, true, video::SColor(0,120,102,136));
|
||||
|
||||
/*
|
||||
First, we draw 3 sprites, using the alpha channel we created with
|
||||
makeColorKeyTexture. The last parameter specifiys that the drawing
|
||||
method should use thiw alpha channel. The parameter before the last
|
||||
one specifies a color, with wich the sprite should be colored.
|
||||
(255,255,255,255) is full white, so the sprite will look like the
|
||||
original. The third sprite is drawed colored based on the time.
|
||||
*/
|
||||
|
||||
// draw fire & dragons background world
|
||||
driver->draw2DImage(images, core::position2d<s32>(50,50),
|
||||
core::rect<s32>(0,0,342,224), 0,
|
||||
video::SColor(255,255,255,255), true);
|
||||
|
||||
// draw flying imp
|
||||
driver->draw2DImage(images, core::position2d<s32>(164,125),
|
||||
(time/500 % 2) ? imp1 : imp2, 0,
|
||||
video::SColor(255,255,255,255), true);
|
||||
|
||||
// draw second flying imp with colorcylce
|
||||
driver->draw2DImage(images, core::position2d<s32>(270,105),
|
||||
(time/500 % 2) ? imp1 : imp2, 0,
|
||||
video::SColor(255,(time) % 255,255,255), true);
|
||||
|
||||
/*
|
||||
Drawing text is really simple. The code should be self explanatory.
|
||||
*/
|
||||
|
||||
// draw some text
|
||||
if (font)
|
||||
font->draw(L"This demo shows that Irrlicht is also capable of drawing 2D graphics.",
|
||||
core::rect<s32>(130,10,300,50),
|
||||
video::SColor(255,255,255,255));
|
||||
|
||||
// draw some other text
|
||||
if (font2)
|
||||
font2->draw(L"Also mixing with 3d graphics is possible.",
|
||||
core::rect<s32>(130,20,300,60),
|
||||
video::SColor(255,time % 255,time % 255,255));
|
||||
|
||||
/*
|
||||
At last, we draw the Irrlicht Engine logo (without using a color or
|
||||
an alpha channel) and a transparent 2d Rectangle at the position of
|
||||
the mouse cursor.
|
||||
*/
|
||||
|
||||
// draw logo
|
||||
driver->draw2DImage(images, core::position2d<s32>(10,10),
|
||||
core::rect<s32>(354,87,442,118));
|
||||
|
||||
// draw transparent rect under cursor
|
||||
core::position2d<s32> m = device->getCursorControl()->getPosition();
|
||||
driver->draw2DRectangle(video::SColor(100,255,255,255),
|
||||
core::rect<s32>(m.X-20, m.Y-20, m.X+20, m.Y+20));
|
||||
|
||||
driver->endScene();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
That's all, it was not really difficult, I hope.
|
||||
*/
|
||||
|
||||
device->drop();
|
||||
|
||||
return 0;
|
||||
}
|
163
examples/06.2DGraphics/tutorial.html
Normal file
163
examples/06.2DGraphics/tutorial.html
Normal file
@ -0,0 +1,163 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Irrlicht Engine Tutorial</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
|
||||
<br>
|
||||
<table width="95%" border="0" cellspacing="0" cellpadding="2" align="center">
|
||||
<tr>
|
||||
<td bgcolor="#666699" width="10"><b><a href="http://irrlicht.sourceforge.net" target="_blank"><img src="../../media/irrlichtlogo.jpg" width="88" height="31" border="0"></a></b></td>
|
||||
<td bgcolor="#666699" width="100%">
|
||||
<div align="center">
|
||||
<div align="center"></div>
|
||||
<div align="left"><b><font color="#FFFFFF">Tutorial 6. 2D Graphics</font></b></div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr bgcolor="#eeeeff">
|
||||
<td height="90" colspan="2">
|
||||
<div align="left">
|
||||
<p>This Tutorial shows how to do 2d graphics with the Irrlicht Engine.
|
||||
It shows how to draw images, keycolor based sprites, transparent rectangles
|
||||
and different fonts. You will may consider this useful if you want to
|
||||
make a 2d game with the engine, or if you want to draw a cool interface
|
||||
or head up display for your 3d game.</p>
|
||||
<p>The program which is described here will look like this:</p>
|
||||
<p align="center"><img src="../../media/006shot.jpg" width="259" height="204"><br>
|
||||
</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<table width="95%" border="0" cellspacing="0" cellpadding="2" align="center">
|
||||
<tr>
|
||||
<td bgcolor="#666699"> <div align="center"><b><font color="#FFFFFF"></font></b></div>
|
||||
<b><font color="#FFFFFF">Lets start!</font></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="90" bgcolor="#eeeeff" valign="top"> <div align="left">
|
||||
<p>As always, I include the header files, use the irr namespace, and tell
|
||||
the linker to link with the .lib file. </p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>#include <irrlicht.h><br>#include <iostream><br><br>using namespace irr;</pre>
|
||||
<pre>#pragma comment(lib, "Irrlicht.lib")
|
||||
</pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>At first, we let the user select the driver type, then start up the
|
||||
engine, set a caption, and get a pointer to the video driver.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>int main()<br>{<br> // let user select driver type<br> video::E_DRIVER_TYPE driverType;<br><br> printf("Please select the driver you want for this example:\n"\<br> " (a) Direct3D 9.0c\n (b) Direct3D 8.1\n (c) OpenGL 1.5\n"\<br> " (d) Software Renderer\n (e) Apfelbaum Software Renderer\n"\<br> " (f) NullDevice\n (otherKey) exit\n\n");<br><br> char i;<br> std::cin >> i;<br><br> switch(i)<br> {<br> case 'a': driverType = video::EDT_DIRECT3D9;break;<br> case 'b': driverType = video::EDT_DIRECT3D8;break;<br> case 'c': driverType = video::EDT_OPENGL; break;<br> case 'd': driverType = video::EDT_SOFTWARE; break;<br> case 'e': driverType = video::EDT_BURNINGSVIDEO;break;<br> case 'f': driverType = video::EDT_NULL; break;<br> default: return 0;<br> } <br><br> // create device</pre>
|
||||
<pre> IrrlichtDevice *device = createDevice(driverType,
|
||||
core::dimension2d<s32>(512, 384));</pre>
|
||||
<pre> if (device == 0)
|
||||
return 1;
|
||||
<br> device->setWindowCaption(L"Irrlicht Engine - 2D Graphics Demo");</pre>
|
||||
<pre> video::IVideoDriver* driver = device->getVideoDriver();</pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p> All 2d graphics in this example are put together into one texture,
|
||||
2ddemo.bmp. Because we want to draw colorkey based sprites, we need
|
||||
to load this texture and tell the engine, which part of it should be
|
||||
transparent based on a colorkey. In this example, we don't tell it the
|
||||
color directly, we just say "Hey Irrlicht Engine, you'll find the
|
||||
color I want at position (0,0) on the texture.". Instead, it would
|
||||
be also possible to call <font face="Courier New, Courier, mono">driver->makeColorKeyTexture(images,
|
||||
video::SColor(0,0,0,0))</font>, to make e.g. all black pixels transparent.
|
||||
Please note, that makeColorKeyTexture just creates an alpha channel
|
||||
based on the color. </p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>video::ITexture* images = driver->getTexture("../../media/2ddemo.bmp");<br>driver->makeColorKeyTexture(images, core::position2d<s32>(0,0));</pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>To be able to draw some text with two different fonts, we load them.
|
||||
Ok, we load just one, as first font we just use the default font which
|
||||
is built into the engine.<br>
|
||||
Also, we define two rectangles, which specify the position of the images
|
||||
of the red imps (little flying creatures) in the texture.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>gui::IGUIFont* font = device->getGUIEnvironment()->getBuiltInFont();<br>gui::IGUIFont* font2 = device->getGUIEnvironment()->getFont(
|
||||
"../../media/fonthaettenschweiler.bmp");</pre>
|
||||
<pre>core::rect<s32> imp1(349,15,385,78);
|
||||
core::rect<s32> imp2(387,15,423,78);</pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>Everything is prepared, now we can draw everything in the draw loop,
|
||||
between the begin scene and end scene calls. In this example, we are
|
||||
just doing 2d graphics, but it would be no problem to mix them with
|
||||
3d graphics. Just try it out, and draw some 3d vertices or set up a
|
||||
scene with the scene manager and draw it.</p>
|
||||
</div>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre>while(device->run() && driver)<br>{<br> if (device->isWindowActive())<br> {<br> u32 time = device->getTimer()->getTime();<br> driver->beginScene(true, true, video::SColor(0,120,102,136));
|
||||
</pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p> First, we draw 3 sprites, using the alpha channel we created with makeColorKeyTexture.
|
||||
The last parameter specifiys that the drawing method should use thiw alpha
|
||||
channel. The parameter before the last one specifies a color, with wich
|
||||
the sprite should be colored. (255,255,255,255) is full white, so the
|
||||
sprite will look like the original. The third sprite is drawed colored
|
||||
based on the time. </p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td><pre>// draw fire & dragons background world<br>driver->draw2DImage(images, core::position2d<s32>(50,50),<br> core::rect<s32>(0,0,342,224), 0, <br> video::SColor(255,255,255,255), true);</pre>
|
||||
<pre>// draw flying imp
|
||||
driver->draw2DImage(images, core::position2d<s32>(164,125),
|
||||
(time/500 % 2) ? imp1 : imp2, 0,
|
||||
video::SColor(255,255,255,255), true);</pre>
|
||||
<pre>// draw second flying imp with colorcylce
|
||||
driver->draw2DImage(images, core::position2d<s32>(270,105),
|
||||
(time/500 % 2) ? imp1 : imp2, 0,
|
||||
video::SColor(255,(time) % 255,255,255), true);</pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p> Drawing text is really simple. The code should be self explanatory.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td><pre>// draw some text<br>if (font)<br> font->draw(L"This is some text.",<br> core::rect<s32>(130,10,300,50),<br> video::SColor(255,255,255,255));</pre>
|
||||
<pre>// draw some other text
|
||||
if (font2)
|
||||
font2->draw(L"This is some other text.",
|
||||
core::rect<s32>(130,20,300,60),
|
||||
video::SColor(255,time % 255,time % 255,255));</pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>At last, we draw the Irrlicht Engine logo (without using a color or an
|
||||
alpha channel) and a transparent 2d Rectangle at the position of the mouse
|
||||
cursor.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre> // draw logo<br> driver->draw2DImage(images, core::position2d<s32>(10,10),<br> core::rect<s32>(354,87,442,118));</pre>
|
||||
<pre> // draw transparent rect under cursor
|
||||
core::position2d<s32> m = device->getCursorControl()->getPosition();
|
||||
driver->draw2DRectangle(video::SColor(100,255,255,255),
|
||||
core::rect<s32>(m.X-20, m.Y-20, m.X+20, m.Y+20));</pre>
|
||||
<pre> driver->endScene();
|
||||
}
|
||||
}</pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>That's all, it was not really difficult, I hope.</p>
|
||||
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
|
||||
<tr>
|
||||
<td> <pre> device->drop();
|
||||
return 0;
|
||||
}</pre>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p> </p></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p> </p>
|
||||
</body>
|
||||
</html>
|
90
examples/07.Collision/Collision.dsp
Normal file
90
examples/07.Collision/Collision.dsp
Normal file
@ -0,0 +1,90 @@
|
||||
# Microsoft Developer Studio Project File - Name="Collision" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** NICHT BEARBEITEN **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=Collision - Win32 Debug
|
||||
!MESSAGE Dies ist kein g<>s Makefile. Zum Erstellen dieses Projekts mit NMAKE
|
||||
!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und f<>Sie den Befehl
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "Collision.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE Sie k<>n beim Ausf<73>von NMAKE eine Konfiguration angeben
|
||||
!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "Collision.mak" CFG="Collision - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE F<> Konfiguration stehen zur Auswahl:
|
||||
!MESSAGE
|
||||
!MESSAGE "Collision - Win32 Release" (basierend auf "Win32 (x86) Console Application")
|
||||
!MESSAGE "Collision - Win32 Debug" (basierend auf "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "Collision - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0xc07 /d "NDEBUG"
|
||||
# ADD RSC /l 0xc07 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"..\..\bin\Win32-VisualStudio\Collision.exe" /libpath:"..\..\lib\Win32-visualstudio"
|
||||
|
||||
!ELSEIF "$(CFG)" == "Collision - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0xc07 /d "_DEBUG"
|
||||
# ADD RSC /l 0xc07 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\..\bin\Win32-VisualStudio\Collision.exe" /pdbtype:sept /libpath:"..\..\lib\Win32-visualstudio"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "Collision - Win32 Release"
|
||||
# Name "Collision - Win32 Debug"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\main.cpp
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
29
examples/07.Collision/Collision.dsw
Normal file
29
examples/07.Collision/Collision.dsw
Normal file
@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "Collision"=".\Collision.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
21
examples/07.Collision/Collision.sln
Normal file
21
examples/07.Collision/Collision.sln
Normal file
@ -0,0 +1,21 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Collision", "Collision.vcproj", "{3C621A22-3107-4236-A96A-6E100B8055A3}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
Release = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{3C621A22-3107-4236-A96A-6E100B8055A3}.Debug.ActiveCfg = Debug|Win32
|
||||
{3C621A22-3107-4236-A96A-6E100B8055A3}.Debug.Build.0 = Debug|Win32
|
||||
{3C621A22-3107-4236-A96A-6E100B8055A3}.Release.ActiveCfg = Release|Win32
|
||||
{3C621A22-3107-4236-A96A-6E100B8055A3}.Release.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user