本文整理汇总了C#中IResourceManager.CreateTexture方法的典型用法代码示例。如果您正苦于以下问题:C# IResourceManager.CreateTexture方法的具体用法?C# IResourceManager.CreateTexture怎么用?C# IResourceManager.CreateTexture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IResourceManager
的用法示例。
在下文中一共展示了IResourceManager.CreateTexture方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
void Init(IntPtr pParam)
{
// get subsystems
pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RESOURCE_MANAGER, out p_sub_sys);
pResMan = (IResourceManager)p_sub_sys;
pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_INPUT, out p_sub_sys);
pInput = (IInput)p_sub_sys;
pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RENDER, out p_sub_sys);
pRender = (IRender)p_sub_sys;
pRender.GetRender2D(out pRender2D);
// create arrays
IEngineBaseObject pObj = null;
pTextures = new ITexture[TexCount];
pShadows = new ITexture[ShadowCount];
pMeshes = new IMesh[MeshCount];
// loading data
pResMan.Load(RESOURCE_PATH + "sounds\\helicopter.wav", out pObj, 0);
pSound = (ISoundSample)pObj;
pSound.PlayEx(out pSoundChannel, E_SOUND_SAMPLE_PARAMS.SSP_LOOPED);
for (int i = 0; i < TexCount; i++)
{
uint flags = TexNames[i].Contains("grass") ? (uint)(E_TEXTURE_LOAD_FLAGS.TLF_FILTERING_BILINEAR | E_TEXTURE_LOAD_FLAGS.TLF_COORDS_REPEAT) : (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_2D;
pResMan.Load(RESOURCE_PATH + TexNames[i], out pObj, flags);
pTextures[i] = (ITexture)pObj;
}
pTextures[6].SetFrameSize(256, 256); // zombie sprite splitting
for (int i = 0; i < MeshCount; i++)
{
pResMan.Load(RESOURCE_PATH + MeshNames[i], out pObj, (uint)E_MESH_MODEL_LOAD_FLAGS.MMLF_FORCE_MODEL_TO_MESH);
pMeshes[i] = (IMesh)pObj;
}
// render shadows
for (int i = 0; i < MeshCount; i++)
{
RenderMeshToTexture(out pShadows[i], pMeshes[i], pTextures[i]);
}
// render rotor shadow
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();
pRender2D.DrawCircle(ref coords, 100, 64, ref col, E_PRIMITIVE2D_FLAGS.PF_FILL);
pRender.SetRenderTarget(null);
// gather, fill and init 3d-objects data
MyMeshes = new MyMesh[8]
{
new MyMesh(pMeshes[0], pTextures[0], pShadows[0], new TPoint2( 900f, 500f), new TPoint3(400f, 400f, 500f), 225),
new MyMesh(pMeshes[0], pTextures[0], pShadows[0], new TPoint2(-250f, 300f), new TPoint3(400f, 400f, 500f), 225),
new MyMesh(pMeshes[0], pTextures[0], pShadows[0], new TPoint2( 800f, 200f), new TPoint3(400f, 400f, 400f), 225),
new MyMesh(pMeshes[1], pTextures[1], pShadows[1], new TPoint2( 0f, 450f), new TPoint3(300f, 300f, 400f), 175),
new MyMesh(pMeshes[1], pTextures[1], pShadows[1], new TPoint2( 50f, 750f), new TPoint3(300f, 300f, 300f), 175),
new MyMesh(pMeshes[2], pTextures[2], pShadows[2], new TPoint2( 500f, 150f), new TPoint3(400f, 400f, 500f), 225),
new MyMesh(pMeshes[3], pTextures[3], pShadows[3], new TPoint2( 180f, 150f), new TPoint3(400f, 400f, 600f), 200),
new MyMesh(pMeshes[3], pTextures[3], pShadows[3], new TPoint2( 600f, 550f), new TPoint3(400f, 400f, 600f), 200, 90)
};
copter = new Copter(new MyMesh(pMeshes[4], pTextures[4], pShadows[4], new TPoint2(), new TPoint3(600, 600, 600), 200, 0, true), pTextures[5], pShadows[5]);
zombie = new Zombie(pTextures[6]);
}