Allegro.cc Forums » Programming Questions » GFX Capabilities

Credits go to Thomas Fjellstrom and Todd Cope for helping out!
 Todd Cope Member #998 November 2000 This:```if((gfx_capabilities & GFX_CAN_TRIPLE_BUFFER) && (gfx_capabilities & GFX_HW_FILL)) { do_whatever(); } ``` Or:```if((gfx_capabilities & (GFX_CAN_TRIPLE_BUFFER | GFX_HW_FILL))) { do_whatever(); } ``` Each flag is determined by whether or not a certain bit is set in gfx_capabilities. To check if a certain bit is set you use the logical and (&) operator with the righthand operand being a number that has the bits set that you want.The logical or (|) can be used to combine the bits of 2 numbers into 1. If you have a number that has the first two bits set and another with the third and fourth bits set and or them together you will get a number with the first four bits set.
 kazzmir Member #1,786 December 2001 No it would be true if the result was equal to the combination of both flags: ```if ( gfx_capabilities & (GFX_CAN_TRIPLE_BUFFER | GFX_HW_FILL) == (GFX_CAN_TRIPLE_BUFFER | GFX_HW_FILL) ){ .. } ```