[Solved] something missing to make events work ?

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

khayyam
Just popping in
Just popping in
Posts: 13
Joined: Thu Jun 29, 2006 08:22
Location: France

[Solved] something missing to make events work ?

Postby khayyam » Thu Jun 29, 2006 20:36

hi all,

I think something is missing in my code because the events seem not to work properly
(The GUI is correctly displayed)

what I've done :

Code: Select all

CEGUI::LuaScriptModule *scriptmod = new CEGUI::LuaScriptModule();
new CEGUI::System(myRenderer, scriptmod, (CEGUI::utf8*)"cegui.config");

[...]

CEGUI::WindowManager &winMgr = CEGUI::WindowManager::getSingleton();

CEGUI::Window *myRoot = winMgr.loadWindowLayout("../data/schemes/demolayout.xml");
CEGUI::System::getSingleton().setGUISheet(myRoot);


with demolayout.xml

Code: Select all

[...]
<Window Type="TaharezLook/Button" Name="Button1" >
      <Property Name="MouseCursorImage" Value="set:TaharezLook image:MouseArrow" />
      <Property Name="UnifiedAreaRect" Value="{{0.089232,0.000000},{0.207778,0.000000},{0.401089,0.000000},{0.315456,0.000000}}" />
      <Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
      <Event Name="Clicked" Function="luabtn_clicked" />
    </Window>
[...]


and the luabtn_clicked function defined in the lua file called by "cegui.config" (called at creation of CEGUI::System) :

Code: Select all

function luabtn_clicked(e)
  local logger = CEGUI.Logger:getSingleton()
  logger:logEvent( ">>> clic" )
end


Just to see if everything is ok, I put a

Code: Select all

local logger = CEGUI.Logger:getSingleton()
logger:logEvent( ">>> started" )

in the lua file and it's well written in the log file, so this lua file is correctly parsed.

but, the logger:logEvent( ">>> clic" ) inside the luabtn_clicked function is not interpreted when I click the button

What is missing ?
Did I forget something ?
Last edited by khayyam on Sat Jul 01, 2006 15:12, edited 1 time in total.

User avatar
Dalfy
CEGUI Team (Retired)
Posts: 130
Joined: Tue Oct 11, 2005 16:13
Location: Paris, FRANCE
Contact:

Postby Dalfy » Sat Jul 01, 2006 11:29

are you injecting events to cegui ? Did you forward the mouse, keyboard and time event to the library ?

khayyam
Just popping in
Just popping in
Posts: 13
Joined: Thu Jun 29, 2006 08:22
Location: France

Postby khayyam » Sat Jul 01, 2006 13:13

Dalfy wrote:are you injecting events to cegui ?


not at all.
:( http://www.cegui.org.uk/wiki/index.php/ ... ing_Inputs :(

In fact, I'm trying to specify the whole gui only in the xml/lua files, even the events.

that's why I don't have any

Code: Select all

window->subscribeEvent
but

Code: Select all

<Event Name="Clicked" Function="luabtn_clicked" />

Is it what you meant with "injecting inputs" ?

(I think it doesn't)

so, all my events are processed by my renderer, how to inject them into cegui ? (any wiki ? tuto ?)

MacMan45
Just popping in
Just popping in
Posts: 19
Joined: Mon Apr 24, 2006 10:33

Postby MacMan45 » Sat Jul 01, 2006 13:31

Injecting inputs means you get the mouse position etc (clicks, keyboard evens & so on) & every frame pass them to crazy eddie....

Here is an example:

Code: Select all

const OIS::MouseState &ms = mMouse->getMouseState();

CEGUI::System::getSingleton().injectMousePosition(ms.abX,ms.abY);


(in this example i'm using OIS to get my input)

khayyam
Just popping in
Just popping in
Posts: 13
Joined: Thu Jun 29, 2006 08:22
Location: France

Postby khayyam » Sat Jul 01, 2006 15:11

thanks :)

(I was wondering how cegui could get the events, now it's clear)

MacMan45
Just popping in
Just popping in
Posts: 19
Joined: Mon Apr 24, 2006 10:33

Postby MacMan45 » Sat Jul 01, 2006 15:15

Your welcome :)


Return to “Help”

Who is online

Users browsing this forum: No registered users and 33 guests