private void btnTranslate_Click(object sender, EventArgs e)
        {
            double tx = 25;
            double ty = 25;

            //original view
            drawer = new Drawer(buffer);
            Prepare();
            DrawShape();
            DisplayOriginal(buffer);

            //after view 1
            drawer = new Drawer(buffer);
            Prepare();
            drawer.Translate(tx, 0);
            DrawShape();
            DisplayAfter1(buffer);
            txtDesc1.Text = string.Format("Translate X = {0}", tx);

            //after view 2
            drawer = new Drawer(buffer);
            Prepare();
            drawer.Translate(0, ty);
            DrawShape();
            DisplayAfter2(buffer);
            txtDesc2.Text = string.Format("Translate Y = {0}", ty);

            //after view 3
            drawer = new Drawer(buffer);
            Prepare();
            drawer.Translate(tx, ty);
            DrawShape();
            DisplayAfter3(buffer);
            txtDesc3.Text = string.Format("Translate X = {0}\r\nTranslate Y = {1}", tx, ty);
        }
        private void btnRotate_Click(object sender, EventArgs e)
        {
            double angle = 45;

            //original view
            drawer = new Drawer(buffer);
            Prepare();
            DrawShape();
            DisplayOriginal(buffer);

            //after view 1
            drawer = new Drawer(buffer);
            Prepare();
            drawer.Rotate(angle);
            DrawShape();
            DisplayAfter1(buffer);
            txtDesc1.Text = string.Format("Rotate Angle = {0}\r\nCenter (0, 0)", angle);

            //after view 2
            drawer = new Drawer(buffer);
            Prepare();
            drawer.Rotate(angle, cx, cy);
            DrawShape();
            DisplayAfter2(buffer);
            txtDesc2.Text = string.Format("Rotate Angle = {0}\r\nCenter ({1}, {2})", angle, cx, cy);

            //discard after view 3
            DisplayAfter3(null);
            txtDesc3.Text = "";
        }
 public RecordValue(IMatrix matr1, IMatrix matr2, IDrawer dr1, IDrawer dr2)
 {
     this.matr1 = matr1;
       this.matr2 = matr2;
       this.dr1 = dr1;
       this.dr2 = dr2;
 }
Example #4
0
File: Game.cs Project: norniel/Game
        public Game(IDrawer drawer, uint width, uint height)
        {
            curRect.Width = width;
            curRect.Height = height;

            Intervals = Observable.Interval(TimeSpan.FromMilliseconds(TimeStep));
            _unityContainer = new UnityContainer();
            this.RegisterInUnityContainer();

            StateQueueManager = _unityContainer.Resolve<StateQueueManager>();
            Map = _unityContainer.Resolve<Map>();

            loadSaveManager = new LoadSaveManager();
            loadSaveManager.LoadSnapshot(Map);

            _hero = _unityContainer.Resolve<Hero>();
            _hero.Map = Map;

            ActionRepository = _unityContainer.Resolve<IActionRepository>();

            _drawer = drawer;

            Intervals.Subscribe(StateQueueManager);

            _dayNightCycle = new DayNightCycle();
            Intervals.Subscribe(_dayNightCycle);
        }
