Crystal Space
Welcome, Guest. Please login or register.
October 19, 2017, 01:34:30 pm

Login with username, password and session length
Search:     Advanced search
9063 Posts in 2051 Topics by 77272 Members
Latest Member: Sabrina275
* 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 3459 times)
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):

bool Game::LoadLevel() {
level_entity = pl->CreateEntity("level", bl, "level_behave",
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");

// Create level from XML file
iCelMapFile* mapfile = region->CreateMapFile();

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...
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 5.999 seconds with 17 queries.