Announcements
The Scaleform forum is now read-only. Please head to the Gamedev site for product support.
Scaleform Forum (Read Only)
Scaleform enables developers to leverage the power of the Adobe® Flash® tool set to create powerful user interface environments for video games.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Trying to integrate Scaleform

0 REPLIES 0
Reply
Message 1 of 1
Anonymous
724 Views, 0 Replies

Trying to integrate Scaleform

Anonymous
Not applicable

Hi,

I try to use Scaleform with Urho3D but I am stuck because of Scaleform crashing at initialization.

I use the example "tessellation" and more precisely the file GFxPlayerGL.cpp and GFxPlayerGL.h, and I add them to my project.

So in my main function, I have :

 

 

  Scaleform::SysAllocMalloc a;
  Scaleform::GFx::System gfxInit(&a);
  gfxplayer = new Scaleform::GFxPlayer();
  int gfxInitError = gfxplayer->Init();
  if (gfxInitError)
	  return gfxInitError;

 

 

And the function in GFxPlayerGL.cpp :

 

 

int GFxPlayer::Init()
{       
    // Configure Loader.   
    // Developers set states on the loader to modify loading and playback behavior.
    // If you need to load files from a custom package, for example, you can 
    // create a FileOpener derived class that loads files in a custom way.
    // Here FileOpener is set for demonstration purposes, but a default instance of this FileOpener
    // is installed in the loader already.
    Ptr<GFx::FileOpener> pfileOpener = *new GFx::FileOpener;
    mLoader.SetFileOpener(pfileOpener); 

    // Install the customized logging function, which prints output to the console.
    mLoader.SetLog(Ptr<GFx::Log>(*new GFxPlayerLog()));

#ifdef SF_OS_WIN32
    // Install the Win32 font providier, which can pull font definitions from installed system fonts.
	Ptr<GFx::FontProviderWin32> fontProvider = *new GFx::FontProviderWin32(::GetDC(0));
	mLoader.SetFontProvider(fontProvider);
#endif

    // Install the image handler libraries (with all available format handlers), which allows loading images from different types.
    Ptr<GFx::ImageFileHandlerRegistry> pimgReg = *new GFx::ImageFileHandlerRegistry(GFx::ImageFileHandlerRegistry::AddDefaultHandlers);
    mLoader.SetImageFileHandlerRegistry(pimgReg);

    // Install the custom DemoExternalInterfaceHandler, which will process callbacks from the GFx content.
    Ptr<GFx::ExternalInterface> pEIHandler = *new DemoExternalInterfaceHandler;
    mLoader.SetExternalInterface(pEIHandler);

    // Install support for both AS2 and AS3 script. If only targetting one language, you can omit the unused one. Also, GFx can be
    // recompiled with GFX_AS2/AS3_SUPPORT undefined in GFxConfig.h, to reduce copmiled library size (source customers only).
	Ptr<GFx::ASSupport> pAS2Support = *new GFx::AS2Support();
	mLoader.SetAS2Support(pAS2Support);
	Ptr<GFx::ASSupport> pASSupport = *new GFx::AS3Support();
	mLoader.SetAS3Support(pASSupport);

    // Allocate the ThreadCommandQueue, which is an interface for sending rendering commands to the rendering thread. This sample is
    // single threaded, so the ThreadCommandQueue is very simple, executing all commands immediately. For multi-threaded execution,
    // the implementation of this class must be thread safe.

/********************************/
//CRASH RANDOMLY BETWEEN HERE
    Render::SingleThreadCommandQueue* queue = new Render::SingleThreadCommandQueue(); //CRASHES HERE
    pCommandQueue = queue;
	
    // Create renderer.
	Ptr<Render::GL::HAL> phal = *new Render::GL::HAL(pCommandQueue);
    pRenderHAL = phal;
	
    // Give the command queue pointers to the HAL
    queue->pHAL = pRenderHAL; //SOMETIMES CRASHES HERE

    // Configure renderer in "Dependent mode", honoring externally
    // configured device settings.
    if (!phal->InitHAL(Render::GL::HALInitParams()))
        return 1;

//AND HERE
/*******************************************/

    // Load the movie file into a GFx::MovieDef.
    pMovieDef = *mLoader.CreateMovie(FXPLAYER_FILENAME);
    if (!pMovieDef)
    {
		String alternateFilename = "../Debug/";//"../bin/";
        alternateFilename += FXPLAYER_FILENAME;
        if (!(pMovieDef = *mLoader.CreateMovie(alternateFilename)))
        {
            String errorString = "Unable to load file: ";
            errorString += FXPLAYER_FILENAME;
            MessageBoxA(NULL, errorString.ToCStr(), "Error", MB_OK | MB_ICONEXCLAMATION);
            return 1;
        }
    }

    // Now create the GFx::Movie from the loaded GFx::MovieDef.
    pMovie = *pMovieDef->CreateInstance(GFx::MemoryParams(), 0, 0, pCommandQueue);
    if (!pMovie)
    {
        return 1;
    }

	hMovieDisplay = pMovie->GetDisplayHandle();

    // Indicate to the Movie that there is exactly one mouse.
    pMovie->SetMouseCursorCount(1);

    // If you wanted to use the movie as a transparent HUD overlay, you would set background alpha to zero. If you want to
    // see the Stage, then the background alpha should be higher than zero. In this sample, we do not want the stage to
    // obscure the 3D rendering, so we set its alpha to zero.
    pMovie->SetBackgroundAlpha(0.0f);

    // Store initial timing, so that we can determine
    // how much to advance Flash playback.
    MovieLastTime = timeGetTime();

    return 0;
}

 

