Beispiel #1
0
 public override void Draw( GameTime gameTime )
 {
     LiqueurSystem.GraphicsDevice.Clear ( ClearBuffer.AllBuffer, Color.Black );
     LiqueurSystem.GraphicsDevice.BeginScene ();
     base.Draw ( gameTime );
     LiqueurSystem.GraphicsDevice.EndScene ();
 }
            public override void Draw( GameTime gameTime )
            {
                LiqueurSystem.GraphicsDevice.RenderTarget = renderBuffer;
                LiqueurSystem.GraphicsDevice.Clear ( ClearBuffer.AllBuffer, Color.White );
                effect.SetTextures ( new TextureArgument () { Uniform = "texture", Texture = texture } );
                effect.Dispatch ( ( IEffect ef ) =>
                                 {
                    LiqueurSystem.GraphicsDevice.Draw<Vertex> ( PrimitiveType.TriangleList, vertexBuffer, indexBuffer );
                } );

                LiqueurSystem.GraphicsDevice.RenderTarget = null;
                LiqueurSystem.GraphicsDevice.Clear ( ClearBuffer.AllBuffer, new Color ( 0.2f, 0.5f, 0.4f, 1.0f ) );

                effect.SetTextures ( new TextureArgument () { Uniform = "texture", Texture = renderBuffer } );
                effect.Dispatch ( ( IEffect ef ) =>
                                 {
                    LiqueurSystem.GraphicsDevice.Draw<Vertex> ( PrimitiveType.TriangleList, vertexBuffer, indexBuffer );
                } );

                World2 world = new World2 ( LiqueurSystem.GraphicsDevice.ScreenSize / 2 - sprite.Texture.Size / 2,
                                           new Vector2 ( 1 + angle ), sprite.Texture.Size / 2, angle, sprite.Texture.Size / 2 );
                sprite.Draw ( world );

                font.DrawFont ( "Test (문자열 출력 테스트!) 日本語テスト ♣♪", Color.White, new Vector2 ( 0, 0 ) );

                base.Draw ( gameTime );
            }
Beispiel #3
0
 public override void Draw( GameTime gameTime )
 {
     LiqueurSystem.GraphicsDevice.Clear ( ClearBuffer.AllBuffer, Color.Black );
     LiqueurSystem.GraphicsDevice.BeginScene ();
     font.DrawFont ( infoText, Color.White, new Vector2 ( 10, 10 + offset ) );
     base.Draw ( gameTime );
     LiqueurSystem.GraphicsDevice.EndScene ();
 }
Beispiel #4
0
        public override void Draw( GameTime gameTime )
        {
            titleFont.DrawFont ( "Dodge", Color.White, new Vector2 ( 24 ) );

            menuFont.DrawFont ( "A. START", Color.White, new Vector2 ( 24, 256 ) );
            menuFont.DrawFont ( "B. EXIT", Color.White, new Vector2 ( 24, 304 ) );

            base.Draw ( gameTime );
        }
Beispiel #5
0
        public override void Draw( GameTime gameTime )
        {
            LiqueurSystem.GraphicsDevice.Clear ( ClearBuffer.AllBuffer, Color.Black );
            LiqueurSystem.GraphicsDevice.BeginScene ();

            font.DrawFont ( string.Format ( "Audio1: {0}/{1}\nAudio2: {2}/{3}",
                audio1.Position, audio1.Duration, audio2.Position, audio2.Duration ), Color.White, new Vector2 () );

            base.Draw ( gameTime );
            LiqueurSystem.GraphicsDevice.EndScene ();
        }
        public override void Draw( GameTime gameTime )
        {
            if ( currentNode != null )
                currentNode.Draw ( gameTime );

            if ( TransitionState != TransitionState.None )
            {
                TransitionState = SceneTransitor.Transitioning ( TransitionState, sceneList.Peek () );
                if ( TransitionState == Scenes.TransitionState.PretransitionEnd )
                {
                    switch ( ContainMethod )
                    {
                        case SceneContainMethod.Flat:
                            spinlock.Enter ();
                            sceneList.Pop ().Outro ();
                            nextNode.Intro ( nextNodeArgs );
                            nextNode.Parent = this;
                            sceneList.Push ( currentNode = nextNode );
                            nextNode = null;
                            nextNodeArgs = null;
                            spinlock.Exit ();
                            break;
                        case SceneContainMethod.Stack:
                            if ( nextNode == null )
                            {
                                spinlock.Enter ();
                                Node nn = sceneList.Pop ();
                                nn.Parent = null;
                                nn.Outro ();
                                currentNode = null;
                                nextNode = null;
                                nextNodeArgs = null;
                                spinlock.Exit ();
                            }
                            else
                            {
                                spinlock.Enter ();
                                nextNode.Intro ( nextNodeArgs );
                                sceneList.Push ( currentNode = nextNode );
                                nextNode = null;
                                nextNodeArgs = null;
                                spinlock.Exit ();
                            }
                            break;
                    }
                }
                else if ( TransitionState == Scenes.TransitionState.End )
                {
                    TransitionState = TransitionState.None;
                    nextNode = null;
                }
            }
            base.Draw ( gameTime );
        }
        public override void Draw( GameTime gameTime )
        {
            drawSum += gameTime.ElapsedGameTime;
            ++drawFrame;

            if ( drawSum.TotalSeconds >= 1 )
            {
                drawFps = drawFrame + drawFrame * ( float ) ( drawSum.TotalSeconds - 1 );
                drawFrame = 0;
                drawSum = new TimeSpan ();
            }

            base.Draw ( gameTime );
        }
Beispiel #8
0
        public override void Update( GameTime gameTime )
        {
            if ( InputHelper.IsKeyboardKeyUpRightNow ( KeyboardKey.Q ) )
                LiqueurSystem.AudioDevice.Play ( audio1 );
            if ( InputHelper.IsKeyboardKeyUpRightNow ( KeyboardKey.A ) )
                LiqueurSystem.AudioDevice.Stop ( audio1 );

            if ( InputHelper.IsKeyboardKeyUpRightNow ( KeyboardKey.W ) )
                LiqueurSystem.AudioDevice.Play ( audio2 );
            if ( InputHelper.IsKeyboardKeyUpRightNow ( KeyboardKey.S ) )
                LiqueurSystem.AudioDevice.Stop ( audio2 );

            base.Update ( gameTime );
        }
        public override void Update( GameTime gameTime )
        {
            updateSum += gameTime.ElapsedGameTime;
            ++updateFrame;

            if ( updateSum.TotalSeconds >= 1 )
            {
                updateFps = updateFrame + updateFrame * ( float ) ( updateSum.TotalSeconds - 1 );
                updateFrame = 0;
                updateSum = new TimeSpan ();
            }

            base.Update ( gameTime );
        }
 public override void Update( GameTime gameTime )
 {
     Vector2 pos = ( this [ 0 ] as SpriteNode ).World.Translate;
     if ( InputHelper.CurrentKeyboardState.IsKeyDown ( KeyboardKey.Up ) )
         pos += new Vector2 ( 0, -1 ) * ( gameTime.ElapsedGameTime.Milliseconds / 5.0f );
     if ( InputHelper.CurrentKeyboardState.IsKeyDown ( KeyboardKey.Down ) )
         pos += new Vector2 ( 0, 1 ) * ( gameTime.ElapsedGameTime.Milliseconds / 5.0f );
     if ( InputHelper.CurrentKeyboardState.IsKeyDown ( KeyboardKey.Left ) )
         pos += new Vector2 ( -1, 0 ) * ( gameTime.ElapsedGameTime.Milliseconds / 5.0f );
     if ( InputHelper.CurrentKeyboardState.IsKeyDown ( KeyboardKey.Right ) )
         pos += new Vector2 ( 1, 0 ) * ( gameTime.ElapsedGameTime.Milliseconds / 5.0f );
     ( this [ 0 ] as SpriteNode ).World.Translate = ( this [ 1 ] as SpriteNode ).World.Translate = pos;
     base.Update ( gameTime );
 }
Beispiel #11
0
 public override void Update( GameTime gameTime )
 {
     if ( InputHelper.IsKeyboardKeyUpRightNow ( KeyboardKey.A ) )
     {
         ( Parent as SceneContainer ).Transition ( new GameScene () );
     }
     if ( InputHelper.IsKeyboardKeyUpRightNow ( KeyboardKey.B ) )
     {
         LiqueurSystem.Launcher.InvokeInMainThread ( () =>
         {
             LiqueurSystem.Exit ();
         } );
     }
     base.Update ( gameTime );
 }
