Sdl on beos

Hi,

i rewrote my program to work on Linux and BeOS.
Under Linux everything is fine but under BeOS two things
simply don’t work:

a) my window is not resizable under BeOS.
I used SDL_RESIZABLE of course.

b) while the left mouse button is pressed, the right
one does not produce events.

Both things work under Linux. I use absolutely the same
source code for both systems.

Thanks in advance
Leander

should these things work on beos?
does somebody think it’s a mistake in
my code?
should i post code?
any hints?

thanks
leander

Leander Seige wrote:> Hi,

i rewrote my program to work on Linux and BeOS.
Under Linux everything is fine but under BeOS two things
simply don’t work:

a) my window is not resizable under BeOS.
I used SDL_RESIZABLE of course.

b) while the left mouse button is pressed, the right
one does not produce events.

Both things work under Linux. I use absolutely the same
source code for both systems.

Thanks in advance
Leander


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

should these things work on beos?
does somebody think it’s a mistake in
my code?
should i post code?

Go ahead and post a minimal example. I haven’t booted BeOS in a while,
so I’m not sure if they’re supposed to be implemented or not. I think
they are, but I’d have to check.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment

Go ahead and post a minimal example. I haven’t booted BeOS in a while,
so I’m not sure if they’re supposed to be implemented or not. I think
they are, but I’d have to check.

ok, here it is:

    if( SDL_Init( SDL_INIT_VIDEO|SDL_INIT_TIMER ) < 0 )


info = SDL_GetVideoInfo();

bpp = info->vfmt->BitsPerPixel;
if (!PWD) PWD=bpp;
switch (bpp) {… }

    SDL_GL_SetAttribute( SDL_GL_RED_SIZE,  rgb_size[0] );


SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER,1 );

    if( (window=SDL_SetVideoMode( SWX, SWY, bpp,

SDL_OPENGL|SDL_RESIZABLE )) == 0 )
{…}

    SDL_EnableUNICODE(1);
    SDL_EnableKeyRepeat(0,0);
    SDL_ShowCursor(SDL_DISABLE);


glViewport(0,0,SWX,SWY);

init(); /* gl calls … */

    while(1)
    {
        TDFSB_FUNC_IDLE();
        while( SDL_PollEvent( &event ) )
        {   switch( event.type )
            {       case SDL_QUIT:
                        ende (0);
                        break;
                    case SDL_VIDEORESIZE:
                        if( (window=SDL_SetVideoMode( SWX, SWY, bpp,

SDL_OPENGL|SDL_RESIZABLE )) == 0 )
{ printf(“SDL ERROR Video mode set
failed: %s\n”, SDL_GetError() );
ende(1);
}
reshape(event.resize.w,event.resize.h);
break;
case SDL_MOUSEMOTION:
if(TDFSB_FUNC_MOTION)
TDFSB_FUNC_MOTION(event.motion.x,event.motion.y);
break;
case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONUP:
printf(“ME!\n”);
if(TDFSB_FUNC_MOUSE)
TDFSB_FUNC_MOUSE(event.button.button, event.button.state, event.button.x,
event.button.y);
break;
case SDL_KEYDOWN:
if (speckey(event.key.keysym.sym))
TDFSB_FUNC_KEY ((unsigned
char)(event.key.keysym.unicode & 0x7F));
break;
case SDL_KEYUP:
if (specupkey(event.key.keysym.sym))
TDFSB_FUNC_UPKEY((unsigned
char)(event.key.keysym.unicode & 0x7F));
break;
default:
break;
}
}
}

should these things work on beos?
does somebody think it’s a mistake in
my code?
should i post code?
any hints?

If you can post your code, we can verify it, but they could be SDL bugs,
as the BeOS target is very heavily maintained at this point (at least, to
my knowledge).

(I can’t even get SDL to build on BeOS from CVS, since I need autoconf and
automake, but I can’t get autoconf installed without Perl, and I couldn’t
get Perl to build. I threw my hands up. Can someone point me to binaries
for Perl/autoconf for BeOS? The perl binaries on perl.com don’t work
either. I can’t win.)

–ryan.

                    case SDL_VIDEORESIZE:
                        if( (window=SDL_SetVideoMode( SWX, SWY, bpp,

SDL_OPENGL|SDL_RESIZABLE )) == 0 )
{ printf(“SDL ERROR Video mode set
failed: %s\n”, SDL_GetError() );
ende(1);
}
reshape(event.resize.w,event.resize.h);
break;

You’re calling SDL_SetVideoMode and resetting the window to it’s original
size in the resize event. Change the SWX and SWY to event.resize.x and
event.resize.y …

                    case SDL_MOUSEBUTTONDOWN:
                    case SDL_MOUSEBUTTONUP:
                           printf("ME!\n");
                        if(TDFSB_FUNC_MOUSE)

