Terraria ModLoader  0.10.1.5
A framework for Terraria mods
Terraria.ModLoader.ModSurfaceBgStyle Class Referenceabstract

Each background style determines in its own way how exactly the background is drawn. This class serves as a collection of functions for above-ground backgrounds. More...

Public Member Functions

virtual bool Autoload (ref string name)
 Allows you to automatically add a ModSurfaceBgStyle instead of using Mod.AddSurfaceBgStyle. Return true to allow autoloading; by default returns the mod's autoload property. Name is initialized to the overriding class name. Use this to either force or stop an autoload, or change the name that identifies this type of ModSurfaceBgStyle. More...
 
virtual bool ChooseBgStyle ()
 Whether or not the conditions have been met for this background style to draw its backgrounds. Returns false by default. More...
 
virtual int ChooseCloseTexture (ref float scale, ref double parallax, ref float a, ref float b)
 Allows you to determine which texture is drawn in the closest part of the background. This also lets you modify the scale and parallax (as well as two unfortunately-unknown parameters). More...
 
virtual int ChooseFarTexture ()
 Allows you to determine which texture is drawn in the very back of the background. Mod.GetBackgroundSlot may be useful here, as well as for the other texture-choosing hooks. More...
 
virtual int ChooseMiddleTexture ()
 Allows you to determine which texture is drawn in the middle of the background. More...
 
abstract void ModifyFarFades (float[] fades, float transitionSpeed)
 Allows you to modify the transparency of all background styles that exist. In general, you should move the index equal to this style's slot closer to 1, and all other indexes closer to 0. The transitionSpeed parameter is what you should add/subtract to each element of the fades parameter. See the ExampleMod for an example. More...
 
virtual bool PreDrawCloseBackground (SpriteBatch spriteBatch)
 Gives you complete freedom over how the closest part of the background is drawn. Return true for ChooseCloseTexture to have an effect; return false to disable tModLoader's own code for drawing the close background. More...
 

Properties

Mod mod [get, set]
 The mod that added this surface background style. More...
 
string Name [get, set]
 The internal name of this surface background style. More...
 
int Slot [get, set]
 The ID of this surface background style. More...
 

Detailed Description

Each background style determines in its own way how exactly the background is drawn. This class serves as a collection of functions for above-ground backgrounds.

Definition at line 57 of file ModBackgroundStyle.cs.

Member Function Documentation

virtual bool Terraria.ModLoader.ModSurfaceBgStyle.Autoload ( ref string  name)
virtual

Allows you to automatically add a ModSurfaceBgStyle instead of using Mod.AddSurfaceBgStyle. Return true to allow autoloading; by default returns the mod's autoload property. Name is initialized to the overriding class name. Use this to either force or stop an autoload, or change the name that identifies this type of ModSurfaceBgStyle.

Definition at line 86 of file ModBackgroundStyle.cs.

Referenced by Terraria.ModLoader.Mod.AutoloadSurfaceBgStyle().

86  {
87  return mod.Properties.Autoload;
88  }
ModProperties Properties
Definition: Mod.cs:49
bool Autoload
Whether or not this mod will autoload content by default. Autoloading content means you do not need t...
Mod mod
The mod that added this surface background style.

+ Here is the caller graph for this function:

virtual bool Terraria.ModLoader.ModSurfaceBgStyle.ChooseBgStyle ( )
virtual

Whether or not the conditions have been met for this background style to draw its backgrounds. Returns false by default.

Definition at line 93 of file ModBackgroundStyle.cs.

93  {
94  return false;
95  }
virtual int Terraria.ModLoader.ModSurfaceBgStyle.ChooseCloseTexture ( ref float  scale,
ref double  parallax,
ref float  a,
ref float  b 
)
virtual

Allows you to determine which texture is drawn in the closest part of the background. This also lets you modify the scale and parallax (as well as two unfortunately-unknown parameters).

Parameters
scaleThe scale.
parallaxThe parallax value.
aa?
bb?
Returns

Definition at line 131 of file ModBackgroundStyle.cs.

131  {
132  return -1;
133  }
virtual int Terraria.ModLoader.ModSurfaceBgStyle.ChooseFarTexture ( )
virtual

Allows you to determine which texture is drawn in the very back of the background. Mod.GetBackgroundSlot may be useful here, as well as for the other texture-choosing hooks.

Definition at line 105 of file ModBackgroundStyle.cs.

105  {
106  return -1;
107  }
virtual int Terraria.ModLoader.ModSurfaceBgStyle.ChooseMiddleTexture ( )
virtual

Allows you to determine which texture is drawn in the middle of the background.

Definition at line 112 of file ModBackgroundStyle.cs.

112  {
113  return -1;
114  }
abstract void Terraria.ModLoader.ModSurfaceBgStyle.ModifyFarFades ( float[]  fades,
float  transitionSpeed 
)
pure virtual

Allows you to modify the transparency of all background styles that exist. In general, you should move the index equal to this style's slot closer to 1, and all other indexes closer to 0. The transitionSpeed parameter is what you should add/subtract to each element of the fades parameter. See the ExampleMod for an example.

virtual bool Terraria.ModLoader.ModSurfaceBgStyle.PreDrawCloseBackground ( SpriteBatch  spriteBatch)
virtual

Gives you complete freedom over how the closest part of the background is drawn. Return true for ChooseCloseTexture to have an effect; return false to disable tModLoader's own code for drawing the close background.

Definition at line 119 of file ModBackgroundStyle.cs.

119  {
120  return true;
121  }

Property Documentation

Mod Terraria.ModLoader.ModSurfaceBgStyle.mod
getset

The mod that added this surface background style.

Definition at line 62 of file ModBackgroundStyle.cs.

Referenced by Terraria.ModLoader.Mod.AddSurfaceBgStyle(), and Terraria.ModLoader.Mod.AutoloadSurfaceBgStyle().

string Terraria.ModLoader.ModSurfaceBgStyle.Name
getset

The internal name of this surface background style.

Definition at line 70 of file ModBackgroundStyle.cs.

Referenced by Terraria.ModLoader.Mod.AddSurfaceBgStyle().

int Terraria.ModLoader.ModSurfaceBgStyle.Slot
getset

The ID of this surface background style.

Definition at line 78 of file ModBackgroundStyle.cs.

Referenced by Terraria.ModLoader.Mod.AddSurfaceBgStyle().