Skip to content
This repository has been archived by the owner on Dec 11, 2017. It is now read-only.

Commit

Permalink
Updated C# examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
megaDRONe86 committed Nov 16, 2014
1 parent d57e6dd commit 3650c55
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 30 deletions.
15 changes: 8 additions & 7 deletions src/examples/csharp/3d_in_2d/3Din2D.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,17 @@
</StartupObject>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<OutputPath>..\..\..\..\Bin\examples\csharp\</OutputPath>
<OutputPath>..\..\..\..\bin\windows\examples\csharp\3d_in_2d\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<OutputPath>..\..\..\..\bin\windows\examples\csharp\3d_in_2d\</OutputPath>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="DGLE_sharp, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\Bin\DGLE_sharp.dll</HintPath>
<Reference Include="DGLESharp">
<HintPath>..\..\..\..\include\csharp\DGLESharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Windows.Forms" />
Expand All @@ -74,9 +78,6 @@
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
<Visible>False</Visible>
Expand Down
13 changes: 6 additions & 7 deletions src/examples/csharp/3d_in_2d/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ class Program
{
#region various initialization
const string APP_CAPTION = "Sample 3DIn2D";
const string DLL_PATH = @"..\..\DGLE.dll";

const string RESOURCE_PATH = @"..\..\..\resources\";
const string DLL_PATH = @"..\..\..\..\windows\DGLE.dll";
const string RESOURCE_PATH = @"..\..\..\..\..\resources\";

const uint SCREEN_WIDTH =1024u;
const uint SCREEN_HEIGHT = 768u;
Expand Down Expand Up @@ -51,7 +50,7 @@ class Program
"meshes\\copter\\copter.png",
"meshes\\copter\\propeller.png",
"sprites\\zombie.png",
"grass.jpg",
"textures\\grass.jpg",
"textures\\stone.tga"
};

Expand Down Expand Up @@ -234,7 +233,7 @@ void Init(IntPtr pParam)
}

// render rotor shadow
pResMan.CreateTexture(out pShadows[5], null, 256, 256, E_TEXTURE_DATA_FORMAT.TDF_RGBA8, E_TEXTURE_CREATION_FLAGS.TCF_DEFAULT, E_TEXTURE_LOAD_FLAGS.TLF_FILTERING_BILINEAR);
pResMan.CreateTexture(out pShadows[5], null, 256, 256, E_TEXTURE_DATA_FORMAT.TDF_RGBA8, E_TEXTURE_CREATE_FLAGS.TCF_DEFAULT, E_TEXTURE_LOAD_FLAGS.TLF_FILTERING_BILINEAR);
pRender.SetRenderTarget(pShadows[5]);
TPoint2 coords = new TPoint2(128f, 128f);
TColor4 col = TColor4.ColorWhite();
Expand Down Expand Up @@ -262,7 +261,7 @@ void Init(IntPtr pParam)
// This function creates texture and renders models shadow to it.
void RenderMeshToTexture(out ITexture pTex, IMesh pMesh, ITexture pMeshTex)
{
pResMan.CreateTexture(out pTex, null, 256, 256, E_TEXTURE_DATA_FORMAT.TDF_RGBA8, E_TEXTURE_CREATION_FLAGS.TCF_DEFAULT, E_TEXTURE_LOAD_FLAGS.TLF_FILTERING_BILINEAR);
pResMan.CreateTexture(out pTex, null, 256, 256, E_TEXTURE_DATA_FORMAT.TDF_RGBA8, E_TEXTURE_CREATE_FLAGS.TCF_DEFAULT, E_TEXTURE_LOAD_FLAGS.TLF_FILTERING_BILINEAR);
pRender.SetRenderTarget(pTex);
TPoint2 coords = new TPoint2(128f, 128f);
TPoint3 dims = new TPoint3(256f, 256f, 1f);
Expand Down Expand Up @@ -404,10 +403,10 @@ void Run()
pEngineCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_RENDER, DRender, IntPtr.Zero);

