Пример #1
0
// Output a string to the debugger.
MF_API void MFDebug_Message(const char *pMessage)
{
	FujiModule *pModule = (FujiModule*)pp::Module::Get();
	Fuji *pInstance = pModule->GetInstance();
	if(pInstance)
		pInstance->PostMessage(pp::Var(pMessage));
}
Пример #2
0
MFInitStatus MFFileSystemNative_InitModulePlatformSpecific()
{
	if(gFilesystemExternal == 0)
	{
		FujiModule *pModule = (FujiModule*)pp::Module::Get();

		pFSInterface = (PPB_FileSystem*)pModule->GetBrowserInterface(PPB_FILESYSTEM_INTERFACE);

		Fuji *pInstance = pModule->GetInstance();
		if(!pInstance)
			return MFAIC_Failed;

		gFilesystemExternal = pFSInterface->Create(pInstance->pp_instance(), PP_FILESYSTEMTYPE_EXTERNAL);
		gFilesystemLocalPersistent = pFSInterface->Create(pInstance->pp_instance(), PP_FILESYSTEMTYPE_LOCALPERSISTENT);
		gFilesystemLocalTemporary = pFSInterface->Create(pInstance->pp_instance(), PP_FILESYSTEMTYPE_LOCALTEMPORARY);

		int32_t err = pFSInterface->Open(gFilesystemExternal, 0, PP_MakeOptionalCompletionCallback(CompletionCallback, (void*)0));
		if(err == PP_OK)
		{
			gOpenComplete |= 1;
		}
		else if(err != PP_OK_COMPLETIONPENDING)
		{
			MFDebug_Error("MFFileSystemNative_InitModulePlatformSpecific: Error opening FS interface!");
			return MFAIC_Failed;
		}

		err = pFSInterface->Open(gFilesystemLocalPersistent, 0, PP_MakeOptionalCompletionCallback(CompletionCallback, (void*)1));
		if(err == PP_OK)
		{
			gOpenComplete |= 2;
		}
		else if(err != PP_OK_COMPLETIONPENDING)
		{
			MFDebug_Error("MFFileSystemNative_InitModulePlatformSpecific: Error opening FS interface!");
			return MFAIC_Failed;
		}

		err = pFSInterface->Open(gFilesystemLocalTemporary, 0, PP_MakeOptionalCompletionCallback(CompletionCallback, (void*)2));
		if(err == PP_OK)
		{
			gOpenComplete |= 4;
		}
		else if(err != PP_OK_COMPLETIONPENDING)
		{
			MFDebug_Error("MFFileSystemNative_InitModulePlatformSpecific: Error opening FS interface!");
			return MFAIC_Failed;
		}
	}

	if(gOpenComplete == -1)
		return MFAIC_Failed;

	return gOpenComplete == 7 ? MFIS_Succeeded : MFAIC_Pending;
}
Пример #3
0
int MFDisplay_CreateDisplay(int width, int height, int bpp, int rate, bool vsync, bool triplebuffer, bool wide, bool progressive)
{
	MFCALLSTACK;

	FujiModule *pModule = (FujiModule*)pp::Module::Get();
	pNaClGLContext = new OpenGLContext(pModule->GetInstance());

	pNaClGLContext->MakeContextCurrent();

	gDisplay.fullscreenWidth = gDisplay.width = width;
	gDisplay.fullscreenHeight = gDisplay.height = height;
	gDisplay.refreshRate = rate;
	gDisplay.colourDepth = 32;
	gDisplay.windowed = true;
	gDisplay.wide = false;
	gDisplay.progressive = true;

	MFRenderer_CreateDisplay();

	initialised = true;

	return 0;
}