⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 brutalfighting.c

📁 很好的韩国游戏
💻 C
📖 第 1 页 / 共 5 页
字号:
#include "BrutalFighting.h"
/*===========================================================================
FILE: BrutalFighting.c
===========================================================================*/
int AEEClsCreateInstance(AEECLSID ClsId, IShell *pIShell, IModule *po, void **ppObj)
{
	*ppObj = NULL;
	if( ClsId == AEECLSID_BRUTALFIGHTING )
	{
		// Create the applet and make room for the applet structure
		if( AEEApplet_New(sizeof(BrutalFighting),
                          ClsId,
                          pIShell,
                          po,
                          (IApplet**)ppObj,
                          (AEEHANDLER)BrutalFighting_HandleEvent,
                          (PFNFREEAPPDATA)BrutalFighting_FreeAppData) ) // the FreeAppData function is called after sending EVT_APP_STOP to the HandleEvent function
                          
		{
			//Initialize applet data, this is called before sending EVT_APP_START
            // to the HandleEvent function
			if(BrutalFighting_InitAppData((BrutalFighting*)*ppObj))
			{
				//Data initialized successfully
				return(AEE_SUCCESS);
			}
			else
			{
				//Release the applet. This will free the memory allocated for the applet when
				// AEEApplet_New was called.
				IAPPLET_Release((IApplet*)*ppObj);
				return EFAILED;
			}
        } // end AEEApplet_New
    }
	return(EFAILED);
}
/*===========================================================================
FUNCTION SampleAppWizard_HandleEvent

DESCRIPTION
	This is the EventHandler for this app. All events to this app are handled in this
	function. All APPs must supply an Event Handler.

PROTOTYPE:
	boolean SampleAppWizard_HandleEvent(IApplet * pi, AEEEvent eCode, uint16 wParam, uint32 dwParam)

PARAMETERS:
	pi: Pointer to the AEEApplet structure. This structure contains information specific
	to this applet. It was initialized during the AEEClsCreateInstance() function.

	ecode: Specifies the Event sent to this applet

   wParam, dwParam: Event specific data.

DEPENDENCIES
  none

RETURN VALUE
  TRUE: If the app has processed the event
  FALSE: If the app did not process the event

SIDE EFFECTS
  none
===========================================================================*/
static boolean BrutalFighting_HandleEvent(BrutalFighting* pMe, AEEEvent eCode, uint16 wParam, uint32 dwParam)
{  
    switch (eCode) 
	{
        // App is told it is starting up
        case EVT_APP_START:                        
		    // Add your code here...
			 ISHELL_RegisterNotify(pMe->pIShell, AEECLSID_BRUTALFIGHTING, AEECLSID_TAPI, NMASK_TAPI_SMS_TEXT); 
//			 ISHELL_SetTimerEx(pMe->pIShell, 3, &(pMe->m_cbMainTimer));
			 Adout_LoadHtmlData(pMe);
			 Help_LoadHtmlData(pMe);
			 BrutalFighting_Main_Start(pMe);
            return(TRUE);
        // App is told it is exiting
        case EVT_APP_STOP:
            // Add your code here...
      		return(TRUE);
        // App is being suspended 

		case EVT_NOTIFY:
			CALLBACK_Cancel(&pMe->m_cbMainTimer);
			pMe->bisNotify = TRUE;
			
			if (pMe->m_bSound == TRUE)
			{
				BruatlFighting_stop_Music(pMe);
			}
		
			return (TRUE);

//	case EVT_NOTIFY:
	case EVT_APP_SUSPEND:
			CALLBACK_Cancel(&pMe->m_cbMainTimer);
			
				if (pMe->m_bSound)
				{
					BruatlFighting_stop_Music(pMe);
				}

      		return(TRUE);

        case EVT_APP_RESUME:
			{
				if (NULL != pMe->m_pIMedia)
				{
					IMEDIA_Stop(pMe->m_pIMedia);
					IMEDIA_RegisterNotify(pMe->m_pIMedia, NULL, NULL);
					IMEDIA_Release(pMe->m_pIMedia);
					pMe->m_pIMedia = NULL;
				}
				if (WIN_ID_GAME == pMe->m_emGameState)
				{
					BruatlFighting_Paly_Music(pMe);
				}
				if (WIN_ID_HELP == pMe->m_emGameState) 
				{
					pMe->m_bhtml = TRUE;
					Help_DisplayHtmlData(pMe);
				}
				if (WIN_ID_ABOUT == pMe->m_emGameState)
				{
					pMe->m_bhtml = TRUE;
					About_DisplayHtmlData(pMe);
				}
				BrutalFighting_ResumeGame(pMe);
			}
			return(TRUE);
		case EVT_KEY_RELEASE:
			if(pMe->bisNotify)
			{
				if (NULL != pMe->m_pIMedia)
				{
					IMEDIA_Stop(pMe->m_pIMedia);
					IMEDIA_RegisterNotify(pMe->m_pIMedia, NULL, NULL);
					IMEDIA_Release(pMe->m_pIMedia);
					pMe->m_pIMedia = NULL;
				}
				if (WIN_ID_GAME == pMe->m_emGameState)
				{
					BruatlFighting_Paly_Music(pMe);
				}
				if (WIN_ID_HELP == pMe->m_emGameState) 
				{
					pMe->m_bhtml = TRUE;
					Help_DisplayHtmlData(pMe);
				}
				if (WIN_ID_ABOUT == pMe->m_emGameState)
				{
					pMe->m_bhtml = TRUE;
					About_DisplayHtmlData(pMe);
				}
				BrutalFighting_ResumeGame(pMe);
				pMe->bisNotify = FALSE;
			}
		return TRUE;
        case EVT_APP_MESSAGE:
      		return(TRUE);
        default:
            switch(pMe->m_emGameState)
			{
			case WIN_ID_MENU:
				return Menu_HandleEvent(pMe,eCode,wParam,dwParam);
			case WIN_ID_SETUP://设置
				return SetUp_HandleEvent(pMe,eCode,wParam,dwParam);	
			case WIN_ID_SELECT:
				return Select_HandleEvent(pMe,eCode,wParam,dwParam);	
			case WIN_ID_GAME:
				return Game_HandleEvent(pMe,eCode,wParam,dwParam);
			case WIN_ID_HIGHSCORE:
				return AppHighScore_HandleEvent(pMe,eCode,wParam,dwParam);
			case WIN_ID_HELP:
				return HELP_HandleEvent(pMe,eCode,wParam,dwParam);
			case WIN_ID_ABOUT:
				return Adout_HandleEvent(pMe,eCode,wParam,dwParam);
			case WIN_ID_STOP:
				return Stop_HandleEvent(pMe,eCode,wParam,dwParam);
			case WIN_ID_NOSPACE:
				return NoSpace_HandleEvent(pMe, eCode, wParam, dwParam);
			case WIN_ID_DEMO:
				return Demo_HandleEvent(pMe, eCode, wParam, dwParam);
		}
		break;
   }
   return FALSE;
}
/*
static boolean BrutalFighting_HandleEvent(BrutalFighting* pMe, AEEEvent eCode, uint16 wParam, uint32 dwParam)
{  
    switch (eCode) 
	{
        // App is told it is starting up
        case EVT_APP_START:                        
		    // Add your code here...
			 ISHELL_RegisterNotify(pMe->pIShell, AEECLSID_BRUTALFIGHTING, AEECLSID_TAPI, NMASK_TAPI_SMS_TEXT); 
			 ISHELL_SetTimerEx(pMe->pIShell, 0, &(pMe->m_cbMainTimer));
			 Adout_LoadHtmlData(pMe);
			 Help_LoadHtmlData(pMe);
			 BrutalFighting_Main_Start(pMe);
            return(TRUE);
        // App is told it is exiting
        case EVT_APP_STOP:
            // Add your code here...
      		return(TRUE);
        // App is being suspended 
		case EVT_NOTIFY:
			pMe->bisNotify = TRUE;
			
			if (pMe->m_bSound == TRUE)
			{
				BruatlFighting_stop_Music(pMe);
			}
			CALLBACK_Cancel(&pMe->m_cbMainTimer);
			return (TRUE);
        case EVT_APP_SUSPEND:


				if (pMe->m_bSound== TRUE)
				{
					BruatlFighting_stop_Music(pMe);
				}
			CALLBACK_Cancel(&pMe->m_cbMainTimer);
      		return(TRUE);
        // App is being resumed

		case EVT_KEY_RELEASE:
			if(pMe->bisNotify)
			{
				if (WIN_ID_GAME == pMe->m_emGameState)
				{
					BruatlFighting_Paly_Music(pMe);
				}
				if (WIN_ID_HELP == pMe->m_emGameState) 
				{
					pMe->m_bhtml = TRUE;
					Help_DisplayHtmlData(pMe);
				}
				if (WIN_ID_ABOUT == pMe->m_emGameState)
				{
					pMe->m_bhtml = TRUE;
					About_DisplayHtmlData(pMe);
				}
				BrutalFighting_ResumeGame(pMe);
				pMe->bisNotify = FALSE;
			}
		return TRUE;

        case EVT_APP_RESUME:
				pMe->bisNotify = FALSE;
				if (NULL != pMe->m_pIMedia)
				{
					IMEDIA_Stop(pMe->m_pIMedia);
					IMEDIA_RegisterNotify(pMe->m_pIMedia, NULL, NULL);
					IMEDIA_Release(pMe->m_pIMedia);
					pMe->m_pIMedia = NULL;
				}
				if (WIN_ID_GAME == pMe->m_emGameState)
				{
					if (pMe->m_bSound)
					{
							BruatlFighting_Paly_Music(pMe);
					}
				
				}
				if (WIN_ID_HELP == pMe->m_emGameState) 
				{
					pMe->m_bhtml = TRUE;
					Help_DisplayHtmlData(pMe);
				}
				if (WIN_ID_ABOUT == pMe->m_emGameState)
				{
					pMe->m_bhtml = TRUE;
					About_DisplayHtmlData(pMe);
				}
				BrutalFighting_ResumeGame(pMe);
			return(TRUE);
        case EVT_APP_MESSAGE:
      		return(TRUE);
        default:
            switch(pMe->m_emGameState)
			{
			case WIN_ID_MENU:
				return Menu_HandleEvent(pMe,eCode,wParam,dwParam);
			case WIN_ID_SETUP://设置
				return SetUp_HandleEvent(pMe,eCode,wParam,dwParam);	
			case WIN_ID_SELECT:
				return Select_HandleEvent(pMe,eCode,wParam,dwParam);	
			case WIN_ID_GAME:
				return Game_HandleEvent(pMe,eCode,wParam,dwParam);
			case WIN_ID_HIGHSCORE:
				return AppHighScore_HandleEvent(pMe,eCode,wParam,dwParam);
			case WIN_ID_HELP:
				return HELP_HandleEvent(pMe,eCode,wParam,dwParam);
			case WIN_ID_ABOUT:
				return Adout_HandleEvent(pMe,eCode,wParam,dwParam);
			case WIN_ID_STOP:
				return Stop_HandleEvent(pMe,eCode,wParam,dwParam);
			case WIN_ID_NOSPACE:
				return NoSpace_HandleEvent(pMe, eCode, wParam, dwParam);
			case WIN_ID_DEMO:
				return Demo_HandleEvent(pMe, eCode, wParam, dwParam);
		}
		break;
   }
   return FALSE;
}
*/
// this function is called when your application is starting up
boolean BrutalFighting_InitAppData(BrutalFighting* pMe)
{
    // Get the device information for this handset.
    // Reference all the data by looking at the pMe->DeviceInfo structure
    // Check the API reference guide for all the handy device info you can get
    pMe->DeviceInfo.wStructSize = sizeof(pMe->DeviceInfo);
    ISHELL_GetDeviceInfo(pMe->a.m_pIShell,&pMe->DeviceInfo);
    // The display and shell interfaces are always created by
    // default, so we'll asign them so that you can access
    // them via the standard "pMe->" without the "a."
    pMe->pIDisplay = pMe->a.m_pIDisplay;
    pMe->pIShell   = pMe->a.m_pIShell;
	ISHELL_CreateInstance(pMe->pIShell, AEECLSID_GRAPHICS, (void**)&pMe->pIGraphics);
    // Insert your code here for initializing or allocating resources...
	BrutalFighting_InitResData(pMe);
    // if there have been no failures up to this point then return success
    return TRUE;
}
// this function is called when your application is exiting
void BrutalFighting_FreeAppData(BrutalFighting* pMe)
{
    // insert your code here for freeing any resources you have allocated...

    // example to use for releasing each interface:
    // if ( pMe->pIMenuCtl != NULL )         // check for NULL first
    // {
    //    IMENUCTL_Release(pMe->pIMenuCtl)   // release the interface
    //    pMe->pIMenuCtl = NULL;             // set to NULL so no problems trying to free later
    // }
    //
	int loop;
	CALLBACK_Cancel(&pMe->m_cbMainTimer);

	if (NULL != pMe->m_pfhtmlFileMgr) 
	{
		IFILEMGR_Release(pMe->m_pfhtmlFileMgr);
		pMe->m_pfhtmlFileMgr = NULL;
	}
	if (NULL != pMe->m_pfaboutFileMgr) 
	{
		IFILEMGR_Release(pMe->m_pfaboutFileMgr);
		pMe->m_pfaboutFileMgr = NULL;
	}
	if (NULL != pMe->m_pfaFile)
	{
		IFILE_Release(pMe->m_pfaFile);
		pMe->m_pfaFile = NULL;
	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -