Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

A hypothetical game called “AlienShooter” needs to be able to work on Windows and on the Xbox. In the Windows version, the keyboard will handle firing at alien spaceships, and this functionality is contained within a method called “KeyboardSupport()”. In the Xbox version of the game, the gamepad will be used for shooting, and this functionality is contained within a method called “GamepadSupport()”. Write the statement(s) that must be added so that the appropriate code is used in the each version of the game.

share|improve this question
Really unclear. I had to look at the answer to figure out what the question was. –  Anko Dec 9 '12 at 17:30
-1 You really couldn't even pose the question in your own words? Lack of research and I don't think "needing to do this homework problem" is "questions based on actual problems that you face." –  Byte56 Dec 9 '12 at 18:33

1 Answer 1

Use the #if directive:

#elif XBOX

The following symbols are defined for use in cross-platform compilation: WINDOWS, XBOX or XBOX360 and WINDOWS_PHONE. See Cross-Platform Conditional Compilation Symbols for further information.

share|improve this answer
@NikoDrašković I edited my answer to make it clearer. Thank you for your suggestion. –  Asakeron Dec 9 '12 at 18:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.