pEngineCore.StartEngine(); //Entering engine loop
Engine.FreeEngine();
}
else
MessageBox.Show("Couldn't load \"DGLE.dll\"!", APP_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
Engine.FreeEngine();
}

[STAThread]
Expand Down
11 changes: 5 additions & 6 deletions src/examples/csharp/low_level_2d/LowLevel2D.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SimplestSharp</RootNamespace>
<AssemblyName>lov_level_2d</AssemblyName>
<AssemblyName>LowLevel2D</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<FileUpgradeFlags>
Expand All @@ -21,7 +21,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\..\..\Bin\examples\csharp\</OutputPath>
<OutputPath>..\..\..\..\bin\windows\examples\csharp\low_level_2d\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
Expand All @@ -30,16 +30,15 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\..\..\Bin\Samples\CSharp\</OutputPath>
<OutputPath>..\..\..\..\bin\windows\examples\csharp\low_level_2d\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="DGLE_sharp, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\Bin\DGLE_sharp.dll</HintPath>
<Reference Include="DGLESharp">
<HintPath>..\..\..\..\include\csharp\DGLESharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Windows.Forms" />
Expand Down
9 changes: 4 additions & 5 deletions src/examples/csharp/low_level_2d/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ namespace SimplestSharp
public class Program
{
const string APP_CAPTION = "Low Level 2D";
const string DLL_PATH = @"..\..\DGLE.dll";

const string RESOURCE_PATH = @"..\..\..\resources\";
const string DLL_PATH = @"..\..\..\..\windows\DGLE.dll";
const string RESOURCE_PATH = @"..\..\..\..\..\resources\";

IEngineCore pEngineCore = null;
IRender2D pRender2D = null;
Expand Down Expand Up @@ -129,9 +128,9 @@ void Init(IntPtr pParam)
pBg = (ITexture)p_obj;
p_res_man.Load(RESOURCE_PATH + "sprites\\cartoon_cloudy_night_sky.jpg", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_2D);
pSky = (ITexture)p_obj;
p_res_man.Load(RESOURCE_PATH + "textures\\smoke.png", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_2D);
p_res_man.Load(RESOURCE_PATH + "sprites\\smoke.png", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_2D);
pFog = (ITexture)p_obj;
p_res_man.Load(RESOURCE_PATH + "textures\\light.jpg", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_2D);
p_res_man.Load(RESOURCE_PATH + "sprites\\light.jpg", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_2D);
pLightRound = (ITexture)p_obj;

p_res_man.Load(RESOURCE_PATH + "sprites\\vox.jpg", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_2D);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="DGLE_sharp, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\Bin\DGLE_sharp.dll</HintPath>
<Reference Include="DGLESharp">
<HintPath>..\..\..\..\include\csharp\DGLESharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Windows.Forms" />
Expand Down
4 changes: 2 additions & 2 deletions src/examples/csharp/matrix_stack_3d/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace matrix_stack_3d
class Program
{
const string APP_CAPTION = "MatrixStack3D";
const string DLL_PATH = @"..\..\..\..\DGLE.dll";
const string DLL_PATH = @"..\..\..\..\windows\DGLE.dll";
const string RESOURCE_PATH = @"..\..\..\..\..\resources\";
const uint SCREEN_WIDTH = 1280u;
const uint SCREEN_HEIGHT = 800u;
Expand Down Expand Up @@ -325,7 +325,7 @@ void Render(IntPtr pParam)
transform.MultLocal(ref mat);
mat = TMatrix4x4.MatrixScale(new TPoint3(0.25f, 0.25f, 0.25f));
transform.MultLocal(ref mat);
mat = TMatrix4x4.MatrixBillboard(transform.Top);
//mat = TMatrix4x4.MatrixBillboard(transform.Top);
pRender3D.SetMatrix(ref mat);
pTexLight.Draw3D();
pRender3D.ToggleLighting(true);
Expand Down

0 comments on commit 3650c55

Please sign in to comment.