Example #5
0
 static public bool Displayed(this IDrawTask draw, IDrawer drawer = null, IDrawClient drawClient = null, ISceneNode sceneRoot = null)
 {
     return(draw.Rendered &&
            (drawer == null ||
             (sceneRoot == null || drawer.DrawPredicate(sceneRoot)) &&
             (draw.DrawPredicate == null || draw.DrawPredicate(drawer))) &&
            (drawClient == null || draw.DrawClientFilter == null || draw.DrawClientFilter.Filter(drawClient)));
 }
 public Figure(IDrawer drawer, IScaler scaler, IUpdater updater, IMover mover, IRotator rotator)
 {
     Updater = updater;
     Scaler  = scaler;
     Drawer  = drawer;
     Mover   = mover;
     Rotator = rotator;
 }
        /// <inheritdoc/>
        protected override void OnSelectedInternal(ReasonSelectionChanged reason, IDrawer previous, bool isMultiSelection)
        {
                        #if DEV_MODE && DEBUG_ON_SELECTED
            Debug.Log(ToString() + ".OnSelectedInternal(" + reason + "," + StringUtils.ToString(previous) + ")");
                        #endif

            bool wasUnfolded = false;

            bool isClick = false;
            switch (reason)
            {
            case ReasonSelectionChanged.PrefixClicked:
                isClick = true;
                if (DrawGUI.LastInputEvent().control)
                {
                    ComponentDrawerUtility.singleInspectedInstance = this;
                }
                break;

            case ReasonSelectionChanged.ControlClicked:
                if (DrawGUI.LastInputEvent().control)
                {
                    ComponentDrawerUtility.singleInspectedInstance = this;
                }
                return;

            case ReasonSelectionChanged.ThisClicked:
                isClick = true;
                break;
            }

                        #if UNFOLD_ON_SELECT_IN_SINGLE_ACTIVE_MODE
            if (UserSettings.EditComponentsOneAtATime && !inspector.HasFilter)
            {
                if (ComponentDrawerUtility.singleInspectedInstance != null && ComponentDrawerUtility.singleInspectedInstance != this)
                {
                    ComponentDrawerUtility.singleInspectedInstance.SetUnfolded(false);
                }
                ComponentDrawerUtility.singleInspectedInstance = this;

                // if Component was clicked, let the click event handle the unfolding
                if (!Unfolded && (!isClick || (MouseoveredHeaderPart != HeaderPart.FoldoutArrow && !inspector.Preferences.changeFoldedStateOnFirstClick)))
                {
                    wasUnfolded = true;
                    // allow bypassing EditComponentsOneAtATime functionality by holding down control when clicking the Component header
                    bool collapseAllOthers = !Event.current.control || reason != ReasonSelectionChanged.PrefixClicked;
                    SetUnfolded(true, collapseAllOthers, false);
                }
            }
                        #endif

            base.OnSelectedInternal(reason, previous, isMultiSelection);

            if (wasUnfolded)
            {
                ExitGUIUtility.ExitGUI();
            }
        }
Example #8
0
 public void AddControl(IInteractiveControl logic, IDrawer <TImage> drawer, string nativeName = null, int contextId = 0)
 {
     controls.Add(new ControlInfo {
         logic      = logic,
         drawer     = drawer,
         nativeName = nativeName,
         contextId  = contextId
     });
 }
Example #9
0
 public RadioList(Vector2 vector, int itemsInCollumn, IDrawer drawer, IMouse mouse, bool DisableSelection = false) : base(drawer, mouse)
 {
     position              = vector;
     size                  = 0;
     radios                = new List <IndexedButton>();
     ItemsInCollumn        = itemsInCollumn;
     Drawer                = drawer;
     this.DisableSelection = DisableSelection;
 }
 public void Deactivate()
 {
     if (isActivated)
     {
         isActivated = false;
         drawer.Dispose();
         drawer = new NullDrawer();
     }
 }
Example #11
0
 /// <inheritdoc />
 protected override void OnDeselectedInternal(ReasonSelectionChanged reason, IDrawer losingFocusTo)
 {
     if (DrawGUI.EditingTextField)
     {
         OnStoppedFieldEditing();
     }
     base.OnDeselectedInternal(reason, losingFocusTo);
     editField = false;
 }
Example #12
0
 /// <summary>
 /// Prevents a default instance of the <see cref="Engine" /> class from being created.
 /// </summary>
 private Engine()
 {
     this.consoleDrawer = new ConsoleRenderer();
     this.consoleReader = new ConsoleInput();
     this.inputHandler  = new InputHandler(this.consoleDrawer, this.consoleReader);
     this.mineFactory   = new MineCreator();
     this.highscore     = new HighScore();
     this.finalScore    = InitialScore;
 }
Example #13
0
        private void OnEnable()
        {
            var config = GetComponent <ConfigMono>();

            if (config != null)
            {
                drawer = Create(config.Prototype, config);
            }
        }
Example #14
0
 private void fmFill_Load(object sender, EventArgs e)
 {
     if (!DesignMode)
     {
         buffer = new PixelsBuffer(w, h);
         drawer = new Drawer(buffer);
         Draw();
     }
 }
Example #15
0
 /// <summary>
 /// Draw the form to the screen
 /// </summary>
 /// <param name="screen">Display device instance</param>
 public override void Paint(IDrawer screen)
 {
     base.Paint(screen);
     graphPort.X = 0;
     graphPort.Width = screen.Width - 1;
     graphPort.Y = (int)(screen.Height * 0.4);
     graphPort.Heigth = (int)(screen.Height * 0.6) - 1;
     graphPort.Paint(screen);
 }
