Ejemplo n.º 1
0
        public void InsertObject(CNode node, OBJECT obj)
        {
            RECTANGLE rect = RECTANGLE.Intersec(node.m_bound, obj.RangeOfMovement);

            if (rect.cX == 0 && rect.cY == 0 && rect.width == 0 && rect.height == 0)
            {
                return;
            }

            if (node.m_bound.width >= (MAX_HEIGHT_SIZE_OF_NODE + 10) && node.m_bound.height > (MAX_HEIGHT_SIZE_OF_NODE + 10))
            {
                if (node.m_tl == null)
                {
                    node.m_tl = new CNode(node.m_id, PositionOfNode.TopLeft, node.Bound);
                    node.m_tr = new CNode(node.m_id, PositionOfNode.TopRight, node.Bound);
                    node.m_bl = new CNode(node.m_id, PositionOfNode.BottomLeft, node.Bound);
                    node.m_br = new CNode(node.m_id, PositionOfNode.BottomRight, node.Bound);
                }

                node.InsertObject(node.m_tl, obj);
                node.InsertObject(node.m_tr, obj);
                node.InsertObject(node.m_bl, obj);
                node.InsertObject(node.m_br, obj);
            }
            else
            {
                node.m_listObject.Add(obj);
            }

            return;
        }
Ejemplo n.º 2
0
        public static Int32 SetStreamWindowPosition(ref RECTANGLE rect, Int32 devid, Int32 strmidx)
        {
            int hr;

            hr = S2253_SetStreamWindowPosition(ref rect, devid, strmidx);
            return(hr);
        }
Ejemplo n.º 3
0
        //====================================================================================================
        // ■ GUI
        //====================================================================================================
        void OnGUI()
        {
            if (HitFlag)
            {
                UI.Color = COLOR.white;

                var camera   = GAMEOBJECT.Find("Main Camera").Camera;
                var position = camera.WorldToScreenPoint(transform.position);

                //Energy

                UI.Color = (0, 0.4f, 0, 1);

                UI.DrawTexture(new RECTANGLE(position.x, SCREEN.height - position.y - 10, 30, 5), TEXTURE2D.whiteTexture);

                UI.Color = (0, 0.9f, 0, 1);

                UI.DrawTexture(new RECTANGLE(position.x, SCREEN.height - position.y - 10, 30 * HitCount / OriginalHitCount, 5), TEXTURE2D.whiteTexture);
            }

            if (Die)
            {
                UI.Color = COLOR.white;

                ScorePosition = math.lerp(ScorePosition, new float3(SCREEN.width * 0.5f, SCREEN.height, 0), 0.01f);

                //Number
                var rectangle = new RECTANGLE(ScorePosition.x - 60, SCREEN.height - ScorePosition.y, 30, 30);
                INTERFACE.DrawNumber(100, rectangle);
            }
        }
Ejemplo n.º 4
0
 public OBJECT()
 {
     this.mType = -1;
     this.mID = -1;
     this.mPosition = new VECTOR2D(0, 0);
     this.mBound = new RECTANGLE(0, 0, 0, 0);
     this.mImage = null;
 }
Ejemplo n.º 5
0
 public OBJECT()
 {
     this.mType     = -1;
     this.mID       = -1;
     this.mPosition = new VECTOR2D(0, 0);
     this.mBound    = new RECTANGLE(0, 0, 0, 0);
     this.mImage    = null;
 }
        private void RectButton_Click(object sender, EventArgs e)
        {
            RECTANGLE MyRectangle = new RECTANGLE();

            MyRectangle.getparameters();
            MyRectangle.drawshape(this);
            MyRectangle.MyPen.Dispose();
            MyRectangle.description(this);
            MyRectangle.enabling(this);
        }
