Beispiel #1
0
	void ResourceW32Pointer::deserialization(MyGUI::xml::ElementPtr _node, MyGUI::Version _version)
	{
		Base::deserialization(_node, _version);

		MyGUI::xml::ElementEnumerator info = _node->getElementEnumerator();
		while (info.next())
		{
			if (info->getName() == "Property")
			{
				const std::string& key = info->findAttribute("key");

				if (key == "SourceFile")
				{
					std::string path = MyGUI::DataManager::getInstance().getDataPath(info->getContent());
					mHandle = (size_t)LoadCursorFromFileA(path.c_str());
				}
				else if (key == "SourceSystem")
				{
					std::string value = info->getContent();
					if (value == "IDC_ARROW")
						mHandle = (size_t)::LoadCursor(NULL, IDC_ARROW);
					else if (value == "IDC_IBEAM")
						mHandle = (size_t)::LoadCursor(NULL, IDC_IBEAM);
					else if (value == "IDC_WAIT")
						mHandle = (size_t)::LoadCursor(NULL, IDC_WAIT);
					else if (value == "IDC_CROSS")
						mHandle = (size_t)::LoadCursor(NULL, IDC_CROSS);
					else if (value == "IDC_UPARROW")
						mHandle = (size_t)::LoadCursor(NULL, IDC_UPARROW);
					else if (value == "IDC_SIZE")
						mHandle = (size_t)::LoadCursor(NULL, IDC_SIZE);
					else if (value == "IDC_ICON")
						mHandle = (size_t)::LoadCursor(NULL, IDC_ICON);
					else if (value == "IDC_SIZENWSE")
						mHandle = (size_t)::LoadCursor(NULL, IDC_SIZENWSE);
					else if (value == "IDC_SIZENESW")
						mHandle = (size_t)::LoadCursor(NULL, IDC_SIZENESW);
					else if (value == "IDC_SIZEWE")
						mHandle = (size_t)::LoadCursor(NULL, IDC_SIZEWE);
					else if (value == "IDC_SIZENS")
						mHandle = (size_t)::LoadCursor(NULL, IDC_SIZENS);
					else if (value == "IDC_SIZEALL")
						mHandle = (size_t)::LoadCursor(NULL, IDC_SIZEALL);
					else if (value == "IDC_NO")
						mHandle = (size_t)::LoadCursor(NULL, IDC_NO);
					else if (value == "IDC_HAND")
						mHandle = (size_t)::LoadCursor(NULL, IDC_HAND);
					else if (value == "IDC_APPSTARTING")
						mHandle = (size_t)::LoadCursor(NULL, IDC_APPSTARTING);
					else if (value == "IDC_HELP")
						mHandle = (size_t)::LoadCursor(NULL, IDC_HELP);
				}
			}
		}
	}