Beispiel #12
0
        public override void Draw( GameTime gameTime )
        {
            Vector2 position = Position;
            Vector2 measure = ( Alignment != 0 ) ? font.MeasureString ( Text ) : new Vector2 ();

            if ( ( Alignment & SpriteAlignment.Center ) != 0 ) position += new Vector2 ( -measure.X / 2, 0 );
            if ( ( Alignment & SpriteAlignment.Right ) != 0 ) position += new Vector2 ( -measure.X, 0 );

            if ( ( Alignment & SpriteAlignment.Middle ) != 0 ) position += new Vector2 ( 0, -measure.Y / 2 );
            if ( ( Alignment & SpriteAlignment.Bottom ) != 0 ) position += new Vector2 ( 0, -measure.Y );

            font.DrawFont ( Text, Color, position );

            base.Draw ( gameTime );
        }
Beispiel #13
0
        public override void Update( GameTime gameTime )
        {
            World.Translate += new Vector2 ( ( float ) Math.Cos ( angle ), ( float ) Math.Sin ( angle ) ) *
                ( gameTime.ElapsedGameTime.Milliseconds / 10.0f );

            if ( World.Translate.X < 0 || World.Translate.X > 800 )
                InitializeBullet ();
            if ( World.Translate.Y < 0 || World.Translate.Y > 600 )
                InitializeBullet ();

            SpriteNode chr = Parent.Parent [ 0 ] [ 1 ] as SpriteNode;
            if ( CheckCollaps ( World.Translate, Texture.Width / 2, chr.World.Translate, chr.Texture.Width / 2 ) )
                ( Parent.Parent as GameScene ).IsGameOver = true;

            base.Update ( gameTime );
        }
 public override void Update( GameTime gameTime )
 {
     List<Timer> removeTimers = new List<Timer> ();
     foreach ( KeyValuePair<Timer, Action<Timer>> pair in timers.ToArray () )
     {
         pair.Key.Update ( gameTime );
         if ( pair.Key.Check )
         {
             pair.Key.Reset ();
             pair.Value ( pair.Key );
             removeTimers.Add ( pair.Key );
         }
     }
     foreach ( Timer timer in removeTimers )
         timers.Remove ( timer );
     base.Update ( gameTime );
 }
Beispiel #15
0
        public override void Draw( GameTime gameTime )
        {
            LiqueurSystem.GraphicsDevice.Clear ( ClearBuffer.AllBuffer, Color.Black );
            LiqueurSystem.GraphicsDevice.BeginScene ();

            terrainEffect.SetArgument<Matrix4x4> ( "worldMatrix",
                new View ( new Vector3 ( 20, 0, 20 ), new Vector3 ( 0, -200, 0 ), new Vector3 ( 0, 1, 0 ) ).Matrix *
                new World3 ( new Vector3 ( 0, -200, 0 ), new Vector3 ( 0 ), new Vector3 ( 1 ), new Vector3 ( 0 ), new Vector3 ( 0 ) ).Matrix );
            terrainEffect.SetArgument<Matrix4x4> ( "projectionMatrix",
                new PerspectiveFieldOfViewProjection ( 3.141492f / 4, 800 / 600.0f, 0.001f, 10000.0f ).Matrix );
            terrainEffect.SetTexture ( new TextureArgument () { Texture = texture, Uniform = "texture0" } );
            terrainEffect.Dispatch ( ( IEffect effect ) =>
            {
                LiqueurSystem.GraphicsDevice.Draw<TerrainVertex> ( PrimitiveType.TriangleList, terrainVertex, terrainIndex );
            } );

            base.Draw ( gameTime );
            LiqueurSystem.GraphicsDevice.EndScene ();
        }
