Skip to main content
added 130 characters in body
Source Link
RoughPlace
  • 532
  • 2
  • 7

Using the Component Based approach (c#) i have created a debug object that gets added as component to the Overall solution it is able to handle all debug requests that i'm interested in and draw them to screen by passing an object to the handler

i have then wrapped anything that it does within the compiler if statements

#IF DEBUG
#ENDIF

therefore if i add a peice of text to the Debug handler

i.e

public void AddTouchLocation(vector2 location , string text)
{
    #IF DEBUG        
    Dosomething(location,text);
    #ENDIF
}

the code doesn't do anything with it

i can also wrap the draw method like this also

whilst it maynot be the cleanest solution (it leaves a empty component in release mode) it does allow me to ignore any if debug anywhere else in the project.

public override void Draw()
{
    #IF DEBUG
     //Perform draw of touchlocations
    #ENDIF
}

Using the Component Based approach (c#) i have created a debug object that gets added as component to the solution

i have then wrapped anything that it does within the compiler if statements

#IF DEBUG
#ENDIF

therefore if i add a peice of text to the Debug handler

i.e

public void AddTouchLocation(vector2 location , string text)
{
    #IF DEBUG        
    Dosomething(location,text);
    #ENDIF
}

the code doesn't do anything with it

i can also wrap the draw method like this also

whilst it maynot be the cleanest solution (it leaves a empty component in release mode) it does allow me to ignore any if debug anywhere else in the project.

public override void Draw()
{
    #IF DEBUG
     //Perform draw of touchlocations
    #ENDIF
}

Using the Component Based approach (c#) i have created a debug object that gets added as component to the Overall solution it is able to handle all debug requests that i'm interested in and draw them to screen by passing an object to the handler

i have then wrapped anything that it does within the compiler if statements

#IF DEBUG
#ENDIF

therefore if i add a peice of text to the Debug handler

i.e

public void AddTouchLocation(vector2 location , string text)
{
    #IF DEBUG        
    Dosomething(location,text);
    #ENDIF
}

the code doesn't do anything with it

i can also wrap the draw method like this also

whilst it maynot be the cleanest solution (it leaves a empty component in release mode) it does allow me to ignore any if debug anywhere else in the project.

public override void Draw()
{
    #IF DEBUG
     //Perform draw of touchlocations
    #ENDIF
}
Source Link
RoughPlace
  • 532
  • 2
  • 7

Using the Component Based approach (c#) i have created a debug object that gets added as component to the solution

i have then wrapped anything that it does within the compiler if statements

#IF DEBUG
#ENDIF

therefore if i add a peice of text to the Debug handler

i.e

public void AddTouchLocation(vector2 location , string text)
{
    #IF DEBUG        
    Dosomething(location,text);
    #ENDIF
}

the code doesn't do anything with it

i can also wrap the draw method like this also

whilst it maynot be the cleanest solution (it leaves a empty component in release mode) it does allow me to ignore any if debug anywhere else in the project.

public override void Draw()
{
    #IF DEBUG
     //Perform draw of touchlocations
    #ENDIF
}