Пример #1
0
void CIwGameXmlParser::ShowError(eXMLParserError error, int pos) const
{
#ifdef SHOW_ERRORS
	s3eDebugOutputString(GetErrorString(error));
	s3eDebugOutputString(" at line ");
	CIwGameString num = CIwGameString(m_pDataInput->GetLineNumber(pos));
	s3eDebugOutputString(num.c_str());
#endif
}
Пример #2
0
void CIwGameXmlNode::PrintAttributes()
{
	for (CIwGameXmlAttributeList::iterator i = Attributes.begin(); i != Attributes.end(); ++i)
	{
		s3eDebugOutputString(" ");
		s3eDebugOutputString((*i)->Name.c_str());
		s3eDebugOutputString("=\"");
		s3eDebugOutputString((*i)->Value.c_str());
		s3eDebugOutputString("\"");
	}

}
Пример #3
0
void JNICALL s3eKiip_saveMomentCompletionCallback( JNIEnv* env, jobject obj, jobject param )
{
	s3eDebugOutputString("s3eKiip_saveMomentCompletionCallback: start");

	const char* pItemData = jstringToChar( env, (jstring) param );

	s3eEdkCallbacksEnqueue(	S3E_EXT_KIIP_HASH, S3EKIIP_SAVE_MOMENT_COMPLETION, (void*)pItemData, 
		0 , NULL, false, &s3eKiip_ReleaseStringCallback, (void*)pItemData );
}
Пример #4
0
void JNICALL s3eKiip_swarmStartCallback( JNIEnv* env, jobject obj, jobject param )
{
	s3eDebugOutputString("s3eKiip_swarmStartCallback: start");

	const char* pItemData = jstringToChar( env, (jstring) param );

	s3eEdkCallbacksEnqueue(	S3E_EXT_KIIP_HASH, S3EKIIP_SWARM_START, (void*)pItemData, 
		0 , NULL, false, &s3eKiip_ReleaseStringCallback, (void*)pItemData );
}
Пример #5
0
static void s3eKiip_ReleaseStringCallback(uint32, int32, void*, void*, int32, void* pData )
{
	s3eDebugOutputString( "s3eKiip_ReleaseStringCallback" );
	
	const char * pItemData = (const char*) pData;
	
	if ( pItemData != NULL)	
		delete[] pItemData;
}
Пример #6
0
// Example showing how to use the s3eWwise extension
int main()
{
    IW_CALLSTACK("main");

    s3eDebugOutputString("Booting s3eWwise example");

    initWwise();

    s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, (s3eCallback)buttonEvent, NULL);
    s3ePointerRegister(S3E_POINTER_MOTION_EVENT, (s3eCallback)motionEvent, NULL);

    IwGxInit();

    IwGxSetColClear(0, 0, 0, 0xff);

    while(!s3eDeviceCheckQuitRequest())
    {
        std::stringstream str;

        s3eWwiseSoundEngineRenderAudio();

        IwGxClear();

        IwGxPrintString(100, 100, "s3eWwise");

        IwGxPrintString(100, 300, "Touch to fire event");

        str << "RPM = " << rpm;
        IwGxPrintString(100, 400, str.str().c_str());
        str.str(std::string());

        str << "TH = " << touchHeight;
        IwGxPrintString(100, 500, str.str().c_str());
        str.str(std::string());

        str << "Height = " << height;
        IwGxPrintString(100, 600, str.str().c_str());
        str.str(std::string());

        IwGxFlush();
        IwGxSwapBuffers();
        s3eDeviceYield(0);
    }

    IwGxTerminate();

    s3ePointerUnRegister(S3E_POINTER_BUTTON_EVENT, (s3eCallback)buttonEvent);
    s3ePointerUnRegister(S3E_POINTER_MOTION_EVENT, (s3eCallback)motionEvent);

    shutdownWwise();

    return 0;
}
Пример #7
0
void buttonEvent(s3ePointerTouchEvent *event)
{
    IW_CALLSTACK("buttonEvent");

    if(event->m_Pressed)
    {
        s3eDebugOutputString("Posting Event \"Play_Hello\"");
        s3eWwiseSoundEnginePostEventWithID(AK::EVENTS::PLAY_HELLO, gameObjectID);

        s3eWwiseSoundEnginePostEventWithID(AK::EVENTS::PLAY_ENGINE, carID);
    }
    else
    {
        s3eWwiseSoundEnginePostEventWithID(AK::EVENTS::STOP_ENGINE, carID);
    }
}
Пример #8
0
static void s3eKiip_ReleaseReceivedContentCallback(uint32, int32, void*, void*, int32, void* pData )
{
	s3eDebugOutputString( "s3eKiip_ReleaseReceivedContentCallback" );
	
	s3eKiipReceivedContent* pItemData = (s3eKiipReceivedContent*) pData;
	
	if ( pItemData->content != NULL)	
		delete[] pItemData->content;

	if ( pItemData->transactionID != NULL)	
		delete[] pItemData->transactionID;

	if ( pItemData->signature != NULL)	
		delete[] pItemData->signature;

    delete[] pItemData;
}
Пример #9
0
void shutdownWwise()
{
    IW_CALLSTACK("shutdownWwise");

    s3eWwiseSoundEngineUnregisterAllGameObj();

    s3eWwiseSoundEngineClearBanks();

    s3eWwiseCommTerm();

    s3eWwiseMusicEngineTerm();

    s3eWwiseSoundEngineTerm();

    s3eWwiseStreamMgrDestroy(streamMgr);

    s3eWwiseMemoryMgrTerm();
    s3eDebugOutputString("Wwise Shutdown");
}
Пример #10
0
void JNICALL s3eKiip_contentReceivedCallback( JNIEnv* env, jobject obj, jobject param )
{
	s3eDebugOutputString("s3eKiip_contentReceivedCallback: start");

	s3eKiipReceivedContent* pItemData = new s3eKiipReceivedContent();
		
    jclass cls = env->FindClass( "com/s3eKiipExt//MainActivity$ReceivedContent" );
	
	if (env->ExceptionOccurred())
	{
		env->ExceptionDescribe();
		env->ExceptionClear();
	}
	
	pItemData->content			= StringFieldAccessor( env, cls, "content",			param );
	pItemData->quantity			= IntFieldAccessor(    env, cls, "quantity",		param );
	pItemData->transactionID	= StringFieldAccessor( env, cls, "transactionId",	param );
	pItemData->signature		= StringFieldAccessor( env, cls, "signature",		param );

	s3eEdkCallbacksEnqueue(	S3E_EXT_KIIP_HASH, S3EKIIP_CONTENT_RECEIVED, (void*)pItemData, 
		0 , NULL, false, &s3eKiip_ReleaseReceivedContentCallback, (void*)pItemData );
}
Пример #11
0
void Game::OutputLine(float i)
{
	char str[16];
	snprintf(str, 16, "%f", i);
	s3eDebugOutputString(str);
}
Пример #12
0
void CIwGameAds::AdImageReceived(CIwGameHttpRequest* request, int error)
{
	s3eDebugOutputString("Ad image received");
	
	// If there wwas an error then set the error
	if (error != 0)
	{
		IW_GAME_ADS->setError(ErrorHttpImage);
		IW_GAME_ADS->setErrorString("Http error retrieving image");
#if defined(_DEBUG)
		CIwGameError::LogError("Error: CIwGameAds::AdImageReceived(): ", CIwGameString(error).c_str());
#endif	// _DEBUG
	}
	else
	{
		eIwGameImageFormat format = GetImageFormatFromHeader();
		if (format == ImageFormatInvalid)
		{
			Error = ErrorInvalidImage;
			ErrorString = "Invalid image format";
		}
		else
		{
			Error = ErrorNone;
			ErrorString = "";

			AdInfo.ImageFormat = format;
#if defined(_DEBUG)
			CIwGameError::LogError("Info: CIwGameAds::AdImageReceived() - Image format - ", CIwGameString((int)format).c_str());
			CIwGameError::LogError("Info: CIwGameAds::AdImageReceived() - Image URL - ", AdInfo.ImageURI.c_str());
			CIwGameError::LogError("Info: CIwGameAds::AdImageReceived() - Link URL - ", AdInfo.LinkURI.c_str());
#endif	// _DEBUG

			// Delete previous image (if any)
			if (AdInfo.Image != NULL)
			{
				delete AdInfo.Image;
				AdInfo.Image = NULL;
			}

			// Create new banner image
			AdInfo.Image = new CIwGameImage();
			if (!AdInfo.Image->Init((void*)request->getContent().c_str(), request->getContentLength()))
			{
#if defined(_DEBUG)
				CIwGameError::LogError("Info: CIwGameAds::AdImageReceived() - Could hot create image!");
#endif	// _DEBUG
				Error = ErrorInvalidImage;
				ErrorString = "Invalid image format";
				delete AdInfo.Image;
				AdInfo.Image = NULL;
			}
			else
			{
CIwGameError::LogError("Info: Image Width - ", CIwGameString(AdInfo.Image->getWidth()).c_str());
CIwGameError::LogError("Info: Image Height - ", CIwGameString(AdInfo.Image->getHeight()).c_str());
			}
		}
	}
	NotifyAdAvailable();
}
Пример #13
0
void CIwGameXmlNode::PrintTree(int level)
{
	for (int t = 0; t < level; t++)
	{
		s3eDebugOutputString("\t");
	}
	s3eDebugOutputString("<");
	s3eDebugOutputString(Name.c_str());
	PrintAttributes();
	if (HasValue)
	{
		if (Value.GetLength() == 0)
			s3eDebugOutputString(" />\n");
		else
		{
			s3eDebugOutputString(">");
			s3eDebugOutputString(Value.c_str());
		}
	}
	else
	{
		s3eDebugOutputString(">\n");
		for (CIwGameXmlNodeList::iterator i = Children.begin(); i != Children.end(); ++i)
			(*i)->PrintTree(level + 1);
		for (int t = 0; t < level; t++)
			s3eDebugOutputString("\t");
	}
//	if (Value.GetLength() > 0 || Value.c_str() == NULL)
	if (Value.GetLength() > 0 || !HasValue)
	{
		s3eDebugOutputString("</");
		s3eDebugOutputString(Name.c_str());
		s3eDebugOutputString(">\n");
	}
}
Пример #14
0
int main()
{
    // Initialise the 2D graphics system
    Iw2DInit();

    // Create an image from a PNG file
    CIw2DImage* image = Iw2DCreateImage("textures/Tiles.png");
		
	//Avatar bits
	AnimationData testData;
	testData.animationName = "Up";
	testData.animationPosition = 0;
	testData.frameHeight = 64;
	testData.frameWidth = 32;
	testData.numberOfFrames = 4;

	AnimationData testData2;
	testData2.animationName = "Right";
	testData2.animationPosition = 64;
	testData2.frameHeight = 64;
	testData2.frameWidth = 32;
	testData2.numberOfFrames = 4;

	Animation* animation = new Animation("textures/AvatarTest.png",testData);
	Animation* animation2 = new Animation("textures/AvatarTest.png",testData2);

	s3eFile* file = s3eFileOpen("tilemaps/tilemapdemo.json", "rb");
	int len = s3eFileGetSize(file);
	char* rawTileJSON = new char[len];
	if (file != NULL)
	{
		if (s3eFileRead(rawTileJSON, len, 1, file) != 1)
		{
			s3eFileGetError();
			s3eDebugOutputString(s3eFileGetErrorString());
		}
		s3eFileClose(file);
	}
	else
	{
		s3eFileGetError();
		s3eDebugOutputString(s3eFileGetErrorString());
	}

	cJSON *root = cJSON_Parse(rawTileJSON);
	int gridHeight = cJSON_GetObjectItem(root,"height")->valueint;
	int gridWidth = cJSON_GetObjectItem(root,"width")->valueint;
	int tileWidth = cJSON_GetObjectItem(root,"tileheight")->valueint;
	int tileHeight = cJSON_GetObjectItem(root,"tilewidth")->valueint;
	cJSON *layers = cJSON_GetObjectItem(root,"layers");

	cJSON *tileData;
	int i;
	for (i = 0; i<cJSON_GetArraySize(layers); i++)
	{
		cJSON *layer = cJSON_GetArrayItem(layers,i);
		tileData = cJSON_GetObjectItem(layer,"data");
	}



    // Loop forever, until the user or the OS performs some action to quit the app
    while (!s3eDeviceCheckQuitRequest())
    {
        // Clear the drawing surface
        Iw2DSurfaceClear(0xff000000);

		int x,y,tileIndex,tileType;
		for( y = 0; y < gridHeight; y++)
		{
			for(x = 0; x < gridWidth; x++)
			{
				tileIndex = (y * gridWidth) + x;
				tileType = cJSON_GetArrayItem(tileData,tileIndex)->valueint -1;
				// Draw an image
				Iw2DDrawImageRegion(image, CIwFVec2(x*tileWidth,y*tileHeight),CIwFVec2(tileWidth,tileHeight),CIwFVec2(tileType*tileWidth,0),CIwFVec2(tileWidth,tileHeight));
			}
		}
		animation->render(50,50);
		animation2->render(150,200);
        // Show the drawing surface
        Iw2DSurfaceShow();
		
        // Yield to the OS
        s3eDeviceYield(0);
    }

	cJSON_Delete(root);

    // Clean-up
	delete rawTileJSON;
    delete image;
	delete animation;
	delete animation2;
    Iw2DTerminate();

    return 0;
}
s3eResult IsChartboostInit_platform()
{
	s3eDebugOutputString("IsChartboostInit_platform");
    // Get the environment from the pointer
    JNIEnv* env = s3eEdkJNIGetEnv();
    jobject obj = NULL;
    jmethodID cons = NULL;
    jclass cls;
    jfieldID  field;
	char g_AppID[255];
	char g_AppSignature[255];

	const JNINativeMethod nativeMethodDefs[] =
    {
		{ "IsChartboostRequestCallback",				"(I)V",			(void*)&IsChartboostRequestCallback },
		{ "IsChartboostAdClosedCallback",				"(I)V",			(void*)&IsChartboostAdClosedCallback },
		{ "IsChartboostAdDismissedRequestCallback",				"(I)V",			(void*)&IsChartboostAdDismissedRequestCallback },
		{ "IsChartboostAdClickedRequestCallback",				"(I)V",			(void*)&IsChartboostAdClickedRequestCallback },
	};

    
    // Get the extension class
    cls = s3eEdkAndroidFindClass("com/isextension/IsChartboost");
    if (!cls)
        goto fail;

    // Setup and cache the Activity Field
    field = env->GetStaticFieldID(cls, "m_Activity", "Lcom/isextension/IsChartboost;");
    if (!field)
        goto fail;

    obj = env->GetStaticObjectField(cls, field);
    if (!obj)
        goto fail;
        
    // Get all the extension methods
    g_IsChartboostSetAppID = env->GetMethodID(cls, "IsChartboostSetAppID", "(Ljava/lang/String;)V");
    if (!g_IsChartboostSetAppID)
        goto fail;

    g_IsChartboostSetAppSignature = env->GetMethodID(cls, "IsChartboostSetAppSignature", "(Ljava/lang/String;)V");
    if (!g_IsChartboostSetAppSignature)
        goto fail;

    g_IsChartboostStartSession = env->GetMethodID(cls, "IsChartboostStartSession", "()V");
    if (!g_IsChartboostStartSession)
        goto fail;

    g_IsChartboostRequestAd = env->GetMethodID(cls, "IsChartboostRequestAd", "()V");
    if (!g_IsChartboostRequestAd)
        goto fail;

    g_IsChartboostCacheInterstitial = env->GetMethodID(cls, "IsChartboostCacheInterstitial", "(Ljava/lang/String;)V");
    if (!g_IsChartboostCacheInterstitial)
        goto fail;

    g_IsChartboostShowInterstitial = env->GetMethodID(cls, "IsChartboostShowInterstitial", "(Ljava/lang/String;)V");
    if (!g_IsChartboostShowInterstitial)
        goto fail;

    g_IsChartboostCacheMoreApps = env->GetMethodID(cls, "IsChartboostCacheMoreApps", "()V");
    if (!g_IsChartboostCacheMoreApps)
        goto fail;

    g_IsChartboostShowMoreApps = env->GetMethodID(cls, "IsChartboostShowMoreApps", "()V");
    if (!g_IsChartboostShowMoreApps)
        goto fail;

    if(env->RegisterNatives(cls, nativeMethodDefs, sizeof(nativeMethodDefs)/sizeof(nativeMethodDefs[0])))
		goto fail;

    IwTrace(CHARTBOOST, ("CHARTBOOST init success"));
    g_Obj = env->NewGlobalRef(obj);

    env->DeleteLocalRef(obj);
    env->DeleteGlobalRef(cls);
    // Add any platform-specific initialisation code here
    return S3E_RESULT_SUCCESS;

fail:
    jthrowable exc = env->ExceptionOccurred();
    if (exc)
    {
        env->ExceptionDescribe();
        env->ExceptionClear();
        IwTrace(IsChartboost, ("One or more java methods could not be found"));
    }
    return S3E_RESULT_ERROR;

}
Пример #16
0
void initWwise()
{
    IW_CALLSTACK("initWwise");

    if (!s3eWwiseAvailable())
    {
        s3eDebugOutputString("Can't load Wwise");
        s3eDebugOutputString(s3eExtGetErrorString());
        return;
    }

    s3eDebugOutputString("Successfully loaded s3eWwise extension");

    s3eWwiseMemSettings memSettings;
    memSettings.uMaxNumPools = 10;

    s3eWwiseResult memoryMgr = s3eWwiseMemoryMgrInit(&memSettings);
    if(memoryMgr  != s3eWwise_Success )
        s3eDebugTracePrintf("Failed to init Wwise memory manager. Error code = %d", memoryMgr);
    else
        s3eDebugOutputString("Wwise memory manager init");

    s3eWwiseStreamMgrSettings streamSettings;
    s3eWwiseStreamMgrGetDefaultSettings(&streamSettings);
    streamMgr = s3eWwiseStreamMgrCreate(&streamSettings);
    s3eDebugOutputString(streamMgr ? "Wwise stream manager init" : "FAILED TO INIT STREAM");

    s3eWwiseInitSettings settings;
    s3eWwisePlatformInitSettings platformSettings;
    s3eWwiseSoundEngineGetDefaultInitSettings(&settings);
    s3eWwiseSoundEngineGetDefaultPlatformInitSettings(&platformSettings);
    s3eWwiseResult soundEngine = s3eWwiseSoundEngineInit(&settings, &platformSettings);
    if(soundEngine  != s3eWwise_Success )
        s3eDebugTracePrintf("Failed to init Wwise. Error code = %d", soundEngine);
    else
        s3eDebugOutputString("Init Wwise Successfully");

    s3eWwiseMusicSettings musicSettings;
    s3eWwiseMusicEngineGetDefaultInitSettings(&musicSettings);
    s3eWwiseResult musicEngine = s3eWwiseMusicEngineInit(&musicSettings);
    if( musicEngine != s3eWwise_Success )
        s3eDebugTracePrintf("Failed to init music. Error code = %d", musicEngine);
    else
        s3eDebugOutputString("Init Music Successfully");

    s3eWwiseCommSettings commSettings;
    s3eWwiseCommGetDefaultInitSettings(&commSettings);
    s3eWwiseResult commEngine = s3eWwiseCommInit(&commSettings);
    if( commEngine != s3eWwise_Success )
    {
        std::stringstream ss;
        ss << "Failed to Init Comm: error code = " << commEngine;
        s3eDebugOutputString(ss.str().c_str());
    }
    else
        s3eDebugOutputString("Init Comm Successfully");

    s3eWwiseBankID bankId;

    // Setup paths
    s3eWwiseStreamMgrSetCurrentLanguage("French(Canada)");
    s3eWwiseLowLevelIOSetBasePath("Audio/iOS/");

    s3eDebugOutputString("Path setup done");

    ///s3eWwiseResult loadInit = s3eWwiseSoundEngineLoadBankWithID(AK::BANKS::INIT, S3E_WWISE_DEFAULT_POOL_ID);
    s3eWwiseResult loadInit = s3eWwiseSoundEngineLoadBankNamed("Init.bnk", S3E_WWISE_DEFAULT_POOL_ID, &bankId);
    if(loadInit  != s3eWwise_Success )
    {
        s3eDebugOutputString("Failed to load sound bank");
        s3eDebugTracePrintf("Error code = %d", loadInit);
    }
    else
        s3eDebugOutputString("Loaded sound bank");

    //s3eWwiseResult loadHuman = s3eWwiseSoundEngineLoadBankWithID(AK::BANKS::HUMAN, S3E_WWISE_DEFAULT_POOL_ID);
    s3eWwiseResult loadHuman = s3eWwiseSoundEngineLoadBankNamed("Human.bnk", S3E_WWISE_DEFAULT_POOL_ID, &bankId);
    if( loadHuman != s3eWwise_Success )
    {
        s3eDebugOutputString("Failed to load sound bank");
        s3eDebugTracePrintf("Error code = %d", loadHuman);
    }
    else
        s3eDebugOutputString("Loaded sound bank");

    s3eWwiseResult loadCar = s3eWwiseSoundEngineLoadBankNamed("Car.bnk", S3E_WWISE_DEFAULT_POOL_ID, &bankId);
    if( loadCar != s3eWwise_Success )
    {
        s3eDebugOutputString("Failed to load sound bank");
        s3eDebugTracePrintf("Error code = %d", loadCar);
    }
    else
        s3eDebugOutputString("Loaded sound bank");

    s3eWwiseSoundEngineRegisterGameObjWithName(gameObjectID, "Human");
    s3eWwiseSoundEngineRegisterGameObj(carID);
}