belugas@8345: /* $Id$ */ belugas@8345: belugas@8345: /** @file transparency.h */ belugas@8345: belugas@8345: #ifndef TRANSPARENCY_H belugas@8345: #define TRANSPARENCY_H belugas@8345: rubidium@8619: #include "gfx_func.h" rubidium@8619: belugas@8345: /** belugas@8345: * Transparency option bits: which position in _transparency_opt stands for which transparency. belugas@8345: * If you change the order, change the order of the ShowTransparencyToolbar() stuff in transparency_gui.cpp too. belugas@8345: * If you add or remove an option don't forget to change the transparency 'hot keys' in main_gui.cpp. belugas@8345: */ belugas@8345: enum TransparencyOption { belugas@8345: TO_SIGNS = 0, ///< signs belugas@8345: TO_TREES, ///< trees belugas@8345: TO_HOUSES, ///< town buildings belugas@8345: TO_INDUSTRIES, ///< industries belugas@8345: TO_BUILDINGS, ///< player buildings - depots, stations, HQ, ... belugas@8345: TO_BRIDGES, ///< bridges belugas@8345: TO_STRUCTURES, ///< unmovable structures smatz@9024: TO_CATENARY, ///< catenary belugas@8345: TO_LOADING, ///< loading indicators belugas@8345: TO_END, belugas@8345: }; belugas@8345: smatz@9024: typedef uint TransparencyOptionBits; ///< transparency option bits belugas@8345: extern TransparencyOptionBits _transparency_opt; maedhros@9023: extern TransparencyOptionBits _transparency_lock; belugas@8345: belugas@8345: /** belugas@8345: * Check if the transparency option bit is set belugas@8345: * and if we aren't in the game menu (there's never transparency) belugas@8345: * belugas@8345: * @param to the structure which transparency option is ask for belugas@8345: */ belugas@8345: static inline bool IsTransparencySet(TransparencyOption to) belugas@8345: { skidd13@8424: return (HasBit(_transparency_opt, to) && _game_mode != GM_MENU); belugas@8345: } belugas@8345: belugas@8345: /** belugas@8345: * Toggle the transparency option bit belugas@8345: * maedhros@9023: * @param to the transparency option to be toggled belugas@8345: */ belugas@8345: static inline void ToggleTransparency(TransparencyOption to) belugas@8345: { skidd13@8428: ToggleBit(_transparency_opt, to); belugas@8345: } belugas@8345: maedhros@9023: /** maedhros@9023: * Toggle the transparency lock bit maedhros@9023: * maedhros@9023: * @param to the transparency option to be locked or unlocked maedhros@9023: */ maedhros@9023: static inline void ToggleTransparencyLock(TransparencyOption to) maedhros@9023: { maedhros@9023: ToggleBit(_transparency_lock, to); maedhros@9023: } maedhros@9023: maedhros@9023: /** Set or clear all non-locked transparency options */ belugas@8345: static inline void ResetRestoreAllTransparency() belugas@8345: { maedhros@9023: /* if none of the non-locked options are set */ maedhros@9023: if ((_transparency_opt & ~_transparency_lock) == 0) { maedhros@9023: /* set all non-locked options */ maedhros@9023: _transparency_opt |= ~_transparency_lock; belugas@8345: } else { maedhros@9023: /* clear all non-locked options */ maedhros@9023: _transparency_opt &= _transparency_lock; belugas@8345: } belugas@8345: belugas@8345: MarkWholeScreenDirty(); belugas@8345: } belugas@8345: belugas@8345: #endif /* TRANSPARENCY_H */