Attempting to make SDL wrapper for QB64 - First hurdle!

Oh yeah… I should also point out that your function probably
doesn’t do what you really want.
Your use of SDL_PollEvent will cause you to lose any events which are
not resize events.

Jonny DOn Fri, Jan 14, 2011 at 4:53 PM, Jonathan Dearborn <@Jonathan_Dearborn> wrote:

Could you make this function do all three? ?I don’t know much about
QB, but you could have this instead:

int GDK_CheckResize(int* width, int* height);

The function would set ‘width’ and ‘height’ to the members in
SDL_ResizeEvent if they’re not NULL.

For reference:

typedef struct{
?Uint8 type;
?int w, h;
} SDL_ResizeEvent;

So, the width is event.resize.w

Jonny D

On Fri, Jan 14, 2011 at 11:18 AM, Unseen Machine wrote:

I must be dumb as i cant make head nore tail of the help files and have googled by fingers sore, so i finally gave in and came here.

Still working with QB64 (pointer support and more has been added by Galleon) so accessing SDL is now a lot easier than when i first posted. I have this code in a lib which reports when a window resize event has occured.

Code:

int GDK_CheckResize(void)
{
? SDL_Event event;
? while(SDL_PollEvent(&event))
? {
? ? switch(event.type)
? ? {
? ? ? case SDL_VIDEORESIZE:
? ?return(-1);
? ?break;
? ? ? default:
? ?return(0);
? ?break;
? ? }
? }
}

It Works as it should. What i need to do know is make 2 new functions that return the new width and height values of the resized window. I dont know how to do this. Is it possible??

Any ideas would be great, thanks folks.

John


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Ah I never looked before. There is SDL_PeepEvents, which might interest you.

Jonny DOn Fri, Jan 14, 2011 at 5:00 PM, Jonathan Dearborn <@Jonathan_Dearborn> wrote:

Oh yeah… ?I should also point out that your function probably
doesn’t do what you really want.
Your use of SDL_PollEvent will cause you to lose any events which are
not resize events.

Jonny D

On Fri, Jan 14, 2011 at 4:53 PM, Jonathan Dearborn <@Jonathan_Dearborn> wrote:

Could you make this function do all three? ?I don’t know much about
QB, but you could have this instead:

int GDK_CheckResize(int* width, int* height);

The function would set ‘width’ and ‘height’ to the members in
SDL_ResizeEvent if they’re not NULL.

For reference:

typedef struct{
?Uint8 type;
?int w, h;
} SDL_ResizeEvent;

So, the width is event.resize.w

Jonny D

On Fri, Jan 14, 2011 at 11:18 AM, Unseen Machine wrote:

I must be dumb as i cant make head nore tail of the help files and have googled by fingers sore, so i finally gave in and came here.

Still working with QB64 (pointer support and more has been added by Galleon) so accessing SDL is now a lot easier than when i first posted. I have this code in a lib which reports when a window resize event has occured.

Code:

int GDK_CheckResize(void)
{
? SDL_Event event;
? while(SDL_PollEvent(&event))
? {
? ? switch(event.type)
? ? {
? ? ? case SDL_VIDEORESIZE:
? ?return(-1);
? ?break;
? ? ? default:
? ?return(0);
? ?break;
? ? }
? }
}

It Works as it should. What i need to do know is make 2 new functions that return the new width and height values of the resized window. I dont know how to do this. Is it possible??

Any ideas would be great, thanks folks.

John


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I dont mind making it do all three at once, it makes sense to me. Thanks for the tips.

John

Thanks Johnny D. QB64 now has resizeable windows thanks to you. It some times misses resize events but i will look into Peepevents to see if that can help in anyway.

The Qb64 thread…

http://www.qb64.net/forum/index.php?topic=2629.new#new

and the code…

Code:

int GDK_ResizeScreen(int* Width, int* Height)
{
SDL_Event event;
while(SDL_PollEvent(&event))
{
switch(event.type)
{
case SDL_VIDEORESIZE:
*Width = event.resize.w;
*Height = event.resize.h;
return(-1);
break;
default:
return(0);
break;
}
}
}

Thanks again,

John