Beispiel #1
0
 static void init()
 {
     if (initialized)
     {
         return;
     }
     initialized  = true;
     delayObjects = new List <IDelayObject>();
     EnterFrame.Add(OnTick);
 }
Beispiel #2
0
        /// <summary>
        /// 各フレームの処理を行います。
        /// </summary>
        private void UpdateFrame(object sender, EventArgs e)
        {
            // アイドル時間を強制的に発生させます。
            using (new ActionOnDispose(PrepareToNextRender))
            {
                var diff = WaitNextFrame();

                // 各フレームの処理を行います。
                EnterFrame.SafeRaiseEvent(this, new FrameEventArgs(diff));
            }
        }
Beispiel #3
0
        /// <summary>
        /// フレーム枚の更新処理を行います。
        /// </summary>
        protected virtual void OnEnterFrame(EnterFrameEventArgs e)
        {
            EnterFrame.SafeRaiseEvent(this, e);

            // シナリオの更新を行います。
            if (Scenario != null)
            {
                Scenario.DoEnterFrame(e.ElapsedTime, e.StateObject);
            }

            // 行列の更新
            UpdateTransform();
        }
Beispiel #4
0
        // TODO this is optimized in Sparrow-s; it maintains an array of things on the Stage
        protected void BroadcastEnterFrameEvent(float passedTime)
        {
            EnterFrame?.Invoke(this, passedTime);
            var displayObjectContainer = this as DisplayObjectContainer;

            if (displayObjectContainer == null)
            {
                return;
            }
            // We need to make a copy here because the Children list might be modified in an EnterFrame event handler
            var copy = new List <DisplayObject>(displayObjectContainer.Children);

            foreach (var child in copy)
            {
                child.BroadcastEnterFrameEvent(passedTime);
            }
        }
Beispiel #5
0
        public void Init(dynamic settings = null) // IPAddress multicastIPaddress, int port, IPAddress localIPaddress = null
        {
            //if (settings == null){
            port = 33333;
            multicastIPaddress = IPAddress.Parse("233.255.255.255");
            if (settings != null)
            {
                int    _port          = (int)settings.GetType().GetProperty("port").GetValue(settings, null);
                string _multicastAddr = (string)settings.GetType().GetProperty("multicastAddr").GetValue(settings, null);
                if (_multicastAddr != null)
                {
                    multicastIPaddress = IPAddress.Parse(_multicastAddr);
                }
            }

            // Create endpoints
            //IPAddress address = IPAddress.Parse("233.255.255.255");
            //int port = 0;
            remoteEndPoint = new IPEndPoint(multicastIPaddress, port);
            localEndPoint  = new IPEndPoint(localIPaddress, port);

            // Create and configure UdpClient
            udpclient = new UdpClient();
            // The following three lines allow multiple clients on the same PC
            udpclient.ExclusiveAddressUse = false;
            udpclient.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
            udpclient.ExclusiveAddressUse = false;
            // Bind, Join
            udpclient.Client.Bind(localEndPoint);
            udpclient.JoinMulticastGroup(multicastIPaddress, localIPaddress);

            // Start listening for incoming data
            //udpclient.BeginReceive(new AsyncCallback(ReceivedCallback), null);

            EnterFrame.Add(Tick);
        }
Beispiel #6
0
        // enter frame event

        private void OnEnterFrame(DisplayObject target, float passedTime)
        {
            EnterFrame?.Invoke(target, passedTime);
        }
Beispiel #7
0
 /// <summary>
 /// 各フレームに必要な処理を行います。
 /// </summary>
 private void DoEnterFrame(double diff, bool frameSkipped)
 {
     EnterFrame.SafeRaiseEvent(this,
                               new FrameEventArgs(diff, frameSkipped));
 }
Beispiel #8
0
 /// <summary>
 /// フレーム枚の更新処理を行います。
 /// </summary>
 protected virtual void OnEnterFrame(EnterFrameEventArgs e)
 {
     EnterFrame.SafeRaiseEvent(this, e);
 }