Terraria ModLoader  0.10.1.5
A framework for Terraria mods
ModBackgroundStyle.cs
Go to the documentation of this file.
1 using Microsoft.Xna.Framework.Graphics;
2 
3 namespace Terraria.ModLoader
4 {
8  public abstract class ModUgBgStyle
9  {
13  public Mod mod {
14  get;
15  internal set;
16  }
17 
21  public string Name {
22  get;
23  internal set;
24  }
25 
29  public int Slot {
30  get;
31  internal set;
32  }
33 
37  public virtual bool Autoload(ref string name) {
38  return mod.Properties.Autoload;
39  }
40 
44  public virtual bool ChooseBgStyle() {
45  return false;
46  }
47 
51  public abstract void FillTextureArray(int[] textureSlots);
52  }
53 
57  public abstract class ModSurfaceBgStyle
58  {
62  public Mod mod {
63  get;
64  internal set;
65  }
66 
70  public string Name {
71  get;
72  internal set;
73  }
74 
78  public int Slot {
79  get;
80  internal set;
81  }
82 
86  public virtual bool Autoload(ref string name) {
87  return mod.Properties.Autoload;
88  }
89 
93  public virtual bool ChooseBgStyle() {
94  return false;
95  }
96 
100  public abstract void ModifyFarFades(float[] fades, float transitionSpeed);
101 
105  public virtual int ChooseFarTexture() {
106  return -1;
107  }
108 
112  public virtual int ChooseMiddleTexture() {
113  return -1;
114  }
115 
119  public virtual bool PreDrawCloseBackground(SpriteBatch spriteBatch) {
120  return true;
121  }
122 
131  public virtual int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b) {
132  return -1;
133  }
134  }
135 
139  public class GlobalBgStyle
140  {
144  public Mod mod {
145  get;
146  internal set;
147  }
148 
152  public string Name {
153  get;
154  internal set;
155  }
156 
160  public virtual bool Autoload(ref string name) {
161  return mod.Properties.Autoload;
162  }
163 
167  public virtual void ChooseUgBgStyle(ref int style) {
168  }
169 
173  public virtual void ChooseSurfaceBgStyle(ref int style) {
174  }
175 
179  public virtual void FillUgTextureArray(int style, int[] textureSlots) {
180  }
181 
185  public virtual void ModifyFarSurfaceFades(int style, float[] fades, float transitionSpeed) {
186  }
187  }
188 }
virtual bool ChooseBgStyle()
Whether or not the conditions have been met for this background style to draw its backgrounds...
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).
virtual void ChooseUgBgStyle(ref int style)
Allows you to change which underground background style is being used.
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.
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.
virtual bool Autoload(ref string name)
Allows you to automatically add a ModUgBgStyle instead of using Mod.AddUgBgStyle. Return true to allo...
virtual bool Autoload(ref string name)
Allows you to automatically add a GlobalBgStyle instead of using Mod.AddGlobalBgStyle. 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 GlobalBgStyle.
This class serves to collect functions that operate on any kind of background style, without being specific to one single background style.
virtual bool ChooseBgStyle()
Whether or not the conditions have been met for this background style to draw its backgrounds...
virtual bool PreDrawCloseBackground(SpriteBatch spriteBatch)
Gives you complete freedom over how the closest part of the background is drawn. Return true for Choo...
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.
virtual void ChooseSurfaceBgStyle(ref int style)
Allows you to change which surface background style is being used.
virtual void FillUgTextureArray(int style, int[] textureSlots)
Allows you to change which textures make up the underground background by assigning their background ...
virtual int ChooseMiddleTexture()
Allows you to determine which texture is drawn in the middle of the background.
virtual void ModifyFarSurfaceFades(int style, float[] fades, float transitionSpeed)
Allows you to modify the transparency of all background styles that exist. The style parameter is the...
Mod is an abstract class that you will override. It serves as a central place from which the mod's co...
Definition: Mod.cs:23
Each background style determines in its own way how exactly the background is drawn. This class serves as a collection of functions for underground backgrounds.