Drag[en]gine Game Engine  1.0
decLayerMask Class Reference

Simple mask to organize objects into layers. More...

#include <decLayerMask.h>

Public Member Functions

Constructors and Destructors
 decLayerMask ()
 Creates a new layer mask. More...
 
 decLayerMask (const decLayerMask &layerMask)
 Creates a new layer mask as a copy of another layer mask. More...
 
 ~decLayerMask ()
 Cleans up layer mask. More...
 
Operators
bool operator== (const decLayerMask &layerMask) const
 Determines if the layer masks are equal. More...
 
bool operator!= (const decLayerMask &layerMask) const
 Determines if the layer masks are not equal. More...
 
decLayerMaskoperator= (const decLayerMask &layerMask)
 Sets this layer mask to another one. More...
 
decLayerMaskoperator|= (const decLayerMask &layerMask)
 Sets all bits that are set in another one. More...
 
decLayerMaskoperator &= (const decLayerMask &layerMask)
 Clears all bits that are not set in another one. More...
 
decLayerMaskoperator^= (const decLayerMask &layerMask)
 Sets bits that are different between this layer mask and another one. More...
 
decLayerMask operator| (const decLayerMask &layerMask) const
 Retrieves a layermask with all bits set that are set in either this layer mask or another one. More...
 
decLayerMask operator & (const decLayerMask &layerMask) const
 Retrieves a layermask with all bits set that are set in both this layer mask and another one. More...
 
decLayerMask operator^ (const decLayerMask &layerMask) const
 Retrieves a layermask with all bits set that are different between this layer mask and another one. More...
 
decLayerMask operator~ () const
 Retrieves the inverse layermask with all bits inverted. More...
 

Management

void ClearMask ()
 Clears the mask. More...
 
void FillMask ()
 Sets all bits in the mask. More...
 
void SetBit (int bit)
 Sets a bit in the range from 0 to 63 inclusive. More...
 
void ClearBit (int bit)
 Clears a bit in the range from 0 to 63 inclusive. More...
 
bool IsBitSet (int bit) const
 Determines if a bit is set in the range from 0 to 63 inclusive. More...
 
bool IsBitCleared (int bit) const
 Determines if a bit is not set in the range from 0 to 63 inclusive. More...
 
bool IsEmpty () const
 Determines if the layer mask has no bits set. More...
 
bool IsNotEmpty () const
 Determines if the layer mask has at least one bit set. More...
 
bool Matches (const decLayerMask &layerMask) const
 Determines if this mask shares at least one bit with another mask. More...
 
bool MatchesNot (const decLayerMask &layerMask) const
 Determines if this mask shares no bits with another mask. More...
 
decString ToBitString () const
 Retrieves a bit string representation. More...
 
void SetFromBitString (const char *string)
 Sets the layer mask from a bit string representation. More...
 
decString ToHexString () const
 Retrieves a hexadecimal string representation. More...
 
void SetFromHexString (const char *string)
 Sets the layer mask from a hexadecimal string representation. More...
 
void WriteToFile (decBaseFileWriter &writer) const
 Write layer mask to file writer. More...
 
static decLayerMask ReadFromFile (decBaseFileReader &reader)
 Read layer mask from file reader. More...
 

Detailed Description

Simple mask to organize objects into layers.

Objects can be located on multiple layers depending on the bits set. A maximum of 64 layers can be used.

Author
Pl├╝ss Roland.
Version
1.0
Date
2015

Constructor & Destructor Documentation

◆ decLayerMask() [1/2]

decLayerMask::decLayerMask ( )

Creates a new layer mask.

◆ decLayerMask() [2/2]

decLayerMask::decLayerMask ( const decLayerMask layerMask)

Creates a new layer mask as a copy of another layer mask.

◆ ~decLayerMask()

decLayerMask::~decLayerMask ( )

Cleans up layer mask.

Member Function Documentation

◆ ClearBit()

void decLayerMask::ClearBit ( int  bit)

Clears a bit in the range from 0 to 63 inclusive.

◆ ClearMask()

void decLayerMask::ClearMask ( )

Clears the mask.

◆ FillMask()

void decLayerMask::FillMask ( )

Sets all bits in the mask.

