Exemple #1
1
 /// <summary>
 /// Initialize a new instance of the ViewContext class.
 /// </summary>
 /// <param name="manager">Reference to the view manager.</param>
 /// <param name="control">Control associated with rendering.</param>
 /// <param name="alignControl">Control used for aligning elements.</param>
 /// <param name="renderer">Rendering provider.</param>
 public ViewContext(ViewManager manager,
                    Control control, 
                    Control alignControl, 
                    IRenderer renderer)
     : this(manager, control, alignControl, null, renderer)
 {
 }
Exemple #2
1
 /// <summary>
 /// Initialize a new instance of the ViewContext class.
 /// </summary>
 /// <param name="control">Control associated with rendering.</param>
 /// <param name="alignControl">Control used for aligning elements.</param>
 /// <param name="graphics">Graphics instance for drawing.</param>
 /// <param name="renderer">Rendering provider.</param>
 public ViewContext(Control control,
                    Control alignControl,
                    Graphics graphics,
                    IRenderer renderer)
     : this(null, control, alignControl, graphics, renderer)
 {
 }
 public StandardTwoPlayerEngine(IRenderer renderer, IInputProvider inputProvider)
 {
     this.renderer = renderer;
     this.input = inputProvider;
     movementStrategy = new NormalMovementStrategy();
     this.board = new Board();
 }
 public KingSurvivalEngine(IRenderer renderer, IInputProvider inputProvider,IBoard board, IWinningConditions winningConditions)
 {
     this.renderer = renderer;
     this.provider = inputProvider;
     this.winningConditions = winningConditions;
     this.board = board;
 }
Exemple #5
0
        private void HandleCollision(IHungryCreature creature, IRenderer renderer)
        {
            List<GameFieldCoords> creatureElements = new List<GameFieldCoords>();

            foreach (GameFieldCoords element in creature.GetPosition())
            {
                creatureElements.Add(element);
            }

            foreach (GameFieldCoords element in creatureElements)
            {
                if (element.Row >= renderer.GameFieldSize.Row || element.Row < 0
                    || element.Col >= renderer.GameFieldSize.Col || element.Col < 0)
                {
                    creature.IsDestroyed = true;
                }
            }

            for (int element = 0; element < creatureElements.Count - 1; element++)
            {
                if (creatureElements.Last().Row == creatureElements[element].Row
                    && creatureElements.Last().Col == creatureElements[element].Col)
                {
                    creature.IsDestroyed = true;
                }
            }
        }
Exemple #6
0
 private Game(IPlayer player, IRenderer renderer, IScoreBoardObserver scoreboard, LabyrinthProcesor processor)
 {
     this.renderer = renderer;
     this.player = player;
     this.scoreBoardHandler = scoreboard;
     this.processor = processor;
 }
 public BookStoreEngine(IRenderer renderer, IInputHandler inputHandler)
 {
     this.renderer = renderer;
     this.inputHandler = inputHandler;
     this.books = new List<IBook>();
     this.revenue = 0;
 }
 public GameController(IGameEngine gameEngine, IInputHandler inputReader, IRenderer renderer)
 {
     this.gameEngine = gameEngine;
     this.inputReader = inputReader;
     this.renderer = renderer;
     this.currentCmd = null;
 }
        public virtual void Draw(ScrollbarButton Button, IRenderer Renderer)
        {
            ILineStyleInfo TopLeft;
            ILineStyleInfo BottomRight;

            if (Button.State == ScrollbarButton.ButtonState.Normal)
            {
                TopLeft = LightBorder;
                BottomRight = DarkBorder;
            }
            else
            {
                TopLeft = DarkBorder;
                BottomRight = LightBorder;
            }

            Rect R = Button.Bounds;
            int x1 = R.Location.X;
            int y1 = R.Location.Y;
            int x2 = R.Right;
            int y2 = R.Bottom;

            DrawBackground(Button, Renderer);

            Renderer.DrawOperations.DrawLine(x1, y1, x2, y1, TopLeft);
            Renderer.DrawOperations.DrawLine(x1, y1, x1, y2, TopLeft);
            Renderer.DrawOperations.DrawLine(x2, y1, x2, y2, BottomRight);
            Renderer.DrawOperations.DrawLine(x1, y2, x2 + 1, y2, BottomRight);
        }
 public Engine(IRenderer renderer, int screenWidth, int screenHeight)
 {
     this.Renderer = renderer;
     this.ScreenWidth = screenWidth;
     this.ScreenHeight = screenHeight;
     this.Initialize();
 }
