Libsdl_image.a

Hi to all,
i need the lib_sdl image compiled with mingw32 compiler (‘a’ lib)
anyone have compiled the lib in this way? thanks a lot!

regards,
Muzero

Hi,

is there a way to use SDL callback functions like Mix_HookMusicFinished
with a c++ method?

i’m trying to do this:

Mix_HookMusicFinished(Sound::playMusic());

and i keep getting the compile error:

void value not ignored as it ought to be

is there a way to fix this/cast this etc, so that i can call a c++
object method with the callback function?

thanks in advance,

jefff

Mix_HookMusicFinished(Sound::playMusic());

  1. You aren’t passing a pointer to a function. You’re saying “call
    Sound::playMusic(), and pass whatever it returns to
    Mix_HookMusicFinished()”.

    Mix_HookMusicFinished(Sound::playMusic);

(Note the lack of “()”).

  1. You might be able to do this if you declare playMusic as a static
    method:

class Sound
{
public:
static void playMusic(void);
}

void Sound::playMusic(void)
{
do_something();
}

–ryan.

Jeff,

I did this instead:

// define a callback function we can work with
extern “C”
{
void musicDone_CCallback()
{
// let it call a method on my (singleton) sound object
Sound::instance()->musicDone();
}
}

// and here’s the sound object
void Sound::musicDone()
{
// etc
}

And when you’re going to use it:

Mix_HookMusicFinished(musicDone_CCallback);

Hope this helps,

 Kent

Friday, June 7, 2002, 9:36:41 PM, you wrote:

JR> Hi,

JR> is there a way to use SDL callback functions like Mix_HookMusicFinished
JR> with a c++ method?

JR> i’m trying to do this:

JR> Mix_HookMusicFinished(Sound::playMusic());

JR> and i keep getting the compile error:

JR> void value not ignored as it ought to be

JR> is there a way to fix this/cast this etc, so that i can call a c++
JR> object method with the callback function?

JR> thanks in advance,

JR> jefff

JR> _______________________________________________
JR> SDL mailing list
JR> SDL at libsdl.org
JR> http://www.libsdl.org/mailman/listinfo/sdl--
Kent Quirk, CTO, CogniToy
@Kent_Quirk
http://www.cognitoy.com

If you can pass an argument to be called with the
callback (I guess this isn’t allowed here), say a void
*, you can get callbacks sent to a particular instance
with

static class1::staticCallback( void *arg )
{
static_cast< class1 * >( arg )
->perInstanceCallbackMethod();
}

When you can’t get a user-defined argument to be sent
to the static callback, you’re out of luck because
apparently taking a reference to a class method
doesn’t even have to be a pointer. Sucky, and very
annoying when you want a particular callback handled
by a particular instance :slight_smile:

Andrew.

— Kent Quirk <kent_quirk at cognitoy.com> wrote:> Jeff,

I did this instead:

// define a callback function we can work with
extern “C”
{
void musicDone_CCallback()
{
// let it call a method on my (singleton)
sound object
Sound::instance()->musicDone();
}
}

// and here’s the sound object
void Sound::musicDone()
{
// etc
}

And when you’re going to use it:

Mix_HookMusicFinished(musicDone_CCallback);

Hope this helps,

 Kent

Friday, June 7, 2002, 9:36:41 PM, you wrote:

JR> Hi,

JR> is there a way to use SDL callback functions
like Mix_HookMusicFinished
JR> with a c++ method?

JR> i’m trying to do this:

JR> Mix_HookMusicFinished(Sound::playMusic());

JR> and i keep getting the compile error:

JR> void value not ignored as it ought to be

JR> is there a way to fix this/cast this etc, so
that i can call a c++
JR> object method with the callback function?

JR> thanks in advance,

JR> jefff

JR> _______________________________________________
JR> SDL mailing list
JR> SDL at libsdl.org
JR> http://www.libsdl.org/mailman/listinfo/sdl


Kent Quirk, CTO, CogniToy
kent_quirk at cognitoy.com
http://www.cognitoy.com


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup

When you can’t get a user-defined argument to be sent
to the static callback, you’re out of luck because
apparently taking a reference to a class method
doesn’t even have to be a pointer. Sucky, and very
annoying when you want a particular callback handled
by a particular instance :slight_smile:

If you need this, use Mix_RegisterEffect(MIX_CHANNEL_POST, …) instead of
Mix_SetPostMix().

–ryan.