Пример #1
0
    virtual void Destroy()
    {
        SAFEDEL(spr);
        SAFEDEL(sprZazaka);
        SAFEDEL(sprZazakaClone);

        DMIMGMANAGER.RemoveImage(pIR);
        DMIMGMANAGER.RemoveImage(pZazaka);
        DMIMGMANAGER.RemoveImage(pZazakaClone);
    }
Пример #2
0
xaeAVGTextbox::~xaeAVGTextbox(void)
{
    SAFEDEL(m_pTextbox);
    SAFEDEL(m_pTalkerFont);
    SAFEDEL(m_pTextFont);

    SAFEDEL(m_pVoice);

    m_pHGE->Release();
}
Пример #3
0
// shutting down
void shutDown()
{
#ifdef CLIENT_SIDE
	SAFEDEL(client);
#endif

#ifdef SERVER_SIDE
	SAFEDEL(server);
#endif
}
Пример #4
0
//----------------------------------------------------
CPhoto::~CPhoto()
{
    DeleteAction() ;
    DeleteTimers() ;

    SAFEDEL( m_pConf) ;
    SAFEDEL( m_pColl) ;

    delete ui ;
}
Пример #5
0
//----------------------------------------------------
void CPhoto::DeleteAction()
{
    SAFEDEL( m_pMoveUpAct) ;
    SAFEDEL( m_pMoveDownAct) ;
    SAFEDEL( m_pZoomAllAct) ;
    SAFEDEL( m_pConfigAct) ;
    SAFEDEL( m_pStartSlideShowAct) ;
    SAFEDEL( m_pEndSlideShowAct) ;
    SAFEDEL( m_pPauseSlideShowAct) ;
    SAFEDEL( m_pShowFullScreen) ;
    SAFEDEL( m_pExitFullScreen) ;
    SAFEDEL( m_pEditNotesAct) ;
}
Пример #6
0
xaeBlockTreasure::~xaeBlockTreasure(void)
{
    for(int i = 0; i < XAE_TREASURE_TYPE_NUM; i++)
    {
        SAFEDEL(m_pTreasureSprite[i]);
    }

    m_pHGE->Release();
}
Пример #7
0
DMApplication::~DMApplication(void)
{
    if(_innerHGE)
    {
        _innerHGE->Release();
        _innerHGE = NULL;
    }

    SAFEDEL(m_pSystemConfiguration);
}
Пример #8
0
void xae::shutdown_core()
{
    if(NULL == m_pHGE) create_core();

    /** 场景管理器释放 */
    xaeSceneMgr::Instance().release();
    /** 资源管理器释放 */
    SAFEDEL(m_pResMgr);

    m_pHGE->System_Shutdown();
}
Пример #9
0
xaeBlockScene::~xaeBlockScene(void)
{
    SAFEDEL(m_pNake);
    SAFEDEL(m_pCloth);
    SAFEDEL(m_pBall);
    SAFEDEL(m_pFlap);
    SAFEDEL(m_pLoseBG);

    SAFEDEL(m_pGUI);
    SAFEDEL(m_pScoreFont);
    SAFEDEL(m_pLevelFont);

#ifdef __DEBUG
    SAFEDEL(g_pDebugFont);
#endif

    //if(m_hTexClothHot != 0) m_pHGE->Texture_Free(m_hTexClothHot);
}
Пример #10
0
OUGUIObject::~OUGUIObject()
{
    //GUI_CHILD_CTRL_LOCK;

    //for(GUIMap::iterator it = m_pControlList.begin(); it != m_pControlList.end(); it++)
    //{
    //    SAFEDEL(it->second);
    //}
    //m_pControlList.clear();
    for(GUIList::iterator it = m_pControlList.begin(); it != m_pControlList.end(); it++)
    {
        SAFEDEL(*it);
    }
    m_pControlList.clear();
}
Пример #11
0
void OUMapTableImg::Clear()
{
    for(map<string, POUGUI_IMG>::iterator it = m_pImgMap.begin(); it != m_pImgMap.end(); it++)
    {
        if(it->second->m_bStatic)
        {
            HTEXTURE hTex = it->second->m_Img.m_pSprite->GetTexture();
            it->second->Release();
            m_pHGE->Texture_Free(hTex);
        }
        else it->second->Release();

        SAFEDEL(it->second);
    }
    m_pImgMap.clear();
}
Пример #12
0
bool OUMapItemRole::SetResource(DWORD dwID)
{
    Release();

    OUMapResourceRole* res = new OUMapResourceRole();
    if(!res->Load(dwID))
    {
        SAFEDEL(res);
        return false;
    }

    memcpy(m_pStanding, res->GetAnimationArray(OURAS_STANDING), sizeof(m_pStanding));
    memcpy(m_pRun, res->GetAnimationArray(OURAS_RUN), sizeof(m_pRun));

    m_pSprite = (OUMapResourceObject*)res;

    SetStateAndFaceDir(OURAS_RUN, OURFD_DOWN);

    return true;
}
Пример #13
0
/**
 * @brief 编译函数
 * 将代码文件根据对应编译器编译成可执行文件
 * 
 * @param type 编译器类型
 * @param input 代码文件名
 * @param output 可执行文件名
 * @param cs 用于接收代码状态的引用
 * @return 若编译成功返回true,否则返回false
 */
