Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
GameInterfaceLayer.cs
Go to the documentation of this file.
1using System;
5
6namespace Terraria.UI;
7
9{
10 public readonly string Name;
11
13
14 public GameInterfaceLayer(string name, InterfaceScaleType scaleType)
15 {
16 Name = name;
17 ScaleType = scaleType;
18 }
19
20 public bool Draw()
21 {
22 Matrix transformMatrix;
23 if (ScaleType == InterfaceScaleType.Game)
24 {
26 transformMatrix = Main.GameViewMatrix.ZoomMatrix;
27 }
28 else if (ScaleType == InterfaceScaleType.UI)
29 {
31 transformMatrix = Main.UIScaleMatrix;
32 }
33 else
34 {
36 transformMatrix = Matrix.Identity;
37 }
38 bool result = false;
39 Main.spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, transformMatrix);
40 try
41 {
42 result = DrawSelf();
43 }
44 catch (Exception e)
45 {
47 }
48 Main.spriteBatch.End();
49 return result;
50 }
51
52 protected virtual bool DrawSelf()
53 {
54 return true;
55 }
56}
static SpriteBatch spriteBatch
Definition Main.cs:974
static Matrix UIScaleMatrix
Definition Main.cs:2619
static SpriteViewMatrix GameViewMatrix
Definition Main.cs:227
static void DrawException(Exception e)
GameInterfaceLayer(string name, InterfaceScaleType scaleType)