예제 #1
0
 public ChannelBar(int width, Channel channel, Action indexChanged) : base(width, 1)
 {
     this.channel      = channel;
     bar               = new Color[width + 1];
     mouse             = new MouseWatch();
     this.indexChanged = indexChanged;
 }
예제 #2
0
 public PaletteMenu(int width, int height, SpriteModel spriteModel, PaletteModel paletteModel, Action brushChanged) : base(width, height)
 {
     this.spriteModel  = spriteModel;
     this.mouse        = new MouseWatch();
     this.paletteModel = paletteModel;
     this.brushChanged = brushChanged;
 }
예제 #3
0
 public PickerMenu(int width, int height, SpriteModel model, PickerModel colorGrid, Action colorPicked) : base(width, height)
 {
     this.model       = model;
     this.mouse       = new MouseWatch();
     this.colorPicker = colorGrid;
     this.colorPicked = colorPicked;
 }
 public ColorCellButton(Func <Color> color, Action click, char ch = '+') : base(1, 1)
 {
     this.color = color;
     this.click = click;
     this.mouse = new MouseWatch();
     this.ch    = ch;
 }
 public ActiveLabelButton(string text, Func <bool> active, Action click) : base(1, 1)
 {
     this.text   = text;
     this.active = active;
     this.click  = click;
     this.mouse  = new MouseWatch();
 }
예제 #6
0
    public Button(string text, Vector2 position, Vector2 size, Menu menu, Map map)
    {
        this.map  = map;
        this.menu = menu;

        this.position = position;
        this.size     = size;
        this.text     = text;

        textBox                 = new TextBox(80f);
        textBox.Text            = text;
        textBox.HorizontalAlign = TextBox.HorizontalAlignment.Center;
        textBox.VerticalAlign   = TextBox.VerticalAlignment.Center;

        textBox.SetHeight = size.Y;

        buttonMesh       = Mesh.CreateFromPrimitive(MeshPrimitive.Quad);
        buttonMesh.Color = new Color(0, 0, 0, 0.4f);

        buttonMesh.Translate(position);
        buttonMesh.Scale(size);

        mouse             = new MouseWatch();
        mouse.Perspective = Map.UICamera;
    }
 public ColorButton(string text, Func <Color> color, Action leftClick, Action rightClick = null) : base(1, 1)
 {
     this.text       = text;
     this.color      = color;
     this.leftClick  = leftClick;
     this.rightClick = rightClick;
     this.mouse      = new MouseWatch();
 }
 public ActiveColorButton(string text, Func <bool> active, Func <Color> color, Action click) : base(1, 1)
 {
     this.text   = text;
     this.active = active;
     this.color  = color;
     this.click  = click;
     this.mouse  = new MouseWatch();
 }
예제 #9
0
 public HueBar(int width, int height, PaletteModel paletteModel, PickerModel model) : base(width, height)
 {
     this.paletteModel = paletteModel;
     this.colorPicker  = model;
     bar = new Color[width];
     for (int i = 0; i < width; i++)
     {
         bar[i] = Helper.HsvToRgb(i * 360d / width, 1.0, 1.0);
     }
     mouse = new MouseWatch();
 }
예제 #10
0
        public HistoryMenu(int width, int height, SpriteModel model) : base(width, height)
        {
            this.model = model;
            buttons    = new List <LabelButton>();
            scroll     = new ScrollVertical(height, historyLength, Scrolled)
            {
                Position = new Point(width - 1, 0)
            };
            this.Children.Add(scroll);
            mouse = new MouseWatch();

            void Scrolled()
            {
                lastScroll = DateTime.Now;
            }
        }
예제 #11
0
    public Player(int id, string name, Vector2 position, Map m)
        : base(position, m)
    {
        playerID   = id;
        playerName = name;

        keyboard          = new KeyboardWatch();
        mouse             = new MouseWatch();
        mouse.Perspective = Map.GameCamera;

        float charHeight = 165f;
        float h          = (float)playerTileset.Height / charHeight;
        float w          = ((float)playerTileset.Width / playerTileset.Height);

        playerMesh         = sprite.Mesh;
        playerMesh.Tileset = playerTileset;

        playerMesh.Vertices2 = new Vector2[] {
            new Vector2(-0.5f * w * h, -0.5f + h),
            new Vector2(0.5f * w * h, -0.5f + h),
            new Vector2(0.5f * w * h, -0.5f),
            new Vector2(-0.5f * w * h, -0.5f)
        };

        playerMesh.UV = new Vector2[] {
            new Vector2(0, 1),
            new Vector2(1, 1),
            new Vector2(1, 0),
            new Vector2(0, 0)
        };

        shadow = new PlayerShadow(this, playerMesh);

        dashCooldown  = new Timer(stats.DashCooldown, false);
        dodgeCooldown = new Timer(stats.DodgeCooldown, true);

        hud = new PlayerHud(this);

        ownedWeapons.Add(WeaponList.Pistol);

        size = size * 1.4f;
    }
예제 #12
0
    public Editor(EditorForm form)
    {
        CurrentEditor = this;

        this.form = form;

        editorCamera = new Camera();
        editorCamera.Use();

        mouse             = new MouseWatch();
        mouse.Perspective = editorCamera;

        keyboard = new KeyboardWatch();

        manipulators = new Manipulator[] { new Manipulator(this), new ManipulatorTranslate(this), new ManipulatorRotate(this), new ManipulatorScale(this), new VertexPen(this) };

        gridModel = new Model();
        gridModel.PrimitiveType = PrimitiveType.Lines;

        List <Vector3> gridVertices = new List <Vector3>();

        for (int i = -50; i <= 50; i++)
        {
            gridVertices.Add(new Vector3(-50f, i, 0));
            gridVertices.Add(new Vector3(50f, i, 0));
            gridVertices.Add(new Vector3(i, -50f, 0));
            gridVertices.Add(new Vector3(i, 50f, 0));
        }

        gridModel.VertexPosition = gridVertices.ToArray();

        cameraControl = new CameraControl(this);
        selectionBox  = new SelectionBox(this);
        meshCreator   = new MeshCreator(this);

        rootLayer = new LayerNode("root", this);
    }
예제 #13
0
 public CameraControl(Map m, Camera camera)
 {
     map         = m;
     this.camera = camera;
     mouse       = new MouseWatch();
 }