Example #16
0
        public override void Apply(IDrawer drawer)
        {
            if (!Enabled)
            {
                return;
            }

            ApplyEffect(drawer);
        }
        public static Triangle CreateTriangle(Point point1, Point point2, Point point3, IGeometryCalculator calculator, IDrawer drawer)
        {
            if (calculator.IsAStraightLine(point1, point2, point3))
            {
                throw new ArgumentException("Can't have 3 points on same line");
            }

            return new Triangle(point1, point2, point3, calculator, drawer);
        }
Example #18
0
 private void DrawShapes(IDrawer drawer)
 {
     // Draw all the shapes
     foreach (Shape shape in shapes)
     {
         shape.SetDrawer(drawer);
         shape.Draw();
     }
 }
 public void Render(Scene scene, IDrawer drawer, float delta)
 {
     drawer.BeginDraw(
         scene.WindowCanvas,
         samplerState: SamplerState.PointClamp
     );
     drawWidget(scene.UI.Root, delta, drawer);
     drawer.EndDraw();
 }
Example #20
0
        public override void Draw(IDrawer drawer)
        {
            if (Source.Texture == null)
            {
                return;
            }

            Render(drawer);
        }
Example #21
0
 /// <summary>
 /// Paint the associated componant to screen in the viewport bounds
 /// </summary>
 /// <param name="screen">Instance of the display device</param>
 public void Paint(IDrawer screen)
 {
     ViewPortDevice device = new ViewPortDevice(screen);
     device.xOffset = X;
     device.yOffset = Y;
     device.yDrawable = Heigth;
     device.xDrawable = Width;
     component.Draw(device);
 }
Example #22
0
 private void fmFill_Load(object sender, EventArgs e)
 {
     if (!DesignMode)
     {
         buffer = new PixelsBuffer(w, h);
         drawer = new Drawer(buffer);
         Draw();
     }
 }
Example #23
0
 public void Init(Panel renderer, int tileWidth, int tileHeight, int screenWidth, int screenHeight)
 {
     Renderer     = renderer;
     TileWidth    = tileWidth;
     TileHeight   = tileHeight;
     ScreenWidth  = screenWidth;
     ScreenHeight = screenHeight;
     Drawer       = new Drawer(renderer, screenWidth, screenHeight);
     TouchManager.Instance.Init(renderer);
 }
Example #24
0
        private void DeleteMember(IDrawer drawer)
        {
            int index = Array.IndexOf(members, drawer);

            if (index != -1)
            {
                invocationList = invocationList.RemoveAt(index);
                SetValue(Delegate.Combine(invocationList.RemoveNullMembers()) as MulticastDelegate, true, false);
            }
        }
 private void drawTextUILayout(TextUILayout drawable, IDrawer drawer)
 {
     drawer.DrawString(
         drawable.Font,
         drawable.Area,
         drawable.Tint,
         drawable.Text,
         drawable.SourceRectangle
     );
 }
 private void drawWidget(Widget ui, float delta, IDrawer drawer)
 {
     ui.Layout.Match(
         (ui) => drawWidgets(ui.Children, delta, drawer),
         (ui) => drawIDrawableUILayout(ui, delta, drawer),
         (ui) => drawTextUILayout(ui, drawer),
         (ui) => drawIAnimatableUILayout(ui, delta, drawer),
         (ui) => drawWidgets(ui.Children, delta, drawer)
     );
 }
Example #27
0
        public FillWords(IDrawer drawer, int fieldWidth, int fieldHeight)
        {
            _drawer = drawer;

            _fieldWidth  = fieldWidth;
            _fieldHeight = fieldHeight;

            _field      = new Field(fieldWidth, fieldHeight);
            _cellStates = new CellState[_field.GetFieldWidth(), _field.GetFieldHeight()];
        }
Example #28
0
        /// <inheritdoc />
        protected override void OnDeselectedInternal(ReasonSelectionChanged reason, IDrawer losingFocusTo)
        {
                        #if DEV_MODE && DEBUG_APPLY_VALUE
            Debug.Log(GetType().Name + " - Applying valueUnapplied " + valueUnapplied + " over " + Value + " because selection changed");
                        #endif

            base.DoSetValue(valueUnapplied, true, true);

            base.OnDeselectedInternal(reason, losingFocusTo);
        }