bool CNBUTOJCore::CompileFile(const string type, const string input, const string output, CodeState &cs)
{
    /** 根据编译器类型创建编译对象 */
    NCompiler *cp = CPFactories::Instance().Create(type);
    
    /** 若找不到相应编译器 */
    if(!cp)
    {
        cs.state = SYSTEM_ERROR;
        strcpy(cs.err_code, "Wrong Compiler.");
        return false;
    }

    /** 获取新路径 */
    string newinput = string(TEMP_PATH) + input;
    string newoutput = string(TEMP_PATH) + output;

    /** 过滤代码 */
    bool fr = cp->FilterCode(newinput.c_str());
    if(fr == true)
    {
        cs.state = DANGEROUS_CODE;
        return false;
    }

    /** 编译文件 */
    bool r = cp->CompileFile(newinput.c_str(), newoutput.c_str(), cs.err_code);
    
    /** 更新状态 */
    if(r) 
    {
        cs.state = COMPILATION_SUC;
        strcpy(cs.err_code, "\0");
    }
    else cs.state = COMPILATION_ERROR;

    /** 删除编译器对象指针 */
    SAFEDEL(cp);

    return r;
}
Пример #14
0
xaeBlockScene::xaeBlockScene(void) :
    m_szLevelName(""),

    m_hTexNake(0),
    m_hTexClothHot(0),

    m_pNake(NULL),
    m_pCloth(NULL),
    m_pFlap(NULL),
    m_dwFlapNum(4),

    m_dwBlockLeft(0),

    m_fFlapX(300.0f - 2 * g_Setting.Block.m_nFlapLength),
    m_fFlapY(g_Setting.Block.m_fFlapY),

    m_fBallSpeedX(0.0f),
    m_fBallSpeedY(-g_Setting.Block.m_fBallSpeed),

    m_fBallX(300.0f),
    m_fBallY(g_Setting.Block.m_fFlapY - g_Setting.Block.m_nBallLength / 2),
    m_pBall(NULL),

    m_emStatus(XBPS_READY),

    m_pLoseBG(NULL),
    m_pGUI(NULL),
    m_pScoreFont(NULL),
    m_pLevelFont(NULL)
{
    memset(m_bClothes, 0, sizeof(m_bClothes));

#ifdef __DEBUG
    SAFEDEL(g_pDebugFont);
    g_pDebugFont = new xaeFont("宋体", 12, 0, 0, 0);
    g_pDebugFont->SetColor(0xff000000);
#endif

    __loadResource();
}
Пример #15
0
int serverMain(const int argc, char* argv[])
{
#ifdef SERVER_SIDE
	if (argc < 1)
	{
		return EXIT_FAILURE;
	}

	atexit(shutDown);

	ushort port = 0;
	short broadCastRate = 0;

	if (argc == 2)
	{
		const char* argumentsStr = utils::file::readFile(CONST_STR("resourcesDir") + "/serverArgs.txt");
		const std::vector<std::string> arguments = utils::tokenize(argumentsStr, " ");

		port			= atoi(arguments[0].c_str());
		broadCastRate	= atoi(arguments[1].c_str());

		delete argumentsStr;
	}
	else
	{
		port = atoi(argv[2]);
		broadCastRate = atoi(argv[3]);
	}

	server = new network::Server(port, broadCastRate);
	server->start();

	SAFEDEL(server);
#endif
	return EXIT_SUCCESS;
}
Пример #16
0
		~cGlobalPtrMan(){ SAFEDEL(mPtr); }
