Game Development Community

OnRightMouseDown

by Chosen.Kyle · in Torque Game Engine · 11/15/2005 (10:21 pm) · 10 replies

So I followed the object slection code which works fine. Then I decided I would like to you right click aswell, which turns out to be a headache. I applied the same idea as onMouseDown. Though of course it doesnt work. I currently have:

class GameTSCtrl : public GuiTSCtrl
{
private:
typedef GuiTSCtrl Parent;
// object selection additions
Point3F mMouse3DVec;
Point3F mMouse3DPos;
public:
GameTSCtrl();

bool processCameraQuery(CameraQuery *query);
void renderWorld(const RectI &updateRect);

void onMouseMove(const GuiEvent &evt);
void onRender(Point2I offset, const RectI &updateRect);
// object selection additions
void onMouseDown(const GuiEvent &evt); //left-mouse click
void onRightMouseDown(const GuiEvent & event);
Point3F getMouse3DVec() {return mMouse3DVec;};
Point3F getMouse3DPos() {return mMouse3DPos;};

DECLARE_CONOBJECT(GameTSCtrl);
};
//------------------ .CC file--------------------------------//
void GameTSCtrl::onRightMouseDown(const GuiEvent & event)
{
Con::printf("right mouse");
Con::executef(this, 1, "onMouseRightDown");
}
void GameTSCtrl::onMouseDown(const GuiEvent & event)
{
Con::printf("leftmouse");
Con::executef(this, 1, "onMouseDown");
}

Where only "left mouse" is being echo'd :S!! Am I totaly blind? I doing this is 3rd person with CursorOn(). What am I doing wrong?

#1
11/15/2005 (10:53 pm)
Void onMouseDown(const GuiEvent &evt); //left-mouse click
void onRightMouseDown(const GuiEvent & event);


perhaps the &evt and & event? i dunno i saw that and thought it looked funny.
#2
11/16/2005 (6:57 am)
Yeh I don't think that matters too much but I tried it anyways and no go =(
#3
11/16/2005 (7:09 am)
I figured this one out a few months ago... don't have the code to hand but if I recall, I found that right mouse down events weren't even being passed to the GuiTSCtrl.
#4
11/16/2005 (9:57 am)
Hmm although EditTsCtrl I believe has right mouse events where it also uses GuiTSCtrl, Though Ill check in that area again.
#5
11/16/2005 (10:03 am)
There is already a RightMouse function, check your default.bind.cs file for details.
#6
11/16/2005 (10:14 am)
I know, I know!!!! make sure the profile for the gui has this set
canKeyFocus = true;
#7
11/16/2005 (10:36 am)
Dreamer, that of course was the first thing I tried. Though when the cursor is being displayed the mouse input doesn't get captured. Since GameTS does not capture all the mouse events. I figured I could use the mouseEventCtrl but I'd rather just code it for more customability.


Anthony, I will try that out when I get home i'd be nice if that was the issue.
#8
11/17/2005 (9:04 pm)
Alright tried that Anothny, didnt work. Still looking into this :S
#9
11/17/2005 (9:36 pm)
If you are using GuiShapeNameHud, it has a tendancy to capture mouseDown/mouseUp events. What you need to do is add onMouseDown events to GuiShapeNameHud, that pass the event up to its parent (which should be GameTS).
#10
11/18/2005 (4:44 am)
Ah damn I forgot all about that x.x