Ejemplo n.º 7
0
        //====================================================================================================
        // ■ GUI
        //====================================================================================================
        void OnGUI()
        {
            for (int i = 0; i < UserArray.Length; i++)
            {
                var rectangle = new RECTANGLE(50, 100 + i * 50, 40, 40);

                if (SelectedUser == i)
                {
                    UI.Color = new COLOR(0.8f, 0.8f, 0.8f, 1);
                }
                else
                {
                    UI.Color = new COLOR(0, 0.5f, 0.6f, 1);
                }

                UI.DrawTexture(rectangle, UserTexture);

                rectangle = new RECTANGLE(50 + 50, 110 + i * 50, 200, 20);

                UI.Label(rectangle, UserArray[i].Name);

                ///////////////////////
                //PowerLine
                ///////////////////////

                int    power    = UserArray[i].Power;
                float2 position = new float2(100, 105 + i * 50);

                UI.Color = (0, 0.4f, 0, 1);
                UI.DrawTexture(new RECTANGLE(position.x, position.y, 60, 5), TEXTURE2D.whiteTexture);

                UI.Color = (0, 0.9f, 0, 1);
                UI.DrawTexture(new RECTANGLE(position.x, position.y, 60 * power / 100, 5), TEXTURE2D.whiteTexture);


                ///////////////////////
                // Chat Window
                ///////////////////////

                UI.Color = new COLOR(0.8f, 0.8f, 0.8f, 1);
                UI.Label(new RECTANGLE(SCREEN.width - 350, SCREEN.height - 280, 300, 30), "Active User : " + UserArray[SelectedUser].Name);

                UI.Color = new COLOR(0, 0.2f, 0.3f, 0.4f);

                UI.DrawTexture(new RECTANGLE(SCREEN.width - 350, SCREEN.height - 250, 300, 200), TEXTURE2D.whiteTexture);

                UI.Color = COLOR.white;
                //Paste Button
                if (UI.DrawButton(new RECTANGLE(SCREEN.width - 50 - 300 * 0.5f - 40, SCREEN.height - 50, 80, 40), PasteTexture))
                {
                }
            }
        }
Ejemplo n.º 8
0
        public void InsertObject(CNode node, OBJECT obj)
        {
            RECTANGLE rect = RECTANGLE.Intersec(node.m_bound, obj.RangeOfMovement);

            if (rect.cX == 0 && rect.cY == 0 && rect.width == 0 && rect.height == 0)
            {
                return;
            }
            node.m_listObject.Add(obj);

            return;
        }
Ejemplo n.º 9
0
        public CNode(int ID, RECTANGLE Bound)
        {
            // if node is root
            this.m_id = ID;

            this.m_next = null;

            this.m_listObject = new List <OBJECT>();
            if (ID == 0)
            {
                this.m_bound = Bound;
            }
            else
            {
                this.m_bound = new RECTANGLE(Bound.cX, Bound.cY, Support.SIZE_CELLS_WIDTH, Support.SIZE_CELLS_HEIGHT);
            }
        }
Ejemplo n.º 10
0
        //====================================================================================================
        // ■ DRAW NUMBER
        //====================================================================================================
        static public void DrawNumber(int number, RECTANGLE area)
        {
            int n     = number;
            int count = 0;

            do
            {
                n = n / 10;
                count++;
            }while (n > 0);

            for (int i = count; i > 0; i--)
            {
                n      = number % 10;
                number = number / 10;
                UI.DrawTextureWithTexCoords(new RECTANGLE((area.x + i * area.width), area.y, area.width, area.height), NumbersTexture, new RECTANGLE(0.1f * n, 0, 0.1f, 1.0f));
            }
        }
Ejemplo n.º 11
0
        static void Main(string[] args)
        {
            double A, B, C, pi = 3.14159;
            double TRIANGLE, CIRCLE, TRAPEZIUM, SQUARE, RECTANGLE;

            string[] values = Console.ReadLine().Split(' ');
            A = double.Parse(values[0], CultureInfo.InvariantCulture);
            B = double.Parse(values[1], CultureInfo.InvariantCulture);
            C = double.Parse(values[2], CultureInfo.InvariantCulture);

            TRIANGLE  = A * C / 2.0;
            CIRCLE    = pi * C * C;
            TRAPEZIUM = (A + B) / 2.0 * C;
            SQUARE    = B * B;
            RECTANGLE = A * B;

            Console.WriteLine("TRIANGULO: " + TRIANGLE.ToString("F3", CultureInfo.InvariantCulture));
            Console.WriteLine("CIRCULO: " + CIRCLE.ToString("F3", CultureInfo.InvariantCulture));
            Console.WriteLine("TRAPEZIO: " + TRAPEZIUM.ToString("F3", CultureInfo.InvariantCulture));
            Console.WriteLine("QUADRADO: " + SQUARE.ToString("F3", CultureInfo.InvariantCulture));
            Console.WriteLine("RETANGULO: " + RECTANGLE.ToString("F3", CultureInfo.InvariantCulture));
        }