Example #29
0
 private DxBallEngine(
     IDisplay display,
     InputReader <ConsoleKey> inputReader,
     IDrawer drawer)
 {
     this.IsGameRunning = false;
     this.display       = display;
     this.drawer        = drawer;
     this.inputReader   = inputReader;
 }
Example #30
0
 public Particle(double _x, double _y, IDrawer _drawer)
 {
     Drawer = _drawer;
     m_CoordinatesNew = m_Coordinates = new PairDouble(_x, _y);
     
     Random k = new Random((int) DateTime.Now.ToBinary());
     Random r = new Random(k.GetHashCode());
     m_Speed = new PairDouble(Miscelaneous.ParticleSpeed * (0.5 - r.NextDouble()), Miscelaneous.ParticleSpeed * (0.5 - r.NextDouble()));
     m_Speed.Normalize();
 }
 public TournamentPlayWindow(Tournament tournament, IFileManager fileManager)
 {
     InitializeComponent();
     _tournament     = tournament;
     _fileManager    = fileManager;
     _drawer         = new HorisontalDrawer();
     PlaceForDrawind = new Canvas();
     SetCurrentMeeting(_tournament.GetNextMeeting());
     TournamentPrint();
 }
Example #32
0
        /// <inheritdoc/>
        public bool DraggingPrefixAffectsMember(IDrawer member)
        {
                        #if DEV_MODE && PI_ASSERTATIONS
            Debug.Assert(member != null);
            Debug.Assert(Array.IndexOf(members, member) != -1);
            Debug.Assert(memberBuildState == MemberBuildState.MembersBuilt);
                        #endif

            return(member is IDraggablePrefix);
        }
Example #33
0
 protected void DrawCells(IDrawer drawer)
 {
     for (int i = 0; i < this.Row_count; i++)
     {
         for (int j = 0; j < this.Column_count; j++)
         {
             drawer.DrawCell(this, i, j);
         }
     }
 }
Example #34
0
       /// <summary>
       /// Paint the splash screen
       /// </summary>
       /// <param name="screen">instance of screen device</param>
       public override void Paint(IDrawer screen)
       {
           base.Paint(screen);
           // Load an image from resources
           FEZ_Components.FEZTouch.Image img = new FEZ_Components.FEZTouch.Image(Resource.GetBytes(Resource.BinaryResources.jas2));
           // draw image
           screen.DrawImage((xDrawable- img.Width) / 2, this.yOffset + (yDrawable - img.Height) / 2, img);

    
       }
Example #35
0
File: Game.cs Project: himapo/ccm
 public void Run(IUpdater RootUpdater, IDrawer RootDrawer)
 {
     using (var game = new XnaGame(Initializer))
     {
         XnaGame = game;
         game.RootUpdater = RootUpdater;
         game.RootDrawer = RootDrawer;
         game.Run();
     }
 }
Example #36
0
 public MobSpawner(IEntitiesData engine, IActiveElements activeElements, IDrawer drawer, IPixSound sound, Player player)
 {
     size           = 0;
     Engine         = engine;
     Player         = player;
     ActiveElements = activeElements;
     Drawer         = drawer;
     Sound          = sound;
     Randomizer     = new Random();
 }
Example #37
0
 public void Draw(IDrawer drawer)
 {
     lock (lockObject)
     {
         foreach (var shape in shapes)
         {
             shape.Draw(drawer);
         }
     }
 }
Example #38
0
        public static FieldDrawer Create(FieldInfo info)
        {
            IDrawer drawer = DrawerCollector.CreateDrawer(info);

            if (drawer == null)
            {
                return(null);
            }
            return(new FieldDrawer(info, drawer));
        }
Example #39
0
 public Game(IDrawer drawer)
 {
     this.drawer = drawer;
     objects     = new List <IGameObject>();
     objects.Add(new Snake());
     objects.Add(new Food());
     objects.Add(new Food());
     objects.Add(new Obstacle());
     objects.Add(new Obstacle());
 }
Example #40
0
        public ReturnChecker(IDrawer drawer, string uniqueControlName = null)
        {
            _drawer = drawer;
            if (uniqueControlName == null)
            {
                uniqueControlName = "Control" + GetHashCode();
            }

            _uniqueControlName = uniqueControlName;
        }