Beispiel #16
0
        public override void Update( GameTime gameTime )
        {
            if ( InputHelper.IsKeyboardKeyUpRightNow ( KeyboardKey.Q ) )
                Add ( 0, 100 );

            if ( InputHelper.IsKeyboardKeyUpRightNow ( KeyboardKey.W ) )
                Add ( 1, 100 );

            if ( InputHelper.IsKeyboardKeyUpRightNow ( KeyboardKey.E ) )
                Add ( 2, 100 );

            if ( InputHelper.IsKeyboardKeyUpRightNow ( KeyboardKey.R ) )
                Add ( 3, 100 );

            if ( InputHelper.IsKeyboardKeyUpRightNow ( KeyboardKey.T ) )
                Add ( 4, 100 );

            if ( InputHelper.IsKeyboardKeyUpRightNow ( KeyboardKey.Y ) )
                Add ( 5, 100 );

            if ( InputHelper.IsKeyboardKeyUpRightNow ( KeyboardKey.A ) )
                Remove ( 0, 100 );

            if ( InputHelper.IsKeyboardKeyUpRightNow ( KeyboardKey.S ) )
                Remove ( 1, 100 );

            if ( InputHelper.IsKeyboardKeyUpRightNow ( KeyboardKey.D ) )
                Remove ( 2, 100 );

            if ( InputHelper.IsKeyboardKeyUpRightNow ( KeyboardKey.F ) )
                Remove ( 3, 100 );

            if ( InputHelper.IsKeyboardKeyUpRightNow ( KeyboardKey.G ) )
                Remove ( 4, 100 );

            if ( InputHelper.IsKeyboardKeyUpRightNow ( KeyboardKey.H ) )
                Remove ( 5, 100 );

            base.Update ( gameTime );
        }
 public override void Update( GameTime gameTime )
 {
     spinlock.Enter ();
     Node currentNode = this.currentNode;
     spinlock.Exit ();
     if ( currentNode != null )
         currentNode.Update ( gameTime );
     base.Update ( gameTime );
 }
Beispiel #18
0
 /// <summary>
 /// Calculating the time difference
 /// </summary>
 /// <param name="gameTime">Game time</param>
 public void Update( GameTime gameTime )
 {
     lastTimeSpan += gameTime.ElapsedGameTime;
 }
Beispiel #19
0
        public override void Update( GameTime gameTime )
        {
            if ( InputHelper.CurrentKeyboardState.IsKeyDown ( KeyboardKey.Down ) )
                offset -= gameTime.ElapsedGameTime.Milliseconds * 0.1f;
            if ( InputHelper.CurrentKeyboardState.IsKeyDown ( KeyboardKey.Up ) )
                offset += gameTime.ElapsedGameTime.Milliseconds * 0.1f;

            base.Update ( gameTime );
        }
Beispiel #20
0
        public override void Draw( GameTime gameTime )
        {
            tempWorld.Translate = World.Translate;
            tempWorld.Scale = World.Scale;
            tempWorld.ScaleCenter = World.ScaleCenter;
            tempWorld.Rotation = World.Rotation;
            tempWorld.RotationCenter = World.RotationCenter;

            if ( ( Alignment & SpriteAlignment.Center ) != 0 )
                tempWorld.Translate += new Vector2 ( -sprite.ClippingArea.Size.X * tempWorld.Scale.X / 2, 0 );
            else if ( ( Alignment & SpriteAlignment.Right ) != 0 )
                tempWorld.Translate += new Vector2 ( -sprite.ClippingArea.Size.X * tempWorld.Scale.X, 0 );

            if ( ( Alignment & SpriteAlignment.Middle ) != 0 )
                tempWorld.Translate += new Vector2 ( 0, -sprite.ClippingArea.Size.Y * tempWorld.Scale.Y / 2 );
            else if ( ( Alignment & SpriteAlignment.Bottom ) != 0 )
                tempWorld.Translate += new Vector2 ( 0, -sprite.ClippingArea.Size.Y * tempWorld.Scale.Y );

            sprite.Draw ( tempWorld );

            base.Draw ( gameTime );
        }