Ejemplo n.º 12
0
        //====================================================================================================
        public void DrawNumber(int number, int digitCount, RECTANGLE area)
        {
            int n     = number;
            int count = 0;

            do
            {
                n = n / 10;
                count++;
            }while (n > 0);

            for (int i = 0; i < digitCount - count; i++)
            {
                UI.DrawTextureWithTexCoords(new RECTANGLE(area.x + i * area.width, area.y, area.width, area.height), NumbersTexture, new RECTANGLE(0.0f, 0, 0.1f, 1.0f));
            }

            for (int i = count; i > 0; i--)
            {
                n      = number % 10;
                number = number / 10;
                UI.DrawTextureWithTexCoords(new RECTANGLE(area.x + (i + digitCount - count - 1) * area.width, area.y, area.width, area.height), NumbersTexture, new RECTANGLE(0.1f * n, 0, 0.1f, 1.0f));
            }
        }
Ejemplo n.º 13
0
        public OBJECT(int _type, int _id, int _index, VECTOR2D _position, RECTANGLE _bound)
        {
            this.mType     = _type;
            this.mID       = _id;
            this.mIndex    = _index;
            this.mPosition = _position;
            this.mBound    = _bound;

            if ((ObjectType)_type == ObjectType.TILE_MAP)
            {
                this.mImage = new Image();

                // Set atribute for image object
                if (Support.map != null)
                {
                    BitmapSource      bmpSource;
                    JpegBitmapEncoder bmpCreate = new JpegBitmapEncoder();

                    byte[] arrPixel = new byte[((Support.WIDTH_OF_TILE * Support.map.BitMap.Format.BitsPerPixel) / 8) * Support.HEIGHT_OF_TILE];
                    Support.map.TileMap[this.mID].ExportBitMap(0, 0, arrPixel, (Support.WIDTH_OF_TILE * Support.map.BitMap.Format.BitsPerPixel / 8));
                    bmpSource          = BitmapSource.Create(Support.WIDTH_OF_TILE, Support.HEIGHT_OF_TILE, 96, 96, Support.map.BitMap.Format, null, arrPixel, ((Support.WIDTH_OF_TILE * Support.map.BitMap.Format.BitsPerPixel) / 8));
                    this.mImage.Source = bmpSource;
                    this.mImage.Width  = bmpSource.Width;
                    this.mImage.Height = bmpSource.Height;
                    this.mImage.Tag    = this.mType;
                }
            }

            if (Support.IsDynamic((ObjectID)this.mID) && (ObjectType)(this.mType) == (ObjectType.NORMAL_OBJECT))
            {
                this.mRangeOfMovement = new RECTANGLE(this.mBound.cX, this.mBound.cY, this.mBound.width + 600, this.mBound.height + 600);
            }
            else
            {
                this.mRangeOfMovement = new RECTANGLE(this.mBound.cX - this.mBound.width / 2, this.mBound.cY + this.mBound.height / 2, this.mBound.width, this.mBound.height);
            }
        }
