Panch20 wrote:
> 
> Hello all,
> 
> I've had some trouble getting CE GUI integrated, so today I mimicked it
> from Viewmesh. It compiles just fine but it gives an assertion error
> referencing ms_singleton and it points to a file on the F drive which I
> don't even have.
> 
> EDIT - The same goes for the code from within the ceguitest application
> :(.
> I get the error when I ever I try a cegui-> anything. Initialize() works
> but anything after that causes the singleton error.
> 
> Thanks!
> 

Ok So i tried something different, I wrote these two .h and .cpp files:

header:
#ifndef __CEGUITIME_H__
#define __CEGUITIME_H__

#include "crystalspace.h"

#include "ivaria/icegui.h"

class CEGUITest
{
private:
        iObjectRegistry* gui_object_reg;
  
public:

        csRef<iCEGUI> cegui;
        csRef<iVFS> vfs;

        ~CEGUITest();
        // Create GUI
        bool CreateGui();
        void Draw();

  // Handle exit button clicked event
  bool OnExitButtonClicked (const CEGUI::EventArgs& e);
  bool Initialize(iObjectRegistry* obj_reg);

};

#endif

cpp:
#include "cssysdef.h"
#include "ceguitime.h"

#include "csutil/custom_new_disable.h"
#include <CEGUI.h>
#include <CEGUIWindowManager.h>
#include <CEGUILogger.h>
#include "csutil/custom_new_enable.h"

bool CEGUITest::Initialize(iObjectRegistry* obj_reg)
{
        gui_object_reg = obj_reg;
  
        cegui = csQueryRegistryOrLoad<iCEGUI> (gui_object_reg,
        "crystalspace.cegui.wrapper");

        if (!cegui)
    {
        csReport (gui_object_reg,
                CS_REPORTER_SEVERITY_ERROR, "time.gui",
                "Can't load the GUI!");
                csPrintf("cegui failed!");
        return false;
    }

        vfs = csQueryRegistryOrLoad<iVFS> (gui_object_reg, 
                "crystalspace.vfs");
        if (!vfs)
    {
        csReport (gui_object_reg,
                CS_REPORTER_SEVERITY_ERROR, "time.gui",
                "Can't load the vfs!");
                csPrintf("vfs failed!");
        return false;
    }

        CreateGui();

  return true;
}

bool CEGUITest::CreateGui()
{
   // Initialize CEGUI wrapper
 cegui->Initialize ();

  // Set the logging level
  cegui->GetLoggerPtr ()->setLoggingLevel(CEGUI::Informative);

  vfs->ChDir ("/ceguitest/0.5/");

  // Load the ice skin (which uses Falagard skinning system)
  cegui->GetSchemeManagerPtr ()->loadScheme("ice.scheme");

  cegui->GetSystemPtr ()->setDefaultMouseCursor("ice", "MouseArrow");

  CEGUI::Font* font = cegui->GetFontManagerPtr ()->createFont("FreeType",
    "Vera", "/fonts/ttf/Vera.ttf");
  font->setProperty("PointSize", "10");
  font->load();

  CEGUI::WindowManager* winMgr = cegui->GetWindowManagerPtr ();

  // Load layout and set as root
  cegui->GetSystemPtr
()->setGUISheet(winMgr->loadWindowLayout("ice.layout"));

  // Subscribe to the clicked event for the exit button
  CEGUI::Window* btn = winMgr->getWindow("Demo7/Window1/Quit");
  btn->subscribeEvent(CEGUI::PushButton::EventClicked,
    CEGUI::Event::Subscriber(&CEGUITest::OnExitButtonClicked, this));

  return true;
}
void CEGUITest::Draw()
{
        cegui->Render();
}
bool CEGUITest::OnExitButtonClicked (const CEGUI::EventArgs&)
{
  csPrintf("Success!");

  return true;
}


I loaded the iCEGUI plugin in my main application and call
CEGUITest::cegui->render in exactly the same place viewmesh.exe.

It all compiles fine but anytime I call cegui-> anything from within
ceguitest.cpp it crashes. I'm at work and my debugger is blown but I could
look at later.

Any have any ideas? 

-- 
View this message in context: 
http://www.nabble.com/CE-GUI-problem-tf3887458.html#a11034293
Sent from the Crystal Space - General mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Crystal-main mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/crystal-main
Unsubscribe: mailto:[EMAIL PROTECTED]

Reply via email to