It crashes, making Visual Studio 2015 to crash too, so I can't have any debug information. If I put a breakpoint before in order to go step by step, I don't notice anything, and at one point, it crashes, and exits.

Any ideas?

 

Reply
Reply
0 Likes

Trying to integrate Scaleform

Hi,

I try to use Scaleform with Urho3D but I am stuck because of Scaleform crashing at initialization.

I use the example "tessellation" and more precisely the file GFxPlayerGL.cpp and GFxPlayerGL.h, and I add them to my project.

So in my main function, I have :

 

 

  Scaleform::SysAllocMalloc a;
  Scaleform::GFx::System gfxInit(&a);
  gfxplayer = new Scaleform::GFxPlayer();
  int gfxInitError = gfxplayer->Init();
  if (gfxInitError)
	  return gfxInitError;

 

 

And the function in GFxPlayerGL.cpp :

 

 

int GFxPlayer::Init()
{       
    // Configure Loader.   
    // Developers set states on the loader to modify loading and playback behavior.
    // If you need to load files from a custom package, for example, you can 
    // create a FileOpener derived class that loads files in a custom way.
    // Here FileOpener is set for demonstration purposes, but a default instance of this FileOpener
    // is installed in the loader already.
    Ptr<GFx::FileOpener> pfileOpener = *new GFx::FileOpener;
    mLoader.SetFileOpener(pfileOpener); 

    // Install the customized logging function, which prints output to the console.
    mLoader.SetLog(Ptr<GFx::Log>(*new GFxPlayerLog()));

#ifdef SF_OS_WIN32
    // Install the Win32 font providier, which can pull font definitions from installed system fonts.
	Ptr<GFx::FontProviderWin32> fontProvider = *new GFx::FontProviderWin32(::GetDC(0));
	mLoader.SetFontProvider(fontProvider);
#endif

    // Install the image handler libraries (with all available format handlers), which allows loading images from different types.
    Ptr<GFx::ImageFileHandlerRegistry> pimgReg = *new GFx::ImageFileHandlerRegistry(GFx::ImageFileHandlerRegistry::AddDefaultHandlers);
    mLoader.SetImageFileHandlerRegistry(pimgReg);

    // Install the custom DemoExternalInterfaceHandler, which will process callbacks from the GFx content.
    Ptr<GFx::ExternalInterface> pEIHandler = *new DemoExternalInterfaceHandler;
    mLoader.SetExternalInterface(pEIHandler);

    // Install support for both AS2 and AS3 script. If only targetting one language, you can omit the unused one. Also, GFx can be
    // recompiled with GFX_AS2/AS3_SUPPORT undefined in GFxConfig.h, to reduce copmiled library size (source customers only).
	Ptr<GFx::ASSupport> pAS2Support = *new GFx::AS2Support();
	mLoader.SetAS2Support(pAS2Support);
	Ptr<GFx::ASSupport> pASSupport = *new GFx::AS3Support();
	mLoader.SetAS3Support(pASSupport);

    // Allocate the ThreadCommandQueue, which is an interface for sending rendering commands to the rendering thread. This sample is
    // single threaded, so the ThreadCommandQueue is very simple, executing all commands immediately. For multi-threaded execution,
    // the implementation of this class must be thread safe.

/********************************/
//CRASH RANDOMLY BETWEEN HERE
    Render::SingleThreadCommandQueue* queue = new Render::SingleThreadCommandQueue(); //CRASHES HERE
    pCommandQueue = queue;
	
    // Create renderer.
	Ptr<Render::GL::HAL> phal = *new Render::GL::HAL(pCommandQueue);
    pRenderHAL = phal;
	
    // Give the command queue pointers to the HAL
    queue->pHAL = pRenderHAL; //SOMETIMES CRASHES HERE

    // Configure renderer in "Dependent mode", honoring externally
    // configured device settings.
    if (!phal->InitHAL(Render::GL::HALInitParams()))
        return 1;

//AND HERE
/*******************************************/

    // Load the movie file into a GFx::MovieDef.
    pMovieDef = *mLoader.CreateMovie(FXPLAYER_FILENAME);
    if (!pMovieDef)
    {
		String alternateFilename = "../Debug/";//"../bin/";
        alternateFilename += FXPLAYER_FILENAME;
        if (!(pMovieDef = *mLoader.CreateMovie(alternateFilename)))
        {
            String errorString = "Unable to load file: ";
            errorString += FXPLAYER_FILENAME;
            MessageBoxA(NULL, errorString.ToCStr(), "Error", MB_OK | MB_ICONEXCLAMATION);
            return 1;
        }
    }

    // Now create the GFx::Movie from the loaded GFx::MovieDef.
    pMovie = *pMovieDef->CreateInstance(GFx::MemoryParams(), 0, 0, pCommandQueue);
    if (!pMovie)
    {
        return 1;
    }

	hMovieDisplay = pMovie->GetDisplayHandle();

    // Indicate to the Movie that there is exactly one mouse.
    pMovie->SetMouseCursorCount(1);

    // If you wanted to use the movie as a transparent HUD overlay, you would set background alpha to zero. If you want to
    // see the Stage, then the background alpha should be higher than zero. In this sample, we do not want the stage to
    // obscure the 3D rendering, so we set its alpha to zero.
    pMovie->SetBackgroundAlpha(0.0f);

    // Store initial timing, so that we can determine
    // how much to advance Flash playback.
    MovieLastTime = timeGetTime();

    return 0;
}

 

It crashes, making Visual Studio 2015 to crash too, so I can't have any debug information. If I put a breakpoint before in order to go step by step, I don't notice anything, and at one point, it crashes, and exits.

Any ideas?

 

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report