コード例 #1
0
 public FreeDrawGame(Form form, ImageBox canvas, ImageBox video, TableLayoutPanel panel) : base(form, canvas, panel)
 {
     this.video = video;
     // we want to yield, since this game does nothing with keys
     ShouldYieldKeys = false;
     ShouldDraw      = true;
     // this is a simple drawing mode, with these colors in it by default
     Detectables.Add(new DetectableColor("Red", true, inkColor: new MCvScalar(60, 60, 230), minHsv: new MCvScalar(0, 125, 180), maxHsv: new MCvScalar(6, 255, 255)));
     Detectables.Add(new DetectableColor("Orange", true, inkColor: new MCvScalar(60, 140, 255), minHsv: new MCvScalar(10, 175, 65), maxHsv: new MCvScalar(18, 255, 255)));
     Detectables.Add(new DetectableColor("Yellow", true, inkColor: new MCvScalar(100, 240, 240), minHsv: new MCvScalar(19, 50, 195), maxHsv: new MCvScalar(35, 255, 255)));
     Detectables.Add(new DetectableColor("Green", true, inkColor: new MCvScalar(135, 230, 135), minHsv: new MCvScalar(70, 70, 75), maxHsv: new MCvScalar(95, 255, 255)));
     Detectables.Add(new DetectableColor("Blue", true, inkColor: new MCvScalar(244, 134, 66), minHsv: new MCvScalar(99, 111, 66), maxHsv: new MCvScalar(117, 255, 255)));
     Detectables.Add(new DetectableColor("Purple", true, inkColor: new MCvScalar(255, 140, 185), minHsv: new MCvScalar(125, 100, 100), maxHsv: new MCvScalar(140, 255, 255)));
     Detectables.Add(new DetectableColor("Special", false, inkColor: new MCvScalar(0, 0, 0), minHsv: new MCvScalar(0, 0, 0), maxHsv: new MCvScalar(180, 255, 255)));
     UpdatePrompt(TextHowTo);
 }
コード例 #2
0
        /// <summary>
        /// Called whenever we are adding players and the AutoColor captures a color
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        protected virtual void OnColorCapture(object sender, ColorCaptureArgs args)
        {
            var detect = args.Color;

            Detectables.Add(detect);
        }