コード例 #1
0
            public override void Draw(Cairo.Context cr)
            {
                int x = X;
                int y = Y;

                if (obj.GetGameObject() != null)
                {
                    try {
                        ObjectAnimationFrame o      = obj.GetGameObject().DefaultAnimation.GetFrame(0);
                        TileDrawer           drawer = new CairoTileDrawer(cr, x, y);
                        o.Draw(drawer);
                    }
                    catch (NoAnimationException) {
                        // No animation defined
                    }
                    catch (InvalidAnimationException) {
                        // Error parsing an animation; draw a blue X to indicate the error
                        double xPos = x - BoxHeight / 2 + 0.5;
                        double yPos = y - BoxHeight / 2 + 0.5;

                        cr.SetSourceColor(new Cairo.Color(1.0, 0, 0));
                        cr.MoveTo(xPos, yPos);
                        cr.LineTo(xPos + BoxWidth - 1, yPos + BoxHeight - 1);
                        cr.MoveTo(xPos + BoxWidth - 1, yPos);
                        cr.LineTo(xPos, yPos + BoxHeight - 1);
                        cr.Stroke();
                    }
                }
            }
コード例 #2
0
ファイル: ObjectBox.cs プロジェクト: Drenn1/LynnaLab
        // Private methods

        void DrawObject(ObjectDefinition obj, Cairo.Context cr, double x, double y)
        {
            if (obj.GetGameObject() != null)
            {
                try {
                    CairoTileDrawer      drawer = new CairoTileDrawer(cr, (int)x, (int)y);
                    ObjectAnimationFrame o      = obj.GetGameObject().DefaultAnimation.GetFrame(0);
                    o.Draw(drawer);
                }
                catch (NoAnimationException) {
                    // No animation defined
                }
                catch (InvalidAnimationException) {
                    // Error parsing an animation; draw a blue X to indicate the error
                    int    width = 16;
                    double xPos  = x - width / 2 + 0.5;
                    double yPos  = y - width / 2 + 0.5;

                    cr.SetSourceColor(CairoHelper.ConvertColor(System.Drawing.Color.Blue));
                    cr.MoveTo(xPos, yPos);
                    cr.LineTo(xPos + width - 1, yPos + width - 1);
                    cr.MoveTo(xPos + width - 1, yPos);
                    cr.LineTo(xPos, yPos + width - 1);
                    cr.Stroke();
                }
            }
        }
コード例 #3
0
            public override void Draw(Cairo.Context cr)
            {
                if (chest.Treasure == null)
                {
                    return;
                }
                GameObject obj = Project.GetIndexedDataType <InteractionObject>(
                    Project.EvalToInt("INTERACID_TREASURE") * 256 + chest.Treasure.Graphics);

                try {
                    TileDrawer drawer = new CairoTileDrawer(cr, X, Y);
                    obj.DefaultAnimation.GetFrame(0).Draw(drawer);
                }
                catch (InvalidAnimationException) {
                }
            }