Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
AnOutlinedDrawRenderTargetContent.cs
Go to the documentation of this file.
1using System;
4
6
8{
9 protected int width = 84;
10
11 protected int height = 84;
12
14
16
18
19 public void UseColor(Color color)
20 {
21 _borderColor = color;
22 }
23
24 protected override void HandleUseReqest(GraphicsDevice device, SpriteBatch spriteBatch)
25 {
26 Effect pixelShader = Main.pixelShader;
27 if (_coloringShader == null)
28 {
29 _coloringShader = pixelShader.CurrentTechnique.Passes["ColorOnly"];
30 }
31 new Rectangle(0, 0, width, height);
35 device.Clear(Color.Transparent);
37 DrawTheContent(spriteBatch);
38 spriteBatch.End();
40 device.Clear(Color.Transparent);
43 int num = 2;
44 int num2 = num * 2;
45 for (int i = -num2; i <= num2; i += num)
46 {
47 for (int j = -num2; j <= num2; j += num)
48 {
49 if (Math.Abs(i) + Math.Abs(j) == num2)
50 {
51 spriteBatch.Draw(_helperTarget, new Vector2(i, j), Color.Black);
52 }
53 }
54 }
55 num2 = num;
56 for (int k = -num2; k <= num2; k += num)
57 {
58 for (int l = -num2; l <= num2; l += num)
59 {
60 if (Math.Abs(k) + Math.Abs(l) == num2)
61 {
62 spriteBatch.Draw(_helperTarget, new Vector2(k, l), _borderColor);
63 }
64 }
65 }
66 pixelShader.CurrentTechnique.Passes[0].Apply();
68 spriteBatch.End();
69 device.SetRenderTarget(null);
70 _wasPrepared = true;
71 }
72
73 internal abstract void DrawTheContent(SpriteBatch spriteBatch);
74}
static readonly BlendState AlphaBlend
Definition BlendState.cs:36
unsafe EffectTechnique CurrentTechnique
Definition Effect.cs:34
void Clear(ClearOptions options, Vector4 color, float depth, int stencil)
unsafe void SetRenderTarget(RenderTargetCube renderTarget, CubeMapFace cubeMapFace)
static readonly RasterizerState CullCounterClockwise
static readonly SamplerState PointClamp
void Draw(Texture2D texture, Vector2 position, Color color)
static double Abs(double value)
void PrepareARenderTarget_AndListenToEvents(ref RenderTarget2D target, GraphicsDevice device, int neededWidth, int neededHeight, RenderTargetUsage usage)
void PrepareARenderTarget_WithoutListeningToEvents(ref RenderTarget2D target, GraphicsDevice device, int neededWidth, int neededHeight, RenderTargetUsage usage)
override void HandleUseReqest(GraphicsDevice device, SpriteBatch spriteBatch)
static Effect pixelShader
Definition Main.cs:2764
static Color Transparent
Definition Color.cs:76