C structs & bad aftershave...

new topic     » topic index » view thread      » older message » newer message

Ok no Old Spice... I just wanted some attention! :)

Background: Lest I get ahead of myself.
I am using M Akita's SDL for Eu wrapper. SDL is compiled into a DLL.
I want to access a member of a C structure. 

typedef struct{
  Uint32 hw_available:1;
  Uint32 wm_available:1;
  Uint32 blit_hw:1;
  Uint32 blit_hw_CC:1;
  Uint32 blit_hw_A:1;
  Uint32 blit_sw:1;
  Uint32 blit_sw_CC:1;
  Uint32 blit_sw_A:1;
  Uint32 blit_fill;
  Uint32 video_mem;
  SDL_PixelFormat *vfmt;
} SDL_VideoInfo;

I can access its value by doing this:

atom videoInfo

videoInfo = SDL_GetVideoInfo()

How do I, using Euphoria, best go about reading the above bit flags?
I have tried this:

<EuCode)
sequence mbits
atom lflg

mbits = int_to_bits(videoInfo)

sprintf("flags: %d %d %d ...<snip>", {mbits[1], mbits[2], ...<snip>})

<EuCode>

Which gives me some really odd results.  When I peek 36 bytes into this 
structure, and grab 4 bytes, I do get the correct amount of video memory 
for my graphics card.  There ends my success though.

Could someone explain to me how to access the bit flags of that struct?
I seem to be doing this all wrong despite my best intentions. :)

For more info, here is the SDL API page.
http://www.libsdl.org/cgi/docwiki.cgi/SDL_20API

Thanks again. As always, you guys rule.

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu