void Init(IntPtr pParam) { IRender pRender; IEngineSubSystem pSubSys; pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RENDER, out pSubSys); pRender = (IRender)pSubSys; pRender.GetRender2D(out pRender2D); // All game logic is developed for this screen resolution, so will keep it (on logical level). pRender2D.SetResolutionCorrection(Res.GameVpWidth, Res.GameVpHeight); pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_INPUT, out pSubSys); pInput = (IInput)pSubSys; pInput.Configure(E_INPUT_CONFIGURATION_FLAGS.ICF_HIDE_CURSOR); IResourceManager pResMan; pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RESOURCE_MANAGER, out pSubSys); pResMan = (IResourceManager)pSubSys; // Load resources and give them names to use in future via resource manager. IEngineBaseObject pBaseObj; pResMan.Load(ResPath + "meshes\\planets\\planet.dmd", out pBaseObj, (uint)E_MESH_MODEL_LOAD_FLAGS.MMLF_FORCE_MODEL_TO_MESH, Res.MeshPlanet); pResMan.Load(ResPath + "meshes\\planets\\clouds.jpg", out pBaseObj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_3D, Res.TexClouds); pResMan.Load(ResPath + "meshes\\planets\\earth.jpg", out pBaseObj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_3D, Res.TexPlanet); pResMan.Load(ResPath + "sprites\\space_bg.jpg", out pBaseObj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_2D, Res.TexStars); pResMan.Load(ResPath + "meshes\\planets\\asteroid.dmd", out pBaseObj, (uint)E_MESH_MODEL_LOAD_FLAGS.MMLF_FORCE_MODEL_TO_MESH, Res.MeshAsteroid); pResMan.Load(ResPath + "meshes\\planets\\asteroid.jpg", out pBaseObj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_3D, Res.TexAsteroid); pResMan.Load(ResPath + "meshes\\space_ship\\ship.dmd", out pBaseObj, (uint)E_MESH_MODEL_LOAD_FLAGS.MMLF_FORCE_MODEL_TO_MESH, Res.MeshShip); pResMan.Load(ResPath + "meshes\\space_ship\\ship.jpg", out pBaseObj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_3D, Res.TexShip); pResMan.Load(ResPath + "sprites\\spark.bmp", out pBaseObj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_2D, Res.TexSpark); pResMan.Load(ResPath + "sounds\\explo.wav", out pBaseObj, (uint)E_TEXTURE_LOAD_FLAGS.RES_LOAD_DEFAULT, Res.SndExplo); pResMan.Load(ResPath + "sounds\\fire.wav", out pBaseObj, (uint)E_TEXTURE_LOAD_FLAGS.RES_LOAD_DEFAULT, Res.SndFire); pResMan.Load(ResPath + "sprites\\explo.jpg", out pBaseObj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_2D, Res.TexExplo); ((ITexture)pBaseObj).SetFrameSize(Res.ExploAnimationFramesSize, Res.ExploAnimationFramesSize); pResMan.Load(ResPath + "fonts\\Times_New_Roman_18_Bold.dft", out pBaseObj, 0, Res.FntMain); pFnt = (IBitmapFont)pBaseObj; StartGame(); }
void Init(IntPtr pParam) { IEngineSubSystem pSubSys; pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RENDER, out pSubSys); pRender = (IRender)pSubSys; pRender.GetRender2D(out pRender2D); pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_INPUT, out pSubSys); pInput = (IInput)pSubSys; pInput.Configure(E_INPUT_CONFIGURATION_FLAGS.ICF_HIDE_CURSOR); IResourceManager pResMan; pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RESOURCE_MANAGER, out pSubSys); pResMan = (IResourceManager)pSubSys; IEngineBaseObject pBaseObj; pResMan.Load(RESOURCE_PATH + "sounds\\bug_death.wav", out pBaseObj, 0); pSndDeath = (ISoundSample)pBaseObj; pResMan.Load(RESOURCE_PATH + "sprites\\light.jpg", out pBaseObj, 0); pTexLight = (ITexture)pBaseObj; pResMan.Load(RESOURCE_PATH + "sprites\\smoke.png", out pBaseObj, 0); pTexSmoke = (ITexture)pBaseObj; pResMan.Load(RESOURCE_PATH + "sprites\\bug.png", out pBaseObj, 0); pTexBug = (ITexture)pBaseObj; pResMan.Load(RESOURCE_PATH + "sprites\\bug_corpse.png", out pBaseObj, 0); pTexBugCorpse = (ITexture)pBaseObj; pResMan.Load(RESOURCE_PATH + "sprites\\blood.png", out pBaseObj, 0); pTexBlood = (ITexture)pBaseObj; pResMan.Load(RESOURCE_PATH + "textures\\cartoon_grass.tga", out pBaseObj, (uint)(E_TEXTURE_LOAD_FLAGS.TLF_FILTERING_BILINEAR | E_TEXTURE_LOAD_FLAGS.TLF_COORDS_REPEAT)); pTexBg = (ITexture)pBaseObj; pTexBug.SetFrameSize(52, 42); for (uint i = 0; i < 3; i++) { pResMan.CreateTexture(out pTexTarget[i], null, ScreenWidth, ScreenHeight, E_TEXTURE_DATA_FORMAT.TDF_RGB8, E_TEXTURE_CREATE_FLAGS.TCF_DEFAULT, E_TEXTURE_LOAD_FLAGS.TLF_FILTERING_BILINEAR | E_TEXTURE_LOAD_FLAGS.TLF_COORDS_CLAMP); } Clear(); }
void Init(IntPtr pParam) { IEngineSubSystem p_sub_sys = null; IResourceManager p_res_man = null; pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RESOURCE_MANAGER, out p_sub_sys); p_res_man = (IResourceManager)p_sub_sys; IRender p_render = null; pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RENDER, out p_sub_sys); p_render = (IRender)p_sub_sys; p_render.GetRender2D(out pRender2D); IEngineBaseObject p_obj = null; pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_INPUT, out p_sub_sys); pInput = (IInput)p_sub_sys; pInput.Configure(E_INPUT_CONFIGURATION_FLAGS.ICF_HIDE_CURSOR); p_res_man.GetDefaultResource(E_ENGINE_OBJECT_TYPE.EOT_BITMAP_FONT, out p_obj); pFont = (IBitmapFont)p_obj; // Background clear color setup. TColor4 tc = new TColor4(38, 38, 55, 255); p_render.SetClearColor(ref tc); // This example adapted only for 800X600 resolution, if even resolution will be higher it won't effect it. pRender2D.SetResolutionCorrection(GAME_VP_WIDTH, GAME_VP_HEIGHT, true); p_res_man.Load(RESOURCE_PATH + "sounds\\owl.wav", out p_obj, 0); pSndOwl = (ISoundSample)p_obj; p_res_man.Load(RESOURCE_PATH + "sounds\\forest_ambient.wav", out p_obj, 0); pForestAmbient = (ISoundSample)p_obj; pForestAmbient.PlayEx(out pChannelAmbientLoop, E_SOUND_SAMPLE_PARAMS.SSP_LOOPED); p_res_man.Load(RESOURCE_PATH + "sprites\\cartoon_forest_background.png", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_2D); 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); 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); 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); pVox = (ITexture)p_obj; pVox.SetFrameSize(149, 149); p_res_man.Load(RESOURCE_PATH + "sprites\\cartoon_owl.png", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_2D); pOwl = (ITexture)p_obj; pOwl.SetFrameSize(48, 128); p_res_man.Load(RESOURCE_PATH + "sprites\\cartoon_anime_girl.png", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_2D); pTexGirl = (ITexture)p_obj; pTexGirl.SetFrameSize(55, 117); p_res_man.Load(RESOURCE_PATH + "sprites\\cartoon_mistery_light.jpg", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_2D); pLight = (ITexture)p_obj; pLight.SetFrameSize(64, 128); }
void Init(IntPtr pParam) { IEngineSubSystem p_sub_sys = null; IResourceManager p_res_man = null; pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RESOURCE_MANAGER, out p_sub_sys); p_res_man = (IResourceManager)p_sub_sys; IRender p_render = null; pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RENDER, out p_sub_sys); p_render = (IRender)p_sub_sys; p_render.GetRender2D(out pRender2D); IEngineBaseObject p_obj = null; pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_INPUT, out p_sub_sys); pInput = (IInput)p_sub_sys; pInput.Configure(E_INPUT_CONFIGURATION_FLAGS.ICF_HIDE_CURSOR); p_res_man.GetDefaultResource(E_ENGINE_OBJECT_TYPE.EOT_BITMAP_FONT, out p_obj); pFont = (IBitmapFont)p_obj; // Background clear color setup. TColor4 tc = new TColor4(38, 38, 55, 255); p_render.SetClearColor(ref tc); // This example adapted only for 800X600 resolution, if even resolution will be higher it won't effect it. pRender2D.SetResolutionCorrection(GAME_VP_WIDTH, GAME_VP_HEIGHT, true); p_res_man.Load(RESOURCE_PATH + "sounds\\owl.wav", out p_obj, 0); pSndOwl = (ISoundSample)p_obj; p_res_man.Load(RESOURCE_PATH + "sounds\\forest_ambient.wav", out p_obj, 0); pForestAmbient = (ISoundSample)p_obj; pForestAmbient.PlayEx(out pChannelAmbientLoop, E_SOUND_SAMPLE_PARAMS.SSP_LOOPED); p_res_man.Load(RESOURCE_PATH + "sprites\\cartoon_forest_background.png", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_2D); 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 + "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 + "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); pVox = (ITexture)p_obj; pVox.SetFrameSize(149, 149); p_res_man.Load(RESOURCE_PATH + "sprites\\cartoon_owl.png", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_2D); pOwl = (ITexture)p_obj; pOwl.SetFrameSize(48, 128); p_res_man.Load(RESOURCE_PATH + "sprites\\cartoon_anime_girl.png", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_2D); pTexGirl = (ITexture)p_obj; pTexGirl.SetFrameSize(55, 117); p_res_man.Load(RESOURCE_PATH + "sprites\\cartoon_mistery_light.jpg", out p_obj, (uint)E_TEXTURE_LOAD_FLAGS.TEXTURE_LOAD_DEFAULT_2D); pLight = (ITexture)p_obj; pLight.SetFrameSize(64, 128); }