TDFSB_FUNC_MOUSE(event.button.button, event.button.state, event.button.x,
event.button.y);
break;

The left/right mouse button thing might be a bug in SDL, but I haven’t got
your actual handling code here.

–ryan.

– SNIP –

(I can’t even get SDL to build on BeOS from CVS, since I need autoconf and
automake, but I can’t get autoconf installed without Perl, and I couldn’t
get Perl to build. I threw my hands up. Can someone point me to binaries
for Perl/autoconf for BeOS? The perl binaries on perl.com don’t work
either. I can’t win.)

I develop heavily lately on BeOS and haven’t found any problems with SDL
1.2.3
and BeOS (allthough I didn’t used the CVS lately). BTW, I’m talking about
BeOS R5
Personal (with the necesarry updatepacks). Be sure to grab the latest GCC
for BeOS
at BeBits since I had some troubles to get SDL 1.2.x working under BeOS :

http://www.bebits.com/app/2157

–ryan.

Niels Wagenaar

----- Original Message -----
From: icculus@icculus.org (Ryan C. Gordon)
To:
Sent: Thursday, March 28, 2002 10:42 PM
Subject: Re: [SDL] sdl on beos

You’re calling SDL_SetVideoMode and resetting the window to it’s original
size in the resize event. Change the SWX and SWY to event.resize.x and
event.resize.y …

yes, you’re right - what a stupid mistake - unfortunately it doesn’t help.
i’m wondering that it worked on linux… :wink:

The left/right mouse button thing might be a bug in SDL, but I haven’t got
your actual handling code here.

here is my handling code while TDFSB_FUNC_MOUSE=mouse;
but i assume it will not tell you a lot :-/
in fact the line printf(“ME!\n”); should show me if a mouse event occurs,
but it doesn’t happen…

thank you
leander

void mouse (int button, int state, int x, int y)
{
if (!TDFSB_ANIM_STATE)
{
switch (button) {

case SDL_BUTTON_LEFT:
if (!TDFSB_CLASSIC_NAV)
{ if (state == SDL_PRESSED)
{ TDFSB_OBJECT_SELECTED=NULL;
TDFSB_OBJECT_SEARCH=1; TDFSB_KEY_FINDER=0;
TDFSB_FUNC_KEY=keyfinder;
TDFSB_FUNC_UPKEY=keyupfinder;

                            }
          else
                            {       TDFSB_OBJECT_SELECTED=NULL;

TDFSB_OBJECT_SEARCH=0; TDFSB_KEY_FINDER=0;
TDFSB_FUNC_KEY=keyboard;
TDFSB_FUNC_UPKEY=keyboardup;
}
break;
}
else
{ if (state == SDL_PRESSED)
{ forwardkeybuf=1; backwardkeybuf=0;
TDFSB_FUNC_IDLE=move; }
else
{ forwardkeybuf=0; check_still(); }
break;
}

case SDL_BUTTON_RIGHT:
if (!TDFSB_CLASSIC_NAV)
{ if (state == SDL_PRESSED &&
TDFSB_OBJECT_SELECTED )
{ stop_move();
TDFSB_OA=TDFSB_OBJECT_SELECTED;
TDFSB_OA_DX=(TDFSB_OA->posx-vposx)/100;

                                    if (!((TDFSB_OA->mode)&0x20))

TDFSB_OA_DY=(TDFSB_OA->posy+TDFSB_OA->scaley+4-vposy)/100;
else
TDFSB_OA_DY=(5-vposy)/100;
TDFSB_OA_DZ=(TDFSB_OA->posz-vposz)/100;

                                    TDFSB_ANIM_STATE=1;

TDFSB_OBJECT_SELECTED=NULL; TDFSB_OBJECT_SEARCH=0;
TDFSB_FUNC_KEY=keyboard;
TDFSB_FUNC_UPKEY=keyboardup; TDFSB_KEY_FINDER=0;
TDFSB_FUNC_IDLE=approach;
}
break;
}
else
{
if (state == SDL_PRESSED)
{ backwardkeybuf=1; forwardkeybuf=0;
TDFSB_FUNC_IDLE=move; }
else
{ backwardkeybuf=0; check_still(); }
break;
}

case SDL_BUTTON_MIDDLE:
if (state == SDL_PRESSED)
{ TDFSB_FUNC_MOTION=MouseLift; TDFSB_FUNC_IDLE=move; }
else
{ TDFSB_FUNC_MOTION=MouseMove; TDFSB_FUNC_IDLE=move; check_still();
uposy=vposy; }
break;

default:
break;
}
}

}