Hi all,
Is there a function that lets you move an SDL window?
Jim
Hi all,
Is there a function that lets you move an SDL window?
Jim
To move a surface just use variable SDL_Rect position in an SDL_BlitSuface() like this :
SDL_Rect rect;
rect.x = new_x_position;
rect.y = new_y_position;
this SDL_Rect structure define positions and width/height of surface
then call SDL_BlitSurface()
SDL_BlitSurface(surface_to_move, NULL, screen_surface, &rect);
SDL_UpdateRect(screen_surface); //or can be SDL_Flip()
Then in your main loop you can affect you SDL_Rect to any coordinates (can be mouse cursor, see SDL_MOUSEMOTION event to get cursor positions). Important is to blit each mouvement change with new rect positions.
cya
Carlos
On Wed, 21 May 2003 11:54:34 -0400
"James Tse" a ?crit:> Hi all,
Is there a function that lets you move an SDL window?
Jim
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
— carlos wrote: > To move a
surface just use variable SDL_Rect
position in an SDL_BlitSuface() like this :
SDL_Rect rect;
rect.x = new_x_position;
rect.y = new_y_position;
this SDL_Rect structure define positions and
width/height of surfacethen call SDL_BlitSurface()
SDL_BlitSurface(surface_to_move, NULL,
screen_surface, &rect);
SDL_UpdateRect(screen_surface); //or can be
SDL_Flip()Then in your main loop you can affect you SDL_Rect
to any coordinates (can be mouse cursor, see
SDL_MOUSEMOTION event to get cursor positions).
Important is to blit each mouvement change with new
rect positions.cya
Carlos
On Wed, 21 May 2003 11:54:34 -0400
"James Tse" a ?crit:Hi all,
Is there a function that lets you move an SDL
window?Jim
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
Carlos I think he was refering to a window, not a
surface. I don’t know the answer, but I would expect
if it can be done that it is system specific.
Rafik______________________________________________________________________
Post your free ad now! http://personals.yahoo.ca
Yeah I was referring to windows and not surfaces. Ideally, I’d like a
cross-platform solution. Any plans for a move window function in SDL 1.3 or
2.0?
Jim> ----- Original Message -----
From: rafik_rezzik@yahoo.ca (Rafik Rezzik)
To:
Sent: Wednesday, May 21, 2003 3:27 PM
Subject: Re: [SDL] Moving windows— carlos wrote: > To move a
surface just use variable SDL_Rectposition in an SDL_BlitSuface() like this :
SDL_Rect rect;
rect.x = new_x_position;
rect.y = new_y_position;
this SDL_Rect structure define positions and
width/height of surfacethen call SDL_BlitSurface()
SDL_BlitSurface(surface_to_move, NULL,
screen_surface, &rect);
SDL_UpdateRect(screen_surface); //or can be
SDL_Flip()Then in your main loop you can affect you SDL_Rect
to any coordinates (can be mouse cursor, see
SDL_MOUSEMOTION event to get cursor positions).
Important is to blit each mouvement change with new
rect positions.cya
Carlos
On Wed, 21 May 2003 11:54:34 -0400
"James Tse" <@James_Tse> a ?crit:Hi all,
Is there a function that lets you move an SDL
window?Jim
Carlos I think he was refering to a window, not a
surface. I don’t know the answer, but I would expect
if it can be done that it is system specific.Rafik