Conflict between rigz.timelinefx & bah.cegui mods

BlitzMax Forums/BlitzMax Programming/Conflict between rigz.timelinefx & bah.cegui mods

Armitage 1982(Posted 2011) [#1]
Hi

First, I do not have the last bah.cegui version but cegui.mod v0.6.2 (rev 783).

Does anyone using the TimelineFX module experiencing runtime crash while simply "import bah.cegui" ?
If not, does it work when using loadAnimImage with an incbin png ressources ?

While simply adding Import bah.cegui to the TimelineFX example (http://www.rigzsoft.co.uk/index.php?option=com_content&view=article&id=24:a-simple-program&catid=5:module-help&Itemid=18) the application crash at start.
And when I try to do the same in my game engine, I can reach the first loadAnimImage command before things crash (my engine do use cegui of course). Weird...

A debug version won't help either to locate the problem.
Think I will have to stick with my slow dumb particles engine :(

Last edited 2011

Last edited 2011

Last edited 2011

Last edited 2011

Last edited 2011


Pete Rigz(Posted 2011) [#2]
Hi Armitage, I'll try and find the time to take a look at this. Is it the loadanimimage that is conflicting?


Armitage 1982(Posted 2011) [#3]
Hard to tell,
I thing it as more to do with a low level OpenGl problem, because I can't catch any error in debug mode :(
Simply try to import Cegui in the TimelineFX should reproduce the problem.
If not, it's probably coming from my system.


Armitage 1982(Posted 2011) [#4]
The only thing that log when in Debug Mode is this :

DebugLog:PASSTHROUGH

A bit hard to debug...
I just need to know if it's my version of Cegui that conflict with TimelineFX or if it's a general issue.


Armitage 1982(Posted 2011) [#5]
Hi

No news about this ?
Thank you.


Armitage 1982(Posted 2011) [#6]
I think I find a solution.

This is a "badly" fixed example to use TimelineFX in conjunction with Cegui :
SuperStrict
 
Import bah.cegui
Import rigz.timelinefx
Import rigz.Tweener

New TPixmapLoaderFI  'This will fix the brl.pixmap.LoadPixmap bug

'Load the effects library
Local MyEffectsLib:tlEffectsLibrary = LoadEffects("effects/examples.eff")
'Create an effect and assign it an effect from the library
Local MyEffect:tlEffect = MyEffectsLib.GetEffect("simple explosion 1")
'Create the particle manager to manage the particles
Local MyParticleManager:tlParticleManager = CreateParticleManager()

Graphics (1024, 768, 0) 
		 
'These commands are important to set the origin of the particle manager. For this example we're setting the origin so that
'effects will be placed at screen coordinates. If you leave out the setorigin command then an effect created at 0,0 would
'be placed at the center of the screen.
myparticlemanager.SetScreenSize(GraphicsWidth(), GraphicsHeight())
myparticlemanager.SetOrigin(GraphicsWidth() / 2, GraphicsHeight() / 2)
 
'This will make one frame equal 33 millisecs long - or 30 updates per second.
SetUpdateFrequency(30)
 
'Create a tweener using the tweener mod. Make sure its frequency matches that above
Local Tweener:tTweener = New tTweener.Create(30)
 
'Our main loop
While Not KeyDown(KEY_ESCAPE) Or AppTerminate()
 
  Cls
 
  If MouseHit(1)
    'to create an effect you need to use the copyeffect command, and copy the MyEffect you created earlier. 
    'You shouldn't use MyEffect as it is the template
    'for which is used to create effects you draw on screen.
    Local tempeffect:tlEffect = CopyEffect(myeffect, MyParticleManager)
    'Set the temp effect to the mouse coords
    tempeffect.setx(MouseX())
    tempeffect.sety(MouseY())
    'add the effect the the particle manager. Important, otherwise the particle manager would have nothing to update
    MyParticleManager.addeffect(tempeffect)
  End If
 
  'here is the timing code, update the tweener to get the number of ticks for this loop
  Tweener.Update()
 
  For Local Ticks:Int = 1 To Tweener.FrameTicks
    'Update the execution time for the tweener
    Tweener.UpdateExecutionTime()
    'Update the particle manager
    MyParticleManager.Update()
  Next
 
  'and finally draw the particles.
  MyParticleManager.DrawParticles(Tweener.Tween)
 
  Flip 0
 
Wend


First, I tracked the bug into the modified Indiepath singlesurface.bmx of TimeLineFX.
LoadSpriteEffect::LoadtAnimImage Point me to the reasons of the crash.
This function normally use the brl.pixmap.LoadPixmap.
Unfortunately, this function is implemented by the module bah.freeimage used in bah.cegui.

This implementation is normally done at the end of the Freeimage module thanks to a New TPixmapLoaderFI, but, for some strange reasons, it's no more the case when you import Freeimage and TimeLineFX.

What I simply did is adding
New TPixmapLoaderFI
just before any LoadEffects to ensure that LoadPixmap will correctly work.

Finding what's changing the LoadPixmap function in TimeLineFX is the key to fix this particular case. But as soon as you know you have add New TPixmapLoaderFI, it's no big deal.

Last edited 2011