Пример #1
0
void Editor::update(float interval)
{
	switch (mState)
	{
	case STATE_TESTING:
		if (wasKeyPressed(KEY_ESC))
		{
			disableTestMode();
		}

		updateBall(mBall, interval);
		break;
	case STATE_EDITING:
	{
		Vector3 markerPos;

		if (wasKeyPressed(KEY_ESC))
		{
			Main::pushState(mScreenEditorMain);
		}

		if (wasKeyPressed(KEY_ENTER))
		{
			enableTestMode();
		}

		Vector3 min(gCurStart.x + 0.5f, gCurStart.y + 0.5f, 0.0f);
		Vector3 max(gCurEnd.x + 0.5f, gCurEnd.y + 0.5f, 0.0f);
		KdRangeTraverse iter(*sgLevel.kdLevelTree, min, max);
		KdList list(iter);

		markerPos.x = (gCurStart.x + gCurEnd.x) / 2.0f + 0.5f;
		markerPos.y = (gCurStart.y + gCurEnd.y) / 2.0f + 0.5f;

		if (list.next())
		{
			markerPos.z = (float) sgLevel.blocks[*list].z / HEIGHT_STEPS;
		}
		else
		{
			markerPos.z = (float) 0.0f;
		}

		updateEditorCamera(interval, add(markerPos, sgLevel.origin));
		animateEditor(interval);
		break;
	}
	default:
		break;
	}
}
Пример #2
0
void updateRoomEditor(void)
{
	touchRead(&currentTouch);
	
	if(!currentScreen)
	{
		updateLineOfTouch(currentTouch.px-128, currentTouch.py-96);
		updateEditorCamera();
		if(!updateContextButtons(&currentTouch))
		{
			roomEditorCursor(NULL);
		}
		updateSelection(NULL);
	}else{
		updateInterfaceButtons(oldTouch.px,oldTouch.py); //TEMP
	}

	roomEditorControls();

	oldTouch=currentTouch;
}