Ejemplo n.º 14
0
        public OBJECT(int _type, int _id, int _index, VECTOR2D _position, RECTANGLE _bound)
        {
            this.mType = _type;
            this.mID = _id;
            this.mIndex = _index;
            this.mPosition = _position;
            this.mBound = _bound;

            if ((ObjectType)_type == ObjectType.TILE_MAP)
            {
                this.mImage = new Image();

                // Set atribute for image object
                if (Support.map != null)
                {
                    BitmapSource bmpSource;
                    JpegBitmapEncoder bmpCreate = new JpegBitmapEncoder();

                    byte[] arrPixel = new byte[((Support.WIDTH_OF_TILE * Support.map.BitMap.Format.BitsPerPixel) / 8) * Support.HEIGHT_OF_TILE];
                    Support.map.TileMap[this.mID].ExportBitMap(0, 0, arrPixel, (Support.WIDTH_OF_TILE * Support.map.BitMap.Format.BitsPerPixel / 8));
                    bmpSource = BitmapSource.Create(Support.WIDTH_OF_TILE, Support.HEIGHT_OF_TILE, 96, 96, Support.map.BitMap.Format, null, arrPixel, ((Support.WIDTH_OF_TILE * Support.map.BitMap.Format.BitsPerPixel) / 8));
                    this.mImage.Source = bmpSource;
                    this.mImage.Width = bmpSource.Width;
                    this.mImage.Height = bmpSource.Height;
                    this.mImage.Tag = this.mType;
                }
            }

            if (Support.IsDynamic((ObjectID)this.mID) && (ObjectType)(this.mType) == (ObjectType.NORMAL_OBJECT))
            {
                this.mRangeOfMovement = new RECTANGLE(this.mBound.cX, this.mBound.cY, this.mBound.width + 600, this.mBound.height + 600);
            }
            else
            {
                this.mRangeOfMovement = new RECTANGLE(this.mBound.cX - this.mBound.width / 2, this.mBound.cY + this.mBound.height / 2, this.mBound.width, this.mBound.height);
            }
        }
Ejemplo n.º 15
0
        public CNode(int parentID, PositionOfNode positionOfNode, RECTANGLE parentBound)
        {
            // if node is root
            this.m_id = parentID * 10 + (int)positionOfNode;

            this.m_tl = null;
            this.m_tr = null;
            this.m_bl = null;
            this.m_br = null;

            this.m_listObject = new List<OBJECT>();

            if (parentID == 0)
            {
                this.m_bound = parentBound;
            }
            else
            {
                if (positionOfNode == PositionOfNode.TopLeft)
                {
                    this.m_bound = new RECTANGLE(parentBound.cX, parentBound.cY, parentBound.width / 2, parentBound.height / 2);
                }
                else if (positionOfNode == PositionOfNode.TopRight)
                {
                    this.m_bound = new RECTANGLE(parentBound.cX + parentBound.width / 2, parentBound.cY, parentBound.width / 2, parentBound.height / 2);
                }
                else if (positionOfNode == PositionOfNode.BottomLeft)
                {
                    this.m_bound = new RECTANGLE(parentBound.cX, parentBound.cY - parentBound.height / 2, parentBound.width / 2, parentBound.height / 2);
                }
                else if (positionOfNode == PositionOfNode.BottomRight)
                {
                    this.m_bound = new RECTANGLE(parentBound.cX + parentBound.width / 2, parentBound.cY - parentBound.height / 2, parentBound.width / 2, parentBound.height / 2);
                }
            }
        }
Ejemplo n.º 16
0
        public CNode(int parentID, PositionOfNode positionOfNode, RECTANGLE parentBound)
        {
            // if node is root
            this.m_id = parentID * 10 + (int)positionOfNode;

            this.m_tl = null;
            this.m_tr = null;
            this.m_bl = null;
            this.m_br = null;

            this.m_listObject = new List <OBJECT>();

            if (parentID == 0)
            {
                this.m_bound = parentBound;
            }
            else
            {
                if (positionOfNode == PositionOfNode.TopLeft)
                {
                    this.m_bound = new RECTANGLE(parentBound.cX, parentBound.cY, parentBound.width / 2, parentBound.height / 2);
                }
                else if (positionOfNode == PositionOfNode.TopRight)
                {
                    this.m_bound = new RECTANGLE(parentBound.cX + parentBound.width / 2, parentBound.cY, parentBound.width / 2, parentBound.height / 2);
                }
                else if (positionOfNode == PositionOfNode.BottomLeft)
                {
                    this.m_bound = new RECTANGLE(parentBound.cX, parentBound.cY - parentBound.height / 2, parentBound.width / 2, parentBound.height / 2);
                }
                else if (positionOfNode == PositionOfNode.BottomRight)
                {
                    this.m_bound = new RECTANGLE(parentBound.cX + parentBound.width / 2, parentBound.cY - parentBound.height / 2, parentBound.width / 2, parentBound.height / 2);
                }
            }
        }
Ejemplo n.º 17
0
 static extern Int32 S2253_SetStreamWindowPosition(ref RECTANGLE rect, Int32 devid, Int32 strmidx);