예제 #1
0
 public Button(Texture texture)
 {
     Sprite = texture.Sprite;
     DisplayName = texture.DisplayName;
     Image = texture.Image;
     Name = texture.Name;
     Position = texture.Position;
     Orientation = texture.Orientation;
     
     Type = ObjectType.Button;
 }
예제 #2
0
        private static void Game_OnWndProc(WndEventArgs args)
        {
            if (Player.Instance.IsDead || MenuHandler.GetCheckboxValue(MenuHandler.Settings, "Draw when Alive"))
            {
                if (args.Msg == (uint)WindowMessages.LeftButtonDown)
                    isMouseDown = true;
                else if (args.Msg == (uint)WindowMessages.LeftButtonUp)
                    isMouseDown = false;

                Texture HoverTexture = DrawManager.activeTextures.Where(a => a.IsMouseOver()).LastOrDefault();

                if (HoverTexture != null && HoverTexture.Type == Texture.ObjectType.Button)
                {
                    Button activeButton = ((Button)HoverTexture);
                    activeButton.OnKeyPress(args);
                }

                if (dragObject != null && args.Msg == (uint)WindowMessages.MouseMove && isMouseDown)
                    ((Button)dragObject).OnKeyPress(args);
                else if (dragObject != null && !isMouseDown)
                    dragObject = null;
            }
        }
예제 #3
0
        public static Texture CreateTexture(string textureName, string displayName, Vector2 position, ImagePosition orientation, bool addToActiveList = true)
        {
            Texture active = textures.Where(a => a.Name == textureName).FirstOrDefault();

            if(active == null)
                active = textures.Where(a => a.Name == "Dummy").FirstOrDefault();
            
            Texture instance = new Texture(active.Name, displayName, active.Sprite, active.Image, position, orientation);

            if(addToActiveList)
                activeTextures.Add(instance);

            return instance;
        }