void eUSPInstance::Update(int32_t result)
{
	pp::Module::Get()->core()->CallOnMainThread(17, callback.NewRequiredCallback(&eUSPInstance::Update));
	Handler()->OnLoop();
	audio.Update();
	Draw();
}
void eUSPInstance::HandleMessage(const pp::Var& _m)
{
	if(!_m.is_string())
		return;
	string m = _m.AsString();
	if(m == "run")
	{
		xPlatform::Handler()->OnInit();
		inited = true;
		Update();
		audio.Play();
		PostMessage("ready");
	}
	if(!inited)
		return;
	static const string open("open:");
	static const string joystick("joystick:");
	if(m.length() > open.length() && m.substr(0, open.length()) == open)
	{
		string url = m.substr(open.length());
		new eURLLoader(this, url, this);
	}
	else if(m.length() > joystick.length() && m.substr(0, joystick.length()) == joystick)
	{
		using namespace xOptions;
		string joy = m.substr(joystick.length());
		eOption<int>* op_joy = eOption<int>::Find("joystick");
		SAFE_CALL(op_joy)->Value(joy.c_str());
	}
	else if(m == "reset")
	{
		Handler()->OnAction(A_RESET);
	}
}
Example #3
0
bool eUSPInstance::Init(uint32_t argc, const char* argn[], const char* argv[])
{
    RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE);
	RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_KEYBOARD);
	LoadResources(this);
	audio.Init(this);
	return true;
}
Example #4
0
void eUSPInstance::Update(int32_t result)
{
	pp::Module::Get()->core()->CallOnMainThread(17, callback.NewCallback(&eUSPInstance::Update));
	if(gamepad)
	{
		PP_GamepadsSampleData gamepad_data;
		gamepad->Sample(pp_instance(), &gamepad_data);
		UpdateGamepads(gamepad_data, gamepad_data_prev);
		gamepad_data_prev = gamepad_data;
	}
	Handler()->OnLoop();
	audio.Update();
	Draw();
}
bool eUSPInstance::Init(uint32_t argc, const char* argn[], const char* argv[])
{
	LoadResources(this);
	audio.Init(this);
	return true;
}
void OnLoopSound()
{
	static eAudio audio;
	audio.Update();
}