Beispiel #2
0
void GameState::Init()
{
	mCamera = mApp->CreateCamera();

	//put loading code here.
	mApp->CreateImage("../data/SelectionRing.png", "SelectionRing");
	mApp->CreateImage("../data/Predator.png", "Predator");
	mApp->CreateImage("../data/Prey.png", "Prey");
	mApp->CreateImage("../data/ChuckNorris.png", "Chuck Norris");
	mApp->CreateImage("../data/Rage.png", "Rage");
	mApp->CreateImage("../data/Grass.png" , "Grass");
	mApp->CreateImage("../data/WOD.png", "WOD");
	mApp->CreateImage("../data/High.png", "High");
	mApp->CreateImage("../data/Moose.png", "Moose");

	mObjectManager = new ObjectManager(mApp);

	mEnvironment = new Environment(mApp);
	mEnvironment->Init();
	mEnvironment->SetEnvState(esClear);

	mPredators = new Predator*[ENTITY_LISTSIZE];
	for (int i = 0; i < ENTITY_LISTSIZE; i ++)
	{
		mPredators[i] = new Predator(mApp, "Predator");
		mPredators[i]->SetSize(32, 32);
		mPredators[i]->SetPosition(float(rand()%1600), float(rand()%1600));

		if (i < NumPredators)
			mPredators[i]->SetAlive(true);
		else
			mPredators[i]->SetAlive(false);

		int Gender = rand()%2;
		if (Gender)
			mPredators[i]->SetGender(true);
		else
			mPredators[i]->SetGender(false);

		mObjectManager->AddObject(mPredators[i]);
	}
	mMoose = new Moose*[ENTITY_LISTSIZE];
	for (int i = 0;i < ENTITY_LISTSIZE; i ++)
	{
		mMoose[i] = new Moose(mApp, "Moose");
		mMoose[i]->SetSize(32,32);
		mMoose[i]->SetPosition(float(rand()%1600), float(rand()%1600));

		if (i < NumMoose)
			mMoose[i]->SetAlive(true);
		else
			mMoose[i]->SetAlive(false);

		int Gender = rand()%2;
		if (Gender)
			mMoose[i]->SetGender(true);
		else
			mMoose[i]->SetGender(false);
		mObjectManager->AddObject(mMoose[i]);
	}
	mPrey = new Prey*[ENTITY_LISTSIZE];

	for (int i = 0; i < ENTITY_LISTSIZE; i++)
	{
		mPrey[i] = new Prey(mApp,"Prey");
		mPrey[i]->SetSize(32,32);
		mPrey[i]->SetPosition(float(rand()%1600), float(rand()%1600));
		mPrey[i]->SetAlive(false);
		if (i %5 == 0)
		{
			mPrey[i]->MakeLeader(true);
		}
		else
		{
			mPrey[i]->MakeLeader(false);
		}

		if (i<NumPrey)
			mPrey[i]->SetAlive(true);
		mObjectManager->AddObject(mPrey[i]);
		mPrey[i]->SetID(i);
	}

	mChucklets = new Chuck_Norris*[ENTITY_LISTSIZE];
	for (int i = 0; i < ENTITY_LISTSIZE; i++)
	{
		mChucklets[i] = new Chuck_Norris(mApp,"Chuck Norris");
		mChucklets[i]->SetSize(32,32);
		mChucklets[i]->SetPosition(float(rand()%1600), float(rand()%1600));
		mChucklets[i]->SetAlive(false);
		if (i<NumChucks)
			mChucklets[i]->SetAlive(true);

		mChucklets[i]->SetGender(GENDER_MALE);
		mObjectManager->AddObject(mChucklets[i]);
	}
	mGrass = new Grass*[ENTITY_LISTSIZE];
	for (int i = 0; i < ENTITY_LISTSIZE; i++)
	{
		mGrass[i] = new Grass(mApp,"Grass");
		mGrass[i]->SetSize(32,32);
		mGrass[i]->SetPosition(float(rand()%1600), float(rand()%1600));
		mGrass[i]->SetAlive(false);
		if ( i < 150 )
		{
			mGrass[i]->SetAlive(true);
		}
		mObjectManager->AddObject(mGrass[i]);
	}

	int j = 0;
	mAllTargets = new Entity* [ENTITY_LISTSIZE*5];
	for (int i = 0; i < ENTITY_LISTSIZE*5; i++)
	{
		if (i < ENTITY_LISTSIZE)
			mAllTargets[i] = mPredators[j];
		else if (i < ENTITY_LISTSIZE * 2)
			mAllTargets[i] = mPrey[j];
		else if (i < ENTITY_LISTSIZE * 3)
			mAllTargets[i] = mGrass[j];
		else if (i < ENTITY_LISTSIZE * 4)
			mAllTargets[i] = mChucklets[j];
		else if (i < ENTITY_LISTSIZE * 5)
			mAllTargets[i] = mMoose[j];

		j++;
		if (j >= ENTITY_LISTSIZE)
			j = 0;
	}
	NewPrey = new Entity*[ENTITY_LISTSIZE*2];
	for (int i = 0; i<ENTITY_LISTSIZE; i++)
	{
		NewPrey[i] = mChucklets[i];
	}
	for (int i = 0; i<ENTITY_LISTSIZE; i++)
	{
		NewPrey[i+ENTITY_LISTSIZE] = mPredators[i];
	}
	mTileGenerator = new TileGenerator(mApp);
	mTileGenerator->LoadTiles("../data/Tileset.png");
	mTileGenerator->GenerateTiles(50, 50);
	mObjectManager->AddTiledMap(mTileGenerator);
	ProcessMessage(MessageCheck);

	//Loading hardware cursors.
	cFingerPoint = LoadCursorFromFileA("../data/MightyHandPoint.cur");
	cFingerDown = LoadCursorFromFileA("../data/MightyHandPointDown.cur");
	cHand = LoadCursorFromFileA("../data/MightyHand.cur");
	cHandGrab = LoadCursorFromFileA("../data/MightyHandPick.cur");

	//Loading image cursors.
	iFingerPoint.Img = mApp->CreateImage("../data/MightyHandPoint.png", "CursorFinger"); iFingerPoint.Img->SetSize(32,32); iFingerPoint.X = 8; iFingerPoint.Y = 10;
	iFingerDown.Img = mApp->CreateImage("../data/MightyHandPointDown.png", "CursorFingerDown"); iFingerDown.Img->SetSize(32,32); iFingerDown.X = 8; iFingerDown.Y = 10;
	iHand.Img = mApp->CreateImage("../data/MightyHand.png", "CursorHand"); iHand.X = 14; iHand.Y = 10;
	iHandGrab.Img = mApp->CreateImage("../data/MightyHandPick.png", "CursorHandGrab"); iHandGrab.X = 14; iHandGrab.Y = 10;

	if (!USEHWMOUSE)
		ShowCursor(FALSE);

	mMinimap = new Minimap(mApp);
	mMinimap->SetPosition(800 - 180, 10);

	mStatusPane = new StatusPane(mApp);
	mStatusPane->SetPosition(800-180, 20 + 160);

	mToolbar = new Toolbar(mApp);
	mToolbar->SetPosition((800 - 260)/2, 600 - 70 - 10);

	mEnvironmentPanel = new EnvironmentPanel(mApp);
	mEnvironmentPanel->SetPosition(800-180, 20 + 160 + 200 + 10);

	mDisasterPanel = new Disaster(mApp);
	mDisasterPanel->SetPosition(0, 0);

	Mode = 0;

	//no loading code beyond this point.
}
Beispiel #3
0
TkCursor *
TkGetCursorByName(
    Tcl_Interp *interp,		/* Interpreter to use for error reporting. */
    Tk_Window tkwin,		/* Window in which cursor will be used. */
    Tk_Uid string)		/* Description of cursor. See manual entry for
				 * details on legal syntax. */
{
    struct CursorName *namePtr;
    TkWinCursor *cursorPtr;
    int argc;
    const char **argv = NULL;

    /*
     * All cursor names are valid lists of one element (for
     * Unix-compatability), even unadorned system cursor names.
     */

    if (Tcl_SplitList(interp, string, &argc, &argv) != TCL_OK) {
	return NULL;
    }
    if (argc == 0) {
	goto badCursorSpec;
    }

    cursorPtr = (TkWinCursor *) ckalloc(sizeof(TkWinCursor));
    cursorPtr->info.cursor = (Tk_Cursor) cursorPtr;
    cursorPtr->winCursor = NULL;
    cursorPtr->system = 0;

    if (argv[0][0] == '@') {
	/*
	 * Check for system cursor of type @<filename>, where only the name is
	 * allowed. This accepts any of:
	 *	-cursor @/winnt/cursors/globe.ani
	 *	-cursor @C:/Winnt/cursors/E_arrow.cur
	 *	-cursor {@C:/Program\ Files/Cursors/bart.ani}
	 *      -cursor {{@C:/Program Files/Cursors/bart.ani}}
	 *	-cursor [list @[file join "C:/Program Files" Cursors bart.ani]]
	 */

	if (Tcl_IsSafe(interp)) {
	    Tcl_AppendResult(interp, "can't get cursor from a file in",
		    " a safe interpreter", NULL);
	    ckfree((char *) argv);
	    ckfree((char *) cursorPtr);
	    return NULL;
	}
	cursorPtr->winCursor = LoadCursorFromFileA(&(argv[0][1]));
    } else {
	/*
	 * Check for the cursor in the system cursor set.
	 */

	for (namePtr = cursorNames; namePtr->name != NULL; namePtr++) {
	    if (strcmp(namePtr->name, argv[0]) == 0) {
		cursorPtr->winCursor = LoadCursor(NULL, namePtr->id);
		break;
	    }
	}

	if (cursorPtr->winCursor == NULL) {
	    /*
	     * Hmm, it is not in the system cursor set. Check to see if it is
	     * one of our application resources.
	     */

	    cursorPtr->winCursor = LoadCursorA(Tk_GetHINSTANCE(), argv[0]);
	} else {
	    cursorPtr->system = 1;
	}
    }

    if (cursorPtr->winCursor == NULL) {
	ckfree((char *) cursorPtr);
    badCursorSpec:
	ckfree((char *) argv);
	Tcl_AppendResult(interp, "bad cursor spec \"", string, "\"", NULL);
	return NULL;
    } else {
	ckfree((char *) argv);
	return (TkCursor *) cursorPtr;
    }
}
Beispiel #4
0
/* MAKE_EXPORT LoadCursorFromFileW_new=LoadCursorFromFileW */
HCURSOR WINAPI LoadCursorFromFileW_new(LPCWSTR lpFileNameW)
{
	ALLOC_WtoA(lpFileName);

	return LoadCursorFromFileA(lpFileNameA);
}
Beispiel #5
0
HCURSOR  ZLoadCursorFromFileA( LPCSTR lpszFilename)
{
    return LoadCursorFromFileA(lpszFilename) ;
}