//-----------------------------------------------------------------------------
void ExampleInit()
{
    // Startapp:
	if (s3eDeviceGetInt(S3E_DEVICE_OS) == S3E_OS_ID_ANDROID)
	{
		if(startappAvailable())
		{
			initSDK(STARTAPP_DEVID, STARTAPP_APPID); 
		}
	}
	
	//Initialise the IwUI module
    IwUIInit();

    //Instantiate the view and controller singletons.
    //IwUI will not instantiate these itself, since they can be subclassed to add functionality.
    new CIwUIController;
    new CIwUIView;

    //Load group which contains the ui specifications
    IwGetResManager()->LoadGroup("IwUIBasicButtonEvents.group");

    //Load button
    s_Button = (CIwUIButton*) CIwUIElement::CreateFromResource("EventButton");

    //Attach eventhandler to button
    s_Button->AddEventHandler(new MyButtonEventHandler);

    //Add the label to the UIView singleton
    IwGetUIView()->AddElement(s_Button);
}
//-----------------------------------------------------------------------------
void ExampleShutDown()
{
    delete IwGetUIController();
    delete IwGetUIView();

    //Terminate the IwUI module
    IwUITerminate();
}
Beispiel #3
0
int main()
{
	
	//s3eInetAddress addr;
	//memset(&addr, 0, sizeof(addr));
	//s3eInetLookup("localhost", &addr, NULL, NULL);
	//addr.m_Port = s3eInetHtons(81);

	//s3eSocket* pSock = s3eSocketCreate(S3E_SOCKET_UDP, 0);
	//char szData[20000];
	//for (int i=0; i <20000;++i)
	//{
	//	szData[i] = i;
	//}
	//while (true)
	//{
	//	int sent = s3eSocketSendTo(pSock, szData, 20000, 0, &addr);
	//	s3eDeviceYield(0);
	//}

	s3eLocationStart();

	//IwGx can be initialised in a number of different configurations to help the linker eliminate unused code.
	//For the examples we link in all of IwGx's possible functionality.
	//You can see the code size reduce if you remove any of the IwGxInit calls following IwGxInit_Base.
	//Note that, for demonstration purposes, some examples call IwGxInit() themselves - this will link in the 
	//standard renderer and the GL renderer, so on those examples these features cannot be excluded from the build.
	//IwGxInit_Base();
	//IwGxInit_GLRender();
	IwGxInit();

	Iw2DInit();
	IwUIInit();

	//Instantiate the view and controller singletons.
	//IwUI will not instantiate these itself, since they can be subclassed to add functionality.
	new CIwUIView;
	CIwUIController2* pController = new CIwUIController2;

	IwDebugTraceLinePrintf("Creating Game Object");
	FireflyGameEngine* pGameEngine = new FireflyGameEngine;
	IwDebugTraceLinePrintf("Entering Main");
	int result = GameMain(pGameEngine);
	delete pGameEngine;

	Iw2DTerminate();
	
	delete IwGetUIView();
	delete pController;
	IwUITerminate();
	IwGxTerminate();
	s3eLocationStop();


	return result;
}
//-----------------------------------------------------------------------------
void ExampleRender()
{
    //Render the UI
    IwGetUIView()->Render();

    //Flush IwGx
    IwGxFlush();

    //Display the rendered frame
    IwGxSwapBuffers();
}
//-----------------------------------------------------------------------------
bool ExampleUpdate()
{
    //Update the controller (this will generate control events etc.)
    IwGetUIController()->Update();

    //Update the view (this will do animations etc.) The example framework has
    //a fixed framerate of 20fps, so we pass that duration to the update function.
    IwGetUIView()->Update(1000/20);

    return true;
}