(no subject)

Curantly i am trying to make an pong clone, using sdl with opengl. But I
have hit a road block. I can’t figure out how to make the paddle move when
the user presses a key, then stop when he releses it. Does anyone know how
to do this?_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

Curantly i am trying to make an pong clone, using sdl with opengl. But
I have hit a road block. I can’t figure out how to make the paddle move
when the user presses a key, then stop when he releses it. Does anyone
know how to do this?

You can enable key repeat, and move the paddle a little bit each time a
key is pressed. Key repeat is disabled by default.On Sunday, July 29, 2001, at 03:40 PM, Corey Struble wrote:

i think that key repeat is a bad thing.
i am not sure but i believe only last key typed is repeated…
if user both hit left & right ?

you should store key state and have a timer repeatingly calling 'move()'
for instance.

your move x will be (key_left_state - key_right_state) * vx
and (key_up_state - key_down_state) * vy

Take from my Pong clone :slight_smile:

  if (gamw_key_is_down (GAMW_KEY_RIGHT))
    {
      bat_move_right (&bat_p1, 5);

    }
  if (gamw_key_is_down (GAMW_KEY_LEFT))
    {
      bat_move_left (&bat_p1, 5);
    }

where gamw_key_is_down is a wrapper I wrote to SDL:

int gamw_key_is_down (GAMW_KEY k)
{
Uint8 *keystate;

SDL_PollEvent(&Event);

keystate = SDL_GetKeyState(NULL);

if (keystate[k] == SDL_PRESSED)
return 1;

return 0;
}

and the bat struct is:
typedef struct
{
int x, y;
int w, h;
}
BAT;

Hope it helps.
C’ya.On Sunday 29 July 2001 22:40, you wrote:

Curantly i am trying to make an pong clone, using sdl with opengl. But I
have hit a road block. I can’t figure out how to make the paddle move when
the user presses a key, then stop when he releses it. Does anyone know how
to do this?

You can enable key repeat, and move the paddle a little bit each time a
key is pressed. Key repeat is disabled by default.

no, only ever enable key repeat for text input

G. Gabriele I keep getting told GAMW_KEY cannot start funcition declation.>int gamw_key_is_down (GAMW_KEY k)

{
Uint8 *keystate;

SDL_PollEvent(&Event);

keystate = SDL_GetKeyState(NULL);

if (keystate[k] == SDL_PRESSED)
return 1;

return 0;
}

and the bat struct is:
typedef struct
{
int x, y;
int w, h;
}
BAT;


Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

Eh well I thought it was clear that the code I’ve pasted it is from
a wrapper I’m writing to SDL, anyway:

#define GAMW_KEY SDLKey

C ya> G. Gabriele I keep getting told GAMW_KEY cannot start funcition declation.

int gamw_key_is_down (GAMW_KEY k)
{
Uint8 *keystate;

SDL_PollEvent(&Event);

keystate = SDL_GetKeyState(NULL);

if (keystate[k] == SDL_PRESSED)
return 1;

return 0;
}

and the bat struct is:
typedef struct
{
int x, y;
int w, h;
}
BAT;


Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


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

G. Gabriele I’ve almost got it but I have 1 error left
Undefined symbol ‘Event’ in function gamw_key_is_down(SDLKey)

Thanks for the help.From: g.gabriele@europe.com (G.Gabriele)


Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

G. Gabriele I’ve almost got it but I have 1 error left
Undefined symbol ‘Event’ in function gamw_key_is_down(SDLKey)

Thanks for the help.

Have you read the SDL doc ?

SDL_Event Event;

C ya.On Thursday 02 August 2001 03:55, you wrote:

From: G.Gabriele <@G.Gabriele>

Hello all,
I’m new to game programming, and a friend and I are attmpting the use of SDL
for our game. I’m currently trying to run a basic framework from a book, and
I’m getting this error:

Gamma correction not supported

Using this initialization:

screen = SDL_SetVideoMode(
640, 480, /* width and height of window /
16, /
16 bit color depth /
SDL_SWSURFACE /
video flags */
);

I’m attempting this using YellowDog Linux 2.0 on a PowerBook G4. Perhaps it is
just this machine?
Thanks for any help you might be able to render.
-Brock__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

Brock wrote:

Gamma correction not supported

Using this initialization:

screen = SDL_SetVideoMode(
640, 480, /* width and height of window /
16, /
16 bit color depth /
SDL_SWSURFACE /
video flags */
);

Did you get the error from the SDL_SetvideoMode() call, or what did you do?
Not all video targets/modes support gamma correction. If you were not
trying to do anything gamma-related, please write a complete minimal
program that shows the failure