Beispiel #21
0
 public override void Draw( GameTime gameTime )
 {
     base.Draw ( gameTime );
 }
        public static void Run( ILauncher launcher, Node mainNode, Action initializeEvent = null, params object [] args )
        {
            IWindow window = null; IGraphicsDevice graphicsDevice = null; IAudioDevice audioDevice = null;

            Launcher = launcher;

            try
            {
                launcher.LauncherInitialize ( out window, out graphicsDevice, out audioDevice );
            }
            catch ( Exception e ) { if ( !SkipInitializeException ) throw new Exception ( "Initialization Exception", e ); }
            Window = window;
            GraphicsDevice = graphicsDevice;
            AudioDevice = audioDevice;

            if ( initializeEvent != null )
                initializeEvent ();

            MainNode = mainNode;

            TimeSpan elapsedUpdateTimeStep = new TimeSpan (),
                elapsedDrawTimeStep = new TimeSpan ();
            TimeSpan lastUpdateTimeStep = TimeSpan.FromMilliseconds ( Environment.TickCount ),
                lastDrawTimeStep = TimeSpan.FromMilliseconds ( Environment.TickCount );

            GameTime updateGameTime = new GameTime (), drawGameTime = new GameTime ();

            launcher.LauncherRun ( new LauncherArgument ()
            {
                Initialize = () =>
                {
                    if ( mainNode != null )
                        mainNode.Intro ( args );
                },
                UpdateLogic = () =>
                {
                    if ( elapsedUpdateTimeStep >= FixedUpdateTimeStep || FixedUpdateTimeStep.TotalMilliseconds == 0 )
                    {
                        updateGameTime.Update ();
                        if ( mainNode != null )
                            mainNode.Update ( updateGameTime );
                        elapsedUpdateTimeStep -= FixedUpdateTimeStep;
                    }
                    else
                    {
                        TimeSpan temp = TimeSpan.FromMilliseconds ( Environment.TickCount );
                        elapsedUpdateTimeStep += ( temp - lastUpdateTimeStep );
                        lastUpdateTimeStep = temp;
                    }
                },
                DrawLogic = () =>
                {
                    if ( LiqueurSystem.AudioDevice != null )
                        LiqueurSystem.AudioDevice.Update ();

                    if ( elapsedDrawTimeStep >= FixedDrawTimeStep || FixedDrawTimeStep.TotalMilliseconds == 0 )
                    {
                        drawGameTime.Update ();
                        if ( mainNode != null )
                            mainNode.Draw ( drawGameTime );
                        LiqueurSystem.GraphicsDevice.SwapBuffer ();
                        elapsedDrawTimeStep -= FixedDrawTimeStep;
                    }
                    else
                    {
                        TimeSpan temp = TimeSpan.FromMilliseconds ( Environment.TickCount );
                        elapsedDrawTimeStep += ( temp - lastDrawTimeStep );
                        lastDrawTimeStep = temp;
                    }
                },
                Resize = () =>
                {
                    if ( mainNode != null && mainNode is IWindowEvent )
                        ( mainNode as IWindowEvent ).WindowResize ();
                },
                Activated = () =>
                {
                    if ( mainNode != null && mainNode is IWindowEvent )
                        ( mainNode as IWindowEvent ).WindowActivated ();
                },
                Deactivated = () =>
                {
                    if ( mainNode != null && mainNode is IWindowEvent )
                        ( mainNode as IWindowEvent ).WindowDeactivated ();
                }
            } );
        }
Beispiel #23
0
 public override void Draw( GameTime gameTime )
 {
     if ( NoteDrawer != null )
         NoteDrawer ( this );
     base.Draw (gameTime);
 }
 public override void Update( GameTime gameTime )
 {
     World.Rotation += rotateUnit * gameTime.ElapsedGameTime.Milliseconds / 1000.0f;
     base.Update ( gameTime );
 }
Beispiel #25
0
 public override void Update( GameTime gameTime )
 {
     if ( NoteUpdater != null )
         NoteUpdater ( this );
     base.Update (gameTime);
 }
Beispiel #26
0
        public override void Update( GameTime gameTime )
        {
            if ( LiqueurSystem.Keyboard != null && IsKeyboardEnabled )
            {
                LastKeyboardState = CurrentKeyboardState;
                CurrentKeyboardState = LiqueurSystem.Keyboard.GetState ();
            }

            if ( LiqueurSystem.Mouse != null && IsMouseEnabled )
            {
                LastMouseState = CurrentMouseState;
                CurrentMouseState = LiqueurSystem.Mouse.GetState ();
            }

            if ( LiqueurSystem.GamePad != null && IsGamePadEnabled )
            {
                for ( int i = 0; i < 4; i++ )
                {
                    LastGamePadState [ i ] = CurrentGamePadState [ i ];
                    CurrentGamePadState [ i ] = LiqueurSystem.GamePad.GetState ();
                }
            }

            if ( LiqueurSystem.TouchPanel != null && IsTouchEnabled )
            {
                LastTouchState = CurrentTouchState;
                CurrentTouchState = LiqueurSystem.TouchPanel.GetState ();
            }

            if ( LiqueurSystem.Accelerometer != null && IsAccelerometerEnabled )
            {
                LastAccelerometerState = CurrentAccelerometerState;
                CurrentAccelerometerState = LiqueurSystem.Accelerometer.GetState ();
            }

            base.Update ( gameTime );
        }
Beispiel #27
0
 public override void Update( GameTime gameTime )
 {
     base.Update ( gameTime );
 }
Beispiel #28
0
 public override void Update( GameTime gameTime )
 {
     angle += gameTime.ElapsedGameTime.Milliseconds / 20000.0f;
     base.Update ( gameTime );
 }