Exemple #11
0
 public GameEngine(IReader reader, IRenderer renderer)
 {
     Reader = reader;
     Renderer = renderer;
     this.creepsList = new List<Npc>();
     this.items = new List<Item>();
 }
 public void Configure(IRenderer renderer)
 {
   foreach (var resource in _resources)
   {
     resource.Configure(renderer);
   }
 }
 public Form1(IRenderer renderer)
 {
     m_Renderer = renderer;
     InitializeComponent();
     string handle = panel1.Handle.ToString();
     m_Renderer.CreateRenderWindow(handle);
 }
        public int FrameCountPerRender { get; set; } //number of frames per render (default = 1);


        public DrawingSurfaceSCBP(IRenderer renderer)
        {
            this.FrameCountPerRender = 1;

            //this.InitializeComponent();

            //if (!hasInitializedSurface)
            //{
            //    //effectRenderer = new EffectRenderer();

            //    var fpsRenderer = new FpsRenderer();

            //    d2dTarget = new SwapChainBackgroundPanelTarget(root);
            //    d2dTarget.OnRender += effectRenderer.Render;
            //    d2dTarget.OnRender += fpsRenderer.Render;

            //    deviceManager = new DeviceManager();
            //    deviceManager.OnInitialize += d2dTarget.Initialize;
            //    deviceManager.OnInitialize += effectRenderer.Initialize;
            //    deviceManager.OnInitialize += fpsRenderer.Initialize;

            //    deviceManager.Initialize(DisplayProperties.LogicalDpi);
            //    effectRenderer.InitializeUI(root, root);

            //    // Setup rendering callback
            //    CompositionTarget.Rendering += CompositionTarget_Rendering;

            //    if (_assetUri != string.Empty) effectRenderer.LoadLocalAsset(_assetUri);
            //}
        }
        public void Render(IRenderer renderer)
        {
            rasterizer.ClearImage((byte)' ', (byte)((Kernel32Console.DefaultColors.Foreground.BLACK << 4) | Kernel32Console.DefaultColors.Foreground.WHITE));

            rasterizer.DrawMeshFilled(transformation, meshes);//, Kernel32Console.DefaultColors.FOREGROUND_CYAN, Rasterizer.ShadePixelChar1);
            //rasterizer.DrawMeshVertices(transformation, meshes, Kernel32Console.DefaultColors.FOREGROUND_CYAN, (byte)'X');
            //rasterizer.DrawMeshWired(transformation, meshes, Kernel32Console.DefaultColors.Foreground.CYAN);

            //rasterizer.DrawMeshCenters(transformation, meshes, Kernel32Console.DefaultColors.Foreground.RED);
            //rasterizer.DrawMeshBoundingBox(transformation, meshes, Kernel32Console.DefaultColors.FOREGROUND_MAGENTA);

            //rasterizer.DrawAxes(Transformation.None, Kernel32Console.DefaultColors.Foreground.YELLOW);

            rasterizer.DrawStringHorizontal(Transformation.None, new Vector2(-Width / 2 + 1, Height / 2 - 2), string.Format("MODEL: '{0}'", currentWavefrontObjectFilePath));
            rasterizer.DrawStringHorizontal(Transformation.None, new Vector2(-Width / 2 + 1, Height / 2 - 3), string.Format("# POLYGONS: {0}", meshes.Sum(mesh => mesh.Faces.Count())));

            rasterizer.DrawStringHorizontal(Transformation.None, new Vector2(-Width / 2 + 1, 10), string.Format("TRANSLATION: {0}", transformation.Translation));
            rasterizer.DrawStringHorizontal(Transformation.None, new Vector2(-Width / 2 + 1, 9), string.Format("SCALE: {0}", transformation.Scale));
            rasterizer.DrawStringHorizontal(Transformation.None, new Vector2(-Width / 2 + 1, 8), string.Format("ROTATION: {0}", transformation.Rotation));

            rasterizer.DrawStringHorizontal(Transformation.None, new Vector2(-Width / 2 + 1, 6), string.Format("MODEL CENTER: {0}", transformation.Transform(meshes.First().Centers.Value)));

            var rasterizedFrameBuffer = rasterizer.Rasterize();
            renderer.Render(rasterizedFrameBuffer);
        }
        public MatchRunner(IMatch match, string playerOneFolder, string playerTwoFolder, IRenderer renderer, bool consoleLoggingDisabled, bool consoleLoggingMustScroll, string replayFolder)
        {
            Match = match;
            Renderer = renderer;

            string runFilename = Environment.OSVersion.Platform == PlatformID.Unix ? Settings.Default.BotRunFilenameLinux : Settings.Default.BotRunFilename;
            _players = new BotRunner[2];
            _players[0] = new BotRunner(
                1,
                playerOneFolder,
                runFilename
                );
            _players[1] = new BotRunner(
                2,
                playerTwoFolder,
                runFilename
                );

            match.SetPlayerName(1, _players[0].PlayerName);
            match.SetPlayerName(2, _players[1].PlayerName);

            _replayLogger = new ReplayLogger(replayFolder);

            SetupLogging(consoleLoggingDisabled, consoleLoggingMustScroll);
        }
 public void AddRenderer(IRenderer renderer)
 {
     lock (_lock)
     {
         _renderers.Add(renderer);
     }
 }
 public void RemoveRenderer(IRenderer renderer)
 {
     lock (_lock)
     {
         _renderers.Remove(renderer);
     }
 }
 public CityBuilder(ICity city, IRenderer renderer, IWriter writer)
 {
     this.City = city;
     this.Renderer = renderer;
     this.Writer = writer;
     this.IsRunning = false;
 }