Example #41
0
        public ConsoleApp(CommandLineArgs arguments, Config configuration, IFileParser fileParser, IDrawer drawer, 
			IWordPreparer wordPreparer, ISaver imageSaver)
        {
            _args = arguments;
            _config = configuration;
            _parser = fileParser;
            _drawer = drawer;
            _wordPreparer = wordPreparer;
            _imageSaver = imageSaver;
        }
Example #42
0
 private bool OnMemberKeyboardInputBeingGiven(IDrawer keyboardInputReceiver, Event inputEvent, KeyConfigs keys)
 {
     if (inputEvent.keyCode == KeyCode.LeftArrow)
     {
         Select(ReasonSelectionChanged.SelectControlLeft);
         DrawGUI.Use(inputEvent);
         return(true);
     }
     return(false);
 }
Example #43
0
 /// <summary>
 /// Begins execution of the draw operation between two points.
 /// </summary>
 /// <param name="drawer">The class derived from IDrawer, from which the draw operation will begin.</param>		
 /// <exception cref="OutOfMemoryException">There was not enough mmemory left to start
 /// a new thread for drawing on. (This should almost never happen.)</exception>
 /// <remarks>Note that if the drawingAborted is true, it will be set to false.</remarks>
 public void Draw(IDrawer drawer, Vector3I[] points, byte blockType)
 {
     drawingAborted = false;
     Thread drawThread = new Thread(delegate()
                                    {
                                    	drawer.Start(this, ref drawingAborted, points, blockType, ref sleepTime);
                                    });
     drawThread.IsBackground = true;
     drawThread.Name = "Drawing thread.";
     drawThread.Start();
 }
Example #44
0
        public void Draw(IDrawer drawer)
        {
            foreach (var position in this.positions)
            {
                drawer.DrawPoint(position.X, position.Y, this.symbol);
            }

            var last = this.positions.Last;

            drawer.DrawPoint(last.Value.X, last.Value.Y, ' ');
        }
 public void Execute()
 {
     ManagComm.getInstance().addComm(this);
     g = form2.getGraph1();
     g1 = form2.getGraph2();
     d = new Sheme1(g, 10, 10);
     d1 = new Sheme1(g1, 10, 10);
     m1 = m1.GetComponent();
     m2 = m2.GetComponent();
     RecordValue c = new RecordValue(m1, m2, d, d1);
     c.record();
 }
Example #46
0
 /// <summary>
 /// Draw the form on the screen
 /// </summary>
 /// <param name="screen">Instance of IDrawable device</param>
 public virtual void Paint(IDrawer screen)
 {
     // Paint once
     if (!initPaint)
     {
         return;
     }
     screen.FillRectangle(0, titleBarSize, screen.Width, screen.Height - titleBarSize, this.BackgroundColor);
     initPaint = false;
     screen.FillRectangle(0, 0, screen.Width, titleBarSize, FEZ_Components.FEZTouch.Color.Black);
     screen.DrawString(this.Title, 5, 5, FEZ_Components.FEZTouch.Color.White, FEZ_Components.FEZTouch.Color.Black);
 }
Example #47
0
        public Minion(int type)
        {
            this.type = type;
            if (type == 1)
                Drawer = new Drawer1();

            speed = 0.5;
            directionAngle = 0;
            position.x = 0;
            position.y = 0;
            position.z = 0;
            Radius = 2.0;
        }
Example #48
0
        public MainWindow()
        {
            InitializeComponent();
            IBarrier barrier = new StraightAngleBarrier(35);
            IMathematicalModel mathematicalModel = new MathematicalModel(barrier, 0);
            IMathModel model = new DataModel(mathematicalModel);
            d = new Drawer(model, this.mainCanvas);

            var myDispatcherTimer = new System.Windows.Threading.DispatcherTimer();
            myDispatcherTimer.Interval = new TimeSpan(0, 0, 0, 1, 0);

            myDispatcherTimer.Tick += new EventHandler(Each_Tick);
            myDispatcherTimer.Start();
        }
 public void Execute()
 {
     ManagComm.getInstance().addComm(this);
     form2.getGraph1().Clear(Color.AntiqueWhite);
     form2.getGraph2().Clear(Color.AntiqueWhite);
     draw1 = new Sheme4(form2.getGraph1(), 10, 10);
     draw2 = new Sheme4(form2.getGraph2(), 10, 10);
     smatrix = new HideDecorator(smatrix, 1, 2);
     dmatrix = new HideDecorator(dmatrix, 1, 2);
     smatrix.setDrawer(draw1);
     dmatrix.setDrawer(draw2);
     smatrix.draw();
     dmatrix.draw();
 }
