Crystal Space
Welcome, Guest. Please login or register.
April 19, 2014, 11:09:33 am

Login with username, password and session length
Search:     Advanced search
8990 Posts in 2037 Topics by 7597 Members
Latest Member: Drukareczka1989
* Home Help Search Login Register
+  Crystal Space
|-+  Associate Projects
| |-+  CEL Discussion
| | |-+  Picking/HitBeam on an iCelMapFile, and absolute mouse position
« previous next »
Pages: [1] Print
Author Topic: Picking/HitBeam on an iCelMapFile, and absolute mouse position  (Read 2420 times)
Newton64
Newbie
*
Posts: 21


View Profile Email
« on: September 04, 2008, 02:49:32 am »

A few more (probably) simple questions, the answers to which I can't seem to find anywhere.

Again in keeping with the WalkTut tutorial, I have my level entity using a zonemanager to load a predefined level (just a textured cube, to start with):

Code:
bool Game::LoadLevel() {
level_entity = pl->CreateEntity("level", bl, "level_behave",
"pcinput.standard",
"pcworld.zonemanager",
"pcobject.mesh",
"pcobject.mesh.select",
CEL_PROPCLASS_END);
if(!level_entity)
return app->ReportError("Error creating level entity!");

// Now get the iPcZoneManager interface so we can setup the level.
csRef<iPcZoneManager> zonemgr = CEL_QUERY_PROPCLASS_ENT(level_entity, iPcZoneManager);
iCelZone* zone = zonemgr->CreateZone("main");
iCelRegion* region = zonemgr->CreateRegion("main");
zone->LinkRegion(region);

// Create level from XML file
iCelMapFile* mapfile = region->CreateMapFile();
mapfile->SetPath("/this/entities");
mapfile->SetFile("level");

return true;
}

I want to be able to detect when someone clicks on the cube, so I can move the character wherever the user clicks. I've included pcMesh and pcMeshSelect for this. However, I'm loading the map using CreateMapFile(), and I'm not sure how to "pass" the resulting cube mesh to pcMeshSelect, or if it's even possible to access the loaded mesh from my level_entity (ZoneManagers, Zones, Regions...couldn't find anything referring to a mesh). Is it possible to use CEL for this, or will I have to refer back to regular CS to use the sector/HitBeam combo?

Second, in CEL, is there an easy way to get the dimensions of the window, and/or the exact position of the mouse? I know I can use pcinput to capture MouseX/Y, but that's just the amount of relative motion; and of course MouseX/Y_Centered in relation to the centre of the window. Come to think of it, I suppose getting the absolute mouse position could be a combination of these things...
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 4.248 seconds with 15 queries.