Exemple #20
0
        public Hud(Game currentGame, IHudRenderer renderer,
            IRenderer<CommandBar> commandBarRenderer, IRenderer<CommandMainProgram> mainProgramRenderer, IRenderer<CommandFunction> functionOneRenderer, IRenderer<CommandFunction> functionTwoRenderer,
            IHudIconFactory iconFactory)
            : base(currentGame)
        {
            this.renderer = renderer;
            this.iconFactory = iconFactory;
               // HudHeight = 786;
               // HudWidth = 1024;
            CommandBar = new CommandBar(this, commandBarRenderer, iconFactory);
            MainProgram = new CommandMainProgram(this, mainProgramRenderer, iconFactory);
            FunctionOne = new CommandFunction(this, functionOneRenderer, iconFactory);
            FunctionOne.DefaultEmptyIcon = iconFactory.EmptyFunctionOneIcon;
            FunctionOne.AddEmptyIcons(iconFactory);
            FunctionTwo = new CommandFunction(this, functionTwoRenderer, iconFactory);
            FunctionTwo.DefaultEmptyIcon = iconFactory.EmptyFunctionTwoIcon;
            FunctionTwo.AddEmptyIcons(iconFactory);
            Message = new HudMessage();

            IconRelease += MainProgram.SetGrabbedIcon;
            IconRelease += FunctionOne.SetGrabbedIcon;
            IconRelease += FunctionTwo.SetGrabbedIcon;

            IconGrab += CommandBar.GrabIcon;
            IconGrab += MainProgram.GrabIcon;
            IconGrab += FunctionOne.GrabIcon;
            IconGrab += FunctionTwo.GrabIcon;

            Message.FirstLine = "";
            Message.SecondLine = "";
        }
 public void Render(IRenderer renderer)
 {
     foreach (var position in this.elements)
     {
         renderer.Render(position.x, position.y, 'o');
     }
 }