Example #50
0
 public void Execute()
 {
     ManagComm.getInstance().addComm(this);
     form2.getGraph1().Clear(Color.AntiqueWhite);
     form2.getGraph2().Clear(Color.AntiqueWhite);
     draw1 = new Sheme4(form2.getGraph1(), 10, 10);
     draw2 = new Sheme4(form2.getGraph2(), 10, 10);
     smatrix = smatrix.GetComponent();
     dmatrix = dmatrix.GetComponent();
     smatrix.setDrawer(draw1);
     dmatrix.setDrawer(draw2);
     smatrix.draw();
     dmatrix.draw();
 }
Example #51
0
        private void button2_Click(object sender, EventArgs e)
        {
            CleanMatrix();
            Graphics g = Graphics.FromHwnd(panel1.Handle);
            Graphics g1 = Graphics.FromHwnd(panel2.Handle);

            d = new Sheme4(g, 10, 10);
            d1 = new Sheme4(g1, 10, 10);
            m1 = new HideDecorator(m1, 1, 2);
            m2 = new HideDecorator(m2, 1, 2);
            m1.setDrawer(d);
            m2.setDrawer(d1);
            m1.draw();
            m2.draw();
        }
Example #52
0
 public void Execute()
 {
     ManagComm.getInstance().addComm(this);
     m1 = new SimpleMatrix(3, 4);
     m2 = new DisperseMatrix(5, 3);
     IniciatorMatrix.fullMatrix(m1, 8, 45);
     IniciatorMatrix.fullMatrix(m2, 6, 45);
     g = form2.getGraph1();
     g1 = form2.getGraph2();
     d = new Sheme1(g, 10, 10);
     d1 = new Sheme1(g1, 10, 10);
     m1.setDrawer(d);
     m2.setDrawer(d1);
     m1.draw();
     m2.draw();
 }
Example #53
0
 private void button1_Click(object sender, EventArgs e)
 {
     CleanMatrix();
        // new CommGen(this).Execute();
     m1 = new SimpleMatrix(3, 4);
     m2 = new DisperseMatrix(5, 3);
     IniciatorMatrix.fullMatrix(m1, 8, 45);
     IniciatorMatrix.fullMatrix(m2, 6, 45);
     Graphics g = Graphics.FromHwnd(panel1.Handle);
     Graphics g1 = Graphics.FromHwnd(panel2.Handle);
     d = new Sheme1(g, 10, 10);
     d1 = new Sheme1(g1, 10, 10);
     m1.setDrawer(d);
     m2.setDrawer(d1);
     m1.draw();
     m2.draw();
 }
Example #54
0
        internal Triangle(Point vertex1, Point vertex2, Point vertex3, IGeometryCalculator geometry, IDrawer drawer)
        {
            Contract.Requires(vertex1 != null);
            Contract.Requires(vertex2 != null);
            Contract.Requires(vertex3 != null);
            Contract.Ensures(_angle1 + _angle2 + _angle3 == 180);

            _geometry = geometry;
            _drawer = drawer;

            _vertex1 = vertex1;
            _vertex2 = vertex2;
            _vertex3 = vertex3;

            _angle1 = _geometry.GetInternalAngle(_vertex1, _vertex2, _vertex3);
            _angle2 = _geometry.GetInternalAngle(_vertex2, _vertex3, _vertex1);
            _angle3 = _geometry.GetInternalAngle(_vertex3, _vertex1, _vertex2);
        }
Example #55
0
        public Game()
        {
            LoadSettings();

            _gameTurnTime = 50;
            int fps = 60;
            _frame = 1000.0/fps;
            _updateRate = 200;
            _ui = new UI.UI(this, Settings);
            _drawer = ServiceLocator.GetService<IDrawer>();
            ObjectsDictionary = new ObjectDictionary();
            _updateThread = new Thread(StartUpdate);
            _drawThread = new Thread(StartDraw);

            Initialize();

            Run();
        }
