Esempio n. 1
0
 public HUDModule(TrueCraftGame game, FontRenderer font)
 {
     Game = game;
     Font = font;
     SpriteBatch = new SpriteBatch(game.GraphicsDevice);
     GUI = game.TextureMapper.GetTexture("gui/gui.png");
     Icons = game.TextureMapper.GetTexture("gui/icons.png");
     Items = game.TextureMapper.GetTexture("gui/items.png");
 }
Esempio n. 2
0
        public DebugInfoModule(TrueCraftGame game, FontRenderer font)
        {
            Game = game;
            Font = font;
            SpriteBatch = new SpriteBatch(Game.GraphicsDevice);
#if DEBUG
            Enabled = true;
#endif
        }
Esempio n. 3
0
 public WindowModule(TrueCraftGame game, FontRenderer font)
 {
     Game = game;
     Font = font;
     SpriteBatch = new SpriteBatch(game.GraphicsDevice);
     Inventory = game.TextureMapper.GetTexture("gui/inventory.png");
     Crafting = game.TextureMapper.GetTexture("gui/crafting.png");
     Items = game.TextureMapper.GetTexture("gui/items.png");
     SelectedSlot = -1;
     HeldItem = ItemStack.EmptyStack;
 }
Esempio n. 4
0
 public ChatModule(TrueCraftGame game, FontRenderer font)
 {
     Game = game;
     Font = font;
     Messages = new List<Message>();
     Background = new Texture2D(Game.GraphicsDevice, 1, 1);
     Background.SetData<Color>(new[] { new Color(Color.Black, 160) });
     SpriteBatch = new SpriteBatch(Game.GraphicsDevice);
     Watch = new Stopwatch();
     Watch.Start();
     Text = string.Empty;
     Game.Client.ChatMessage += (sender, e) => AddMessage(e.Message);
 }
        public ChatInterface(MultiplayerClient client, KeyboardComponent keyboard, FontRenderer font)
        {
            Client = client;
            Keyboard = keyboard;
            Font = font;

            Input = string.Empty;
            Messages = new List<ChatMessage>();
            DummyTexture = new Texture2D(keyboard.Game.GraphicsDevice, 1, 1);
            DummyTexture.SetData(new[] { Color.White });

            Client.ChatMessage += OnChatMessage;
            Keyboard.KeyDown += OnKeyDown;
        }
Esempio n. 6
0
        protected override void LoadContent()
        {
            // Ensure we have default textures loaded.
            TextureMapper.LoadDefaults(GraphicsDevice);

            // Load any custom textures if needed.
            TextureMapper = new TextureMapper(GraphicsDevice);
            if (UserSettings.Local.SelectedTexturePack != TexturePack.Default.Name)
                TextureMapper.AddTexturePack(TexturePack.FromArchive(Path.Combine(TexturePack.TexturePackPath, UserSettings.Local.SelectedTexturePack)));

            Pixel = new FontRenderer(
                new Font(Content, "Fonts/Pixel", FontStyle.Regular),
                new Font(Content, "Fonts/Pixel", FontStyle.Bold),
                null, // No support for underlined or strikethrough yet. The FontRenderer will revert to using the regular font style.
                null, // (I don't think BMFont has those options?)
                new Font(Content, "Fonts/Pixel", FontStyle.Italic));
            Interfaces.Add(ChatInterface = new ChatInterface(Client, KeyboardComponent, Pixel));
            Interfaces.Add(DebugInterface = new DebugInterface(Client, Pixel));

            ChatInterface.IsVisible = true;
            DebugInterface.IsVisible = true;

            OpaqueEffect = new BasicEffect(GraphicsDevice);
            OpaqueEffect.EnableDefaultLighting();
            OpaqueEffect.DirectionalLight0.SpecularColor = Color.Black.ToVector3();
            OpaqueEffect.DirectionalLight1.SpecularColor = Color.Black.ToVector3();
            OpaqueEffect.DirectionalLight2.SpecularColor = Color.Black.ToVector3();
            OpaqueEffect.TextureEnabled = true;
            OpaqueEffect.Texture = TextureMapper.GetTexture("terrain.png");
            OpaqueEffect.FogEnabled = true;
            OpaqueEffect.FogStart = 512f;
            OpaqueEffect.FogEnd = 1000f;
            OpaqueEffect.FogColor = Color.CornflowerBlue.ToVector3();
            OpaqueEffect.VertexColorEnabled = true;

            TransparentEffect = new AlphaTestEffect(GraphicsDevice);
            TransparentEffect.AlphaFunction = CompareFunction.Greater;
            TransparentEffect.ReferenceAlpha = 127;
            TransparentEffect.Texture = TextureMapper.GetTexture("terrain.png");
            TransparentEffect.VertexColorEnabled = true;

            base.LoadContent();
        }
 public DebugInterface(MultiplayerClient client, FontRenderer font)
 {
     Client = client;
     Font = font;
 }
Esempio n. 8
0
        protected override void LoadContent()
        {
            // Ensure we have default textures loaded.
            TextureMapper.LoadDefaults(GraphicsDevice);

            // Load any custom textures if needed.
            TextureMapper = new TextureMapper(GraphicsDevice);
            if (UserSettings.Local.SelectedTexturePack != TexturePack.Default.Name)
                TextureMapper.AddTexturePack(TexturePack.FromArchive(Path.Combine(Paths.TexturePacks,
                    UserSettings.Local.SelectedTexturePack)));

            Pixel = new FontRenderer(
                new Font(Content, "Fonts/Pixel"),
                new Font(Content, "Fonts/Pixel", FontStyle.Bold), null, null,
                new Font(Content, "Fonts/Pixel", FontStyle.Italic));

            base.LoadContent();
        }