Exemple #22
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="container"></param>
        /// <param name="renderer"></param>
        /// <returns></returns>
        private static Viewbox ToViewbox(Container container, IRenderer renderer)
        {
            var visual = new DrawingVisual();

            using (var dc = visual.RenderOpen())
            {
                renderer.Draw(dc, container, container.Properties, null);
            }

            visual.Drawing.Freeze();

            var host = new VisualHost()
            {
                Width = container.Width,
                Height = container.Height
            };

            host.Visuals.Add(visual);

            var vb = new Viewbox()
            {
                Stretch = Stretch.Uniform
            };

            vb.Child = host;

            return vb;
        }
        public FeatureElement(Feature f, IRenderer renderer)
        {
            this.ClipBox = Rectangle2D.Empty;
            this.pathIsInvalid = true;
            if (f == null)
            {
                throw new ArgumentNullException("f");
            }
            this.feature = new WeakReference(f);

            if (renderer != null && (f.GetValue(Clusterer.ClusterProperty) == null))
            {
                this.GeoStyle = renderer.GetStyle(f) ?? generateDefaultSyle(f);
            }//renderer的优先级高于Feature自我的
            else
            {
                this.GeoStyle = f.Style ?? generateDefaultSyle(f);
            }
            f.SetBoundedStyle(this.GeoStyle);

            if (this.GeoStyle != null)
            {
                base.Template = this.GeoStyle.ControlTemplate;
            }

            this.Geometry = f.Geometry;
        }
        /// <summary>
        /// Initialize a new instance of the VisualPopupGroup class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonGroup">Reference to ribbon group for display.</param>
        /// <param name="renderer">Drawing renderer.</param>
        public VisualPopupGroup(KryptonRibbon ribbon,
                                KryptonRibbonGroup ribbonGroup,
                                IRenderer renderer)
            : base(renderer, true)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonGroup != null);

            // Remember references needed later
            _ribbon = ribbon;
            _ribbonGroup = ribbonGroup;

            // Create a view element for drawing the group
            _viewGroup = new ViewDrawRibbonGroup(ribbon, ribbonGroup, NeedPaintDelegate);
            _viewGroup.Collapsed = false;

            // Create the background that will contain the actual group instance
            _viewBackground = new ViewDrawRibbonGroupsBorder(ribbon, true, NeedPaintDelegate);
            _viewBackground.Add(_viewGroup);

            // Attach the root to the view manager instance
            ViewManager = new ViewRibbonPopupGroupManager(this, ribbon, _viewBackground, _viewGroup, NeedPaintDelegate);

            // Create and add a hidden button to act as the focus target
            _hiddenFocusTarget = new Button();
            _hiddenFocusTarget.TabStop = false;
            _hiddenFocusTarget.Location = new Point(-_hiddenFocusTarget.Width, -_hiddenFocusTarget.Height);
            CommonHelper.AddControlToParent(this, _hiddenFocusTarget);
        }
 public void RegisterFactory(string[] blocks, IRenderer renderer)
 {
     foreach (var block in blocks)
     {
         RegisterFactory(block, renderer);
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GameEngine" /> class.
 /// </summary>
 /// <param name="renderer">The game renderer.</param>
 /// <param name="inputMethod">The user input method.</param>
 public GameEngine(IRenderer renderer, IInputMethod inputMethod)
 {
     this.gameRenderer = renderer;
     this.inputMethod = inputMethod;
     this.scores = new HighScores(MaxTopPlayers);
     this.cmdExecutor = new DefaultGameCommandExecutor(this.gameRenderer, this.inputMethod, this.scores);
 }
    public CompositeWindow(IController controller, IRenderer renderer, double frameRate)
    {
      if (controller == null) throw new ArgumentNullException("controller");
      if (renderer == null) throw new ArgumentNullException("renderer");
      _controller = controller;
      _renderer = renderer;
      _frameRate = frameRate;
      Width = controller.Width;
      Height = controller.Height;
      if (_controller.IsFullScreen)
        WindowState = WindowState.Maximized;
      Title = controller.Name;

      InitializeComponent();
      if (_controller.HasUserInterface)
      {
        if(_controller.CentralView != null)
          MainGrid.Children.Add((UIElement)_controller.CentralView);
        if (_controller.LeftView != null)
          LeftGrid.Children.Add((UIElement)_controller.LeftView);
        if (_controller.RightView != null)
          RightGrid.Children.Add((UIElement)_controller.RightView);
        if (_controller.TopView != null)
          TopGrid.Children.Add((UIElement)_controller.TopView);
        if (_controller.BottomView != null)
          BottomGrid.Children.Add((UIElement)_controller.BottomView);
        
      }
      Loaded += OnLoaded;
      SizeChanged += OnSizeChanged;
      
    }
Exemple #28
0
        public Tube( IRenderer renderer )
        {
            ReferenceVertices = new GLVector3d[ 4 ];

            ReferenceVertices[0] = new GLVector3d( 0.5, -0.5, 0 );
            ReferenceVertices[1] = new GLVector3d( 0.5, 0.5, 0 );
            ReferenceVertices[2] = new GLVector3d( -0.5, 0.5, 0 );
            ReferenceVertices[3] = new GLVector3d( -0.5, -0.5, 0 );

            iFirstOuterFace = 0;
            iLastOuterFace = 3;

            iNumberFaces = 4;

            bShowCut = false;
            bShowHollow = false;

            iCutStart = 0;
            iCutEnd = MaxCut;

            this.renderer = renderer;
            SendRendererCallbacksToCrossSections();

            rotationalextrusionpath.UpdatePath();
            BuildFaces();
        }
Exemple #29
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="player">Player instance</param>
 /// <param name="renderer">IRender instance</param>
 /// <param name="controller">IControler instance</param>
 /// <param name="scoreBoard">Scoreboard instance</param>
 public Engine(Player player, IRenderer renderer, IController controller, ScoreBoard scoreBoard)
 {
     this.Player = player;
     this.Renderer = renderer;
     this.Controller = controller;
     this.ScoreBoard = scoreBoard;
 }
Exemple #30
0
 public virtual void Configure(IRenderer renderer)
 {
   foreach (var textureParameter in _textureParameters)
   {
     _shader.SetTextureParameter(textureParameter.Key, textureParameter.Value);
   } 
 }
Exemple #31
0
 public static void Run(ref SetScissorCommand command, ThreadedRenderer threaded, IRenderer renderer)
 {
     renderer.Pipeline.SetScissor(command._index, command._enable, command._x, command._y, command._width, command._height);
 }
Exemple #32
0
 public Button(IRenderer renderer, string label)
     : this(renderer, label, Style.Foreground)
 {
 }
Exemple #33
0
 public override void Render(IRenderer dg, CharacterBase character)
 {
     this._rect     = new Rectangle(character.animationpoint.X * character.Wide, character.Height, character.Wide, character.Height);
     this._position = new Vector2(character.positionDirect.X + Shake.X, character.positionDirect.Y + Shake.Y);
     dg.DrawImage(dg, "slash", this._rect, false, this._position, character.union == Panel.COLOR.blue, Color.White);
 }
 public Square(IRenderer renderer) : base(renderer) => Name = "Square";
Exemple #35
0
 public static void Run(ref SetDepthClampCommand command, ThreadedRenderer threaded, IRenderer renderer)
 {
     renderer.Pipeline.SetDepthClamp(command._clamp);
 }
Exemple #36
0
 public override void Render(IRenderer dg)
 {
     this._position = new Vector2(this.positionDirect.X + Shake.X, this.positionDirect.Y + Shake.Y);
     this._rect     = new Rectangle(192 + this.animationpoint.X * 40, this.animationpoint.Y * 24, 40, 24);
     dg.DrawImage(dg, "rieber", this._rect, false, this._position, this.rebirth, Color.White);
 }
Exemple #37
0
 /// <summary>
 /// Initialize a new instance of the VisualPopup class.
 /// </summary>
 /// <param name="renderer">Drawing renderer.</param>
 /// <param name="shadow">Does the popup need a shadow effect.</param>
 public VisualPopup(IRenderer renderer,
                    bool shadow)
     : this(new ViewManager(), renderer, shadow)
 {
 }
Exemple #38
0
 public Button(IRenderer renderer, string label, ActionDelegate action)
     : this(renderer, label, Style.Foreground)
 {
     this.Action = action;
 }
Exemple #39
0
 public override void Render(IRenderer dg, CharacterBase player)
 {
 }
Exemple #40
0
 public override void Render(IRenderer dg)
 {
     base.Render(dg);
 }
Exemple #41
0
 public virtual void Configure(IRenderer renderer)
 {
 }
Exemple #42
0
 public virtual void Render(IRenderer renderer)
 {
 }
Exemple #43
0
 public RasterTriangle(IRenderer renderer) : base(renderer)
 {
 }
Exemple #44
0
        public static void Run(ref ProgramGetBinaryCommand command, ThreadedRenderer threaded, IRenderer renderer)
        {
            byte[] result = command._program.Get(threaded).Base.GetBinary();

            command._result.Get(threaded).Result = result;
        }
Exemple #45
0
 public RasterSquare(IRenderer renderer) : base(renderer)
 {
 }
Exemple #46
0
 public VectorTriangle(IRenderer renderer) : base(renderer)
 {
 }
Exemple #47
0
 public Triangle(IRenderer renderer) : base(renderer)
 {
     Name = "Triangle";
 }
Exemple #48
0
 public VectorSquare(IRenderer renderer) : base(renderer)
 {
 }
 public static ConsolePixel DefaultPixel(this IRenderer <ConsolePixel> renderer) => defPixel;
 public RenderManager(IRenderControl control, IRenderer renderer)
 {
     Initialize(control, renderer);
 }
Exemple #51
0
        public void Render(Graphics g, IRenderer renderer)
        {
            if (counter >= 0 && counter <= 35)
            {
                //Ready
                text1.Draw(g);
            }
            else if (counter > 35 && counter <= 70)
            {
                //Go!
                text2.Draw(g);
                started = true;
            }
            else if (score <= 0)
            {
                ShutdownShowMessage?.Invoke("游戏结束!", "wardeclarer.exe");
            }
            else if (waitingForInput)
            {
                txtGarbageCurrent.Text = "当前: " + currentGarbage.Name;
                txtGarbageCurrent.Draw(g);
                text3.Draw(g);

                if (showCurrentAnswer)
                {
                    txtGarbageCurrentAnswer.Text = "答案: 选择第" + (((int)currentGarbage.Box) + 1).ToString() + "个";
                    txtGarbageCurrentAnswer.Draw(g);
                }
            }
            else if (currentResult != 0)
            {
                if (currentResult == 1)
                {
                    text5.Draw(g);
                    lastGameObject = text5;
                    delay          = 10;
                    currentResult  = 0;
                }
                else if (currentResult == 2)
                {
                    text4.Draw(g);
                    lastGameObject = text4;
                    delay          = 10;
                    currentResult  = 0;
                }
            }
            else if (delay > 0)
            {
                if (lastGameObject != null)
                {
                    lastGameObject.Render(g, renderer);
                }
                delay--;
            }
            else
            {
                int randIndex = rand.Next(0, garbages.Count);
                currentGarbage  = garbages[randIndex];
                waitingForInput = true;

                txtScoreValue.Text = score.ToString();
            }
            counter++;
        }
        //ComponentFactory Palette Painting
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            //Define Bounds
            Rectangle  ButtonBounds       = new Rectangle(0, 0, 16, 16);
            RectangleF ButtonCircleBounds = new RectangleF((float)0, (float)0, (float)15.1, (float)15.1);

            //Smoothing Mode
            e.Graphics.SmoothingMode     = SmoothingMode.AntiAlias;
            e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;

            //Paint Base
            base.OnPaint(e);

            if (_palette != null)
            {
                //Get the renderer associated with this palette
                IRenderer Renderer = _palette.GetRenderer();

                //Create the rendering context that is passed into all renderer calls
                using (RenderContext RenderContext = new RenderContext(this, e.Graphics, ButtonBounds, Renderer))
                {
                    // Set the style we want picked up from the base palette
                    m_paletteBack.Style = PaletteBackStyle.HeaderPrimary;


                    //Fill The Space
                    using (GraphicsPath Path = GetButtonPath(ButtonBounds))
                    {
                        // Ask renderer to draw the background
                        m_mementoBack1 = Renderer.RenderStandardBack.DrawBack(RenderContext, ButtonBounds, Path, m_paletteBack, m_orientation, (this.Enabled ? PaletteState.Normal : PaletteState.Disabled), m_mementoBack1);
                    }

                    // We want the inner part of the control to act like a button, so
                    // we need to find the correct palette state based on if the mouse
                    // is over the control if the mouse button is pressed down or not.
                    PaletteState ButtonState = GetButtonState();

                    // Set the style of button we want to draw
                    m_paletteBack.Style    = m_visuallook;
                    m_paletteBorder.Style  = (PaletteBorderStyle)m_visuallook;
                    m_paletteContent.Style = (PaletteContentStyle)m_visuallook;

                    // Do we need to draw the background?
                    if (m_paletteBack.GetBackDraw(ButtonState) == InheritBool.True)
                    {
                        using (GraphicsPath Path = GetRoundedSquarePath(ButtonCircleBounds))
                        {
                            // Ask renderer to draw the background
                            m_mementoBack2 = Renderer.RenderStandardBack.DrawBack(RenderContext, ButtonBounds, Path, m_paletteBack, m_orientation, ButtonState, m_mementoBack2);
                        }
                    }

                    // Do we need to draw the border?
                    if (m_paletteBorder.GetBorderDraw(ButtonState) == InheritBool.True)
                    {
                        // Now we draw the border of the inner area, also in ButtonStandalone style
                        e.Graphics.DrawEllipse(new Pen(m_paletteBorder.GetBorderColor2(ButtonState)), ButtonCircleBounds);
                    }

                    e.Graphics.SmoothingMode = SmoothingMode.None;

                    //Draw Magnifying Sign
                    switch (m_buttonstyle)
                    {
                    case ButtonStyles.MinusButton:
                        Rectangle MinusOuterBounds = new Rectangle(3, (this.Height / 2) - 2, 10, 4);
                        Rectangle MinusInnerBounds = new Rectangle(4, (this.Height / 2) - 1, 8, 2);

                        e.Graphics.FillRectangle(new SolidBrush(m_outerColor), MinusOuterBounds);
                        e.Graphics.FillRectangle(new SolidBrush(m_innerColor), MinusInnerBounds);

                        break;

                    case ButtonStyles.PlusButton:
                        DrawPlusOuter(e.Graphics, m_outerColor);
                        DrawPlusInner(e.Graphics, m_innerColor);
                        break;
                    }
                }
            }
        }
Exemple #53
0
 public override void Activate(IPlayer player, IRenderer renderer)
 {
     renderer.DrawFinalScore(player.GetMovesTaken());
 }
Exemple #54
0
 /// <summary>
 /// Creates a new TransparentRenderBucket.
 /// </summary>
 /// <param name="renderer">Renderer to use</param>
 /// <param name="comparer">Renderable comparer to use</param>
 public TransparentRenderBucket(IRenderer renderer, IRenderBucketComparer comparer)
     : base(renderer, comparer)
 {
 }
Exemple #55
0
 public override void Render(IRenderer dg, Vector2 position, string picturename)
 {
 }
 /// <summary>
 /// Initialize a new instance of the ViewContext class.
 /// </summary>
 /// <param name="control">Control associated with rendering.</param>
 /// <param name="renderer">Rendering provider.</param>
 public ViewLayoutContext(Control control,
                          IRenderer renderer)
     : this(null, control, control, null, renderer, control.Size)
 {
 }
Exemple #57
0
        public void Draw(IRenderer renderer, Rectangle9 position, float cooldownSize)
        {
            try
            {
                renderer.DrawTexture(this.Ability.TextureName, position);

                if (this.Ability.IsCasting || this.Ability.IsChanneling)
                {
                    renderer.DrawRectangle(position - 3f, Color.LightGreen, 3);
                }
                else
                {
                    renderer.DrawRectangle(position - 1, Color.Black);
                }

                if (this.displayLevel)
                {
                    var level = this.Ability.Level;
                    if (level == 0)
                    {
                        renderer.DrawTexture("o9k.ability_0lvl_bg", position);
                        return;
                    }

                    var levelText     = level.ToString("N0");
                    var levelSize     = renderer.MeasureText(levelText, position.Width * 0.45f);
                    var levelPosition = position.SinkToBottomLeft(levelSize.X, levelSize.Y * 0.8f);

                    renderer.DrawTexture("o9k.ability_lvl_bg", levelPosition);
                    renderer.DrawText(levelPosition, levelText, Color.White, RendererFontFlags.VerticalCenter, position.Width * 0.45f);
                }

                if (this.Ability.IsDisplayingCharges)
                {
                    var chargesText     = this.Ability.Charges.ToString("N0");
                    var chargesPosition = position.SinkToBottomRight(position.Width * 0.5f, position.Height * 0.5f);

                    renderer.DrawTexture("o9k.charge_bg", chargesPosition);
                    renderer.DrawTexture("o9k.outline_green", chargesPosition * 1.07f);
                    renderer.DrawText(chargesPosition, chargesText, Color.White, RendererFontFlags.Center, position.Width * 0.45f);
                }

                if (this.Ability.IsChanneling)
                {
                    return;
                }

                var cooldown = this.Ability.RemainingCooldown;
                if (cooldown > 0)
                {
                    renderer.DrawTexture("o9k.ability_cd_bg", position);
                    renderer.DrawText(
                        position,
                        Math.Ceiling(cooldown).ToString("N0"),
                        Color.White,
                        RendererFontFlags.Center | RendererFontFlags.VerticalCenter,
                        cooldownSize);
                }
                else if (this.Ability.ManaCost > this.Ability.Owner.Mana)
                {
                    renderer.DrawTexture("o9k.ability_mana_bg", position);
                    renderer.DrawText(
                        position,
                        Math.Ceiling((this.Ability.ManaCost - this.Ability.Owner.Mana) / this.Ability.Owner.ManaRegeneration)
                        .ToString("N0"),
                        Color.White,
                        RendererFontFlags.Center | RendererFontFlags.VerticalCenter,
                        cooldownSize);
                }
                else if (!this.Ability.IsUsable)
                {
                    renderer.DrawTexture("o9k.ability_0lvl_bg", position);
                }
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
        }
 /// <summary>
 /// Initialize a new instance of the ViewContext class.
 /// </summary>
 /// <param name="manager">Reference to the view manager.</param>
 /// <param name="form">Form associated with rendering.</param>
 /// <param name="formRect">Window rectangle for the Form.</param>
 /// <param name="renderer">Rendering provider.</param>
 public ViewLayoutContext(ViewManager manager,
                          Form form,
                          Rectangle formRect,
                          IRenderer renderer)
     : base(manager, form, form, null, renderer) =>
Exemple #59
0
 public override void Render(IRenderer dg)
 {
     this.NoTimesRender(dg);
 }
Exemple #60
0
 public override void InitiateBlocks(IPlayerDetails player, IRenderer renderer)
 {
     player.LivesLeft(1);
     renderer.DrawHitByMine();
 }