1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

using Terraria;
using TerrariaAPI;

/*
 * Author iPie uDie
 */

namespace ResoChanger
{

    public class ResoChanger : TerrariaMod
    {

        public override void Initialize(TehModAPI api)
        {
            api.RegisterMenu(this, "Resolution");
            api.AddOption(this, "800x600", "r600p", 2);
            api.AddOption(this, "1280x720", "r720p", 2);
            api.AddOption(this, "1280x1024", "r1024p", 2);
            api.AddOption(this, "1366x768", "r768p", 2);
            api.AddOption(this, "1600x900", "r900p", 2);
            api.AddOption(this, "1920x1080", "r1080p", 2);
        }

        public override void ModMenuAction(TehModAPI api, MenuOption opt)
        {
            string variable = opt.action;
            if (variable.Equals("r600p"))
            {
                api.gfx.PreferredBackBufferWidth = 800;
                api.gfx.PreferredBackBufferHeight = 600;
                api.gfx.ApplyChanges();
            }
            else if (variable.Equals("r720p"))
            {
                api.gfx.PreferredBackBufferWidth = 1280;
                api.gfx.PreferredBackBufferHeight = 720;
                api.gfx.ApplyChanges();
            }
            else if (variable.Equals("r768p"))
            {
                api.gfx.PreferredBackBufferWidth = 1366;
                api.gfx.PreferredBackBufferHeight = 768;
                api.gfx.ApplyChanges();
            }
            else if (variable.Equals("r900p"))
            {
                api.gfx.PreferredBackBufferWidth = 1600;
                api.gfx.PreferredBackBufferHeight = 900;
                api.gfx.ApplyChanges();
            }
            else if (variable.Equals("r1024p"))
            {
                api.gfx.PreferredBackBufferWidth = 1280;
                api.gfx.PreferredBackBufferHeight = 1024;
                api.gfx.ApplyChanges();
            }
            else if (variable.Equals("r1080p"))
            {
                api.gfx.PreferredBackBufferWidth = 1920;
                api.gfx.PreferredBackBufferHeight = 1080;
                api.gfx.ApplyChanges();
            }
        }

        public override string GetName()
        {
            return "ResoChanger";
        }

        public override string GetVersion()
        {
            return "v1.0";
        }
    }

}