move camera with scroller

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
pabloa
Not too shy to talk
Not too shy to talk
Posts: 37
Joined: Mon Oct 03, 2005 09:52

move camera with scroller

Postby pabloa » Mon Oct 24, 2005 12:07

It appears in demo 4, I am trying to copy it in my project. the scrollbar is made, but the problem is asociate it the event. I copy the method to move the camera horizontally

Code: Select all

/*************************************************************************
   Method that moves the camera horizontally
*************************************************************************/
bool CEGUIOgre_FrameListener::horzMoveHandler(const CEGUI::EventArgs& e)
{
   using namespace CEGUI;

   static float lastPos = 0;

   Scrollbar* sb = (Scrollbar*)((const WindowEventArgs&)e).window;

   mRotY = 0;
   mRotX = sb->getScrollPosition() - lastPos;
   lastPos = sb->getScrollPosition();

   moveCamera();

   return true;
}


but dont run I dont undertand how asociatte event to scroller, slicer, etc... Could somebody help me?

User avatar
madlion
Just popping in
Just popping in
Posts: 6
Joined: Wed Aug 10, 2005 07:59

Re: move camera with scroller

Postby madlion » Mon Oct 24, 2005 13:23

Did you subscribe a event to call this method?

User avatar
martignasse
Just can't stay away
Just can't stay away
Posts: 227
Joined: Thu Apr 14, 2005 08:10
Location: Lyon, FRANCE

Re: move camera with scroller

Postby martignasse » Mon Oct 24, 2005 17:54

I dont undertand how asociatte event to scroller, slicer, etc... Could somebody help me?


event system is a core cegui fonctionnality, you have to understand it.

Basicly, you tel to the event system that a button event react by a callback to a fonction :

Code: Select all

 YourButton->subscribeEvent(PushButton::EventClicked, Event::Subscriber( Namespace::YourFonction, this));


For more info, you should look in the FAQ at the question "What is the correct way to subscribe for an event?" ;)

and in the API Reference in the CEGUI:EventSet class reference, the subscribeEvent fonction is the three before the end.

Hope it help.

User avatar
madlion
Just popping in
Just popping in
Posts: 6
Joined: Wed Aug 10, 2005 07:59

Re: move camera with scroller

Postby madlion » Mon Oct 24, 2005 19:21

martignasse wrote:
I dont undertand how asociatte event to scroller, slicer, etc... Could somebody help me?


Ups... next time i should read it more carefully. :roll:

User avatar
martignasse
Just can't stay away
Just can't stay away
Posts: 227
Joined: Thu Apr 14, 2005 08:10
Location: Lyon, FRANCE

Re: move camera with scroller

Postby martignasse » Tue Oct 25, 2005 18:15

no problem,

for myself, it's not easy to found info in the API reference.

it's comming, slowly... ;)

User avatar
pabloa
Not too shy to talk
Not too shy to talk
Posts: 37
Joined: Mon Oct 03, 2005 09:52

Re: move camera with scroller

Postby pabloa » Thu Nov 10, 2005 11:52

OK ! I did it. how can the "scrollbar's Button" appear in the middle of the scrollbar. I want to be able move it rigth and left.

User avatar
martignasse
Just can't stay away
Just can't stay away
Posts: 227
Joined: Thu Apr 14, 2005 08:10
Location: Lyon, FRANCE

Re: move camera with scroller

Postby martignasse » Thu Nov 10, 2005 12:56

OK ! I did it. how can the "scrollbar's Button" appear in the middle of the scrollbar. I want to be able move it rigth and left.
you should do something like making the midle value of you'r slider the default value.

for example, you want you'r slider control camera from -10 to 10, so you'r middle value is 0.
But because the slider widget can manage only positive value, you have to translate (with some helper fonctions) to 0 |-| 20 and make you'r middle value 10.

finely yourslider->setCurrentValue(10.0f) and the thumb will be in the middle.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 7 guests