Example #56
0
        /// <summary>
        /// Draw the Grid
        /// </summary>
        /// <param name="screen">Screen device</param>
        public override void Paint(IDrawer screen)
        {
            base.Paint(screen);
            for (int i = 0; i < ControlRows; i++)
            {
                for (int j = 0; j < ControlColumns; j++)
                {
                    String currentControl = Controls[i][j];

                    if (currentControl != null && currentControl != String.Empty)
                    {
                        int x = xOffset + (j * xDrawable / 2);
                        int y = yOffset + (i * FEZ_Components.FEZTouch.FONT_HEIGHT + 2);
                        screen.DrawString(currentControl, x, y, this.ForegroundColor, this.BackgroundColor);
                    }
                }
            }
        }
Example #57
0
        public void Tick(IDrawer drawer)
        {
            //ball
            _ball.Location += _ball.Direction;

            if (_ball.Location.X <= 0 || _ball.Location.X >= Width)
            {
                _ball.Direction = new Vector2(-_ball.Direction.X, _ball.Direction.Y);
            }

            if (_ball.Location.Y <= 0 || _ball.Location.Y >= Height)
            {
                _ball.Direction = new Vector2(_ball.Direction.X, -_ball.Direction.Y);
            }

            drawer.Draw(_ball);
            foreach (var player in _players)
            {
                drawer.Draw(player);
            }
        }
Example #58
0
 public void Draw(Map map, IDrawer drawer)
 {
     var waveRun = new WaveRun(map, map.Robot);
     var first = true;
     drawer.AddStyle("target", "Gold");
     drawer.AddStyle("firstTarget", "Fuchsia");
     Tuple<Vector, Stack<RobotMove>> firstTarget = null;
     foreach (var target in waveRun.EnumerateTargets((lmap, pos, stepNumber) => lmap.GetCell(pos) == MapCell.Lambda))
     {
         if (first) firstTarget = target;
         var style = first ? "firstTarget" : "target";
         first = false;
         drawer.DrawTarget(map, style, target);
     }
     if (waveRun.Lift != null)
     {
         drawer.DrawTarget(map, "target", waveRun.Lift);
     }
     if (firstTarget != null)
         drawer.DrawTarget(map, "firstTarget", firstTarget);
 }
Example #59
0
        public MainPage()
        {
            InitializeComponent();

            SupportedOrientations = SupportedPageOrientation.Portrait | SupportedPageOrientation.Landscape;

            currentDrawer = new SpriteDrawer(this.ObjectCanvas, "LargeTestGraphic.jpg");

            demos.Add(new Demo1(this));
            demos.Add(new Demo1a(this));
            demos.Add(new Demo2(this));
            demos.Add(new Demo6(this));
            demos.Add(new Demo7(this));
            demos.Add(new Demo10(this));
            demos.Add(new Demo11(this));
            demos.Add(new Demo4(this));
            demos.Add(new Demo12(this));

            KeyUp += Page_KeyUp;

            StartDemo();
        }
Example #60
0
        /// <summary>
        /// Draw the graph on an device
        /// </summary>
        /// <param name="screen">Screen device</param>
        public void Draw(IDrawer screen)
        {

            if (_dataMin == _dataMax)
                _dataMax += 10;

            // Chart area
            screen.FillRectangle(0, 0, screen.Width, screen.Height, FEZ_Components.FEZTouch.Color.Black);
            // Y Axis

            if (_dataMin < 0)
            {
                // X Axis
                screen.DrawLine(0, screen.Height, screen.Width, screen.Height, GHIElectronics.NETMF.FEZ.FEZ_Components.FEZTouch.Color.Black);
            }

            foreach (var key in series.Keys)
            {
                FEZ_Components.FEZTouch.Color color = FEZ_Components.FEZTouch.Color.Green;
                Serie currentSerie = (Serie)series[key];
                int lastX = 0;
                int lastY = 0;

                for (ushort index = 0; index < currentSerie.Count; index++)
                {
                    int x = ComputePositionX(index, screen);
                    int y = ComputePositionY((float)currentSerie[index], screen);

                    // Draw line interval
                    if (index > 0)
                    {
                        lastX = ComputePositionX(index - 1, screen);
                        lastY = ComputePositionY((float)currentSerie[index - 1], screen);
                        screen.DrawLine(lastX, lastY, x, y, color);
                    }
                }
            }
        }