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

📄 m3gworld.c

📁 java 1.1 gemini 08_16
💻 C
字号:
/*******************************************************************************
 *  Modification Notice:
 *  --------------------------
 *  This software is modified by MediaTek Inc. and the information contained
 *  herein is confidential. The software may not be copied and the information
 *  contained herein may not be used or disclosed except with the written
 *  permission of MediaTek Inc. (C) 2001
 *
 *******************************************************************************/

/*****************************************************************************
 *
 * Filename:
 * ---------
 *  World.c
 *
 * Project:
 * --------
 *   Maui_Software
 *
 * Description:
 * ------------
 *   
 *
 * Author:
 * -------
 * -------
 *
 *============================================================================
 *             HISTORY
 * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *------------------------------------------------------------------------------
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *------------------------------------------------------------------------------
 * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *============================================================================
 ****************************************************************************/

/*************************************************************************
 * Include Header Files
 *************************************************************************/
#include "m3g.h"

#ifdef SUPPORT_JSR_184
/*************************************************************************
 * Function Definition
 *************************************************************************/
KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_m3g_World_create()
{
	st_m3g_world* handle;
	
	ENTER_M3D_CS;
	handle = M3G_World_new();
	LEAVE_M3D_CS;
	
	if (handle == NULL) KNI_ThrowNew("java/lang/NullPointerException", "null handle");	
	
	KNI_ReturnInt((jint)handle);
}

KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_m3g_World_getActiveCameraImpl()
{
	st_m3g_world* handle = (st_m3g_world*)KNI_GetParameterAsInt(1);

	//KNI_ReturnInt((jint)handle->active_camera);
	KNI_ReturnInt((jint)M3G_World_getActiveCamera(handle));
}

KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_m3g_World_getBackgroundImpl()
{
	st_m3g_world* handle = (st_m3g_world*)KNI_GetParameterAsInt(1);

	//KNI_ReturnInt((jint)handle->background);
	KNI_ReturnInt((jint)M3G_World_getBackground(handle));
}

KNIEXPORT KNI_RETURNTYPE_VOID
Java_javax_microedition_m3g_World_setActiveCameraImpl()
{
	st_m3g_world* handle = (st_m3g_world*)KNI_GetParameterAsInt(1);
	st_m3g_camera* camera = (st_m3g_camera*)KNI_GetParameterAsInt(2);

	if(camera == NULL) {
		KNI_ThrowNew("java/lang/NullPointerException", "null camera");			
	} else {
	    if (M3G_World_setActiveCamera(handle, camera) != M3G_SUCCESS) {
			/* JSR184Lighting.jar set active camera with null world, however, spec didn't describe 
			 * it's necessary to throw exception */
			/* KNI_ThrowNew("java/lang/IllegalArgumentException", "invalid camera"); */
	    }
	}

	KNI_ReturnVoid();       
}

KNIEXPORT KNI_RETURNTYPE_VOID
Java_javax_microedition_m3g_World_setBackgroundImpl()
{
	st_m3g_world* handle = (st_m3g_world*)KNI_GetParameterAsInt(1);
	st_m3g_background* background = (st_m3g_background*)KNI_GetParameterAsInt(2);
	
	if (M3G_World_setBackground(handle, background) != M3G_SUCCESS) {
		KNI_ThrowNew("java/lang/IllegalArgumentException", "invalid background");			
	}
	
	KNI_ReturnVoid();       
}
#endif /* #ifdef SUPPORT_JSR_184 */

⌨️ 快捷键说明

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