示例#1
0
// This is called just after the constructor when your object has been created.  Construct has set
// up your object here so it is safe to make runtime calls.
void ExtObject::OnCreate()
{
	// Load the edittime data that was serialized.
	bin ar;
	ar.attach(info.editObject->eData, info.editObject->eSize);

	// Read the data.  Same format as you exported in EditExt::Serialize.
	// Your runtime loader must be able to load all versions!
	int Version = 0;
	ar >> Version;


	// Set default dimensions
	info.x = info.editObject->eX;
	info.y = info.editObject->eY;
	info.w = info.editObject->eWidth;
	info.h = info.editObject->eHeight;
	info.angle = 0.0f;

	// Update bounding box
	pRuntime->UpdateBoundingBox(this);

	for(int i = 0; i < 4; i++)
	{
		Player[i] = new CXBOXController(i+1);
	}

	Control editControl;
	for(int i = 0; i < CONTROLLERS; i++)
		for(int j = 0; j < BUTTONS; j++)
		{
			ar >> editControl;
			if(editControl.control != "")
			{
				controls.push_back(RunControl(editControl, i, (XBoxControl::Control)j));
			}
		}


	// Finished reading data
	ar.detach();
	//Player1->Vibrate(65535, 0);
	deadzone=0.2;
}
示例#2
0
文件: Runtime.cpp 项目: Luomu/Wiimote
// This is called just after the constructor when your object has been created.  Construct has set
// up your object here so it is safe to make runtime calls.
void ExtObject::OnCreate()
{
	//int myValue;
	int remoteNumber;
	calcX = 1.f;
	calcY = 1.f;

	// Load the edittime data that was serialized.
	bin ar;
	ar.attach(info.editObject->eData, info.editObject->eSize);

	// Read the data.  Same format as you exported in EditExt::Serialize.
	// Your runtime loader must be able to load all versions!
	int Version = 0;
	ar >> Version;
	//ar >> myValue;
	ar >> remoteNumber;

	//controls
	Control editControl;
	for(int i = 0; i < BUTTONS; i++) {
		ar >> editControl;
		if(editControl.control != "")
			controls.push_back(RunControl(editControl, 0, (Wii::Buttons)i));
		ButtonStates[i] = WiiButtonState::UP;
	}

	// Finished reading data
	ar.detach();

	// Set default dimensions
	info.x = info.editObject->eX;
	info.y = info.editObject->eY;
	info.w = info.editObject->eWidth;
	info.h = info.editObject->eHeight;
	info.angle = 0.0f;

	// Update bounding box
	pRuntime->UpdateBoundingBox(this);
}