Пример #17
0
bool ReleaseNCore(CNBUTOJCore* &core)
{
    SAFEDEL(core);
    
    return true;
}
Пример #18
0
/*! Frees all allocated memory
 *
 *  @returns        ICRESULT        Success/failure code of cleanup
**/
ICRESULT Airhockey::Cleanup(void)
{
    if (m_pMainWin)
        SAFEDEL(m_pMainWin);

    if (m_pGxDevice)
        SAFEDEL(m_pGxDevice);


    // write to settings.ini
    //if (m_InitialSettings != m_Settings)
    {
        icString temps;
        char tempb[256];

        // clear current settings
        m_SettingsFile.ClearValues();
        
        // GET SCREEN AND BACK BUFFER RESOLUTION
        temps = (m_Settings.bFullscreen) ? "true" : "false";
        m_SettingsFile.AddPair("Engine.Graphics.bFullScreen", temps.ToChar());
        sprintf(tempb,"%i",m_Settings.iScreen_x);
        m_SettingsFile.AddPair("Engine.Graphics.ScreenX", tempb);
        sprintf(tempb,"%i",m_Settings.iScreen_y);
        m_SettingsFile.AddPair("Engine.Graphics.ScreenY", tempb);
        //sprintf(tempb,"%i",m_Settings.iBackbuf_x);
        //m_SettingsFile.AddPair("Engine.Graphics.BackBufferX", tempb);
        //sprintf(tempb,"%i",m_Settings.iBackbuf_y);
        //m_SettingsFile.AddPair("Engine.Graphics.BackBufferY", tempb);

        // GET FOG SETTINGS
        temps = (m_Settings.bFog) ? "true" : "false";
        m_SettingsFile.AddPair("Engine.Fog.bEnable", temps.ToChar());
        sprintf(tempb,"%f",m_Settings.fogParams.start);
        m_SettingsFile.AddPair("Engine.Fog.fStart", tempb);
        sprintf(tempb,"%f",m_Settings.fogParams.end);
        m_SettingsFile.AddPair("Engine.Fog.fEnd", tempb);
        sprintf(tempb,"%f",m_Settings.fogParams.density);
        m_SettingsFile.AddPair("Engine.Fog.fDensity", tempb);
        sprintf(tempb,"(%u,%u,%u,%u)",m_Settings.fogParams.col.r,
                                      m_Settings.fogParams.col.g,
                                      m_Settings.fogParams.col.b,
                                      m_Settings.fogParams.col.a);
        m_SettingsFile.AddPair("Engine.Fog.Color", tempb);
        sprintf(tempb,"%d",m_Settings.fogParams.type);
        m_SettingsFile.AddPair("Engine.Fog.ucType", tempb);

        // GET AUDIO SETTINGS
        temps = (m_Settings.bMusic) ? "true" : "false";
        m_SettingsFile.AddPair("Game.Audio.bEnableMusic", temps.ToChar());
        temps = (m_Settings.bSfx) ? "true" : "false";
        m_SettingsFile.AddPair("Game.Audio.bEnableSfx", temps.ToChar());
        sprintf(tempb,"%f",m_Settings.fMusic_vol);
        m_SettingsFile.AddPair("Game.Audio.fMusicVol", tempb);
        sprintf(tempb,"%f",m_Settings.fSfx_vol);
        m_SettingsFile.AddPair("Game.Audio.fSfxVol", tempb);

        // GET PADDLE SETTINGS
        sprintf(tempb,"%d",m_Settings.ucPaddle_type);
        m_SettingsFile.AddPair("Game.Paddle.ucType",tempb);

        // GET NETWORK SETTINGS
        m_SettingsFile.AddPair("Game.Network.sConnectIP",
                               m_Settings.sLast_join_ip.ToChar());

        m_SettingsFile.Write();
    }

    icPrintf("Airhockey::Cleanup succeeded");

    return IC_OK;
}// END FUNCTION Cleanup(void)
Пример #19
0
xae::~xae()
{
    delete_all_temp_folders();
    if(NULL != m_pHGE) m_pHGE->Release();
    SAFEDEL(m_pResMgr);
}
Пример #20
0
void xae::set_resource_mgr(xaeResourceMgrObject* mgr)
{
    SAFEDEL(m_pResMgr);
    m_pResMgr = mgr;
}
Пример #21
0
xaeGUITextButton::~xaeGUITextButton()
{
    SAFEDEL(m_pFont);
}
Пример #22
0
//----------------------------------------------------
void CPhoto::DeleteTimers()
{
    SAFEDEL( m_pTimer) ;
    SAFEDEL( m_pLoadIniTimer) ;
    SAFEDEL( m_pFullScreenTimer) ;
}
Пример #23
0
/*! Frees all allocated memory
 *
 *  @returns        ICRESULT        Success/failure code of cleanup
**/
ICRESULT SkeeBall::Cleanup(void)
{
    if (m_pMainWin)
        SAFEDEL(m_pMainWin);

    if (m_pGxDevice)
        SAFEDEL(m_pGxDevice);

    playing = false;

    // write to settings.ini
    //if (m_InitialSettings != m_Settings)
    {
        icString temps;
        char tempb[256];

        // clear current settings
        m_SettingsFile.ClearValues();

        // GET SCREEN AND BACK BUFFER RESOLUTION
        temps = (m_Settings.bFullscreen) ? "true" : "false";
        m_SettingsFile.AddPair("Engine.Graphics.bFullScreen", temps.ToChar());
        sprintf(tempb,"%i",m_Settings.iScreen_x);
        m_SettingsFile.AddPair("Engine.Graphics.ScreenX", tempb);
        sprintf(tempb,"%i",m_Settings.iScreen_y);
        m_SettingsFile.AddPair("Engine.Graphics.ScreenY", tempb);
        //sprintf(tempb,"%i",m_Settings.iBackbuf_x);
        //m_SettingsFile.AddPair("Engine.Graphics.BackBufferX", tempb);
        //sprintf(tempb,"%i",m_Settings.iBackbuf_y);
        //m_SettingsFile.AddPair("Engine.Graphics.BackBufferY", tempb);

        // GET FOG SETTINGS
        temps = (m_Settings.bFog) ? "true" : "false";
        m_SettingsFile.AddPair("Engine.Fog.bEnable", temps.ToChar());
        sprintf(tempb,"%f",m_Settings.fogParams.start);
        m_SettingsFile.AddPair("Engine.Fog.fStart", tempb);
        sprintf(tempb,"%f",m_Settings.fogParams.end);
        m_SettingsFile.AddPair("Engine.Fog.fEnd", tempb);
        sprintf(tempb,"%f",m_Settings.fogParams.density);
        m_SettingsFile.AddPair("Engine.Fog.fDensity", tempb);
        sprintf(tempb,"(%u,%u,%u,%u)",m_Settings.fogParams.col.r,
                m_Settings.fogParams.col.g,
                m_Settings.fogParams.col.b,
                m_Settings.fogParams.col.a);
        m_SettingsFile.AddPair("Engine.Fog.Color", tempb);
        sprintf(tempb,"%d",m_Settings.fogParams.type);
        m_SettingsFile.AddPair("Engine.Fog.ucType", tempb);

        // GET AUDIO SETTINGS
        temps = (m_Settings.bMusic) ? "true" : "false";
        m_SettingsFile.AddPair("Game.Audio.bEnableMusic", temps.ToChar());
        temps = (m_Settings.bSfx) ? "true" : "false";
        m_SettingsFile.AddPair("Game.Audio.bEnableSfx", temps.ToChar());
        sprintf(tempb,"%f",m_Settings.fMusic_vol);
        m_SettingsFile.AddPair("Game.Audio.fMusicVol", tempb);
        sprintf(tempb,"%f",m_Settings.fSfx_vol);
        m_SettingsFile.AddPair("Game.Audio.fSfxVol", tempb);

        // GET FREE CAM SETTINGS
        temps = (m_Settings.bFreeCam) ? "true" : "false";
        m_SettingsFile.AddPair("Game.bFreeCam",temps.ToChar());

        // GET WII MOTE SETTINGS
        temps = (m_Settings.bWiiMote) ? "true" : "false";
        m_SettingsFile.AddPair("Game.bWiiMote",temps.ToChar());

        // GET HIGH SCORE
        sprintf(tempb,"%i",m_Settings.iHighScore);
        m_SettingsFile.AddPair("Game.iHighScore",tempb);

        m_SettingsFile.Write();
    }

    icPrintf("SkeeBall::Cleanup succeeded");

    return IC_OK;
}// END FUNCTION Cleanup(void)
Пример #24
0
bool xaeBlockScene::loadLevel(string levelName)
{
    /** 删除原图片 */
    SAFEDEL(m_pNake);
    SAFEDEL(m_pCloth);

    m_hTexClothHot = m_hTexNake = 0;

    /** 载入关卡图片 */
    string nakeFilename = g_Setting.File.m_szLevelPath + levelName + ".nake.png";
    string clothFilename = g_Setting.File.m_szLevelPath + levelName + ".cloth.png";
    string clothHotFilename = g_Setting.File.m_szLevelPath + levelName + ".cloth.hot.png";
    
    m_pNake = new xaeSprite(nakeFilename.c_str());
    m_pCloth = new xaeSprite(clothFilename.c_str());

    /** 载入失败 */
    if(m_pNake->get_sprite() == NULL || m_pCloth->get_sprite() == NULL)
    {
        SAFEDEL(m_pNake);
        SAFEDEL(m_pCloth);
        return false;
    }

    /** 大小不对 */
    if(m_pNake->get_sprite()->GetWidth() != 600 ||
        m_pNake->get_sprite()->GetHeight() != 600 ||
        m_pCloth->get_sprite()->GetWidth() != 600 ||
        m_pCloth->get_sprite()->GetHeight() != 600)
    {
        SAFEDEL(m_pNake);
        SAFEDEL(m_pCloth);
        return false;
    }

    /** 热点图片 */
    xaeResourceBody tagRB;
    if(!xae::Instance().get_resource_mgr()->get_resource_bin(clothHotFilename.c_str(), tagRB))
    {
        SAFEDEL(m_pNake);
        SAFEDEL(m_pCloth);
        return false;
    }

    /** 都对了 */
    m_hTexNake = m_pNake->get_sprite()->GetTexture();
    m_hTexClothHot = m_pHGE->Texture_Load((char*)tagRB.m_pRes, tagRB.m_nSize);

    /** 开始切割 */
    m_dwBlockLeft = 0;
    for(int i = 0; i < g_Setting.Block.m_nBlockRowCount; i++)
    {
        for(int j = 0; j < g_Setting.Block.m_nBlockColCount; j++)
        {
            /** 看看分块是不是全透明的 */
            if(!blockTransparent(m_hTexClothHot,
                j * g_Setting.Block.m_nBlockWidth,
                i * g_Setting.Block.m_nBlockHeight,
                g_Setting.Block.m_nBlockWidth,
                g_Setting.Block.m_nBlockHeight))
            {
                m_bClothes[i][j] = true;
                m_dwBlockLeft++;
            }
            else m_bClothes[i][j] = false;
        }
    }

    /** 立绘 */
    if(m_pGUI->get_control("Right")->get_control("Maid") != NULL)
    {
        m_pGUI->del_control("Right");
    }
    m_pGUI->get_control("Right")->add_control(new xaeGUIStaticImage(0, "Maid", g_Setting.File.m_szLevelPath + levelName + ".maid.png", 100, 240));

    m_szLevelName = levelName;

    return true;
}