◆ IsBitCleared()

bool decLayerMask::IsBitCleared ( int  bit) const

Determines if a bit is not set in the range from 0 to 63 inclusive.

◆ IsBitSet()

bool decLayerMask::IsBitSet ( int  bit) const

Determines if a bit is set in the range from 0 to 63 inclusive.

◆ IsEmpty()

bool decLayerMask::IsEmpty ( ) const

Determines if the layer mask has no bits set.

◆ IsNotEmpty()

bool decLayerMask::IsNotEmpty ( ) const

Determines if the layer mask has at least one bit set.

◆ Matches()

bool decLayerMask::Matches ( const decLayerMask layerMask) const

Determines if this mask shares at least one bit with another mask.

◆ MatchesNot()

bool decLayerMask::MatchesNot ( const decLayerMask layerMask) const

Determines if this mask shares no bits with another mask.

◆ operator &()

decLayerMask decLayerMask::operator& ( const decLayerMask layerMask) const

Retrieves a layermask with all bits set that are set in both this layer mask and another one.

◆ operator &=()

decLayerMask& decLayerMask::operator&= ( const decLayerMask layerMask)

Clears all bits that are not set in another one.

◆ operator!=()

bool decLayerMask::operator!= ( const decLayerMask layerMask) const

Determines if the layer masks are not equal.

◆ operator=()

decLayerMask& decLayerMask::operator= ( const decLayerMask layerMask)

Sets this layer mask to another one.

◆ operator==()

bool decLayerMask::operator== ( const decLayerMask layerMask) const

Determines if the layer masks are equal.

◆ operator^()

decLayerMask decLayerMask::operator^ ( const decLayerMask layerMask) const

Retrieves a layermask with all bits set that are different between this layer mask and another one.

◆ operator^=()

decLayerMask& decLayerMask::operator^= ( const decLayerMask layerMask)

Sets bits that are different between this layer mask and another one.

◆ operator|()

decLayerMask decLayerMask::operator| ( const decLayerMask layerMask) const

Retrieves a layermask with all bits set that are set in either this layer mask or another one.

◆ operator|=()

decLayerMask& decLayerMask::operator|= ( const decLayerMask layerMask)

Sets all bits that are set in another one.

◆ operator~()

decLayerMask decLayerMask::operator~ ( ) const

Retrieves the inverse layermask with all bits inverted.

◆ ReadFromFile()

static decLayerMask decLayerMask::ReadFromFile ( decBaseFileReader reader)
static

Read layer mask from file reader.

◆ SetBit()

void decLayerMask::SetBit ( int  bit)

Sets a bit in the range from 0 to 63 inclusive.

◆ SetFromBitString()

void decLayerMask::SetFromBitString ( const char *  string)

Sets the layer mask from a bit string representation.

String contains 1 for set bits and 0 for cleared bits. The first bit is located on the front of the string with bits following up to the bit 63. If the string is less than 64 characters long all bits outside the range are set to cleared.

◆ SetFromHexString()

void decLayerMask::SetFromHexString ( const char *  string)

Sets the layer mask from a hexadecimal string representation.

String contains groups of 4 bits converted to readable hexadecimal in the form 0 to f. The first 4 bits are located in the hex digit at the front of the string with each group of 4 bits following up to bit 63. Inside each hex digit the first bit in the group is located at the high bit with each following bit progressing down to the lowest bit. If the string is less than 16 characters long all bits outside the range are set to cleared.

◆ ToBitString()

decString decLayerMask::ToBitString ( ) const

Retrieves a bit string representation.

String contains 1 for set bits and 0 for cleared bits. The first bit is located on the front of the string with bits following up to the bit 63.

◆ ToHexString()

decString decLayerMask::ToHexString ( ) const

Retrieves a hexadecimal string representation.

String contains groups of 4 bits converted to readable hexadecimal in the form 0 to f. The first 4 bits are located in the hex digit at the front of the string with each group of 4 bits following up to bit 63. Inside each hex digit the first bit in the group is located at the high bit with each following bit progressing down to the lowest bit.

◆ WriteToFile()

void decLayerMask::WriteToFile ( decBaseFileWriter writer) const

Write layer mask to file writer.


The documentation for this class was generated from the following file: