コード例 #1
0
ファイル: Camera.cs プロジェクト: swiercc/SpacebarClicker
        // OnInit
        protected override void OnInit()
        {
            if (Type == E_CameraType._2D)
            {
                CameraSettings2D settings = _UI.Camera2D;

                Position.X = settings.Offset.X;
                Position.Y = settings.Offset.Y;

                Scale = settings.Scale;

                Rotation.X = MathHelper.ToDegrees(settings.Rotation.X);
                Rotation.Y = MathHelper.ToDegrees(settings.Rotation.Y);
                Rotation.Z = MathHelper.ToDegrees(settings.Rotation.Z);
            }
            else
            if (Type == E_CameraType._3D)
            {
                CameraSettings3D settings = _UI.Camera3D;

                Position = settings.Position;

                Rotation.X = MathHelper.ToDegrees(settings.Rotation.X);
                Rotation.Y = MathHelper.ToDegrees(settings.Rotation.Y);
                Rotation.Z = MathHelper.ToDegrees(settings.Rotation.Z);
            }
        }
コード例 #2
0
ファイル: Camera.cs プロジェクト: swiercc/SpacebarClicker
        // OnUpdate
        protected override void OnUpdate(float frameTime)
        {
            if (Type == E_CameraType._2D)
            {
                #if !RELEASE
                if (CameraSettings2D.d_Camera2dDebug)
                {
                    return;
                }
                #endif

                CameraSettings2D settings = _UI.Camera2D;

                settings.Offset.X = Position.X;
                settings.Offset.Y = Position.Y;

                settings.Scale.X = Scale.X;
                settings.Scale.Y = Scale.Y;

                settings.Rotation.X = MathHelper.ToRadians(Rotation.X);
                settings.Rotation.Y = MathHelper.ToRadians(Rotation.Y);
                settings.Rotation.Z = MathHelper.ToRadians(Rotation.Z);

                settings.UpdateTransformMatrix();
            }
            else
            if (Type == E_CameraType._3D)
            {
                #if !RELEASE
                if (CameraSettings3D.d_Camera3dDebug)
                {
                    return;
                }
                #endif

                CameraSettings3D settings = _UI.Camera3D;

                settings.Position = Position;

                settings.Rotation.X = MathHelper.ToRadians(Rotation.X);
                settings.Rotation.Y = MathHelper.ToRadians(Rotation.Y);
                settings.Rotation.Z = MathHelper.ToRadians(Rotation.Z);

                settings.CalculateViewMatrix();
                settings.UpdateTransformMatrix();
            }
        }
コード例 #3
0
ファイル: Globals.cs プロジェクト: tuannsofta/kinect4bag
    public static void Startup( Game game, GameInput gameInput, UI.Settings settings )
    {
        _UI.Settings = settings;

        _UI.Game = game;
        _UI.Content = new ContentManager( game.Services, "Content" );

        _UI.PrimaryPad = -1;

        _UI.GameInput = gameInput;
        _UI.Texture = new UI.TextureManager();
        _UI.Effect = new UI.EffectManager();
        _UI.Sprite = new UI.SpriteManager();
        _UI.Font = new UI.FontManager();
        _UI.Screen = new UI.ScreenManager();

        _UI.Store_Color = new UI.Store< UI.SpriteColors >( Color.Magenta );
        _UI.Store_Timeline = new UI.Store< UI.Timeline >();
        _UI.Store_Texture = new UI.Store< UI.SpriteTexture >( new UI.SpriteTexture( "null", 0.0f, 0.0f, 1.0f, 1.0f ) );
        _UI.Store_FontStyle = new UI.Store< UI.FontStyle >();
        _UI.Store_FontEffect = new UI.Store< UI.FontEffect >();
        _UI.Store_FontIcon = new UI.Store_FontIcon();
        _UI.Store_Widget = new UI.Store< UI.WidgetBase >();
        _UI.Store_RenderState = new UI.Store< UI.RenderState >( new UI.RenderState( (int)UI.E_Effect.MultiTexture1, UI.E_BlendState.AlphaBlend ) );
        _UI.Store_BlendState = new UI.Store< BlendState >();
        _UI.Store_DepthStencilState = new UI.Store< DepthStencilState >();
        _UI.Store_RasterizerState = new UI.Store< RasterizerState >();

        _UI.Camera2D = new UI.CameraSettings2D();
        _UI.Camera3D = new UI.CameraSettings3D();

        PresentationParameters pp = game.GraphicsDevice.PresentationParameters;

        _UI.SX = pp.BackBufferWidth;
        _UI.SY = pp.BackBufferHeight;

        _UI.YT = 0.0f;
        _UI.YM = _UI.YT + ( _UI.SY * 0.5f );
        _UI.YB = _UI.YT + _UI.SY;

        _UI.XL = 0.0f;
        _UI.XM = _UI.XL + ( _UI.SX * 0.5f );
        _UI.XR = _UI.XL + _UI.SX;

        float safeArea = settings.Screen_SafeAreaSize;
        float offsetHalf = ( 1.0f - safeArea ) * 0.5f;

        _UI.SSY = _UI.SY * safeArea;
        _UI.SSX = _UI.SX * safeArea;

        _UI.SYT = _UI.SY * offsetHalf;
        _UI.SYM = _UI.SYT + ( _UI.SSY * 0.5f );
        _UI.SYB = _UI.SYT + _UI.SSY;

        _UI.SXL = _UI.SX * offsetHalf;
        _UI.SXM = _UI.SXL + ( _UI.SSX * 0.5f );
        _UI.SXR = _UI.SXL + _UI.SSX;

        _UI.AutoRepeatDelay = 0.5f;
        _UI.AutoRepeatRepeat = 0.25f;
    }