[SDL] Getting the system resolution

Nuno Santos developer at imaginando.net
Sun Dec 3 12:44:03 PST 2006


I have errors.

I think i don't have the right version. My version is 1.2.11.

I have the following errors:

error: 'SDL_SysWMinfo' has no member named 'subsystem'
error: 'SDL_SYSWM_X11' undeclared (first use in this function)
error: 'SDL_SysWMinfo' has no member named 'info'

Thx,

Nuno

Em Dec 2, 2006, às 11:25 PM, Jeff escreveu:

> On Sat December 2 2006 13:27, Nuno Santos wrote:
>>
>> I'm looking to that structure and i don't see those fields:
>>
> Maybe this is what you're looking for?
>
> #include <stdio.h>
> #include <stdlib.h>
>
> #include <SDL.h>
> #include <SDL_syswm.h>
>
> int main(void)
> {
>  int w, h, x11screen;
>  const SDL_VideoInfo *info;
>  SDL_PixelFormat *vfmt;
>  SDL_SysWMinfo winfo;
>
>  if (SDL_Init(SDL_INIT_VIDEO))
>  {
>   printf("\nCan't initialize SDL\n\n");
>   return 1;
>  }
>
>  info = SDL_GetVideoInfo();
>
>  printf("\n\nhw avail: %d", info->hw_available);
>  printf("\nwm avail: %d", info->wm_available);
>  printf("\nblit hw: %d", info->blit_hw);
>  printf("\nvideo memory %d", info->video_mem);
>
>  if (info->vfmt)
>  {
>   vfmt = info->vfmt;
>   printf("\nBits per pixel %d", vfmt->BitsPerPixel);
>   printf("\nBytes per pixel %d", vfmt->BytesPerPixel);
>  }
>
>  SDL_VERSION(&winfo.version);
>
>  if (SDL_GetWMInfo(&winfo) > 0)
>  {
>   if (winfo.subsystem == SDL_SYSWM_X11)
>   {
>    x11screen = DefaultScreen(winfo.info.x11.display);
>    w = DisplayWidth(winfo.info.x11.display, x11screen);
>    h = DisplayHeight(winfo.info.x11.display, x11screen);
>    printf("\nScreen width %d, height %d", w, h);
>   }
>   else
>    printf("\n\nNOT X11!");
>  }
>  else
>   printf("\n\nCan't get window manager info!");
>
>  printf("\n\n");
>
>  SDL_Quit();
>  return 0;
> }
>
>
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20061203/6815c59b/attachment.htm 


More information about the SDL mailing list