“Brock” wrote in message
news:mailman.997894565.14622.sdl at libsdl.org

Hello all,
I’m new to game programming, and a friend and I are attmpting the use
of SDL
for our game. I’m currently trying to run a basic framework from a book,
and
I’m getting this error:

Gamma correction not supported

I’m guessing you’ve got something like:

// Start code
int val = SDL_Init(SDL_INIT_VIDEO);

if (!val) {
printf(stderr, “error: %s”, SDL_GetError());
}
// End code

Somewhere in your program?

If so, the problem is with the “if (!val)”, it should be “if (val)”
(SDL_Init() returns a 0 on success).

(I had the same problem)–
Mark ‘Nurgle’ Collins
Developer Support - Codeplay Ltd.
http://www.codeplay.com

hi I’m a beginner with SDL.
I downloaded th documentation on www.libsdl.org but there’s nothing in it dealing with text and menus.
Can anyone help me ???

le mer 17-10-2001 at 15:37 Gregory Babusiaux a ?crit :

hi I’m a beginner with SDL.
I downloaded th documentation on www.libsdl.org but there’s nothing in it dealing with text and menus.
Can anyone help me ???

That’s probably because SDL is not for dealing with text and menus. See
the SDL_GUI library, at http://www.newimage.com/~rhk/SDL_gui/

Alex.

Other things to look at is SDL_ttf for text, SDL_image for loading different
image types (files other than BMPs), and SDL_net for cross-platform
networking.

As Alexandre said, SDL_gui has the menus and buttons thing, as does paragui.

Realize that the straight SDL is designed to be low level and very
cross-platform. Menus definitely aren’t (heck there’s 50 ways to do that
under X because everyone has their own library). Another thing the main SDL
has is constent results across platforms (more or less)… menus LOOK
different under different OSs> ----- Original Message -----

From: gbabusia@ulb.ac.be (Gregory Babusiaux)
To:
Sent: Wednesday, October 17, 2001 8:37 AM
Subject: [SDL] (no subject)

hi I’m a beginner with SDL.
I downloaded th documentation on www.libsdl.org but there’s nothing in it
dealing with text and menus.
Can anyone help me ???


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

Gregory Babusiaux wrote:

hi I’m a beginner with SDL.
I downloaded th documentation on www.libsdl.org but there’s nothing in it dealing with text and menus.
Can anyone help me ??

It seems that you’re french, aren’t you ?

If so go on the http://www.pwdn.net/site/cours.asp?Numero=66

I did these pages during my spare time.

You should visit them with IE for better displaying.

Bye
Lawouach

Other things to look at is SDL_ttf for text, SDL_image for loading
different image types (files other than BMPs), and SDL_net for
cross-platform networking.

As Alexandre said, SDL_gui has the menus and buttons thing, as does
paragui.

Realize that the straight SDL is designed to be low level and very
cross-platform. Menus definitely aren’t (heck there’s 50 ways to do
that under X because everyone has their own library).

To be really picky, make that almost one way per application - few
applications fully complies with the GUI design guidelines for the
toolkits used, if any guidelines exist at all. (Menu items structured in
different ways without logical motivation, inconcistent placement of
buttons, naming of functions etc, etc…)

But of course, all that has little to do with toolkits and APIs. :slight_smile:

Another thing
the main SDL has is constent results across platforms (more or less)…
menus LOOK different under different OSs

Well, at least with most toolkits - as it’s generally a bad idea to
differ from the platform look and feel.

That’s one of the motivations for that toolkit I’ve mentioned. It’ll look
and feel exactly the same on all platforms, which is an absolute
requirement if GUI designers aren’t supposed to make dedicated versions
for each platform. Of course, that’s also a good explanation as to why
basing it on SDL is a good idea - I don’t want any high level rendering
layer that’ll produce different results depending on platform and
rendering target.

Oh, well, enough about that - the less I ramble, the sooner I’ll get
around to code it. :wink:

Off to order some arcade joysticks and other cool stuff from Suzo. :slight_smile:

//David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |-------------------------------------> http://olofson.net -'On Wednesday 17 October 2001 16:45, Joe Tennies wrote:

ya va tirando la version para windows (mira la web :slight_smile:
quieres ser mi betatester y te la envio antes de publicarla?

En dv, 2001-10-26 a 10:01, samsaga2 escribio:

ya va tirando la version para windows (mira la web :slight_smile:
quieres ser mi betatester y te la envio antes de publicarla?


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

i’m sorry, wrong destination :slight_smile:

ya va tirando la version para windows (mira la web :slight_smile:
quieres ser mi betatester y te la envio antes de publicarla?

non, non, je ne pense pas !